Bayes' Theorem
Update a belief's probability given new evidence.
Formula
Variables
Example
Updating the chance of a disease after a positive test.
How it works
Bayes' Theorem tells you how to reverse conditional probabilities: it turns a known probability of evidence given a hypothesis into the probability of the hypothesis given the evidence. It works because the same joint event can be written two ways, so P(A and B) = P(B|A)P(A) = P(A|B)P(B), and rearranging gives the formula. In practice, the prior P(A) is your starting belief, the likelihood P(B|A) measures how compatible the evidence is with that belief, and the denominator P(B) normalizes across all possible ways the evidence could occur.
When to use it
Use Bayes' Theorem whenever you need to update a probability after observing new information, especially in classification, diagnostics, filtering, and decision-making under uncertainty. It is especially useful when the evidence is common or rare and you need to distinguish between "probability of evidence if a claim is true" and "probability the claim is true given the evidence."
Worked example, step by step
Suppose a factory has two machines making the same part. - Machine A makes 60% of the parts, so P(A) = 0.60 - Machine B makes 40% of the parts, so P(B) = 0.40 - 2% of Machine A's parts are defective, so P(D|A) = 0.02 - 5% of Machine B's parts are defective, so P(D|B) = 0.05 Question: If a randomly chosen part is defective, what is the probability it came from Machine B? Step 1: Find the total probability of a defective part: P(D) = P(D|A)P(A) + P(D|B)P(B) P(D) = (0.02)(0.60) + (0.05)(0.40) P(D) = 0.012 + 0.020 = 0.032 Step 2: Apply Bayes' Theorem for Machine B: P(B|D) = [P(D|B)P(B)] / P(D) P(B|D) = (0.05 × 0.40) / 0.032 P(B|D) = 0.020 / 0.032 = 0.625 Final answer: P(B|D) = 0.625, so there is a 62.5% chance the defective part came from Machine B.
Common mistakes to avoid
- Confusing P(A|B) with P(B|A); they are usually not the same
- Forgetting to compute P(B) using all possible causes of the evidence
- Using Bayes' Theorem without checking whether the prior and likelihood are based on the same sample space
Did You Know?
Bayes' rule powers spam filters, medical diagnosis and the reasoning of modern AI systems.
Share this formula
More in Game Theory & Decision
View allExpected Value
BasicProbability-weighted average outcome of a decision.
Kelly Criterion
AdvancedOptimal fraction of bankroll to bet for long-run growth.
Expected Utility
AdvancedWeighted average of the utility of outcomes, not just their cash value.
Payoff Comparison
IntermediateOne strategy dominates another if its payoff is always higher.
Minimax Value
AdvancedBest worst-case payoff a player can guarantee.
Mixed Strategy (Indifference)
AdvancedProbability that makes an opponent indifferent between their options.