Calculators/Mathematics/Conditional probability and Bayes' theorem

Conditional probability and Bayes' theorem

P(A|B) = P(A∩B)/P(B) · Bayes' theorem · rare-disease paradox

Conditional probability and Bayes' theorem — illustration
P(A|B)
0.4
= 40 %

P(A|B) = P(A∩B)/P(B) — the probability of A given that B has occurred.

Conditional probability P(A∣B)P(A|B) is the chance of AA occurring given that BB has occurred:

P(A∣B)=P(A∩B)P(B),P(B)>0P(A|B)=\frac{P(A\cap B)}{P(B)},\quad P(B)>0

When the “reverse” probabilities are known, we apply Bayes' theorem:

P(A∣B)=P(B∣A) P(A)P(B∣A) P(A)+P(B∣¬A) P(¬A)P(A|B)=\frac{P(B|A)\,P(A)}{P(B|A)\,P(A)+P(B|\neg A)\,P(\neg A)}

The denominator is P(B)P(B) from the law of total probability. Bayes' theorem updates our knowledge: it combines the prior probability P(A)P(A) with the “sensitivity” of the observation P(B∣A)P(B|A). Beware the rare-disease paradox — even an accurate test gives a low P(A∣B)P(A|B) when P(A)P(A) is low.

Examples

P(A∩B)=0.2; P(B)=0.5
→ P(A|B) = 0.2/0.5 = 0.4
Test: P(A)=1%, sensitivity 90%, false alarm 5%
→ P(diseased|positive) ≈ 15.4%

Frequently asked questions

What is Bayes' theorem?+

A way of “inverting” a conditional probability: given P(B|A) we find P(A|B). It combines the prior probability with a new observation, which is why it is the foundation of statistical inference.

Why can an accurate test still be wrong so often?+

For a very rare disease (low P(A)), false alarms from the large group of healthy people outweigh the true detections. This is the rare-disease paradox — a positive result still gives a low P(diseased).

Found this calculator useful? Share it.

It's free — send it to a friend who's revising.

Teaching? Embed this calculator on your site.

Free widget — paste it on your school site, blog or notes. It links to the full version.

Teaching a class or tutoring? Guide students in NexTutor →