WhatsApp us
IB DP Maths10 Nov 2026

IB Maths AA HL Bayes' Theorem and Continuous Random Variables: Worked Examples, Mistakes and Exam Technique

Bayes' theorem and continuous random variables are the HL-only probability content in IB Maths Analysis and Approaches. How to reverse a conditional probability, work with a probability density function, find the mode, median, mean and variance, and use E(aX + b) and Var(aX + b), with fully worked examples.

IB Maths AA HL Bayes' Theorem and Continuous Random Variables: Worked Examples, Mistakes and Exam Technique

In IB Mathematics: Analysis and Approaches, statistics and probability gets 27 suggested teaching hours at SL and 33 at HL. Much of that extra HL time goes on two ideas: Bayes' theorem, which turns a conditional probability around, and continuous random variables, where probability comes from a function rather than a list. Both mix probability with algebra and calculus, so they suit long Paper 2 and Paper 3 questions as well as short no-calculator ones.

This guide covers what you need, three fully worked examples, the mistakes that cost marks most often, and how to approach these questions in each paper. If you want regular help with HL topics like these, see our IB Maths AA HL tutoring.

What you need to know

Bayes' theorem (HL)

  • Conditional probability from SL: P(A | B) = P(A ∩ B) / P(B).
  • Bayes' theorem reverses the condition. With two outcomes B and B′:

P(B | A) = P(B) P(A | B) / [P(B) P(A | B) + P(B′) P(A | B′)]

  • With three mutually exclusive, exhaustive outcomes B₁, B₂, B₃, the denominator becomes the sum of three products: P(A) = P(B₁)P(A | B₁) + P(B₂)P(A | B₂) + P(B₃)P(A | B₃).
  • A tree diagram is the same calculation in picture form. The denominator is "all the branches that end in A"; the numerator is "the one branch you are asked about".

Continuous random variables (HL)

  • A continuous random variable X has a probability density function (pdf) f(x). It must satisfy f(x) ≥ 0 and ∫ f(x) dx = 1 over the whole domain.
  • Probabilities are areas: P(a < X < b) = ∫ from a to b of f(x) dx. For a continuous variable, P(X = a) = 0, so < and ≤ give the same answer.
  • Mode: the x-value where f(x) is greatest (often found with f′(x) = 0, but check the endpoints too).
  • Median m: solve ∫ from the lower limit to m of f(x) dx = 0.5.
  • Mean: E(X) = ∫ x f(x) dx.
  • Variance: Var(X) = E(X²) − [E(X)]², where E(X²) = ∫ x² f(x) dx.
  • Linear transformations (discrete or continuous): E(aX + b) = aE(X) + b and Var(aX + b) = a²Var(X).

The calculus here is ordinary SL integration, so fluency from our AA calculus guide pays off directly. Binomial and normal distributions, which every course shares, are covered in our probability distributions guide.

Worked example 1: Bayes' theorem with three routes

Riya travels to school by metro on 50% of days, by bus on 30% and by car on 20%. The probability that she is late is 0.04 by metro, 0.10 by bus and 0.12 by car. One morning she is late. Find the probability that she came by bus.

Step 1: define events. Let L be "Riya is late", and M, B, C the three ways of travelling.

Step 2: find P(L) using all three branches.

P(L) = (0.5)(0.04) + (0.3)(0.10) + (0.2)(0.12)

= 0.020 + 0.030 + 0.024

= 0.074

Step 3: apply Bayes' theorem.

P(B | L) = P(B) P(L | B) / P(L) = 0.030 / 0.074 = 0.405 (3 s.f.)

Step 4: sense-check. The other two are P(M | L) = 0.020 / 0.074 = 0.270 and P(C | L) = 0.024 / 0.074 = 0.324. The three add to 1. Notice that the bus is the most likely explanation even though the metro is used most often. That is the whole point of Bayes: the new information (she was late) changes the probabilities.

In Paper 1 you would leave the answer as the exact fraction 30/74 = 15/37 if the numbers allow; in Paper 2, 3 significant figures is fine.

Worked example 2: a probability density function

A continuous random variable X has pdf

f(x) = k x²(4 − x) for 0 ≤ x ≤ 4, and f(x) = 0 otherwise.

(a) Find k. (b) Find the mode. (c) Find E(X) and Var(X). (d) Find the median. (e) Find P(X > 3 | X > 2).

(a) Total area is 1.

∫ from 0 to 4 of (4x² − x³) dx = [4x³/3 − x⁴/4] from 0 to 4 = 256/3 − 64 = 64/3

So k(64/3) = 1, giving k = 3/64.

(b) Mode. f(x) = (3/64)(4x² − x³), so f′(x) = (3/64)(8x − 3x²) = (3/64)x(8 − 3x).

f′(x) = 0 at x = 0 or x = 8/3. Since f(0) = f(4) = 0 and f(8/3) > 0, the maximum is at x = 8/3. Mode = 8/3 ≈ 2.67.

(c) Mean and variance.

E(X) = (3/64) ∫ from 0 to 4 of (4x³ − x⁴) dx = (3/64)[x⁴ − x⁵/5] from 0 to 4 = (3/64)(256 − 1024/5) = (3/64)(256/5) = 12/5 = 2.4

E(X²) = (3/64) ∫ from 0 to 4 of (4x⁴ − x⁵) dx = (3/64)[4x⁵/5 − x⁶/6] from 0 to 4 = (3/64)(2048/15) = 32/5 = 6.4

Var(X) = 6.4 − 2.4² = 6.4 − 5.76 = 0.64, so the standard deviation is 0.8.

(d) Median. The cumulative distribution is

F(m) = (3/64)[4x³/3 − x⁴/4] from 0 to m = (16m³ − 3m⁴)/256

Set F(m) = 0.5: 16m³ − 3m⁴ = 128, that is 3m⁴ − 16m³ + 128 = 0.

This quartic is a GDC job. Graph y = (16x³ − 3x⁴)/256 and y = 0.5 and take the intersection between 0 and 4: m = 2.46 (3 s.f.).

Notice the order: mean 2.4 < median 2.46 < mode 2.67. The distribution has a longer tail to the left (negative skew), which you can see from a sketch.

(e) Conditional probability. Use F(x) from part (d).

P(X > 2) = 1 − F(2) = 1 − 80/256 = 176/256

P(X > 3) = 1 − F(3) = 1 − 189/256 = 67/256

Because "X > 3" lies inside "X > 2", the intersection is just X > 3:

P(X > 3 | X > 2) = (67/256) ÷ (176/256) = 67/176 = 0.381 (3 s.f.)

Worked example 3: E(aX + b) and Var(aX + b)

Let X (from example 2) be the time in hours a technician spends on a repair job. The charge for a job is C = 500X + 300 rupees. Find the mean and standard deviation of C.

Mean: E(C) = 500E(X) + 300 = 500(2.4) + 300 = 1500 rupees.

Variance: Var(C) = 500² Var(X) = 250 000 × 0.64 = 160 000.

Standard deviation: √160 000 = 400 rupees.

The fixed 300 moves the mean but does nothing to the spread. And the multiplier is squared for variance but not for standard deviation (sd(C) = 500 × 0.8 = 400). Both facts are tested again and again.

Common mistakes

  1. Using the wrong denominator in Bayes. P(A) must include every branch that leads to A, not just the one you want.
  2. Mixing up P(A | B) and P(B | A). Read the question twice: which event has already happened? That one goes after the bar.
  3. Forgetting to check the pdf conditions. If a question asks you to show f is a valid pdf, you need both f(x) ≥ 0 on the domain and total area 1.
  4. Finding the mode with f′(x) = 0 and stopping. The maximum of a pdf can be at an endpoint of the domain. Check.
  5. Writing Var(X) = E(X²) and forgetting to subtract [E(X)]².
  6. Var(aX + b) = aVar(X) + b. The constant disappears and a is squared.
  7. Median from a quartic, solved by hand. If the equation has no neat root, the question is almost certainly on a calculator paper. Use the GDC and choose the root inside the domain.

Exam technique: Paper 1, Paper 2 and Paper 3

  • Paper 1 (no calculator). Expect pdfs with simple polynomials or easy exponentials, where k, E(X) and probabilities come out as exact fractions. Keep fractions until the end. Our Paper 1 no-calculator guide has drills for this kind of arithmetic.
  • Paper 2 (GDC required). Use the calculator for definite integrals, medians from awkward equations and any pdf with trig or exponential parts. Still write the integral you are evaluating, for example "∫ from 0 to m of f(x) dx = 0.5", before the answer. Our GDC skills guide shows the fastest menu routes.
  • Paper 3 (HL, 60 minutes, two long questions). Continuous random variables can be the setting for an extended problem, for example a family of pdfs with a parameter. Read the earlier parts as hints for the later ones. Our HL Paper 3 guide explains the style.
  • Bayes in any paper. Draw the tree, even when the question does not ask for one. It costs 30 seconds and earns method marks if the arithmetic slips.
  • Piecewise pdfs. Split every integral at the join and add. Many lost marks come from integrating one rule across the whole domain.

These topics also link to counting and integration. For tree problems with arrangements, see our sibling post on counting and the binomial theorem. For pdfs that need substitution or integration by parts, see AA HL integration techniques.

A short practice routine

  • Week 1: five Bayes questions with two outcomes, then five with three. Draw every tree.
  • Week 2: polynomial pdfs by hand: k, P(a < X < b), mean and variance.
  • Week 3: mode and median, including GDC medians and endpoint maxima.
  • Week 4: mixed questions with E(aX + b) and Var(aX + b), timed.

How Maths Bodhi helps

Our tutors teach AA HL probability as calculus plus careful reading: tree diagrams first, then the formula, then exam-style practice with written method. We check where marks are lost, whether in the setup, the integration or the GDC step, and plan practice around that.

Home tuition is available in Gurgaon (Gurugram). Students elsewhere in India and abroad learn with us online. You can book a free demo class.

Frequently asked questions

Is Bayes' theorem in IB maths AA SL?
No. Conditional probability is in AA SL, but Bayes' theorem itself is additional higher level content in AA HL.
Are continuous random variables in AA SL?
No. Probability density functions, and the mode, median, mean and variance of continuous random variables, are AA HL content. AA SL works with discrete random variables, the binomial and the normal distribution.
How do I find the median of a continuous random variable?
Solve the equation that the integral of f(x) from the lower end of the domain up to m equals 0.5. If the equation is hard to solve by hand, use the GDC and choose the root inside the domain.
What is the difference between mean, median and mode for a pdf?
The mode is where f(x) is highest, the median splits the area into two halves, and the mean is the integral of x f(x). For a skewed distribution the three are different.
What are E(aX + b) and Var(aX + b)?
E(aX + b) = aE(X) + b and Var(aX + b) = a²Var(X). Adding a constant shifts the mean but leaves the spread unchanged.
Do I need a calculator for continuous random variable questions?
Not always. Paper 1 questions are set so that the integrals can be done by hand. Paper 2 and Paper 3 questions may need the GDC for definite integrals and for medians.
IB maths AA HL probabilityBayes' theorem IBcontinuous random variables IBprobability density functionIB maths tutor Gurgaon

Related guides

Keep exploring this maths topic

IB DP Maths17 Nov 2026

IB Maths AA HL Topics and Syllabus: What HL Adds to Each of the Five Topics, the Three Papers and a Checklist

The IB Maths Analysis and Approaches HL syllabus organised by what HL adds beyond SL: the 240 teaching hours by topic, every HL extension with a tick-off checklist, Paper 3 and the exploration, and the changes for students who start DP in August 2027.

IB maths AA HL topicsIB maths AA HL syllabusAA HL vs SL contentIB maths Paper 3

By Maths Bodhi Team

Read guide

IB DP Maths10 Nov 2026

IB Maths AA HL Integration Techniques: Substitution, By Parts, Partial Fractions and Volumes of Revolution

AA HL integration goes well beyond the SL reverse chain rule. How to choose between substitution, integration by parts and partial fractions, how to handle the e^x sin x loop, how to find volumes of revolution about both axes, and when to integrate by hand or on the GDC, with four fully worked examples.

IB maths AA HL integrationintegration by parts IBintegration by substitution IBvolumes of revolution IB

By Maths Bodhi Team

Read guide

IB DP Maths10 Nov 2026

IB Maths AA HL Algebra: Partial Fractions, Systems of Linear Equations and Polynomials, with Worked Examples

Three AA HL algebra skills that turn up inside bigger questions: partial fractions, systems of up to three linear equations (including no solution and infinitely many solutions), and polynomials with the factor and remainder theorems and the sum and product of roots. Methods, four worked examples and exam tips.

IB maths AA HL algebrapartial fractions IBsystems of linear equations IBfactor and remainder theorem

By Maths Bodhi Team

Read guide

IB DP Maths10 Nov 2026

IB Maths AA HL Permutations, Combinations and the Binomial Theorem: Methods, Worked Examples and Exam Tips

Counting principles and the extended binomial theorem are AA HL algebra topics that reward a clear method. How to count arrangements with restrictions, when to use permutations or combinations, and how to expand (1 + x)^n for negative and fractional n, with four fully worked examples.

IB maths AA HL countingpermutations and combinations IBIB binomial theoremextended binomial theorem

By Maths Bodhi Team

Read guide

IB DP Maths10 Jul 2026

IB Mathematics AA HL vs AA SL: Which Course Should You Choose?

Choosing between IB Mathematics AA HL and AA SL is an important decision that can affect university admissions and academic success. Learn the key differences, workload expectations, and factors students should consider before making a choice.

IB Mathematics AAAA HLAA SLIB DP Mathematics

By Maths Bodhi Team

Read guide

IB DP Maths17 Nov 2026

IB Maths AA HL Inequalities and Modulus Functions: Rational Inequalities, |f(x)| Equations and Graphical Solutions

How to solve AA HL inequalities and modulus equations without losing solutions: sign tables for rational inequalities, cases and squaring for modulus, and graphs for anything else, by hand or on the GDC. Four worked examples, a Paper 2 illustration and a self-check.

IB maths AA HL functionsmodulus equations IBrational inequalities IBsolving inequalities graphically

By Maths Bodhi Team

Read guide