Bayes’ Theorem Calculator

Enter the prior and conditional probabilities for each hypothesis. The hypotheses must be mutually exclusive and exhaustive: the sum of P(Hᵢ) must equal 1.

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.

P(Hk|B)=P(Hk)×P(B|Hk)P(B)=P(Hk)×P(B|Hk)∑i=1nP(Hi)×P(B|Hi)

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

  1. Identify the exhaustive set of hypotheses and record P(Hᵢ) and P(B | Hᵢ) for each. Check that the prior probabilities sum to 1.
  2. Select one or more hypotheses whose posterior probabilities you want to find.
  3. Compute P(B) by adding the products P(Hᵢ) × P(B | Hᵢ) for all hypotheses.
  4. For each selected hypothesis Hₖ, divide P(Hₖ) × P(B | Hₖ) by P(B). Write the result as an exact reduced fraction.