A test turns positive. A message contains a suspicious word. A sensor reports an anomaly. The tempting question is, “How likely is the cause?” The number a test-maker usually gives—how often the signal appears when the cause is present—answers a different question. Bayes’ theorem is the conversion rule that keeps those directions separate.
P(A | B) = P(B | A) P(A) / P(B)Posterior = likelihood × prior, divided by the total probability of the evidence.

The four parts of an update
The chance of the target event before seeing B.
How compatible the evidence is with A.
Every modeled route by which B could occur.
The revised chance of A after B is known.
All four quantities are dimensionless probabilities from 0 to 1. That makes the unit check simple: a product of two probabilities, divided by one probability, is still dimensionless. The catch is semantic, not mechanical. You must state what A, B, the population, and the time window are before inserting numbers.
For competing hypotheses A₁, …, Aₙ that are mutually exclusive and exhaustive, the denominator becomes a weighted total:
P(Ak | B) = P(B | Ak)P(Ak) / ΣiP(B | Ai)P(Ai)The denominator is the normalizer. Leave out a plausible route to B and the resulting “posterior” is not a probability across the intended set.
Why the formula is true
Bayes’ theorem is not an extra assumption about independence. It follows from writing the same joint event in two valid orders. The National Institute of Standards and Technology presents this same joint-probability derivation in its Bayesian experiment-design material.
P(A ∩ B) = P(A | B)P(B)P(A ∩ B) = P(B | A)P(A)P(A | B) = P(B | A)P(A) / P(B)The useful inverse forms are just as direct: P(B | A) = P(A | B)P(B)/P(A) and P(A) = P(A | B)P(B)/P(B | A), when the relevant denominators are non-zero. In practice, however, the denominator is usually the harder part: it requires thinking about alternatives rather than only the target case.
Worked example: a positive screening result
This is a hypothetical arithmetic model, not medical advice or a performance claim about any assay. Let D mean that a condition is present and + a positive result. In a specified screened population, suppose prevalence is P(D) = 0.0100, sensitivity is P(+ | D) = 0.950, and specificity is P(− | not D) = 0.900. The false-positive rate is therefore P(+ | not D) = 0.100.
The model gives P(D | +) = 8.76%, not 95%. A frequency check makes the denominator visible: among 10,000 people, 100 have the condition and yield 95 true positives; 9,900 do not and yield 990 false positives. So 95 of 1,085 positive results are true positives: 95/1,085 = 0.0875576. The CDC’s screening guidance calls this positive predictive value and emphasizes its dependence on prevalence.

Worked example: a spam signal
Now let S mean “message is spam” and W mean “message contains a particular signal.” Suppose P(S)=0.20, P(W | S)=0.80, and P(W | not S)=0.10. Here the same reversal gives:
(0.80)(0.20) = 0.160(0.10)(0.80) = 0.0800.160 / (0.160 + 0.080) = 2/3 = 66.7%In 1,000 messages, that means 160 signal-bearing spam messages and 80 signal-bearing legitimate messages: 160/(160+80)=2/3. The likelihood is 80%, but the posterior is 66.7%, because legitimate messages can carry the signal too.
Mistakes that change the answer
P(+ | D) is sensitivity; P(D | +) is a posterior. They can be far apart.
Using only a test’s sensitivity skips the prior and makes a low-prevalence result look stronger than it is.
Bayes does not grant independence. Correlated signals need a joint likelihood, not two multiplications.
Probability alone does not set an action. Costs, benefits, and follow-up options still matter.

What Bayes can and cannot say
Bayes’ theorem returns a probability conditional on the supplied model. It is excellent for stating how a prior and a likelihood fit together, for comparing defined hypotheses, and for exposing which missing number is doing the work. It does not establish causation, repair a biased sample, prove that the chosen hypotheses are complete, or make uncertain sensitivity and specificity exact.
In continuous-parameter work, the analogous expression uses densities: p(θ | y) = p(y | θ)p(θ)/p(y). A density at one exact point is not a probability and may exceed one; probabilities come from integrating over a stated interval. That distinction, plus model calibration and uncertainty in the inputs, matters whenever an update informs a high-stakes decision.
The most responsible Bayes calculation therefore starts with a sentence, not an equation: “In this population, over this time window, for this precisely defined evidence, what alternatives could have produced the observation?” Once that sentence is sound, the arithmetic is usually the easy part.