Home / Probability

Conditional Probability

Learning that B happened does not change the world — it shrinks it. Drag the two events and watch the universe you are allowed to count in get smaller.

Events

4.0
5.0
5.0

throw away every outcome outside B

The Sample Space

400 outcomes

Every dot is one equally likely outcome. Probabilities here are exact counts, not areas.

Counts

P(A) 0.00
P(B) 0.00
P(A and B) 0.00

Conditionals

P(A given B)
0.00
0 / 0
P(B given A) 0.00
Independent? no

Conditional Probability

Conditional probability recalculates an event’s chance within the smaller set where known evidence occurred.

Why the direction matters

A medical test’s sensitivity P(positive|disease) is not the same as the chance of disease after a positive result P(disease|positive). The second depends on how common the disease is; Bayes’ theorem connects them. Confusing these conditionals is a common reasoning error.

For a sequence of events, the chain rule multiplies successive conditional probabilities. The events need not be independent; each factor accounts for what is already known.

A two-way table makes the denominator visible

Suppose a class has 12 students who ride the bus, and 4 of them arrive late. There are 30 students total, with 10 late. Then P(late | bus)=4/12=1/3, while P(bus | late)=4/10=0.4. Both conditionals use the same overlap—the four students who are both bus riders and late—but the condition determines the denominator. Read the vertical bar as “given that” and identify the group after it before dividing.

Conditioning changes the reference group. In a deck, P(king)=4/52, but P(king | face card)=4/12. Independence is precisely the case where conditioning on B leaves A's probability unchanged. If P(B)=0, the elementary ratio definition is undefined; more advanced models need a separate definition. For continuous variables, conditioning on an exact value with probability zero also requires a density or limiting argument. Use Bayes’ theorem when the evidence is known but the hypothesis is the quantity you need to infer.

Try this above

Select an evidence group in the visualiser and compare the event’s probability before and after conditioning. Check that the restricted denominator matches the selected group.

For three events, the chain rule gives P(A∩B∩C)=P(A)P(B|A)P(C|A∩B). This is true without assuming independence; each factor updates the probability using what has already occurred. It is useful for sequential draws, where the chance changes after each draw. For example, drawing two aces without replacement is (4/52)(3/51), not (4/52)². The squared expression would model independent draws with replacement. Always check whether the process returns an item or changes the next trial.

The multiplication rule is often easier than the conditional formula when outcomes occur in sequence. If the chance of rain is 0.2 and the chance of a traffic delay given rain is 0.5, then P(rain and delay)=0.2×0.5=0.1. Reversing the condition asks a different question and needs Bayes' theorem. A probability tree or contingency table helps expose the path and its denominator, especially when several conditions are involved.

Sources and next steps

Overview

Restrict the sample space

If P(B) > 0, the probability of A given B is the fraction of B’s outcomes that also belong to A:

P(A|B) = P(A ∩ B) / P(B)

In a standard deck, given that a drawn card is a face card, the chance it is a king is 4/12 = 1/3. The condition changes the denominator: we count only the 12 face cards, not all 52 cards.

Rearranging gives the multiplication rule P(A ∩ B) = P(A|B)P(B). Events are independent precisely when P(A|B) = P(A), provided the conditional probability is defined. Conditional probability is not generally symmetric: P(A|B) can differ from P(B|A).

Predict, then reveal

About to run: set Separation to its maximum (14). Before it does — what happens to the readout?

Committing to an answer first is the point — the reveal runs the experiment on the visualisation above and reads the real value back, so nothing here is scripted.

Check yourself

0 of 2

Answer without scrolling back up.

  1. In P(A|B), what sample space is used?

  2. Are P(A|B) and P(B|A) generally equal?

Cheat sheet

Conditional Probability

Conditioning does not change the outcomes, it discards them. Watch the sample space shrink, and see why P(A given B) is not P(B given A).

MATHS · vizlearn.in/maths/conditional_probability.html

About the author

Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.