Study Guide

Conditional probability and Bayes' theorem

IB Mathematics: Analysis and Approaches HLΒ· Topic 4.4 ProbabilityΒ· 20 min read

1. Conditional Probability: Definition & Basic Rulesβ˜…β˜…β˜†β˜†β˜†β± 5 min

πŸ“˜ Definition

Conditional Probability

P(A∣B)P(A|B)

The probability of event occurring, given that event is already known to have occurred. It restricts the sample space to only outcomes where occurs.

Example:

Probability the second card drawn from a deck is an ace, given the first card drawn was an ace.

From the definition, the core formula for conditional probability is derived directly from the joint probability of and :

P(A∣B)=P(A∩B)P(B),P(B)>0P(A|B) = \frac{P(A \cap B)}{P(B)}, \quad P(B) > 0
πŸ“ Worked Example

A bag contains 5 red marbles and 3 blue marbles. Two marbles are drawn without replacement. What is the probability the second marble is red, given the first was blue?

  1. 1

    Define events: ,

  2. 2

    Calculate joint and marginal probabilities:

  3. 3
    P(A∩B)=38Γ—57=1556,P(B)=38=2156P(A \cap B) = \frac{3}{8} \times \frac{5}{7} = \frac{15}{56}, \quad P(B) = \frac{3}{8} = \frac{21}{56}
  4. 4

    Apply the conditional probability formula:

  5. 5
    P(A∣B)=15/5621/56=1521=57P(A|B) = \frac{15/56}{21/56} = \frac{15}{21} = \frac{5}{7}

2. Tree Diagrams & Law of Total Probabilityβ˜…β˜…β˜†β˜†β˜†β± 6 min

βœ“ Calculator OK

Tree diagrams are ideal for sequential probability problems. Each branch is labeled with the conditional probability of that step given all prior steps. The law of total probability lets us calculate the total probability of an outcome from all possible paths.

  1. Multiply probabilities along each path to get joint probabilities

  2. Add joint probabilities for all paths that lead to the outcome you want

  3. Confirm the sum of all joint probabilities equals 1

πŸ“ Worked Example

Two machines produce widgets: Machine A makes 60% of widgets, 2% defective. Machine B makes 40% of widgets, 5% defective. What is the probability a randomly selected widget is defective?

  1. 1

    Define events: , ,

  2. 2

    Label tree branches with given conditional probabilities: ,

  3. 3

    Apply the law of total probability:

  4. 4
    P(D)=P(D∣A)P(A)+P(D∣B)P(B)=(0.02Γ—0.6)+(0.05Γ—0.4)=0.012+0.02=0.032P(D) = P(D|A)P(A) + P(D|B)P(B) = (0.02 \times 0.6) + (0.05 \times 0.4) = 0.012 + 0.02 = 0.032

3. Bayes' Theorem for Two Eventsβ˜…β˜…β˜…β˜†β˜†β± 7 min

πŸ“˜ Definition

Bayes' Theorem

A formula to reverse conditional probability, calculating the posterior probability of a prior event given an observed outcome, from known prior and conditional probabilities.

P(B∣A)=P(A∣B)P(B)P(A),P(A)=P(A∣B)P(B)+P(A∣Bβ€²)P(Bβ€²)P(B|A) = \frac{P(A|B) P(B)}{P(A)}, \quad P(A) = P(A|B)P(B) + P(A|B')P(B')
πŸ“ Worked Example

A disease affects 1% of a population. A test for the disease returns positive for 95% of people with the disease, and positive for 10% of people without the disease. What is the probability a person who tests positive actually has the disease?

  1. 1

    Define events: , . Given: , ,

  2. 2

    Calculate total probability of testing positive:

  3. 3
    P(+)=P(+∣D)P(D)+P(+∣Dβ€²)P(Dβ€²)=(0.95Γ—0.01)+(0.10Γ—0.99)=0.1085P(+) = P(+|D)P(D) + P(+|D')P(D') = (0.95 \times 0.01) + (0.10 \times 0.99) = 0.1085
  4. 4

    Apply Bayes' theorem:

  5. 5
    P(D∣+)=P(+∣D)P(D)P(+)=0.00950.1085β‰ˆ0.088P(D|+) = \frac{P(+|D)P(D)}{P(+)} = \frac{0.0095}{0.1085} \approx 0.088

4. Extended Bayes' Theorem for Multiple Eventsβ˜…β˜…β˜…β˜†β˜†β± 6 min

βœ“ Calculator OK

For mutually exclusive, exhaustive events , Bayes' theorem extends directly to calculate the posterior probability of any individual event:

P(Bi∣A)=P(A∣Bi)P(Bi)βˆ‘k=1nP(A∣Bk)P(Bk)P(B_i|A) = \frac{P(A|B_i) P(B_i)}{\sum_{k=1}^n P(A|B_k) P(B_k)}
πŸ“ Worked Example

Three boxes have counters: Box 1: 1 red, 2 blue; Box 2: 2 red, 1 blue; Box 3: 3 red, 6 blue. A box is chosen uniformly at random, then a counter drawn is red. What is the probability the counter came from Box 2?

  1. 1

    Define events: , . Given:

  2. 2

    Conditional probabilities: , ,

  3. 3

    Calculate denominator (total probability of red):

  4. 4
    βˆ‘P(R∣Bk)P(Bk)=13(13+23+13)=49\sum P(R|B_k)P(B_k) = \frac{1}{3} \left( \frac{1}{3} + \frac{2}{3} + \frac{1}{3} \right) = \frac{4}{9}
  5. 5

    Apply extended Bayes' theorem:

  6. 6
    P(B2∣R)=P(R∣B2)P(B2)4/9=(2/3)(1/3)4/9=12P(B_2|R) = \frac{P(R|B_2)P(B_2)}{4/9} = \frac{(2/3)(1/3)}{4/9} = \frac{1}{2}

5. Common Pitfalls

Wrong move:

Dividing by instead of in

Why:

Mixing up which event is the given event that restricts the sample space

Correct move:

Always remember: the denominator is the probability of the event you already know has occurred,

Wrong move:

Leaving probabilities unchanged for sampling without replacement on tree diagrams

Why:

Treating dependent draws as independent, leading to incorrect joint probabilities

Correct move:

Adjust counts and probabilities for each subsequent branch after drawing without replacement

Wrong move:

Assuming without applying Bayes' theorem

Why:

Base rate neglect and confusion about the direction of conditional probability

Correct move:

Always explicitly apply Bayes' theorem when reversing the direction of conditional probability

Wrong move:

Using extended Bayes' theorem with non-exhaustive or overlapping events

Why:

The denominator of Bayes' theorem relies on all possible outcomes being included and non-overlapping

Correct move:

Confirm all events are mutually exclusive and cover the entire sample space before calculation

6. Quick Reference Cheatsheet

Concept

Formula

Common Use Case

Conditional Probability

Find probability of A given B occurred

Law of Total Probability

Calculate total P(A) from two cases

Bayes' Theorem (2 events)

Reverse conditional probability

Extended Bayes (n events)

Multiple competing prior events

7. Frequently Asked

When should I use Bayes' theorem instead of basic conditional probability?

Use basic conditional probability when you know the event you are conditioning on, and need the probability of the outcome. Use Bayes' theorem when you have the reverse: you know the outcome, and need the probability of a prior event that led to it.

When this came up on past exams

AI-estimated based on syllabus patterns β€” cross-check with official past papers for accuracy. Use only as revision-focus signals.

  • 2021 Β· 1

    Bayes' theorem with tree diagram

  • 2022 Β· 2

    False positive probability calculation

  • 2023 Β· 1

    Conditional probability multiple events

What's Next

Conditional probability and Bayes' theorem are foundational for nearly all advanced topics in statistics and probability, including discrete probability distributions, expected values, and statistical inference. This topic appears regularly in both Paper 1 and Paper 2 of IB AA HL exams, often combined with tree diagrams or binomial probability concepts. Mastery of these ideas also prepares you for university-level study of statistics, data science, and quantitative fields.