Foundations · Probability
Conditional Probability Calculator
Conditional probability is the chance of A once you know B has happened — written P(A|B), and equal to the overlap P(A∩B) divided by P(B). Knowing something narrows the world of possibilities, and the probability re-scales to fit. This works it out from the pieces, draws the probability tree, and — crucially — also gives the reverse P(B|A), because mixing the two up is one of the most expensive mistakes in all of reasoning.
Enter probabilities as decimals between 0 and 1. P(A and B) is the joint probability — the chance both happen — and it must be no bigger than either P(A) or P(B). If A and B can’t both happen, set it to 0.
Result
In plain English
Before you know anything, A has probability P(A). The moment you learn that B is true, the only outcomes still in play are the ones where B happened, so you throw the rest away and ask: among those, how often is A also true? That share — the overlap divided by B’s slice — is P(A|B). Conditioning is just zooming in on part of the sample space and renormalising.
- conditional probability P(A|B)
- The probability of A given that B has occurred: P(A∩B) ∕ P(B). Read “the probability of A given B.”
- joint probability P(A∩B)
- The chance that A and B both happen. Different from the conditional: P(A∩B) counts B’s likelihood too, while P(A|B) takes B as already settled.
- the inversion P(A|B) ≠ P(B|A)
- These two are not the same and can be wildly different. The chance of a positive test given disease is not the chance of disease given a positive test — confusing them is the prosecutor’s fallacy.
- independence
- A and B are independent when learning B tells you nothing about A: P(A|B) = P(A), equivalently P(A∩B) = P(A)·P(B). Then conditioning changes nothing.
- Bayes’ link
- The two conditionals are tied together by Bayes’ rule, P(A|B) = P(B|A)·P(A) ∕ P(B) — which is how you legitimately turn one into the other, base rate and all.
- base rate
- P(A) on its own, before conditioning. Ignore it and even a strong P(B|A) can leave P(A|B) surprisingly small — the base-rate fallacy.
Frequently asked
How do you calculate conditional probability?
Divide the joint probability by the probability of the condition: P(A|B) = P(A∩B) ∕ P(B). For P(A∩B) = 0.3 and P(B) = 0.4 that is 0.3 ∕ 0.4 = 0.75. Intuitively you are restricting attention to the outcomes where B is true (a 0.4 slice of the world) and asking what fraction of those also have A (0.3 of the whole, which is 0.75 of the slice). The condition must have non-zero probability — you cannot condition on something that never happens.
What is the difference between P(A|B) and P(B|A)?
They condition on different things and are generally different numbers. P(A|B) divides the overlap by P(B); P(B|A) divides the same overlap by P(A). They are equal only when P(A) = P(B). Swapping them is the inversion (or prosecutor’s) fallacy: “the probability of this DNA match if innocent” is not “the probability of innocence given the match.” Bayes’ rule, P(A|B) = P(B|A)·P(A) ∕ P(B), is the only correct way to convert one into the other, and it needs the base rate P(A).
What does it mean for two events to be independent?
A and B are independent if knowing one happened does not change the probability of the other: P(A|B) = P(A), which is the same as saying P(A∩B) = P(A)·P(B). The calculator checks this for you. If the joint probability is larger than P(A)·P(B) the events are positively associated (B makes A more likely); if smaller, negatively associated. Independence is a strong assumption — many real-world “independent” events quietly are not, which is how compound risks get badly underestimated.
Why can a 99% accurate test still usually be wrong when positive?
Because of the base rate. If a disease affects 1 in 1,000 and the test is 99% accurate, the rare true positives are swamped by the far more numerous false positives drawn from the huge healthy majority — so P(disease | positive) can be well under 10% even though P(positive | disease) is 99%. The two conditionals point in opposite directions, and only Bayes’ rule, weighting by the base rate, gets the honest answer. This is the heart of the base-rate fallacy.