What “Given” Really Means
A probability is always a share of some crowd. The word “given” doesn't change the question — it changes the crowd. You stop looking at everyone and look only at the ones that match what you already know.
Here are 100 days of weather. Each tile is one day: grey = cloudy, yellow = sunny, and a blue drop means it rained. How likely is rain? It depends on what you already know about the sky.
Rain on a random day: 20%. Rain on a cloudy day: 45%. Same rain, different crowd. That is all conditional probability is — count inside the smaller crowd.
The Universe Shrinks — From Counting to a Formula
Counting tiles becomes a formula once you swap counts for probabilities. Imagine the whole square has area 1. Then the area of a shape is its probability.
P(A | B) = P(A ∩ B)P(B) the part of A that lives inside B ÷ all of B — “B becomes the new whole”Drag the two rectangles, resize them with their corner dot, then press Given B. The picture zooms until B fills the whole frame. What you see is literally the new universe — and the purple part's share of it is P(A | B).
Notice two things while you play. First, when the rectangles don't overlap, P(A | B) = 0: once you know B happened, A is impossible (they are mutually exclusive). Second, P(A | B) and P(B | A) share the same top — the purple overlap — but divide by different wholes. That is the whole secret of the next section.
Order Matters: P(A | B) ≠ P(B | A)
Same overlap, different crowd. Swapping what is “given” swaps the denominator — and the answer can change enormously.
P(rain | cloudy) = 18/40 = 0.45
P(cloudy | rain) = 18/20 = 0.90
Both share the 18 rainy-cloudy days. Different crowds: 40 cloudy days vs 20 rainy days.
P(plays cricket | in Pakistan's team) ≈ 1
P(in Pakistan's team | plays cricket) ≈ 0
Same overlap (the 15 players). One crowd is 15 people, the other is millions.
P(fever | flu) is high — most flu brings fever.
P(flu | fever) is much lower — many illnesses bring fever.
Both are built from the same joint probability:
P(A ∩ B) = P(A | B)·P(B) = P(B | A)·P(A)
Hold on to this line — Bayes' theorem is one division away from it.
Mixing up P(evidence | cause) with P(cause | evidence) is one of the most common reasoning errors — in exams, in courtrooms (the “prosecutor's fallacy”) and in medicine. Bayes' theorem is the tool that converts one into the other correctly.
Independence — When “Given” Changes Nothing
Sometimes zooming in changes nothing: the share of A inside B is the same as the share of A everywhere. Then knowing B tells you nothing about A — the events are independent.
P(A | B) = P(A) ⇔ P(A ∩ B) = P(A)·P(B) two coins, two dice, today's coin flip and tomorrow's — classic independent pairsBelow, each column is one group of students and the green part shows who passed. Column width is how big the group is. Move the sliders until the two green levels line up — that is what independence looks like.
The overall pass rate always sits between the two group rates — it is their average, weighted by group size. Remember that: it is the law of total probability, and it returns in Section 06.
Probability Trees — The Multiplication Rule
Rearrange the conditional formula and you get the most useful rule in probability: to find the chance of “this and then that”, walk the path and multiply.
P(A ∩ B) = P(A) × P(B | A) first step × second step, where the second step already knows the first happenedA bag holds red and blue balls. Draw one, then draw another. Every branch of the tree carries a conditional probability — after a red ball leaves the bag, the bag has changed. Click any end of the tree to see its path multiplied out, and run a simulation to check the maths against reality.
The branches leaving any node add up to 1. And the four leaf probabilities add up to 1 — every possible story is on the tree exactly once.
The Law of Total Probability
What is the chance the second ball is red? It can happen along two different roads — red then red, or blue then red. Add up every road that ends where you want.
P(B) = P(B | A)·P(A) + P(B | A′)·P(A′) general form: P(B) = Σ P(B | Aᵢ)·P(Aᵢ) over every way Aᵢ the world could startIn the tree above, press P(2nd red) to see both roads light up. In the student chart of Section 04 the same law drew the dashed line: overall pass rate = weighted average of the group pass rates. This sum is exactly the denominator of Bayes' theorem — which is where we go next.
Flip the Question — Bayes from the Tree
A tree answers forward questions easily: if the first ball is red, how likely is a red second? But often we see the end and want the start: the second ball was red — how likely was the first one red?
Bayes' theorem in one sentence: the road you care about ÷ all the roads that lead to what you saw. In symbols, start from the bridge of Section 03 and divide:
Switch on with replacement and press the Bayes button again: the answer becomes exactly P(1st red). When draws are independent, seeing the second ball teaches you nothing about the first — Section 04 again.
Prior, Likelihood, Evidence, Posterior
Each part of Bayes' theorem has a name, and the names tell the story of how we learn: start with a belief, see evidence, update the belief.
posterior = likelihood × priorevidenceWhat you believed before the evidence. How common is the disease? How often is an email spam?
How well the hypothesis explains the evidence. If you are sick, how often does the test say positive?
How common the evidence is overall, along every road (total probability). It rescales so everything adds to 1.
What you should believe after the evidence. Tomorrow, it becomes your new prior.
Strong evidence for a rare thing is still often a false alarm, because the rare thing has so few people to begin with. The prior matters as much as the evidence.
The Medical Test — Think in People, Not Percentages
A disease affects 1% of people. A test catches 99% of sick people, and falsely flags 2% of healthy people. Your test is positive. Are you 99% likely to be sick?
Most people say yes. Let's test 1,000 people and simply count. Then press Only positive tests — that is the crowd you are actually in.
About 10 sick people test positive — but so do about 20 healthy people, because there are 99 times more healthy people to make mistakes on. A positive test means roughly 1 in 3, not 99%. Now raise the prevalence slider to 20% (say, a patient who already has symptoms): the same test suddenly becomes very convincing. The prior changes everything.
Learning From Evidence — Update, Then Update Again
Bayes' theorem is not a one-off calculation; it is a learning loop. Today's posterior becomes tomorrow's prior. Take a second test and update again.
posterior odds = prior odds × likelihood ratio the fastest form of Bayes · odds = p / (1 − p) · likelihood ratio LR = P(evidence | sick) ÷ P(evidence | healthy)Two positive tests in a row take the belief from 1% to about 96%: the second test starts from a much higher prior (33%). One negative result pulls it sharply back down. This loop — believe, observe, update — is how spam filters, medical diagnosis, self-driving cars and many machine-learning models reason under uncertainty.
Practice — Your Turn
Answer as a decimal (0.62) or a percentage (62%). Draw a tree or picture a crowd of 1,000 first — it makes every problem easy.
Traps & Formula Sheet
P(positive | sick) is not P(sick | positive). Always ask: which crowd am I counting in?
A great test for a rare condition still raises many false alarms. Never skip the prior.
Multiply P(A)·P(B) only when knowing one truly changes nothing about the other.
Turn percentages into 1,000 people (natural frequencies). Bayes becomes simple counting.