IB Analysis and Approaches HL · Probability · Section 5 of 5

Total probability, Bayes' theorem and tree diagrams

3 worked examples · By Álvaro López

Key idea

A compound experiment is carried out in stages, and the tree diagram organises it: you multiply along each branch and add the branches that satisfy an event (total probability). If you are also told how it ended and ask how it started, you divide one branch by the sum of all the possible branches: this is Bayes' theorem. In the IB exam it is the most common final question in Section B.

Multi-stage experiments

A lot of probability happens in steps: you draw a token and then another, you choose a machine and then check whether the part comes out defective, a patient takes a test and the result is known. Each step is a stage, and an outcome of the whole experiment is a sequence of outcomes, one per stage.

To organise them, draw a tree that is read from left to right:

  • From the starting point come as many branches as there are outcomes of the first stage.
  • At the end of each branch comes a new group of branches with the outcomes of the second stage in that particular case.
  • Each complete path, read from left to right, is one outcome of the experiment.

Two-stage tree diagram: from A and A′ come the branches P(A) and 1 − P(A); from each come the branches towards B and B′ with P(B | A), P(B′ | A), P(B | A′) and P(B′ | A′); on the right, the product for each complete path (A ∩ B, A ∩ B′, A′ ∩ B and A′ ∩ B′); the branches from one node add up to 1

The last rule is your best check: if the sum at a node is not 1, a branch is missing or a number is wrong. It is also useful for filling gaps: if one branch from a node is worth , the other is worth .

Multiplying along a path

The intuition: the fraction of the total goes through branch , and of that fraction only a part continues along branch . A part of a part is a product. The probabilities of all the complete paths add up to 1; this is a second check.

With and without replacement

When objects are drawn from a set (tokens, cards, students), everything depends on whether what was drawn is put back.

If there are 5 objects of a certain type out of 12, the first one is of that type with probability . With replacement, so is the second one. Without replacement, it is if the first was of that type (4 of the remaining 11 are of that type) and if it was not (5 of the remaining 11 are of that type). At each node the branches still add up to 1.

Total probability

An event is often reached by several paths. Since these paths cannot occur at the same time, their probabilities are added.

On the tree: mark all the paths that end in , multiply along each one and add. You do not need to memorise the formula if you draw the tree.

Bayes' theorem

A tree says "first this, then that". But sometimes the question is asked the other way round: you already know how it ended () and want to know which branch it came from (). The probability is not on the tree: it must be calculated.

This formula appears in the IB formula booklet. Even so, the safest approach is to read it from the tree:

The idea is a split: of all the cases that end in , what proportion goes through branch ? Note that the answer depends not only on how reliable each branch is, but on how many cases come in through each one: a very rare event stays rare even if it is detected well.

Worked examples

Example 1 Basic

Two sweets from a bag

A bag contains 8 sweets: 3 strawberry and 5 lemon. Two are taken at random, one after the other, without replacement.

a) Find the probability that both are strawberry.

b) Find the probability that both are the same flavour.

c) If the first sweet were returned to the bag before taking the second, what would be the probability that both were strawberry?

d) Find, without replacement, the probability that the second sweet is strawberry.

Solution

Let be "strawberry" and be "lemon". Without returning, 7 sweets are left at the second stage.

a) Multiply along the path :

b) "Same flavour" means the paths and , which are added:

c) With replacement the probabilities repeat:

d) Two paths end in "second is strawberry": and . This is the same as the probability for the first sweet: with no information about the first draw, there is no reason for the second to be different.

Answer: a) ; b) ; c) ; d) .

Example 2 Medium

How they get to school

At a school, 40% of the pupils travel by bus, 35% walk and the rest cycle. Of those who travel by bus, 10% arrive late; of those who walk, 4% arrive late; and of those who cycle, 2% arrive late. One pupil is chosen at random.

a) Find the probability that they arrive late.

b) Given that they arrived late, find the probability that they travelled by bus.

c) Given that they did not arrive late, find the probability that they cycled.

Solution

Let be "bus", be "walk", be "bicycle" and be "arrives late". The data are , and . At the second stage: , and .

a) Three paths end in ; they are added (total probability):

b) Among the cases that end in (denominator ), the bus path is worth :

c) Now the possible cases are those that end in , with . The path "cycle and not late" is worth and then

Answer: a) ; b) ; c) .

Example 3 Hard

A repeated medical test

A disease affects 2% of the population. A test gives a positive result in 95% of ill people and, by mistake, in 10% of healthy people. One person is chosen at random and given the test.

a) Find the probability that the test is positive.

b) Given that the test is positive, find the probability that the person is ill.

c) The same person is tested again and the result is positive again. Assuming that, once the person's state (ill or healthy) is known, the two results are independent, find the probability that the person is ill.

d) Given that the first test was negative, find the probability that the person is healthy.

Solution

Let be "ill" and "positive test". Data: , and . The missing branches: , and .

Two-stage tree diagram of a diagnostic test: E (ill) with 1/50 and E′ (healthy) with 49/50; from E, + with 19/20 and − with 1/20; from E′, + with 1/10 and − with 9/10; on the right, E and + = 19/1000, E and − = 1/1000, E′ and + = 49/500 and E′ and − = 441/500

a) Two paths end in a positive result:

b) Bayes' theorem (or ratio of paths): Although the test detects 95% of ill people, only 16.2% of positives are ill: the disease is so rare that the false positives from the large healthy majority weigh more.

c) With independence within each state, the probability of two positives in a row for an ill person is , and for a healthy one . The paths that end in "two positives" are worth and then A second positive result raises the probability from 16.2% to 64.8%.

d) The possible cases are those that end in a negative result: . The path "healthy and negative" is worth . Therefore

In the exam: marks are given for leaving the tree (or the products of the branches) and for showing the quotient with numerator and denominator separately. The classic mistake is to answer b) with , which is , the probability the wrong way round. In c) you must justify why the probabilities of the two tests are multiplied within each branch; without that step you cannot continue.

Common mistakes

Summary

  • A tree is read from left to right: in the first stage come ordinary probabilities, and in later stages conditional probabilities. The branches from the same node add up to 1.
  • Multiplying along a path gives the probability of the complete path: .
  • Adding the paths that satisfy an event gives its probability (total probability): .
  • With replacement the probabilities repeat at each stage; without replacement they are recalculated according to what has already been drawn.
  • Bayes' theorem (HL only): , which appears in the IB formula booklet.
  • Read from the tree: .
  • Always check that the branches at each node add up to 1 and that the complete paths add up to 1. In the exam, write the products of the branches and the quotient with numerator and denominator.
Maths classes in Aldaia and online

Want to work on it together?

Free first consultation: we look at your level and your exam, and build a plan. Álvaro replies on WhatsApp.

Message us on WhatsApp