MathLabs
TheoremProved

Bayes' theorem

Statement

For any events AA and BB with P(A)>0\mathbb{P}(A) > 0 and P(B)>0\mathbb{P}(B) > 0, P(A∣B)=P(B∣A) P(A)P(B)\mathbb{P}(A \mid B) = \frac{\mathbb{P}(B \mid A)\,\mathbb{P}(A)}{\mathbb{P}(B)}. More generally, if A1,…,AkA_1, \dots, A_k form a partition of the sample space with P(Ai)>0\mathbb{P}(A_i) > 0 and P(B)>0\mathbb{P}(B) > 0, then for each jj, P(Aj∣B)=P(B∣Aj) P(Aj)∑i=1kP(B∣Ai) P(Ai)\mathbb{P}(A_j \mid B) = \frac{\mathbb{P}(B \mid A_j)\,\mathbb{P}(A_j)}{\sum_{i=1}^k \mathbb{P}(B \mid A_i)\,\mathbb{P}(A_i)}.

Why is it true?

Bayes' theorem is the mathematical rule for reversing conditional probabilities: it tells you how to update a prior belief P(A)\mathbb{P}(A) about a hidden cause AA into a posterior belief P(A∣B)\mathbb{P}(A \mid B) after observing evidence BB, by weighting the prior by how likely AA was to produce BB.

Proof sketch

By the definition of conditional probability, P(A∣B)=P(A∩B)P(B)\mathbb{P}(A \mid B) = \frac{\mathbb{P}(A \cap B)}{\mathbb{P}(B)} when P(B)>0\mathbb{P}(B) > 0, and symmetrically P(B∣A)=P(A∩B)P(A)\mathbb{P}(B \mid A) = \frac{\mathbb{P}(A \cap B)}{\mathbb{P}(A)} when P(A)>0\mathbb{P}(A) > 0. Equating the two expressions for P(A∩B)\mathbb{P}(A \cap B) gives P(A∩B)=P(B∣A) P(A)\mathbb{P}(A \cap B) = \mathbb{P}(B \mid A)\,\mathbb{P}(A), and dividing by P(B)\mathbb{P}(B) yields P(A∣B)=P(B∣A) P(A)P(B)\mathbb{P}(A \mid B) = \frac{\mathbb{P}(B \mid A)\,\mathbb{P}(A)}{\mathbb{P}(B)}. If A1,…,AkA_1, \dots, A_k partition the sample space, the law of total probability expands the denominator as P(B)=∑i=1kP(B∩Ai)=∑i=1kP(B∣Ai) P(Ai)\mathbb{P}(B) = \sum_{i=1}^k \mathbb{P}(B \cap A_i) = \sum_{i=1}^k \mathbb{P}(B \mid A_i)\,\mathbb{P}(A_i).

Proved by

Topics that use this theorem

Related theorems

Step-by-step proofs

No step-by-step proof yet for this theorem.

References

  1. Thomas Bayes, Richard Price (1763). An Essay towards solving a Problem in the Doctrine of Chances · DOI:10.1098/rstl.1763.0053
  2. Pierre-Simon Laplace (1812). Théorie analytique des probabilités