๐ŸŒ‚
๐ŸŒง๏ธ
๐Ÿง 

Bayes' Theorem

How we update what we believe โ€” one piece of evidence at a time

โ†“
Chapter 1

Your Brain Already Does This

You're standing at your window on a summer morning in a desert city. The sun is blazing. Rain almost never happens here this time of year. You'd guess maybe a 15% chance of rain today, tops.

Then you see your neighbor walking to his car. He's carrying an umbrella. Your brain does something interesting in that moment. It doesn't just note the umbrella and move on. It recalculates. You started with a belief (probably won't rain), you got new information (umbrella sighting), and you updated your belief to something new (maybe it will rain after all).

๐ŸŒ‚ Belief Updater
Drag the slider to set your prior belief about rain, then click "See Umbrella" to watch your belief update.
โ˜€๏ธ Almost impossible๐ŸŒง๏ธ Almost certain
Before
15%
After
โ€”

That jump โ€” from your initial guess to your updated belief โ€” is exactly what Bayes' theorem calculates. It's the mathematically correct way to do what your brain was already trying to do.

Chapter 2

Why Do We Need a Formula?

Your brain does this updating automatically, but it's often terrible at it. We overreact to dramatic information. We ignore our starting point. We get confused when the evidence is ambiguous.

Bayes' theorem is just the correct way to do what your brain was already trying to do. It's the recipe for updating beliefs that makes logical sense.

๐Ÿงฉ Intuition Trap
Can your gut get the right answer? Click to reveal how far off intuition usually is.

If your neighbor carries an umbrella 90% of rainy days and only 5% of dry days, and rain has a 15% chance โ€” what's the probability of rain after seeing the umbrella? Take a guess before revealing.

Answer: about 76%.

Most people guess too high (like 90%) or too low (like 30%). They either anchor on the 90% umbrella-on-rainy-days number or they can't shake the 15% prior. Bayes' theorem gets the exact right answer by weighing both pieces of information properly.

Chapter 3

The Building Blocks

Before you saw the umbrella, you had a prior belief โ€” a 15% chance of rain. That's what you think before getting new information.

You also know things about your neighbor. If it's going to rain, he'll bring an umbrella 90% of the time. That's the likelihood โ€” how probable the evidence is if the hypothesis is true. On dry days, he only carries one 5% of the time โ€” the false alarm rate.

๐Ÿ“Š The Three Ingredients
Click each ingredient to highlight it and see how it fits into the calculation.
Click an ingredient above
Chapter 4

Think It Through With 100 Days

Imagine watching your neighbor for 100 days. Based on your beliefs, on 15 of those days it rains and on 85 it's dry. On rainy days, he brings the umbrella 90% of the time โ€” that's about 13.5 days. On dry days, he brings it 5% of the time โ€” about 4.25 days.

So out of 100 days, he carries an umbrella on about 17.75 days total. When you see him with an umbrella, you're looking at one of those 17.75 days. Of those, 13.5 are rainy and 4.25 are dry.

๐Ÿ—“๏ธ 100-Day Grid
Click the filter buttons to see which days have rain, umbrellas, or both.
Rainy Dry Umbrella day
Showing all 100 days

The key insight: 13.5 รท 17.75 = about 76%. Your belief jumped from 15% to 76%. That umbrella was strong evidence.

Chapter 5

The Four-Step Pattern

What we just did follows a very specific pattern. Every time you use Bayes' theorem, you repeat these same four steps.

๐Ÿชœ The Bayesian Recipe
Click each step to see it applied to the umbrella example.
Start with how often rain happens in general
How often you'd see an umbrella on rainy days
How often you'd see an umbrella on ALL days
Of all umbrella days, what fraction are rainy?
Chapter 6

The Photo Sorting Trick

Imagine you have a big bag of photographs, each showing your neighbor on a different day. You dump them on a table and sort: rain photos in one pile, dry in another. The rain pile is smaller โ€” this is a desert city, after all.

Now re-sort: photos where he has an umbrella vs. photos where he doesn't. Pull out just the umbrella photos. What fraction show rain? That's your updated belief. You're not looking at all days anymore โ€” you're looking at just the umbrella days.

๐Ÿ“ธ Photo Filter
Click "Filter to Umbrella Photos" to see Bayes' theorem in action โ€” focusing on the relevant subset.

This is what Bayes' theorem does mathematically. It helps you focus on the relevant subset of possibilities.

Chapter 7

Another Example: The Email Situation

You're expecting an important email from a client. Based on past experience, there's a 30% chance it arrives today. You know that on days when you get the important email, you tend to get less spam โ€” about 1 spam email. On regular days, you get about 3.

You check your inbox. You have 2 spam emails. Is that more consistent with "important email day" or "regular day"? Two spam is more than the 1 you'd expect on an important day but less than the 3 on a regular day. It's ambiguous โ€” but Bayes' theorem handles ambiguity with precision.

๐Ÿ“ง Spam Evidence Meter
Click the spam count buttons to see how different amounts of spam shift your belief about the important email arriving.
P(Important)
30%
Bayes' theorem lets you take ambiguous evidence and update your belief in the right direction by the right amount.
Chapter 8

The Pattern Emerges

Both examples follow the same dance. You start with a belief about something you can't directly observe (will it rain? will the email come?). You observe something you can see (umbrella, spam count). You know how those observations relate to the hidden thing you care about. And then you update.

๐Ÿ”„ The Universal Pattern
Hover over each stage to see it applied to both examples side by side.
1. Start with a belief about something hidden
2. Observe something you CAN see
3. Know how observations relate to the hidden thing
4. Update your belief
Chapter 9

The Formula โ€” Words First

The chance of RAIN given that you see an UMBRELLA equals the chance of RAIN times the chance of UMBRELLA given RAIN, divided by the chance of UMBRELLA overall.

In words:
P(Rain) ร— P(Umbrella | Rain)
รท
P(Umbrella overall)
๐Ÿ”ข Plug In the Numbers
Click "Calculate" to watch each value fill in step by step.
P(Rain) = 0.15
P(Umbrella | Rain) = 0.90
P(Umbrella) = 0.1775
โ†’ (0.15 ร— 0.90) รท 0.1775 = 0.135 รท 0.1775 = 0.76 = 76%
Chapter 10

Why Does This Formula Work?

The numerator (top part) โ€” 0.15 ร— 0.90 = 0.135 โ€” is the chance of BOTH rain AND umbrella happening together. Out of 100 days, that's how many have both rain and an umbrella.

The denominator (bottom part) โ€” 0.1775 โ€” is the chance of umbrella happening at all, rain or no rain. When we divide them, we're asking: "Of all the umbrella days, what fraction also have rain?"

๐ŸŽฏ Numerator vs Denominator
Click each part to see what it represents out of 100 days.
Click a part above to explore
Chapter 11

The Formula in Symbols

The general form:
P(H | D) = P(H) ร— P(D | H) รท P(D)
๐Ÿท๏ธ Symbol Decoder
Click each symbol to decode what it means in plain English.
Click a symbol to decode it
That vertical bar "|" means "given that" or "conditional on." It says: "assuming this other thing is true, what's the probability?"
Chapter 12

What About That Bottom Part?

The denominator P(D) sometimes trips people up. We break it into pieces: the data could happen with the hypothesis true, OR with the hypothesis false.

P(Umbrella) = P(Rain) ร— P(Umb|Rain) + P(No Rain) ร— P(Umb|No Rain)
0.1775 = 0.15 ร— 0.90 + 0.85 ร— 0.05
0.1775 = 0.135 + 0.0425
๐ŸŒณ Probability Tree
Follow the branches to see how P(Umbrella) is built from two paths.
Day 0.15 Rain 0.85 Dry 0.90 Umbrella = 0.135 0.10 No Umb. 0.05 Umbrella = 0.0425 0.95 No Umb. P(Umbrella) = 0.135 + 0.0425 = 0.1775
Chapter 13

The Multiplier View

Your prior belief P(H) is your starting position. The term P(D|H) รท P(D) acts like a multiplier that adjusts your belief up or down. If the evidence is more likely when your hypothesis is true than in general, the multiplier is greater than 1 and your belief goes up.

โœ–๏ธ The Bayesian Multiplier
See how the prior gets multiplied to produce the posterior.
Prior
0.15
ร—
Multiplier
5.07
=
Posterior
0.76

P(Umbrella|Rain) / P(Umbrella) = 0.90 / 0.1775 = 5.07ร—
Since 5.07 > 1, seeing the umbrella increases your belief in rain.

If P(D|H) is bigger than P(D), the multiplier is greater than 1 and your belief goes up. If smaller, your belief goes down. This is the heart of Bayesian reasoning.
Chapter 14

Sequential Updating

Here's where it gets really interesting. Tomorrow morning, you see your neighbor again โ€” this time wearing a raincoat too. You don't start over. Your new prior is the 76% you calculated yesterday. Now you update that based on the raincoat evidence.

Each piece of evidence updates your belief, and that updated belief becomes your starting point for the next piece.

๐Ÿ“ˆ Evidence Accumulator
Click each piece of evidence in order to watch your belief evolve.
Belief in Rain
15%
Based on the desert city's summer climate alone.
Chapter 15

Why This Matters

Bayes' theorem isn't just a math trick. It's the logically correct way to combine what you believed with what you've learned. Any other method of updating beliefs will lead to contradictions or inconsistencies. There is no other valid way to do this โ€” and that's a remarkable fact.

โ“ Common Confusions
Click each question to reveal the answer.

In simple cases, yes! But your intuition often gets the direction right while getting the magnitude wrong. Bayes' theorem tells you exactly how much to update, not just which way.

You rarely do in real life. But even rough estimates are better than nothing. If you think rain is "unlikely" (say 15%) and umbrellas are "pretty reliable" (say 90%), you can still do the calculation and get a useful answer.

Because it's not just a useful formula โ€” it's a mathematical truth that follows inevitably from the basic rules of probability. It's not an assumption or approximation. It's just logic.

Chapter 16

The Big Picture

Bayes' theorem is simple in concept: it's just updating beliefs based on evidence. When you see someone with an umbrella and think "huh, maybe it will rain," your brain is trying to do Bayesian updating. Bayes' theorem is just the instruction manual for doing it correctly.

We start with what we believe. We observe something new. We update our belief in the precise way that keeps everything logically consistent. The math looks fancy when you write it out, but the idea is as natural as looking out your window and changing your mind about the weather.

Your Toolkit

๐ŸŽฏ
Prior Belief
Your starting estimate before seeing any evidence
๐Ÿ”
Likelihood
How probable the evidence is if your hypothesis is true
โœ–๏ธ
Multiplier
P(D|H) รท P(D) โ€” adjusts your belief up or down
๐Ÿ“ˆ
Posterior
Your updated belief after combining prior with evidence
๐Ÿ”„
Sequential Updating
Each posterior becomes the next prior โ€” beliefs evolve
๐ŸŒณ
Total Probability
Break P(D) into branches โ€” hypothesis true + false

Cite this post

Rizvi, I. (2026). Bayes' Theorem โ€” A Visual Guide. theog.dev.
DOI: 10.5281/zenodo.19413291

@article{rizvi2026bayes,
  title   = {Bayes' Theorem โ€” A Visual Guide},
  author  = {Rizvi, Imran},
  year    = {2026},
  url     = {https://theog.dev/ml-ds/bayes-theorem-visual.html},
  doi     = {10.5281/zenodo.19413291}
}