Module 32 of 46Lesson 1 of 2 · HL · AA 4.13 — Bayes’ theorem
Course map · Topic 4: Statistics and Probability
4.13 Bayes’ theorem
Bayes’ theorem turns a conditional probability around: from P(positive test | disease), which a laboratory measures, to P(disease | positive test), which a patient cares about. In AA HL it appears with two or three possible causes, and the working is almost always by hand from a tree diagram.
✏️ Start with the questions. Try each one on paper, then open the solution and compare.
Stuck? Open the notes ↓Try each question on paper first. Then open the solution and compare every step.
Question 1●○○ Warm-up[4 marks]
Show the full step-by-step solution
Step 1🧠 ThinkRead the tree
First branch: or ( and ). Second branch: or not. The probabilities and are on the branches.
Step 2✍️ By hand(a) Add both paths that end in B
Step 3✍️ By hand(b) The path through A, out of all of B
Final answer (a) (b)
Question 2●○○ Warm-up[5 marks]
A factory has three machines. Machine A makes 50% of the items, B makes 30% and C makes 20%. The percentages of defective items are 2% for A, 3% for B and 5% for C. An item is chosen at random and is found to be defective. Find the probability that it was made by machine C.
Show the full step-by-step solution
Step 1🧠 ThinkThree causes
The defective item could come from A, B or C. Bottom: the total probability of “defective”. Top: the path through C.
Step 2✍️ By handTotal probability of a defective
Step 3✍️ By handBayes
💡 Remember C makes only 20% of the items, but over a third of the defective ones.
Final answer
Question 3●○○ Warm-up[4 marks]
Box A contains 3 red and 2 blue counters. Box B contains 1 red and 4 blue counters. A fair coin is tossed: heads → a counter is taken from box A, tails → from box B. The counter is red. Find the probability that it came from box A.
Show the full step-by-step solution
Step 1🧠 ThinkCauses: box A or box B, each
P(red | A) = , P(red | B) = .
Step 2✍️ By handBayes
Final answer
Question 4●●○ Standard[5 marks]
1% of a population has a certain disease. A test gives a positive result for 95% of people with the disease and for 5% of people without it. A person tests positive. Find the probability that they have the disease, as a fraction in its simplest form.
Show the full step-by-step solution
Step 1🧠 ThinkName the events
Step 2✍️ By handTotal probability of a positive test
Step 3✍️ By handBayes
💡 Why so small? In 10 000 people: 95 true positives but 495 false positives. Most positives come from the huge healthy group.
Final answer
Question 5●●○ Standard[4 marks]
In Maun the probability of rain on a day in March is . When it will rain, the forecast says “rain” with probability ; when it will not rain, the forecast says “rain” with probability . The forecast says “rain”. Find the probability that it does rain.
Show the full step-by-step solution
Step 1✍️ By handBottom: all ways the forecast says rain
Step 2✍️ By handTop: rain and forecast rain
Final answer
Question 6●●○ Standard[5 marks]
For the test in Question 4 (prevalence 1%, , ), a person who tests positive takes the test a second time, independently, and again tests positive. Find the probability that the person has the disease.
Show the full step-by-step solution
Step 1🧠 ThinkThe old answer becomes the new prior
After the first positive, . Use this as the starting probability and apply Bayes again.
Step 2✍️ By handSet up
Step 3🖩 On the GDCStore the prior, then compute
19/118›sto→💻 type :=›q›enter💻 Enter›q·0.95/(q·0.95+(1-q)·0.05)›ctrl+enter💻 Ctrl+Enter
Step 4✍️ By handAnswer
Final answer
Question 7●●○ Standard[4 marks]
Show the full step-by-step solution
Step 1🧠 ThinkWrite Bayes with p and solve
Step 2✍️ By handEquation
Final answer
Question 8●●● Exam-level[8 marks]
A supermarket in Gaborone buys eggs from three farms: 45% from farm A, 35% from farm B and 20% from farm C. The proportions of cracked eggs are 1%, 2% and 4% respectively.
- (a) Find the probability that a randomly chosen egg is cracked.[2]
- (b) Given that an egg is cracked, find the probability that it came from each farm.[3]
- (c) Ten cracked eggs are chosen at random from a very large batch of cracked eggs. Find the probability that at least 4 of them came from farm C.[3]
Show the full step-by-step solution
Part (a)
Step 1🖩 On the GDCTotal probability, stored as t
0.45·0.01+0.35·0.02+0.2·0.04›sto→💻 type :=›t›enter💻 Enter
Part (b)
Step 1🖩 On the GDCEach branch divided by t
Step 2✍️ By handAnswers
Part (c)
Step 1🧠 ThinkBinomial with p from part (b)
Step 2🖩 On the GDCBinomial Cdf from 4 to 10
Final answer (a) (b) (c)
Question 9●●● Exam-level[6 marks]
A bag contains two coins: one fair coin and one coin with heads on both sides. A coin is chosen at random and tossed times. It shows heads every time.
- (a) Show that the probability that the double-headed coin was chosen is
.[4] - (b) Find the least value of
for which this probability is greater than .[2]
Show the full step-by-step solution
Part (a)
Step 1✍️ By handBayes with H = n heads in a row
Multiply top and bottom by : M1AG
Part (b)
Step 1✍️ By handInequality
Final answer (a) shown (b)
Question 10●●● Exam-level[7 marks]
40% of the emails Boitumelo receives are spam. The word “winner” appears in 35% of spam emails and in 5% of other emails.
- (a) Find the probability that an email contains “winner”.[2]
- (b) An email contains “winner”. Find the probability that it is spam.[2]
- (c) On one day 6 emails contain “winner”. A filter deletes them all. Find the probability that at least 5 of the deleted emails really were spam.[3]
Show the full step-by-step solution
Part (a)
Step 1✍️ By handTotal probability
Part (b)
Step 1✍️ By handBayes
Part (c)
Step 1🧠 ThinkEach deleted email is spam with probability
Step 2🖩 On the GDCBinomial Cdf
binomCdf(6,14/17,5,6)›enter💻 Enter
📍 Where to find it on the TI-Nspire
binomCdf(is inmenu💻 click menu on keypad›››
Final answer (a) (b) (c)
Question 11●●● Exam-level[15 marks]
Investigating a screening test. A disease affects a proportion of a population. A screening test is positive for 98% of people with the disease and for 4% of people without it. Let .
- (a) Show that
.[2] - (b) Hence show that
.[1] - (c) Find
and .[2] - (d) Find the exact value of
for which .[3] - (e) Sketch
for and describe what happens to as increases.[2] - (f) For
, a person tests positive times in independent tests. Show that , and find the least for which this exceeds .[5]
Show the full step-by-step solution
Part (a)
Step 1✍️ By handTotal probability
Part (b)
Step 1✍️ By handBayes
Part (c)
Step 1🖩 On the GDCDefine f, then evaluate
f(p):=0.98·p/(0.94·p+0.04)›enter💻 Enter›f(0.01)›enter💻 Enter›f(0.05)›enter💻 Enter
📍 Where to find it on the TI-Nspire
⌨️ store a value: type
:= (colon, then equals) on the keyboardPart (d)
Step 1✍️ By handSolve by hand
Part (e)
Step 1🖩 On the GDCGraph f1(x) =
Step 2✍️ By handDescribe
Part (f)
Step 1✍️ By handk independent positives
Step 2🖩 On the GDCTry k = 1, 2, 3
g(k):=0.01·0.98^k/(0.01·0.98^k+0.99·0.04^k)›enter💻 Enter
📍 Where to find it on the TI-Nspire
⌨️ store a value: type
:= (colon, then equals) on the keyboardStep 3✍️ By handConclude
least A1
Final answer (c) (d) (e) increasing, levelling off (f)
🆘 Stuck on a question? Open the notes, GDC toolkit and common mistakes
💻 Using the TI-Nspire CX Student Software on a laptop
- The screens in these notes are drawn exactly as the Student Software shows them. The keypad on the left of the software works like the handheld — click its keys with the mouse.
- menu: click menu on the on-screen keypad (or Documents Toolbox ▸ 🔧). The menu numbers and letters are the same as in these notes.
- enter = Enter · tab = Tab (next box) · esc = Esc · del = Backspace.
- Powers: type
^(Shift+6), the power, then press → to come back down before typing more. x² =^2then →. - Fraction: type
/· √: typesqrt(· π: typepi· eˣ: typeexp(· store: type:=. For EE (×10ⁿ) and i, click them on the keypad. - New page: Ctrl+I (or the Insert menu) · change page: Ctrl+← / Ctrl+→ · graph entry line: Ctrl+G · var: Ctrl+L.
- Radian / Degree: click Settings in the status bar at the bottom of the window. The mode (RAD or DEG) shows in the top bar.
- IB exam mode (Press-to-Test): everything in these notes works on the non-CAS TI-Nspire with the IB exam settings. In exam mode there are no dot-product, cross-product, unit-vector or eigenvalue keys and no Diff Eq graphs — the notes show the allowed way (type the components, use polyRoots on the characteristic equation, do Euler steps on a Calculator page).
- If you type
nDeriv(, the software shows it ascentralDiff(— it is the same command.
🎯 What you must know
- Idea:
. Bayes just works out the top and the bottom from a tree drawn in the “other” order. - Two causes:
. - Three or more causes
(they must cover everything and not overlap): . - Tree method: (1) draw the tree with the causes first; (2) the bottom = add all branches that end in
; (3) the top = the one branch through the cause you want. - The bottom line is the law of total probability:
. - Rare conditions: even a good test gives many false positives, so
can be surprisingly small. A second positive test updates the probability again (the old answer becomes the new prior).
Bayes’ theorem (two events)
📘 In the formula booklet
Bayes’ theorem (three events)
📘 In the formula booklet
🖩 Your GDC toolkit for this subtopic
Follow the steps on your own TI-Nspire CX II. The screens show what you should see.
Store the bottom line (total probability), then divide
0.45·0.01+0.35·0.02+0.2·0.04›sto→💻 type :=›t›enter💻 Enter
- Type 0.45·0.01+0.35·0.02+0.2·0.04.
- Press sto→ (ctrl then var).
- Type t.
- Press enter.
Worked example: Question 11 — Define f, then evaluate
Exact fraction ↔ decimal
ctrl+enter💻 Ctrl+Enter
- Press ctrl then enter to get the answer as a decimal.
Worked example: Question 6 — Store the prior, then compute
⚠️ Where students lose marks
- Mixing up
and . Read the sentence: the part after “given” is what you already know. - Putting only one branch in the denominator. The bottom must include every path to the observed event.
- Using percentages and decimals together carelessly: 2% → 0.02, not 0.2.
- Rounding the denominator early on Paper 1 — keep exact fractions.