Sign in

Libre University uses your GitHub account. Signing in is only needed to sit a final test, so the score is kept on your profile.

Bayes' theorem

Bayes' theorem is the engine of learning from evidence. It tells you how to revise a probability when new information arrives, and it repairs one of the most common and consequential errors in reasoning.

The theorem

Often you know the probability of the evidence given the cause, but you want the reverse: the probability of the cause given the evidence. Bayes' theorem flips one into the other:

P(A|B)=P(B|A)P(A)P(B).

Here P(A) is your prior: the probability before the evidence; P(B|A) is how likely the evidence is if A is true; and P(A|B) is the posterior, your updated belief after seeing B.

The rare-disease test

The classic example is a medical test. Suppose a disease affects 1 in 1000 people, and a test for it is 99% accurate: it catches almost every case and only rarely misfires. You test positive. What is the chance you are actually sick? Most people guess about 99%. The true answer is closer to 9%.

A probability tree for a medical test: the population split by who has the disease and who does not, each branch splitting again into positive and negative results, showing why most positives can still be false when the disease is rare.
A probability tree for a medical test: the population split by who has the disease and who does not, each branch splitting again into positive and negative results, showing why most positives can still be false when the disease is rare.

Why the base rate wins

Picture 100,000 people. About 100 have the disease and nearly all test positive: call it 99. But of the 99,900 healthy people, even a 1% error rate produces about 999 false positives. So there are roughly 99 true positives among 99+9991098 positives in total, and your chance of really being sick is about 99/10989%. The disease is so rare (the prior so low) that false alarms swamp the true cases.

The lesson

Ignoring the prior is the base-rate fallacy, and it drives real mistakes in medicine, law, and security screening. Bayes' theorem forces the base rate into the calculation, which is why it underlies spam filters, diagnostic reasoning, and modern machine learning. Its message is simple and profound: evidence should update what you already believed, not replace it.