๐ŸŽฒ ๐ŸŒง๏ธ โœˆ๏ธ

Probability

Measuring uncertainty, making better decisions, and understanding the world through numbers between 0 and 1.

โ†“
Chapter 1

What Are We Really Asking?

You check your phone in the morning and see a notification: "60% chance of rain today." Should you grab an umbrella? Later, you're stuck in traffic wondering if you'll make your flight. That evening, you're deciding whether to back up your computer files, knowing there's some small chance your hard drive could fail.

All these situations share one thing: uncertainty. And that's exactly what probability is built to handle. It's how we put a number on "how likely" something is.

๐Ÿ“ The Probability Scale
Drag the marker left and right to explore what different probabilities feel like.
0 โ€” Impossible0.5 โ€” Coin Flip1 โ€” Certain
0.50 โ€” Equally likely to happen or not

A probability of 0 means something will never happen. A probability of 1 means it definitely will. Everything else falls somewhere in between. The probability of an event is always a positive number (or zero) and can never be greater than 1.

Chapter 2

Why Do We Need Probability at All?

Why can't we just say "it will rain" or "it won't rain"? Why do we need this middle ground of "probably" or "60% chance"?

The answer is simple: we don't have perfect information. If we knew everything about the atmosphere, every air current, every temperature gradient, we could predict the weather exactly. But we don't. We're making decisions with incomplete information.

Probability and statistics are deeply connected. Probability is about what we expect to happen before we see the data. Statistics is about what we conclude after we see the data. They're two sides of the same coin.
๐Ÿ”„ Before vs. After
See how probability and statistics complement each other.
๐Ÿ”ฎ
Probability
What we expect before seeing data
๐Ÿ“Š
Statistics
What we conclude after seeing data
Chapter 3

Calculating Probability: The Bus Stop

You're waiting for a bus. Your route is served by two bus lines: the Red Line (every 20 minutes) and the Blue Line (every 5 minutes). You arrive at a random time. A bus pulls up. What's the probability it's the Red Line?

We need to count: in 20 minutes, the Blue Line sends 4 buses and the Red Line sends 1 bus. That's 5 buses total.

๐ŸšŒ Bus Frequency Timeline
This shows all buses arriving in a 20-minute window. Click any bus to see which line it belongs to.
20 min
๐ŸšŒ
๐ŸšŒ
๐ŸšŒ
๐ŸšŒ
๐ŸšŒ
Blue Line (ร—4) Red Line (ร—1)
P(Red Line) = 1 / 5 = 0.20 = 20%
P(Red Line) = Red Line buses / Total buses
P(Red Line) = 1 / 5 = 0.20 (20%)

Out of every 5 buses, on average, 1 is a Red Line bus. We calculate probability by counting favorable outcomes divided by total outcomes.

Chapter 4

Building Intuition: Long-Run Frequency

Imagine you did this experiment 100 times. You show up at the bus stop randomly, 100 different times, and note which bus arrives. You'd expect to see the Red Line about 20 times and the Blue Line about 80 times.

We're thinking about probability as a long-run frequency. If we repeat something many times under the same conditions, probability tells us what fraction of the time each outcome happens.

๐Ÿ” Bus Arrival Simulator
Click to simulate random bus arrivals. Watch how the proportions settle near 20% Red / 80% Blue.
Total: 0 buses
Red Line
Blue Line

But here's where it gets interesting. You only catch one bus tomorrow morning. That bus will either be Red or Blue โ€” it won't be "20% Red." So what does the probability really mean for that single trip?

This is one of the deep questions about probability. Some say probability is about long-run frequencies. Others say it's about our degree of belief or uncertainty. For our purposes, it's a number between 0 and 1 that tells us how likely something is.

Chapter 5

Conditional Probability: When Things Change

Now imagine you've learned something new. When it's raining, the Red Line often runs late, coming every 40 minutes instead of every 20. The Blue Line still comes every 5 minutes.

Today it's raining. In 40 minutes on a rainy day: 8 Blue Line buses and 1 Red Line bus arrive. That's 9 total.

๐ŸŒง๏ธ Sunny vs. Rainy Day Comparison
Click the weather condition to see how the bus lineup changes.
P(Red Line | Rain) = Red Line buses in rain / Total buses in rain
P(Red Line | Rain) = 1 / 9 = 0.11 (11%)

That vertical bar "|" means "given that." This is called conditional probability โ€” the probability of one thing happening when we already know something else has happened. Before you knew it was raining, the probability of a Red Line bus was 20%. After learning it was raining, that dropped to about 11%.

Chapter 6

New Information Changes Everything

Here's where probability gets powerful. Think about flight arrivals. Under good weather, 80% of flights arrive on time. During bad weather, only 30% do. If tomorrow has a 60% chance of good weather, what's the probability your flight arrives on time?

๐ŸŒณ Flight Probability Tree
Follow the branches to see each possible path and its probability. Click a leaf to highlight that path.
โœˆ๏ธ 60% Good โ˜€๏ธ 80% On Time: 0.6ร—0.8 = 0.48 20% Late: 0.6ร—0.2 = 0.12 40% Bad ๐ŸŒง๏ธ 30% On Time: 0.4ร—0.3 = 0.12 70% Late: 0.4ร—0.7 = 0.28
P(On Time) = 0.48 + 0.12 = 0.60 (60%)
P(On Time) = P(Good) ร— P(On Time | Good) + P(Bad) ร— P(On Time | Bad)
P(On Time) = 0.6 ร— 0.8 + 0.4 ร— 0.3 = 0.48 + 0.12 = 0.60

The flight can arrive on time via two different paths. When we want the probability that at least one of several paths leads to an outcome, we add up each path's probability.

Chapter 7

Thinking in Counts: 100 Flights

Sometimes it helps to think in actual counts instead of probabilities. Imagine 100 flights tomorrow. About 60 have good weather and 40 have bad weather.

๐Ÿ“Š 100 Flights Breakdown
Animated bars show the same 60% answer reached by counting instead of multiplying.
Good + On Time
48
Good + Late
12
Bad + On Time
12
Bad + Late
28
On Time total: 48 + 12 = 60 out of 100 = 60%

See how we got the same answer? Counting real instances often makes probability feel more concrete and intuitive.

Chapter 8

Dramatic Probability Updates

You're waiting for your flight, and suddenly it's announced that the flight departed one hour behind schedule. Now it has a probability of only 0.05 (or 5%) to arrive on time.

๐Ÿ“ข Before vs. After the Announcement
Click the toggle to see how one piece of news changes everything.
Before
60%
After Delay
5%

New information changed the probability from 60% all the way down to 5%. A delayed departure tells us something went wrong, making on-time arrival much less likely. This is the power of conditional probability โ€” every time we learn something new, we update our probabilities.

Chapter 9

Independent Events: The Multiplication Rule

A virus is trying to corrupt two files on your computer. If the virus attacks each file independently (what happens to one doesn't affect the other), each with a 20% chance, we can find the probability both get corrupted by multiplying.

๐Ÿฆ  Virus Attack Simulator
Click "Attack!" to simulate the virus. Each file has a 20% chance of being corrupted. Run it many times to see both corrupted roughly 4% of the time.
๐Ÿ“„ File 1
๐Ÿ“„ File 2
Attacks: 0 | Both corrupted: 0 (0%)
P(Both Corrupted) = P(File 1 corrupted) ร— P(File 2 corrupted)
P(Both Corrupted) = 0.2 ร— 0.2 = 0.04 (4%)

Why does multiplication work? Out of 100 attempts, the virus corrupts the first file about 20 times. Of those 20, it also corrupts the second file about 20% of the time โ€” that's 20% of 20, or 4 times. So 4 out of 100, which is 4%.

Chapter 10

Picking from a Set: The Server Farm

You're managing a small data center with 100 servers. You know from experience that 4 of these servers have a hardware defect that will cause them to fail within the year. You need to pick one server at random to run a critical application.

๐Ÿ–ฅ๏ธ 100-Server Grid
Click "Pick a Server" to randomly select one. Defective servers are hidden โ€” see if you pick one!
P(Defective) = 4 / 100 = 0.04 = 4%
P(Defective) = Defective servers / Total servers
P(Defective) = 4 / 100 = 0.04 (4%)

But suppose you pick a server and it fails within a month. What does that tell you? It tells you that you very likely picked one of the 4 defective ones. The probability you picked a defective server, given that it failed, is now much higher than 4%. New information, once again, changes everything.

Chapter 11

Bringing It All Together

Probability is fundamentally about measuring uncertainty. We calculate probabilities by thinking about all possible outcomes and figuring out what fraction of them match what we're looking for.

๐Ÿ“‹ The Four Core Rules
Click each rule to see a worked example from the article.

Probability = favorable outcomes / total outcomes. With 1 Red Line bus and 4 Blue Line buses, P(Red) = 1/5 = 20%.

P(A | B) means "probability of A given B." On rainy days, P(Red | Rain) = 1/9 โ‰ˆ 11%. New information updates your expectations.

When events are independent, multiply. P(Both files corrupted) = 0.2 ร— 0.2 = 0.04 (4%).

When multiple paths lead to the same outcome, add them. P(On Time) = 0.48 + 0.12 = 0.60 (60%).

Your Probability Toolkit

๐ŸŽฏ
Basic Probability
Favorable outcomes divided by total outcomes
๐Ÿ”„
Conditional Probability
P(A|B) โ€” probability updated with new info
โœ–๏ธ
Multiplication Rule
Independent events: multiply their probabilities
โž•
Addition Rule
Multiple paths to same outcome: add them up
๐Ÿ“
The 0-to-1 Scale
0 = impossible, 1 = certain, always positive
๐Ÿ“Š
Think in Counts
Imagine 100 trials to build intuition

Cite this post

Rizvi, I. (2026). Probability โ€” A Visual Guide. theog.dev.
DOI: 10.5281/zenodo.19413289

@article{rizvi2026probability,
  title   = {Probability โ€” A Visual Guide},
  author  = {Rizvi, Imran},
  year    = {2026},
  url     = {https://theog.dev/ml-ds/probability-visual.html},
  doi     = {10.5281/zenodo.19413289}
}