Skip to content
MasterMath

Conditional Probability Calculator

The probability of A once you know B has happened. Conditioning changes the answer, and P(A|B) is almost never the same as P(B|A).

P(A|B): A given that B happened

—

P(A|B): A given that B happened—
P(B|A): B given that A happened—
That both happen—
That either happens—
Are they independent?—
Were they independent, both would be—

How this was worked out

    The formula

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

    What it means

    Conditioning shrinks the space of cases. Knowing B has happened rules out every case where it did not, so the probability of A is no longer measured against the whole but only within B. That is why you divide by P(B): you are changing the denominator.

    How to work it out by hand

    1. Write the probability of each event on its own
    2. Write the probability that both happen
    3. Divide the probability of both by the one you know has happened
    4. Compare the overlap with the product: if they match, they are independent

    What is worth knowing

    Confusing P(A|B) with P(B|A) is behind a great deal of badly read statistics, and it has a name: the prosecutor's fallacy. “80 % of crash victims were wearing a seatbelt” does not make seatbelts dangerous, because nearly everyone wears one: the figure that matters is the other way round. The independence test is useful on its own too: if the overlap matches the product of the two probabilities, knowing one tells you nothing about the other, and if it departs from it, they are related.

    Frequently asked questions

    How do you calculate conditional probability?

    Divide the probability that both happen by the probability of the one you know has happened: P(A|B) = P(A∩B) ÷ P(B).

    Is P(A|B) the same as P(B|A)?

    Almost never. With P(A) of 10 %, P(B) of 50 % and an overlap of 8 %, P(A|B) is 16 % and P(B|A) is 80 %.

    How do I know whether two events are independent?

    Compare the overlap with the product of the two probabilities. If they match, they are; if not, they are related.

    What is the prosecutor's fallacy?

    Confusing the probability of the evidence given the event with the probability of the event given the evidence. They are very different numbers and the confusion has cost convictions.