Bayes’ theorem
How to reverse a conditional probability: from the chance of a positive test given the disease to the chance of the disease given a positive test. Bayes’ theorem with two and with three events.
1What you need to know
Tick these off as you go. By the end of the page you should be able to do all of them without notes.
- Explain why and are usually differentAHL 4.13
- Find by adding the branches of a tree (the law of total probability)AHL 4.13
- Use Bayes’ theorem for an event and its complement AHL 4.13
- Use Bayes’ theorem with three mutually exclusive, exhaustive eventsAHL 4.13
- Interpret a result in context, including false positives and repeated testsAHL 4.13
2Notes & worked examples
Each idea is followed by a worked example. Try the question yourself first, then reveal the solution one step at a time.
A tree diagram is drawn in the order things happen: first whether a person has a disease, then whether their test is positive. So the tree gives you directly. The question people actually care about runs the other way: given a positive test, how likely is the disease? Bayes’ theorem turns the tree around. It is nothing more than the definition of conditional probability, used carefully.
2.1 Two conditionals are not the same
Suppose 1% of a population has a disease. A test detects it 95% of the time, and gives a positive result for 5% of healthy people (a false positive). Most people guess that a positive test means about a 95% chance of having the disease. The true answer is about 16%.
The quickest way to see why is to imagine 10 000 people. 100 have the disease and 95 of them test positive. 9900 are healthy and 5% of them, 495 people, also test positive. So 590 people test positive, and only 95 of them are ill:
The false positives swamp the true positives because healthy people vastly outnumber ill people. , but . Mixing up these two is a famous error in medicine and in court cases.
2.2 Bayes’ theorem for an event and its complement
Start from . The numerator is one branch of the tree: . The denominator is the sum of every branch that ends in : .
The numerator is the branch you want. The denominator is all the branches that end in .
Both methods are the same calculation. Counting people (95 out of 590) is the formula with every probability multiplied by 10 000. If you are unsure which numbers go where in the formula, count imaginary people: it is hard to get it wrong.
2.3 Three (or more) events
The IB course also covers three events that are mutually exclusive and exhaustive (exactly one of them happens). Typical examples: three machines in a factory, three ways of getting to school, three bags to choose from.
(a) Find the probability that it is defective.
(b) Given that it is defective, find the probability that it was made by C.
2.4 Updating: testing twice
Bayes’ theorem updates a probability when new evidence arrives. The probability before the evidence is the prior; the probability after is the posterior. After one positive test the probability of disease rose from 0.01 to 0.161. If the person is tested again (independently), the 0.161 becomes the new prior.
- Identify the events and write down every probability you are given, using notation.
- Draw the tree in the order things happen (the "cause" first, the "evidence" second).
- Find the probability of the evidence by adding every branch that ends in it.
- Divide the branch you want by that total.
- Check: is the answer sensible? Do the posteriors add to 1?
Bayes questions are short arithmetic, but long decimals are common. Store intermediate results: type 0.01*0.95+0.99*0.05, then press ctrl var and store it as pb. Then 0.0095/pb gives with no rounding error.
3Explore it
Each square is one person out of 1000. Change how common the disease is and how good the test is, and watch what fraction of the positive results are true positives.
4Common mistakes & exam tips
Common mistakes
- Confusing with . Write the probability you want in notation before starting.
- Using only one branch for in the denominator. It must include every branch that ends in .
- Forgetting the complement: is not .
- Rounding the denominator early and losing accuracy in a Paper 2 answer.
- In a repeated test, using 0.01 again as the prior instead of the updated probability.
Exam tips
- Always draw the tree. Examiners give method marks for the correct branches even if the arithmetic goes wrong.
- Questions often say "given that the item is defective" or "given that the student was late": that event is the one in the denominator.
- In a three-event question, check that your three posterior probabilities add to 1.
- Give a one-line interpretation in context when asked, e.g. "most positive results are false positives".
5Practice
Fluency questions build the basics. Problem-solving questions make you think about which method to use.
6Exam-style questions
Original questions in the style of the IB exam, with full markschemes. Give yourself about 1 minute per mark.
Box A contains 3 red and 2 blue counters. Box B contains 1 red and 4 blue counters. A fair coin is tossed: if it shows heads a counter is taken from box A, otherwise from box B.
- (a)Find the probability that the counter is red.[3]
- (b)Given that the counter is red, find the probability that it was taken from box A.[3]
| (a) | |
| tree diagram or | M1A1 |
| A1 | |
| (b) | |
| M1A1 | |
| A1 | |
At a school, 40% of students travel by bus, 35% by car and the rest walk. The probability of being late is 0.1 for a bus traveller, 0.05 for a car traveller and 0.02 for a walker. A student is chosen at random.
- (a)Find the probability that the student is late.[3]
- (b)Given that the student is late, find the probability that they travelled by bus.[2]
- (c)Given that the student is not late, find the probability that they travelled by car.[2]
| (a) | |
| M1A1 | |
| A1 | |
| (b) | |
| M1 | |
| A1 | |
| (c) | |
| M1 | |
| A1 | |
A disease affects 1% of a population. A test gives a positive result for 95% of people with the disease and for 5% of people without it.
- (a)A person tests positive. Find the probability that they have the disease.[3]
- (b)The person takes the test again, independently, and again tests positive. Find the probability that they have the disease.[3]
- (c)Comment on your answers.[1]
| (a) | |
| M1A1 | |
| A1 | |
| (b) | |
| using 0.161 as the new prior, or over | M1A1 |
| A1 | |
| (c) | |
| one positive test is weak evidence because false positives outnumber true positives; a second positive makes the disease likely | R1 |
7Check yourself
Six quick questions, marked instantly. Aim for 6/6 before moving on. Fractions like 3/2 are accepted.
8Past-paper practice
Once you're scoring well above, try real IB questions. Your school or teacher will have these papers.
| Paper | Question | Focus | Difficulty |
|---|---|---|---|
| Nov 2025 · TZ1 · Paper 2 | Q7 | Two machines with different defect rates; a conditional probability given the number of defects | ★★ |
| May 2025 · TZ3 · Paper 2 | Q11 | Which person entered a survey, given that it was entered inaccurately | ★★★ |
