Bayes' Theorem
Invert conditional probabilities to update beliefs about a hidden cause from an observed effect.
1. The idea
Bayes' theorem inverts the direction of conditioning: it lets you go from , which is often easy to state, to , which is what you actually want to know.
The formula is , where is the prior belief, is the likelihood, and is the posterior. The denominator is usually expanded via the law of total probability over all possible hypotheses.
Interview versions of this problem almost always feature a hidden state (which coin, which machine, which factory, whether a trader is informed) and an observable outcome (a coin flip, a defective part, a trade). The trick is identifying the hypotheses, writing down priors and likelihoods, and computing the total probability of the evidence.
2. Why it matters
Bayes' theorem is the mathematical core of updating on information, which is exactly what trading, risk, and machine learning models do continuously. Interviewers use it to test structured thinking under a slightly confusing setup.
3. Core mathematics
Bayes' theorem
Law of total probability
Odds form
4. How to recognize it
Think of this when…
- Two or more possible "sources" or "hypotheses" (which coin, which factory, which urn) with different rates for producing an observation.
- You observe an outcome and are asked for the probability of the underlying cause.
- Words like "prior," "given a positive test," or "informed trader" appear.
- A defective-item / diagnostic-test setup with known base rates and known error rates.
5. Worked example
Worked example
Factory A makes 60% of a company's widgets and factory B makes 40%. 2% of A's widgets are defective and 5% of B's are defective. A random widget is found defective. What is the probability it came from factory B?
- 1
Define hypotheses and priors: , .
- 2
Write likelihoods of the evidence (defective) under each hypothesis: , .
- 3
Compute the total probability of the evidence via the law of total probability.
- 4
Apply Bayes' theorem for .
- Answer:
6. Common mistakes
- Confusing with and skipping the inversion entirely (the base-rate fallacy).
- Forgetting to weight likelihoods by the priors when computing .
- Leaving out a hypothesis from the law of total probability, so the denominator is too small.
- Not normalizing: forgetting to divide by so the posterior probabilities across hypotheses no longer sum to 1.
7. Quick check
In the factory example, what is ?
A rare disease affects 1% of people. A test is 99% accurate (both sensitivity and specificity). A random person tests positive. Is it more likely than not they have the disease?
8. Practice
40 QuantSolve questions use this concept.
Practice this concept9. Related methods
Create a free account to save lesson progress.
Recommended next lessonIndependence →