Math · Probability

Bayes’ Theorem

Bayes’ Theorem updates a probability after observing evidence: start with a prior, filter for the evidence, then compare what remains.

Concept

Before observing evidence, A has a base rate. Evidence B may occur when A is true, but it can also occur when A is false. Once B is observed, cases without B no longer matter; among the remaining B cases, find the fraction that belong to A.

PriorP(A)
EvidenceP(B|A), P(B|¬A)
PosteriorP(A|B)

Equation

P(A|B)=P(B|A)P(A)P(B)

P(B)=P(B|A)P(A)+P(B|¬A)P(¬A)

P(A|B)=P(B|A)P(A)P(B|A)P(A)+P(B|¬A)P(¬A)

Focus or select a term to trace it in the population.

Manipulate

Adjust the prior and the two evidence rates. The labels describe the relationship before you need to read the notation.

A without B¬A without BB among AB among ¬A (dashed)

Live calculation

Natural frequencies

This is why the denominator matters: P(B|A) asks about B within A, while P(A|B) asks about A within B. Reversing the condition changes the sample space.

A spam-filtering signal

Let A mean “a message is spam” and B mean “the message contains a particular signal.” A prior spam rate and the frequency of that signal among spam and non-spam messages combine to update P(spam|signal). Real filters use many signals and richer models; this is one clear slice of the reasoning.

Computing, data & machine learning

Bayes supports Bayesian inference, probabilistic classification, Naive Bayes methods, spam filtering, uncertainty-aware systems, and model updating. It provides a disciplined way to combine a base rate with new evidence.