How this instrument works
Bayes' theorem answers a specific question: given that event B has just been observed, how likely is event A now? It starts from three ingredients — the prior P(A), your belief about A before seeing any evidence; the likelihood P(B|A), how probable the evidence would be if A were true; and the evidence P(B), how probable that evidence is overall, across every way it could arise. Combining them gives the posterior, P(A|B): your updated belief about A after taking the evidence into account.
The formula itself is a rearrangement of the definition of conditional probability: P(A|B) = P(B|A) x P(A) / P(B). What makes it powerful is direction — P(B|A) and P(A|B) are usually easy to confuse but are not the same number, and mixing them up is one of the most common reasoning errors in statistics. Bayes' theorem is precisely the tool for converting one into the other correctly.
A subtle but important consequence is that the posterior depends heavily on the prior, not just the likelihood. Even strong evidence (a high P(B|A)) can still leave the posterior surprisingly low if the prior P(A) started out small, because P(B) — the evidence's overall probability — gets pulled up by all the ways B can happen when A is false, too. This site's conditional-probability instrument computes the plain P(A|B) = P(A and B) / P(B) form directly when you already have the joint probability; Bayes' theorem is for when you only have the prior and the likelihood instead.
- Enter your starting belief about A, before any evidence, into P(A) — prior.
- Enter how likely the evidence would be if A were true into P(B | A) — likelihood.
- Enter the evidence's overall probability, across every way it could occur, into P(B) — evidence.
- Read P(A | B) — posterior for the updated probability of A now that B has been observed.
- P(B) can't be zero — the instrument requires it to be greater than zero, since you can't condition on evidence that never occurs.
Worked example — a classic 1%-prevalence screening test
This is a standard, deliberately clean textbook illustration, not a real diagnostic recommendation. Set P(A) — prior to 0.01 (a condition affecting 1% of a population), P(B|A) — likelihood to 0.9 (a test that correctly flags 90% of true cases), and P(B) — evidence to 0.0189 (the overall chance of a positive test result, once both true and false positives across the whole population are counted). P(A | B) — posterior reads 0.476190, meaning roughly 47.6% — just under half.
That number is the whole point of the example: even with a test that catches 90% of real cases, a positive result on a condition this rare is still more likely than not to be a false alarm, because the low prior (only 1% of people actually have the condition) means most positive results come from the much larger pool of people who don't. Bayes' theorem is exactly the arithmetic that makes this base-rate effect visible instead of easy to miss.
Questions
What's the difference between P(B|A) and P(A|B)?
They answer different questions and are almost never equal. P(B|A) is the chance of the evidence given the hypothesis — how likely a positive test result is if the condition is really present. P(A|B) is the reverse: the chance the hypothesis is true given the evidence — how likely the condition is, now that a positive result has come back. Bayes' theorem is precisely the formula for converting the first into the second, since they can differ enormously, as the worked example shows.
Why does a low prior matter so much, even with strong evidence?
Because P(B), the overall evidence probability, blends the true-positive rate with the false-positive rate across everyone, not just those with the condition. When the prior P(A) is small, the pool of people without the condition is huge, so even a modest false-positive rate among them can outnumber the true positives from the small group who actually have it — pulling the posterior down well below what the likelihood alone would suggest.
How is this different from the conditional-probability calculator on this site?
They compute the same posterior but from different starting ingredients. The conditional-probability instrument divides a joint probability P(A and B) directly by P(B); this Bayes' theorem instrument instead builds that same P(A and B) indirectly, as P(B|A) x P(A), for situations where you know the prior and likelihood but never had the joint probability to begin with.
Why must P(B) be greater than zero?
Dividing by zero has no defined result, and it makes no sense to condition on evidence that has no chance of ever being observed — there is no updated belief to compute if B literally cannot happen. The instrument requires P(B) to be strictly positive before it will return a posterior.
Where does P(B) actually come from if I don't already have it?
It's the total probability of the evidence across every way it can arise: P(B) = P(B|A) x P(A) + P(B|not A) x P(not A). In the worked example, that's the 90% true-positive rate applied to the 1% who have the condition, plus a smaller false-positive rate applied to the 99% who don't, summing to the 1.89% overall positive rate used as P(B).
Can the posterior ever come out higher than the likelihood?
Yes, whenever the prior P(A) is large enough. If most of the population already has the condition, then a positive test is overwhelmingly likely to be a true positive, so P(A|B) can land close to 1 even from a middling likelihood. The posterior is always a blend of the prior and the likelihood — neither one alone determines it.