In this guide
← Maths AA guides

Statistics & probability · AA HL

Bayes’ theorem

Update a probability after observing evidence and avoid confusing a test’s accuracy with the chance a positive result is genuine.

Course focus: AA HL: this guide develops additional higher-level content; it is not required for AA SL.

Before you start: Conditional probability, tree diagrams and total probability.

Start with a small example

Build it from the beginning

HL content

Reversing a conditional probability changes the denominator. Among positive tests, include both genuine positives and false positives. A small natural-frequency table often makes the update easier to understand than a memorised formula.

A first walkthrough

Among 1000 people, 100 have a condition. A test finds 80 of them positive and also gives 90 false positives. Find P(condition given positive).

  1. There are \(80+90=170\) positive tests.
  2. Eighty of those positive results come from people with the condition.
  3. The posterior probability is \(80/170=8/17\), approximately 0.471.
Try the practice ladder after learning the methods ↓

The foundations behind the method

Understand what the symbols mean

Bayes' theorem reverses a conditional question: how likely is a cause after seeing evidence? A base rate describes how common that cause was before the evidence. Sensitivity and specificity condition on actual status; the probability that a positive result is genuine conditions on the result instead.

How the ideas connect

The positive-result group combines true positives and false positives. Build those two joint probabilities, then divide the true-positive contribution by their total. This is ordinary conditional probability with a denominator expanded using mutually exclusive cases.

01

Start with the idea

Build your understanding

Bayes reasoning updates a prior probability when evidence is observed. The denominator includes every way the evidence could arise, not just the desired case. Natural frequencies often make this distinction more intuitive than a formula alone.

Likelihood is directional

Evidence given a condition is not the same as the condition given evidence. Reversing the condition requires accounting for the base rates.

Rare conditions

Even an accurate test can generate many false positives when the underlying condition is uncommon. Compare counts, not only a headline accuracy.

Compare the approaches

Choose by the information in the question, rather than the formula you recognise first.

Tree or joint probabilities

When it helpsMultiply the prior by the likelihood for each case.

Check before using itAll relevant cases must contribute to the evidence total.

Natural frequencies

When it helpsChoose a convenient hypothetical population.

Check before using itThe counts must preserve both priors and conditional rates.

Your method plan

  1. List mutually exclusive source cases and their priors.
  2. Calculate the evidence contribution from every source.
  3. Divide the desired joint contribution by the full evidence total.
02

Learn the methods

Learn step by step

1. Prior, likelihood and posterior

A prior is a probability before observing evidence. A likelihood gives the probability of that evidence under a specified case. A posterior is the probability of the case given the evidence. These have different denominators: \(P(\text{positive}|\text{condition})\) is not \(P(\text{condition}|\text{positive})\).

2. Total evidence probability

Split the population into disjoint exhaustive cases. Multiply each case’s prior by its evidence likelihood, then add. This gives the denominator of the posterior. Missing a false-positive path can dramatically overstate the answer.

Multiple cases

Why this formula works

Disjoint exhaustive cases partition every way the evidence can arise. Adding their joint path probabilities produces P(B). Dividing the target path by that sum updates its share among the evidence outcomes.

The formula

\(P(A_i|B)=P(B|A_i)P(A_i)/\sum_jP(B|A_j)P(A_j)\), for disjoint exhaustive Aⱼ.

Quick example

If three sources contribute evidence probabilities 0.02, 0.03 and 0.05, the first source’s posterior share is \(\frac{0.02}{0.10}=0.2\), not 0.02.

3. Bayes through a tree

A tree with case first and evidence second is often the clearest method. The numerator is the path probability for the target case and evidence. Divide it by the sum of all paths producing the evidence. Bayes’ theorem is the conditional probability rule combined with this total probability.

Two-case Bayes

Why this formula works

The conditional-probability definition gives \(\text{posterior}=\text{joint}\) evidence-and-case probability divided by total evidence probability. The numerator is prior times likelihood; splitting total evidence into A and its complement produces the denominator.

The formula

\(P(A|B)=\frac{P(B|A)P(A)}{P(B|A)P(A)+P(B|A^c)P(A^c)}\), for positive denominator.

Quick example

If \(P(A)=0.2\), \(P(B|A)=0.8\) and \(P(B|A^{c})=0.1\), then \(P(A|B)=\frac{0.16}{0.16+0.08}=\frac{2}{3}\).

Worked example: Factory source

Factory A supplies 60% of items and has defect rate 2%; B supplies 40% with defect rate 5%. Find B given defective.

  1. The defective paths have probabilities \(0.6\times 0.02=0.012\) and \(0.4\times 0.05=0.02\).
  2. Total defect probability is 0.032.
  3. \(P(B|\text{defective})=\frac{0.02}{0.032}=0.625\).

4. Base rates matter

Even a highly accurate test may have many false positives when the condition is rare. To explain this intuitively, use an imagined population and expected counts. Specify whether a quoted “accuracy” means sensitivity, specificity or something else; a single vague percentage is not enough.

Count every way a positive result can occur

100010 have it990 do not9 positive1 negative99 positive891 negative
Among 1000 people with 1% prevalence: 10 have the condition. With 90% sensitivity, 9 test positive; with 10% false positives among the other 990, 99 also test positive. Only 9 of 108 positive results are true positives.
Worked example: A rare condition

A condition affects 1% of people. A test is positive for 90% of affected people and 5% of unaffected people. Find affected given positive.

  1. The true-positive path is \(0.01\times 0.9=0.009\).
  2. The false-positive path is \(0.99\times 0.05=0.0495\), so total positive probability is 0.0585.
  3. The posterior is \(\frac{0.009}{0.0585}=\frac{2}{13}\approx 15.4\%\). A positive result is not 90% likely to indicate the condition.

5. Repeated evidence

For multiple tests, multiply likelihoods only if the tests are conditionally independent given each case. Shared measurement errors can violate that assumption. State the model instead of assuming that two positive results automatically square every probability.

6. Use natural frequencies to verify an update

A hypothetical population can make every probability path visible. Choose a convenient cohort size, split it by the prior case probabilities, and then split each group by its conditional likelihoods. Count all outcomes matching the observed evidence, not only the desired-case outcomes. The final conditional proportion is target-and-evidence count divided by total-evidence count. These are modelled frequencies for explanation, not a claim about an actual observed cohort.

Use natural frequencies to verify an update

Why this formula works

Every path count is the cohort total times its joint probability. In the final ratio the common cohort size cancels, leaving Bayes’ theorem. This is a useful independent check of a fraction that can otherwise look counterintuitive.

The formula

Posterior =desired-case evidence count /all evidence count, for nonzero evidence total.

Quick example

If 100 of 1000 modelled items come from A and 20 of those are defective, while 45 from the other source are defective, the posterior A-given-defective share is \(\frac{20}{20+45}=\frac{4}{13}\).

Worked example: Check a reverse probability by counts

A supplies 10% of items with 20% defect rate. B supplies 90% with 5% defect rate. Find A given defective.

  1. Use a modelled cohort of 1000 items: A supplies 100, producing 20 defects; B supplies 900, producing 45 defects.
  2. There are 65 defects altogether, and 20 came from A.
  3. The posterior is \(\frac{20}{65}=\frac{4}{13}\approx 0.3077\), which differs from both the prior 0.1 and the likelihood 0.2.
Quick formula reference

For revision once you understand the methods above. Check the conditions before using a formula.

Two-case Bayes

\(P(A|B)=\frac{P(B|A)P(A)}{P(B|A)P(A)+P(B|A^c)P(A^c)}\), for positive denominator.

Return to the explanation →

Multiple cases

\(P(A_i|B)=P(B|A_i)P(A_i)/\sum_jP(B|A_j)P(A_j)\), for disjoint exhaustive Aⱼ.

Return to the explanation →

Use natural frequencies to verify an update

Posterior =desired-case evidence count /all evidence count, for nonzero evidence total.

Return to the explanation →

Learn to diagnose an error

Spot the mistake

The statement below is incorrect. Identify the missing condition or reasoning before opening the explanation.

Incorrect reasoning

A test has 90% sensitivity, so a positive result means a 90% chance of disease.

Explain and repair the mistake

With prevalence 1% and false-positive rate 10%, true positives contribute 0.009 and false positives 0.099. The posterior is \(0.009/0.108=1/12\), about 8.33%. The low base rate changes the answer substantially.

03

Connect and apply

Put the ideas together

A more demanding application of this guide’s methods. This is a learning stage; any additional HL content is labelled separately.

Worked application

A positive test and a low base rate

A condition affects 1% of people. A test is positive for 90% of affected people and 5% of unaffected people. Find the condition probability given a positive result.

  1. In 10,000 people, expect 100 affected and 9,900 unaffected under the model.
  2. Positive results come from 90 affected people and 495 unaffected people. The positive group therefore contains 585 people.
  3. The posterior is \(90/585=2/13\), about 15.4%. It is not the 90% sensitivity.
  4. The large unaffected population explains why false positives dominate the positive group. These are model frequencies, not a diagnosis of an individual.
Pause and explain

What additional assumption is needed before multiplying likelihoods for two repeated tests?

Check your reasoning

Conditional independence of the test results within each source group, or another justified model of their dependence. Repeated evidence cannot automatically be treated as independent.

Common mistakes and how to avoid them

  • Do not reverse a conditional probability without recalculating.
  • Include all paths that can produce the evidence.
  • Conditional independence must be justified for repeated tests.
04

Practise independently

Build confidence, then apply it

Try each question before opening its hint or solution. If a method is new, return to the walkthrough, then try again. These learning stages describe the practice sequence; additional HL content is labelled separately.

  1. 1

    Build confidence

    HL extension

    Find P(positive given condition) in this example.

    Need a starting point?

    Restrict the denominator to people with the condition.

    Show the worked solution
    1. Eighty of 100 test positive.
    2. The probability is 0.8, different from 8/17.
  2. 2

    Apply and explain

    HL extension

    If false positives fell to 20 with everything else unchanged, what would the posterior be?

    Need a starting point?

    Rebuild the positive-test group.

    Show the worked solution
    1. There would be \(80+20=100\) positive tests.
    2. The probability would be \(80/100=0.8\); fewer false positives make a positive result more informative.
  3. 3

    Check your understanding

    Why must both false and true positives appear in the denominator?

    Show the worked solution

    The condition is a positive result. Every way of producing that result belongs to the conditional reference group, regardless of actual disease status.

  4. 4

    Use the method

    In the factory example, what is \(P(A|\text{defective})\)?

    Show the worked solution

    \(\frac{0.012}{0.032}=0.375\). It complements \(P(B|\text{defective})=0.625\) because A and B exhaust the sources.

  5. 5

    Combine the skills

    Use natural frequencies to verify an update

    In a modelled cohort of 1000 items, A produced 20 defects and B 45 defects. To calculate \(P(A|\text{defective})\), why is dividing 20 by all 1000 items wrong?

    Show the worked solution

    That gives the joint probability of A and defective. The question conditions on defective, so the denominator must be the 65 defective items.

Finished? Use the linked question bank below to practise selecting the method without a guide telling you which rule to use.

Using these methods in exam questions

AA Paper 1

No calculator

Practise the algebra and exact values by hand. Keep fractions, surds and multiples of π exact where required. Show the steps that justify the result.

AA Paper 2

GDC required

Use graphing, numerical solving or statistical tools when appropriate. Write the setup before giving the output, and keep extra precision until the final answer.

For this topic: Define the variable or events, write the probability statement or hypotheses, then calculate. Name the distribution and its parameters; interpret the result using the original population or context.

HL only · GDC required

Paper 3: build a connected argument

Both AA HL and AI HL Paper 3 contain two extended problem-solving questions. A question develops a theme, so keep useful earlier results, test small cases and explain any proposed general rule. A calculator pattern can suggest a result; your mathematical reasoning must support it.

  1. Identify what the first part establishes and record the conditions under which it holds.
  2. When a later part introduces a new definition or model, connect it to methods you already know rather than assuming a new formula must have been memorised.
  3. Check the conclusion against an earlier numerical case and explain its meaning or limitation.

For the first-assessment-2021 courses. IB assessment reference ↗

Find a specific method or formula

Now practise the method

If you opened this guide from a question, return to that tab and try the method without looking at the example. Your answer stays in the question tab.

Practise this subtopic →

Want a broader practice session? Explore IB Maths AA HL practice questions →Try free IB Maths exam-style questions and worked solutions →

Core-topic coverage checked against Haese Core Topics HL (2019), chapters 11K. The explanations, diagrams and exercises here are original Arc material.

Original Arc Practice teaching notes for Maths AA. Core and HL sections are distinguished above. These notes follow the first-assessment-2021 course and are not an official IB publication or a complete syllabus checklist. IB course reference. Report a correction.