Bayes’ theorem
Bayes’ theorem updates the probability of a hypothesis Hₖ after observing event B. P(Hₖ) is the prior probability and P(Hₖ | B) is the posterior probability.
Let H₁, H₂, …, Hₙ be mutually exclusive and exhaustive hypotheses. Their prior probabilities sum to 1.
The denominator is the probability of B, computed using the law of total probability:
P(B) = P(H₁) × P(B | H₁) + … + P(Hₙ) × P(B | Hₙ)
If P(B) = 0, the posterior probability is undefined. A hypothesis with zero prior probability contributes zero to the sum; its conditional probability is used only as a model parameter.
Calculation algorithm
- Identify the exhaustive set of hypotheses and record P(Hᵢ) and P(B | Hᵢ) for each. Check that the prior probabilities sum to 1.
- Select one or more hypotheses whose posterior probabilities you want to find.
- Compute P(B) by adding the products P(Hᵢ) × P(B | Hᵢ) for all hypotheses.
- For each selected hypothesis Hₖ, divide P(Hₖ) × P(B | Hₖ) by P(B). Write the result as an exact reduced fraction.