Module 32 of 46Lesson 1 of 2 · HL · AA 4.13 — Bayes’ theorem
Course map · Topic 4: Statistics and Probability

4.13 Bayes’ theorem

HL only11 worked questions

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 ↓

✏️ Practice questions

Try each question on paper first. Then open the solution and compare every step.

Question 1●○○ Warm-up✍️ By hand · Paper 1 · no calculator[4 marks]
, and . Find (a) ; (b) .
AA′BB′BB′0.30.70.60.2
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
M1
A1
Step 3✍️ By hand(b) The path through A, out of all of B
M1
A1
Final answer (a)   (b)
Question 2●○○ Warm-up✍️ By hand · Paper 1 · no calculator[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
M1
A1
Step 3✍️ By handBayes
M1A1
A1
💡 Remember C makes only 20% of the items, but over a third of the defective ones.
Final answer
Question 3●○○ Warm-up✍️ By hand · Paper 1 · no calculator[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
M1A1
M1
A1
Final answer
Question 4●●○ Standard✍️ By hand · Paper 1 · no calculator[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
= has the disease, = tests positive. Known: , , . Wanted: .
Step 2✍️ By handTotal probability of a positive test
M1
A1
Step 3✍️ By handBayes
M1A1
A1
💡 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✍️ By hand · Paper 1 · no calculator[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
M1A1
Step 2✍️ By handTop: rain and forecast rain
M1
A1
Final answer
Question 6●●○ Standard✍️ + 🖩 · Paper 2[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
M1A1
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
1.1*DocRAD19118→q19118q·0.95q·0.95+(1−q)·0.050.784783
press ctrl+enter for a decimal
Step 4✍️ By handAnswer
(exactly )A1A1
Final answer
Question 7●●○ Standard✍️ By hand · Paper 1 · no calculator[4 marks]
, and . Given that , find .
Show the full step-by-step solution
Step 1🧠 ThinkWrite Bayes with p and solve
. The equation is linear in once we multiply out the fraction.
Step 2✍️ By handEquation
M1A1
M1
A1
Final answer
Question 8●●● Exam-level✍️ + 🖩 · Paper 2[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.
  1. (a) Find the probability that a randomly chosen egg is cracked.[2]
  2. (b) Given that an egg is cracked, find the probability that it came from each farm.[3]
  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
1.1*DocRAD0.45·0.01+0.35·0.02+0.2·0.04→t0.0195
Part (b)
Step 1🖩 On the GDCEach branch divided by t
1.1*DocRAD0.45·0.01t0.2307690.35·0.02t0.3589740.2·0.04t0.410256
Step 2✍️ By handAnswers
A1A1A1
Part (c)
Step 1🧠 ThinkBinomial with p from part (b)
= number from farm C among 10 cracked eggs, .
Step 2🖩 On the GDCBinomial Cdf from 4 to 10
1.1*DocRADbinomCdf10,0.2·0.04t,4,100.643102
Final answer (a)   (b)   (c)
Question 9●●● Exam-level✍️ By hand · Paper 1 · no calculator[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.
  1. (a) Show that the probability that the double-headed coin was chosen is .[4]
  2. (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
A1
M1
Multiply top and bottom by : M1AG
Part (b)
Step 1✍️ By handInequality
M1
; A1
Final answer (a) shown   (b)
Question 10●●● Exam-level✍️ + 🖩 · Paper 2[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.
  1. (a) Find the probability that an email contains “winner”.[2]
  2. (b) An email contains “winner”. Find the probability that it is spam.[2]
  3. (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
M1A1
Part (b)
Step 1✍️ By handBayes
M1A1
Part (c)
Step 1🧠 ThinkEach deleted email is spam with probability
; we want .
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›5: Probability›5: Distributions›B: Binomial Cdf…
1.1*DocRADbinomCdf6,1417,5,60.713012
Final answer (a)   (b)   (c)
Question 11●●● Exam-level✍️ + 🖩 · Paper 3[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 .
  1. (a) Show that .[2]
  2. (b) Hence show that .[1]
  3. (c) Find and .[2]
  4. (d) Find the exact value of for which .[3]
  5. (e) Sketch for and describe what happens to as increases.[2]
  6. (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
M1
AG
Part (b)
Step 1✍️ By handBayes
AG
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 keyboard
1.1*DocRADf(p):=0.98·p0.94·p+0.04Donef(0.01)0.198381f(0.05)0.563218
Part (d)
Step 1✍️ By handSolve by hand
M1
A1
A1
Part (e)
Step 1🖩 On the GDCGraph f1(x) =
1.11.2*DocRAD00.210xy0.050.25f1(x)=0.98·x0.94·x+0.04(0.0392, 0.5)
Increasing, steep at first, then levelling off
Step 2✍️ By handDescribe
increases: the rarer the disease, the less a positive result means; it rises steeply for small and then levels off towards 1A1A1
Part (f)
Step 1✍️ By handk independent positives
M1
AG
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 keyboard
1.1*DocRADg(k):=0.01·0.98k0.01·0.98k+0.99·0.04kDoneg(1)0.198381g(2)0.85842g(3)0.993313
Step 3✍️ By handConclude
M1A1
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² = ^2 then →.
  • Fraction: type /  ·  √: type sqrt(  ·  π: type pi  ·  eˣ: type exp(  ·  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 as centralDiff( — 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
  1. Type 0.45·0.01+0.35·0.02+0.2·0.04.
  2. Press sto→ (ctrl then var).
  3. Type t.
  4. Press enter.
1.1*DocRADf(p):=0.98·p0.94·p+0.04Donef(0.01)0.198381f(0.05)0.563218
Worked example: Question 11 — Define f, then evaluate
Exact fraction ↔ decimal
ctrl+enter💻 Ctrl+Enter
  1. Press ctrl then enter to get the answer as a decimal.
1.1*DocRAD19118→q19118q·0.95q·0.95+(1−q)·0.050.784783
press ctrl+enter for 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.