Advanced Mathematics

Bayes' Theorem

Turns the chance of the evidence given a cause into the chance of the cause given the evidence, weighing how common the cause is.

Needs a step first: 4

P(A∣B)=P(B∣A) P(A)P(B)P(A\mid B)=\frac{P(B\mid A)\,P(A)}{P(B)}, where P(B)P(B) adds up every way the evidence could arise. The prior P(A)P(A) matters: a good test for a rare condition still gives mostly false alarms, because the healthy far outnumber the ill. Counting an imagined 1000010000 people is the surest way to get it right. Bayesian inference is this rule applied to a whole range of hypotheses at once.

Where it shows up: Spam filters apply it directly, and it is the update step of every Bayesian model, from medical diagnosis to a robot working out where it is.

How to hold it: In your head

Explain with an imagined crowd of 1000010000 people why an accurate test for a rare condition still gives mostly false alarms, and see how much the prior weighs in the answer.

What knowing it looks like

  • Compute a posterior probability, with the law of total probability in the denominator.
  • Redo the same calculation by counting an imagined population of 1000010000 and get the same answer.
  • Explain to someone why a positive result from an accurate test can still most likely be a false alarm.

Test yourself

A condition affects 1%1\% of people. A test detects it in 90%90\% of people who have it, and wrongly flags 5%5\% of people who do not. Someone tests positive. What is the probability that they have the condition?
Show the worked answer
P(ill∣+)=0.9×0.010.9×0.01+0.05×0.99=0.0090.0585=213≈15%P(\text{ill}\mid +)=\frac{0.9\times0.01}{0.9\times0.01+0.05\times0.99}=\frac{0.009}{0.0585}=\frac{2}{13}\approx15\%. In 1000010000 people: 100100 are ill and 9090 of them test positive; 99009900 are well and 495495 of them test positive. Of the 585585 positives, 9090 are ill. The tempting answer, 90%90\%, is the chance of a positive given illness: the question the wrong way round.

Needs a step first: 4

Learn it with an AI

Copy this prompt into any AI assistant. It will take you through step by step at your level and finish with the test above.

Be my maths tutor. I'm learning "Bayes' Theorem" (Core tier): Turns the chance of the evidence given a cause into the chance of the cause given the evidence, weighing how common the cause is.
I already know: Conditional Probability.
Teach it Socratically: first ask what I already know; then explain the core idea with one concrete example and why it's true; then give me three problems, one at a time, easy to hard. Wait for my answer, check every step, and point out mistakes without giving the answer away.
Finish by testing me with this: A condition affects $1\%$ of people. A test detects it in $90\%$ of people who have it, and wrongly flags $5\%$ of people who do not. Someone tests positive. What is the probability that they have the condition?
Use LaTeX for formulas. When you say where it's used later (machine learning, quantum mechanics), be specific.

On the way to

Recommended