MathorynMathematical Formula Database

Statistics & Probability

Bayes' Theorem

Bayes' theorem reverses conditional probabilities: it updates the probability of a hypothesis A after observing evidence B. It is central to medical testing, spam filters and Bayesian statistics.

P(A∣B)=P(B∣A) P(A)P(B)P(A\mid B)=\frac{P(B\mid A)\,P(A)}{P(B)}
LaTeXP(A\mid B)=\frac{P(B\mid A)\,P(A)}{P(B)}

Variables

P(A)P(A)
prior probability
P(B∣A)P(B\mid A)
likelihood
P(B)P(B)
total probability of the evidence
P(A∣B)P(A\mid B)
posterior probability

Example

1% of people have a disease. A test detects it 90% of the time and gives 5% false positives. Probability of disease after a positive test?

  1. P(B)=0.9⋅0.01+0.05⋅0.99=0.009+0.0495=0.0585P(B)=0.9\cdot0.01+0.05\cdot0.99=0.009+0.0495=0.0585.
  2. P(A∣B)=0.0090.0585P(A\mid B)=\frac{0.009}{0.0585}.

Answer: ≈0.1538\approx0.1538 (about 15%).

Related formulas