Bayes' theorem formula
Bayes' theorem relates the posterior probability P(A|B) to the prior P(A), the likelihood P(B|A), and the marginal probability of the evidence P(B). The marginal evidence is computed as P(B) = P(B|A) × P(A) + P(B|¬A) × P(¬A).
The classic example is medical testing: if a disease has 1% prevalence (prior = 0.01), a test has 90% sensitivity (likelihood = 0.9), and a 5% false positive rate, the posterior probability of having the disease given a positive test is about 15.4% — much lower than the 90% sensitivity might suggest.
P(A|B) = P(B|A) × P(A) / P(B)
Bayes' theorem: the posterior probability of A given evidence B.
P(B) = P(B|A) × P(A) + P(B|¬A) × P(¬A)
The total probability of the evidence (law of total probability).