Computing Library › Probability Statistics
Probability Statistics

Bayes Theorem

Bayes theorem inverts conditional probability, turning a likelihood and a prior into an updated posterior belief.

The formula

Bayes theorem states P(H | E) = P(E | H) P(H) / P(E). It relates the posterior P(H | E) — the probability of a hypothesis after seeing evidence — to the likelihood P(E | H), the prior P(H), and the evidence P(E).

The pieces named

Kronos motion — bayes opt

Odds form

Dividing the theorem for two hypotheses cancels the shared denominator: posterior odds = prior odds × likelihood ratio. This form makes updating a single multiplication and shows that only the ratio of likelihoods matters, not their absolute size.

python
# medical-test style update
prior = 0.02
sens = 0.90        # P(E|H)
false_pos = 0.05   # P(E|not H)
evid = sens*prior + false_pos*(1-prior)
posterior = sens*prior/evid
print(round(posterior,4))  # 0.2687

Why it is central

Bayes theorem is the mathematics of learning from data. It is prescriptive: given a model of how evidence arises, it dictates exactly how beliefs must change. Sequentially, yesterday's posterior becomes today's prior, so evidence accumulates coherently.

The theorem itself is not controversial — it follows directly from the definition of conditional probability. What draws debate is the choice of prior, which is a modeling decision rather than a mathematical one.