4.13 · AHL · HL onlyPaper 1Paper 2

Bayes’ theorem

Builds on 4.11 Conditional probability21 min read

In a minute

turns a conditional probability round. You know how likely the evidence is for each cause, and it tells you how likely each cause is once you have seen the evidence. It works for two or three first-stage outcomes, and it shows at once when two events are independent.

You'll be able to

  • Find P(B∣A)\mathrm{P}(B \mid A) from P(B)\mathrm{P}(B), P(A∣B)\mathrm{P}(A \mid B) and P(A∣B′)\mathrm{P}(A \mid B') with .
  • Use Bayes' theorem when the first stage has three outcomes that form a .
  • Combine Bayes' theorem with binomial probabilities from your calculator on Paper 2.
  • Spot when the evidence changes nothing, and use Bayes' theorem to decide whether two events are .
Before you start3 quick questions on what this builds on
Check yourself
Events AA and BB have P(A∩B)=0.12\mathrm{P}(A \cap B) = 0.12 and P(B)=0.3\mathrm{P}(B) = 0.3. Find P(A∣B)\mathrm{P}(A \mid B).
Check yourself
Events AA and BB have P(B)=0.6\mathrm{P}(B) = 0.6 and P(A∣B)=0.25\mathrm{P}(A \mid B) = 0.25. Find P(A∩B)\mathrm{P}(A \cap B).
Check yourself
Events AA and BB are independent, with P(A)=0.3\mathrm{P}(A) = 0.3 and P(B)=0.8\mathrm{P}(B) = 0.8. Write down P(A∣B)\mathrm{P}(A \mid B).

Revise first: 4.11 Conditional probability

Bayes' theorem for two events

In 4.11 you turned a round. You knew how the second stage ended, and you found the chance of a first-stage branch. is that method written as one formula.

Questions often give the chance of the evidence for each cause. You want the reverse: the chance of the cause, given the evidence. The two can be very different.

Take a factory scanner that checks bolts for cracks. Only 0.5%0.5\% of bolts are cracked. It sounds an alarm for 98%98\% of cracked bolts, and also for 3%3\% of good ones. If the alarm sounds, how likely is a crack?

Picture 20 00020\,000 bolts. Of these, 100100 are cracked, and the alarm sounds for 9898 of them. The other 19 90019\,900 are good, and the alarm sounds for 3%3\% of those, which is 597597.

Tree of counts for 20000 bolts. 100 are cracked: the alarm sounds for 98 and not for 2. 19900 are good: the alarm sounds for 597 and not for 19303. The two alarm branches, 98 and 597, are highlighted. 20 000 100 cracked 19 900 good 98 alarm 2 no alarm 597 alarm 19 303 no alarm 0.5% 99.5% 98% 2% 3% 97%
Every alarm comes from one of the two highlighted branches. Only 9898 of the 695695 alarms are real cracks.

So 695695 bolts set off the alarm, and only 9898 of them are cracked. Given an alarm, the chance of a crack is 98695≈0.141\frac{98}{695} \approx 0.141. Most alarms are false, because good bolts far outnumber cracked ones.

Now use probabilities. Let BB be the first-stage event (cracked) and AA the evidence (alarm). The top is the path through BB to AA. The bottom adds every path that ends in AA, which gives P(A)\mathrm{P}(A).

In the formula booklet
P(B∣A)=P(B) P(A∣B)P(B) P(A∣B)+P(B′) P(A∣B′)\mathrm{P}(B \mid A) = \dfrac{\mathrm{P}(B)\,\mathrm{P}(A \mid B)}{\mathrm{P}(B)\,\mathrm{P}(A \mid B) + \mathrm{P}(B')\,\mathrm{P}(A \mid B')}

It's in the formula booklet, so you don't need to memorise it. Your job is to name the events: BB is the first-stage event you want, and AA is the one you are told happened.

Check it on the bolts: 0.005×0.980.005×0.98+0.995×0.03=0.00490.03475=98695\frac{0.005 \times 0.98}{0.005 \times 0.98 + 0.995 \times 0.03} = \frac{0.0049}{0.03475} = \frac{98}{695}. That matches the count.

Worked exampleOf the emails reaching an inbox, 20%20\% are spam. A filter flags 95%95\% of spam emails, and it also flags 4%4\% of genuine emails. An email is flagged. Find the probability that it is spam.

Try it first, then reveal one step at a time.

  1. Name the events. Let SS be "the email is spam" and FF be "the email is flagged". You want P(S∣F)\mathrm{P}(S \mid F).
Check yourself
Use the spam filter from the example. An email is not flagged. Find the probability that it is spam. Give your answer to 3 s.f.
Worked exampleMia's first serve lands in on 60%60\% of points. When it lands in, she wins the point with probability 0.70.7. When it doesn't, she wins the point with probability 0.40.4. (a) Show that the probability Mia loses a point is 0.420.42. (b) Given that Mia loses a point, find the probability that her first serve landed in.

Try it first, then reveal one step at a time.

  1. Let NN be "the first serve lands in" and WW be "Mia wins the point". So P(N)=0.6\mathrm{P}(N) = 0.6 and P(N′)=0.4\mathrm{P}(N') = 0.4.
Check yourself
On 25%25\% of days the river is high. When it is high, a footpath floods with probability 0.60.6. When it is not high, the footpath floods with probability 0.040.04. The footpath is flooded. Find the probability that the river is high.

Three first-stage outcomes

Sometimes the first stage has three outcomes, such as three couriers or three machines. The idea is the same: one path on top, every path to the evidence on the bottom.

BB and B′B' are a partition with two pieces, so the two-event version is a special case. With three pieces, the bottom of the formula gains a third path.

In the formula booklet
P(Bi∣A)=P(Bi) P(A∣Bi)P(B1) P(A∣B1)+P(B2) P(A∣B2)+P(B3) P(A∣B3)\mathrm{P}(B_{i} \mid A) = \dfrac{\mathrm{P}(B_{i})\,\mathrm{P}(A \mid B_{i})}{\mathrm{P}(B_{1})\,\mathrm{P}(A \mid B_{1}) + \mathrm{P}(B_{2})\,\mathrm{P}(A \mid B_{2}) + \mathrm{P}(B_{3})\,\mathrm{P}(A \mid B_{3})}

This is for three events, and it is in the booklet too. Here ii is 11, 22 or 33, for the event you want. The bottom adds all three paths to give P(A)\mathrm{P}(A), whichever BiB_i you want.

Tree diagram with three first-stage branches: courier C1 with probability 0.5, C2 with 0.3 and C3 with 0.2. Each courier then branches to late L or on time L prime. Late probabilities are 0.04 after C1, 0.1 after C2 and 0.05 after C3. The three late paths are highlighted, with products 0.02, 0.03 and 0.01. C1 C2 C3 L L′ L L′ L L′ 0.5 0.3 0.2 0.04 0.96 0.1 0.9 0.05 0.95 0.5 × 0.04 = 0.02 0.3 × 0.1 = 0.03 0.2 × 0.05 = 0.01
The three highlighted paths add up to P(L)\mathrm{P}(L), the bottom of Bayes' theorem.
Worked exampleAn online shop sends 50%50\% of its parcels with courier C1C_1, 30%30\% with C2C_2 and 20%20\% with C3C_3. These couriers deliver 4%4\%, 10%10\% and 5%5\% of their parcels late. (a) Find the probability that a parcel is late. (b) Given that a parcel is late, find the probability that it was sent with C2C_2.

Try it first, then reveal one step at a time.

  1. Let LL be "the parcel is late". Each parcel goes with exactly one courier, and 0.5+0.3+0.2=10.5 + 0.3 + 0.2 = 1, so C1C_1, C2C_2, C3C_3 form a partition.
Check yourself
Machines M1M_1, M2M_2 and M3M_3 make 25%25\%, 35%35\% and 40%40\% of a factory's chips. Of their chips, 2%2\%, 4%4\% and 1%1\% are faulty. A chip is faulty. Find the probability that it was made by M2M_2.

On Paper 2, the second-stage probabilities may come from a distribution. Find each one with your calculator, then put them into Bayes' theorem exactly as before.

Worked exampleA games box holds 55 spinners: 22 of type T1T_1, 22 of type T2T_2 and 11 of type T3T_3. Each spin of a T1T_1, T2T_2 or T3T_3 spinner shows red with probability 0.20.2, 0.50.5 or 0.70.7 respectively, independently of other spins. Ana picks a spinner at random and spins it 88 times. She gets exactly 55 reds. Use your calculator to find the probability that she picked a T3T_3 spinner. Give your answer to 3 s.f.

Try it first, then reveal one step at a time.

  1. Let RR be "exactly 55 reds in 88 spins". The first stage is the type: P(T1)=0.4\mathrm{P}(T_1) = 0.4, P(T2)=0.4\mathrm{P}(T_2) = 0.4 and P(T3)=0.2\mathrm{P}(T_3) = 0.2.
Check yourself
Use the three machines from the last check. A chip is not faulty. Find the probability that it was made by M3M_3. Give your answer to 3 s.f.

When the evidence changes nothing

Look at when the evidence is equally likely on both branches, so P(A∣B)=P(A∣B′)\mathrm{P}(A \mid B) = \mathrm{P}(A \mid B'). Call this common value qq.

The bottom becomes P(B) q+P(B′) q=q\mathrm{P}(B)\,q + \mathrm{P}(B')\,q = q, because P(B)+P(B′)=1\mathrm{P}(B) + \mathrm{P}(B') = 1. So P(B∣A)=P(B) qq=P(B)\mathrm{P}(B \mid A) = \frac{\mathrm{P}(B)\,q}{q} = \mathrm{P}(B).

If the evidence is just as likely whatever the cause, seeing it tells you nothing. The reversed probability equals the one you started with. That is what means, as in 4.6 and 4.11.

In the formula booklet
P(A∩B)=P(A) P(B)\mathrm{P}(A \cap B) = \mathrm{P}(A)\,\mathrm{P}(B)

This product rule from the formula booklet is the same idea. The same holds with three branches: if P(A∣Bi)\mathrm{P}(A \mid B_i) is equal for all three, then every P(Bi∣A)=P(Bi)\mathrm{P}(B_i \mid A) = \mathrm{P}(B_i).

Worked exampleA running app finds that 65%65\% of runs are done with music. Runners set a personal best on 8%8\% of runs with music and on 8%8\% of runs without. Let MM be "the run is done with music" and BB be "the runner sets a personal best". Given that a runner sets a personal best, find the probability that the run was done with music.

Try it first, then reveal one step at a time.

  1. Bayes' theorem: P(M∣B)=0.65×0.080.65×0.08+0.35×0.08=0.0520.08=0.65\mathrm{P}(M \mid B) = \frac{0.65 \times 0.08}{0.65 \times 0.08 + 0.35 \times 0.08} = \frac{0.052}{0.08} = 0.65.
Worked exampleEvents AA and BB have P(B)=0.4\mathrm{P}(B) = 0.4, P(A∣B)=0.3\mathrm{P}(A \mid B) = 0.3 and P(A∣B′)=0.5\mathrm{P}(A \mid B') = 0.5. (a) Find P(B∣A)\mathrm{P}(B \mid A). (b) Determine whether AA and BB are independent.

Try it first, then reveal one step at a time.

  1. (a) P(B′)=1−0.4=0.6\mathrm{P}(B') = 1 - 0.4 = 0.6. Bayes' theorem: P(B∣A)=0.4×0.30.4×0.3+0.6×0.5\mathrm{P}(B \mid A) = \frac{0.4 \times 0.3}{0.4 \times 0.3 + 0.6 \times 0.5}.
Check yourself
Events AA and BB are independent, with P(A)=0.2\mathrm{P}(A) = 0.2 and P(B)=0.35\mathrm{P}(B) = 0.35. Find P(B′∣A)\mathrm{P}(B' \mid A).
Check yourself
Events AA and BB have P(B)=0.5\mathrm{P}(B) = 0.5, P(A∣B)=0.2\mathrm{P}(A \mid B) = 0.2 and P(A∣B′)=0.6\mathrm{P}(A \mid B') = 0.6. Use Bayes' theorem to decide whether AA and BB are independent.

Common mistakes

  • Giving the conditional the question gave you. If you know P(alarm∣cracked)=0.98\mathrm{P}(\text{alarm} \mid \text{cracked}) = 0.98 and want P(cracked∣alarm)\mathrm{P}(\text{cracked} \mid \text{alarm}), the 0.980.98 is not the answer: turn it round with Bayes' theorem.
  • Stopping at the top line. A path product is the chance of both events. Divide it by the total of every path that ends in the given event.
  • Leaving a path out of the bottom. Three first-stage outcomes give three products; check their probabilities add up to 11.
  • Writing P(A∣B′)=1−P(A∣B)\mathrm{P}(A \mid B') = 1 - \mathrm{P}(A \mid B). The complement rule changes the event before the bar, never the condition.
  • Rounding calculator values before dividing. Store them and round only the final answer.
  • Calling events independent with no comparison. Give both values, write == or ≠\ne, and conclude in words.

Exam tips

  • "Find" a reversed probability: name your events, then write Bayes' theorem with your letters before any numbers. That line earns the method mark.
  • On Paper 1, keep answers exact. Clear decimals by multiplying top and bottom by a power of 1010: 0.190.222=190222\frac{0.19}{0.222} = \frac{190}{222}.
  • When part (b) divides by the probability from part (a), a wrong (a) used correctly can still earn follow-through marks.

Key takeaways

In bookletP(B∣A)=P(B) P(A∣B)P(B) P(A∣B)+P(B′) P(A∣B′)\mathrm{P}(B \mid A) = \dfrac{\mathrm{P}(B)\,\mathrm{P}(A \mid B)}{\mathrm{P}(B)\,\mathrm{P}(A \mid B) + \mathrm{P}(B')\,\mathrm{P}(A \mid B')}
In bookletP(Bi∣A)=P(Bi) P(A∣Bi)P(B1) P(A∣B1)+P(B2) P(A∣B2)+P(B3) P(A∣B3)\mathrm{P}(B_{i} \mid A) = \dfrac{\mathrm{P}(B_{i})\,\mathrm{P}(A \mid B_{i})}{\mathrm{P}(B_{1})\,\mathrm{P}(A \mid B_{1}) + \mathrm{P}(B_{2})\,\mathrm{P}(A \mid B_{2}) + \mathrm{P}(B_{3})\,\mathrm{P}(A \mid B_{3})}
Learn thisTop: the one path through the event you want. Bottom: every path that ends in the given event, which adds up to P(A)\mathrm{P}(A).
Learn thisP(B∣A)\mathrm{P}(B \mid A) and P(A∣B)\mathrm{P}(A \mid B) are usually different. A rare cause can stay unlikely even after strong evidence.
Learn thisIf P(A∣B)=P(A∣B′)\mathrm{P}(A \mid B) = \mathrm{P}(A \mid B'), then P(B∣A)=P(B)\mathrm{P}(B \mid A) = \mathrm{P}(B), and AA and BB are independent.

Practise this

6 past-paper questions on 4.13 in the AA HL bank, each with a mark scheme and a worked explanation.

Practise 4.13 →