Why this matters
Imagine a medical test comes back positive. How likely is it that the person really has the condition? That question runs a conditional probability backwards, and Bayes' theorem is the tool for it. To get there, we first need the total probability of an event, added up over all its possible causes. So we will prove the theorem of total probability, then Bayes' theorem, and put both to work.
Partitions and total probability
We say events form a partition of when no two of them overlap, together they cover everything, and each one has non-zero probability. Then for any event ,
The idea is simple. breaks up into separate pieces , and each piece has probability . Add the pieces back together and you have the whole event.
Example 1. A factory has three machines making , and of its bolts, and their defect rates are , and . Then .

Bayes' theorem
We call the the prior probabilities: what we believed before. The are the posterior probabilities, our updated belief once we have seen .
Example 2. Go back to Example 1 and suppose a bolt turns out defective. How likely is it that the third machine made it? The answer is .
Example 3. Say a disease affects of people. A test catches it in of those who have it, but it also wrongly says positive for of those who do not. If your result is positive, . Surprised? Because the disease is rare, most positive results are actually false alarms.

Example 4. Bag I has red and blue balls, and bag II has red and blue. You pick a bag at random, draw a ball, and it is red. Then .
Example 5. In an exam, a student knows the answer with probability ; otherwise the student guesses from options. If the answer is correct, how likely is it that the student actually knew it? We get .
Practice
- There are two boxes. Box A has gold and silver coins; box B has gold and silver. A box is picked at random and a coin is drawn. Find .
- In question 1 the coin turns out gold. Find the probability that it came from box B.
- of a college's students live in hostels. of hostel students and of day students get an A grade. A student with an A is chosen at random. Find .
- A factory has two plants making and of its output, and and of their items are faulty. A faulty item turns up. Which plant more likely made it?
- A test for a condition detects of cases and has a false-positive rate; the condition affects of people. Find the probability that someone who tests positive really has it.
- A woman tells the truth times in . She says a die showed a one. Find the probability that it really did.
- There are three coins: one has two heads, one is biased to show heads of the time, and one is fair. A coin is picked at random and shows heads. Find the probability that it is the two-headed coin.
- In one sentence, explain why a very accurate test can still give mostly false positives.
Answers
Show answers
- .
- .
- .
- Plant 1 gives and plant 2 gives , so it is plant 2 ().
- .
- .
- .
- When the condition is rare, the few true positives get swamped by the false positives coming from the much larger healthy group.