IB Mathematics: Analysis and Approaches • Statistics and Probability

Continuous Random Variables — AHL 4.8 Continuous random variables; probability density functions (HL)

Discover how probability density functions model real-world data that can take any value in an interval.

IB Mathematics Analysis and Approaches emblem with a function, curved graph, and sigma notation
Inside this lesson 10 sections 5 questions 9 figures

SECTION 1

Historical Context & Motivation

Before the 18th century, probability was almost exclusively about counting outcomes — rolling dice, drawing cards, or tallying votes. These scenarios involve discrete random variables, where outcomes can be listed one by one. But as scientists began measuring things like heights, temperatures, and errors in astronomical readings, they realised that data often takes any value within an interval rather than jumping between separate values. This shift demanded an entirely new mathematical tool — the probability density function (pdf).

1733 • De Moivre's Bell Curve

Abraham de Moivre discovered the normal curve as an approximation to the binomial distribution, providing the first continuous probability curve.

1809 • Gauss and the Error Curve

Carl Friedrich Gauss applied the bell curve to measurement errors in astronomy, cementing the Gaussian (normal) distribution as a foundational model in science.

1812 • Laplace's Analytical Framework

Pierre-Simon Laplace published Théorie analytique des probabilités, formalising the use of integrals to compute probabilities for continuous variables.

1933 • Kolmogorov's Axioms

Andrey Kolmogorov laid the rigorous axiomatic foundations for probability theory, unifying discrete and continuous probability under a single framework using measure theory.

The central question these mathematicians faced was deceptively simple: if a variable can take infinitely many values, how do you assign a probability to each one without everything adding up to infinity? The answer lies in measuring probability as area under a curve rather than as individual point values. This idea is the heart of AHL 4.8.

SECTION 2

Core Principles & Definitions

A continuous random variable X is a variable that can take any real value within a given interval (or across all real numbers). Unlike a discrete random variable, where you can list individual outcomes and their probabilities, continuous variables are described by a smooth function called a probability density function (pdf), denoted f(x). The following principles form the foundation you need.

1

Non-Negativity

A pdf is never negative: f(x) ≥ 0 for all x. The curve sits on or above the horizontal axis — negative probabilities do not exist.
2

Total Area Equals 1

The total area under the pdf across its entire domain equals exactly 1. This ensures that the probability of something happening is 100%.
3

Probability = Area

The probability that X falls between a and b is the area under f(x) from a to b, computed as the definite integral ∫ from a to b of f(x) dx.
4

Point Probability Is Zero

For any single value c, P(X = c) = 0. A single point has no width, so the area under the curve at one point is zero. Probabilities are only meaningful over intervals.
5

The CDF Connection

The cumulative distribution function (CDF) F(x) = P(X ≤ x) is the running total of area from −∞ to x. Its derivative gives back the pdf: F′(x) = f(x).
✦

KEY TAKEAWAY

Think of a pdf like a map of a hilly landscape. The height of the hill at any point tells you how "dense" the probability is there, but the actual probability of landing in a region is the area of that region — just like measuring the area of a patch of land, not just how tall the hill is at one spot.

SECTION 3

Visualising the Probability Density Function

The diagram below shows a generic probability density function f(x) plotted on a standard set of axes. The shaded region between x = a and x = b represents P(a ≤ X ≤ b) — the probability that the random variable X takes a value in that interval. Notice that the entire curve sits above the x-axis (non-negativity), and the total area under the curve is 1.

abP(a ≤ X ≤ b)Probability Density Function f(x)xf(x)f(x)Shaded area = ∫ from a to b of f(x) dx
The purple-to-cyan curve is the pdf f(x). The shaded region between a and b represents the probability P(a ≤ X ≤ b), computed as the definite integral of f(x) from a to b.

A key observation from this diagram: the value f(x) at any particular point is not a probability. It is a density — it tells you how concentrated the probability is near that value. To obtain an actual probability, you must integrate (find area). This is why f(x) can even exceed 1 at certain points, as long as the total area under the whole curve remains exactly 1.

SECTION 4

Mathematical Framework

The mathematics of continuous random variables centres on three key operations: finding probabilities via integration, computing the expected value (mean), and computing the variance. All three rely on definite integrals of the pdf.

NORMALISATION CONDITION

∫from−∞to∞off(x)dx=1∫ from −∞ to ∞ of f(x) dx = 1

This guarantees that the total probability across all possible values is 100%. When the pdf is defined on a finite interval [a, b], replace the limits accordingly: ∫ from a to b of f(x) dx = 1.

PROBABILITY OVER AN INTERVAL

P(a≤X≤b)=∫fromatoboff(x)dxP(a ≤ X ≤ b) = ∫ from a to b of f(x) dx

Since P(X = c) = 0 for any single point, it follows that P(a ≤ X ≤ b) = P(a < X < b). Including or excluding endpoints makes no difference for continuous variables.

EXPECTED VALUE (MEAN)

E(X)=μ=∫from−∞to∞ofx⋅f(x)dxE(X) = μ = ∫ from −∞ to ∞ of x · f(x) dx

The expected value is the "balance point" of the pdf — the value around which the distribution is centred, weighted by probability density.

VARIANCE

Var(X)=E(X2)−[E(X)]2=∫from−∞to∞ofx2⋅f(x)dx−μ2Var(X) = E(X²) − [E(X)]² = ∫ from −∞ to ∞ of x² · f(x) dx − μ²

Variance measures how spread out the distribution is. It is often easier to compute E(X²) first, then subtract μ². The standard deviation is σ = √Var(X).

💡

IB Exam Tip

In IB HL papers, you are frequently asked to find the value of a constant k in a pdf such as f(x) = kx² on [0, 3]. Use the normalisation condition: set ∫ from 0 to 3 of kx² dx = 1 and solve for k. Always check that f(x) ≥ 0 on the given interval.

SECTION 5

CDF, Mode, and Median

Beyond the pdf itself, several related quantities appear regularly in IB HL questions. The cumulative distribution function (CDF), the mode, and the median each provide a different perspective on the same distribution.

PDF f(x) and CDF F(x) Side by SidePDF: f(x)abModef(x)xCDF: F(x)10.5Median0F(x)x
Left panel: the pdf f(x) with its peak at the mode and a shaded probability region. Right panel: the CDF F(x) rises from 0 to 1. The median is where F(x) = 0.5.
QuantityDefinitionHow to Find It
CDF F(x)P(X ≤ x), the running total of probability up to xIntegrate: F(x) = ∫ from −∞ to x of f(t) dt
ModeThe value of x where f(x) is greatestSet f′(x) = 0 and verify it is a maximum
MedianThe value m such that half the distribution lies on each sideSolve F(m) = 0.5, i.e., ∫ from lower limit to m of f(x) dx = 0.5

Key quantities derived from a continuous distribution

SECTION 6

Worked Example

Consider a continuous random variable X with probability density function f(x) = kx(4 − x) for 0 ≤ x ≤ 4, and f(x) = 0 otherwise. We will find k, then compute P(1 ≤ X ≤ 3), the mean E(X), and the variance Var(X).

Finding k, Probabilities, Mean, and Variance

  1. 1

    Step 1 — Find k using the normalisation condition

    Set ∫ from 0 to 4 of kx(4 − x) dx = 1. Expand the integrand: kx(4 − x) = k(4x − x²). Integrate term by term: ∫ from 0 to 4 of k(4x − x²) dx = k[2x² − x³/3] from 0 to 4 = k[2(16) − 64/3] = k[32 − 64/3] = k · 32/3. Set this equal to 1.
    k · 32/3 = 1, so k = 3/32
  2. 2

    Step 2 — Calculate P(1 ≤ X ≤ 3)

    P(1 ≤ X ≤ 3) = ∫ from 1 to 3 of (3/32)x(4 − x) dx = (3/32) ∫ from 1 to 3 of (4x − x²) dx. Evaluate: (3/32)[2x² − x³/3] from 1 to 3 = (3/32){[2(9) − 27/3] − [2(1) − 1/3]} = (3/32){[18 − 9] − [2 − 1/3]} = (3/32){9 − 5/3} = (3/32)(22/3) = 66/96.
    P(1 ≤ X ≤ 3) = 11/16 = 0.6875
  3. 3

    Step 3 — Find the expected value E(X)

    E(X) = ∫ from 0 to 4 of x · (3/32)x(4 − x) dx = (3/32) ∫ from 0 to 4 of (4x² − x³) dx = (3/32)[4x³/3 − x⁴/4] from 0 to 4 = (3/32)[4(64)/3 − 256/4] = (3/32)[256/3 − 64] = (3/32)(64/3).
    E(X) = 2. This makes sense by symmetry since f(x) = kx(4 − x) is symmetric about x = 2.
  4. 4

    Step 4 — Find E(X²)

    E(X²) = ∫ from 0 to 4 of x² · (3/32)x(4 − x) dx = (3/32) ∫ from 0 to 4 of (4x³ − x⁴) dx = (3/32)[x⁴ − x⁵/5] from 0 to 4 = (3/32)[256 − 1024/5] = (3/32)(256/5) = 768/160.
    E(X²) = 4.8
  5. 5

    Step 5 — Calculate the variance

    Var(X) = E(X²) − [E(X)]² = 4.8 − 2² = 4.8 − 4.
    Var(X) = 0.8, and the standard deviation σ = √0.8 ≈ 0.894.

SECTION 7

Discrete vs. Continuous — Key Differences

Many students find it helpful to compare continuous random variables with the discrete ones they already know. The table below highlights the most important parallels and contrasts. Understanding these differences helps prevent common errors on IB exams.

FeatureDiscreteContinuous
ValuesCountable set (e.g., 0, 1, 2, …)Any real number in an interval
Probability functionP(X = x), a probability mass function (pmf)f(x), a probability density function (pdf)
P(X = c)Can be non-zeroAlways 0
Summing probabilitiesΣ P(X = xᵢ) = 1∫ f(x) dx = 1
Expected valueE(X) = Σ xᵢ · P(X = xᵢ)E(X) = ∫ x · f(x) dx
Graphical representationSpike / bar chartSmooth curve

Comparing discrete and continuous random variables

✦

KEY TAKEAWAY

Moving from discrete to continuous is like switching from counting individual coins in a jar to measuring the volume of water in a bucket. With coins, you can ask "how many are worth exactly 50 cents?" but with water, it makes no sense to ask "how much weighs exactly 500.0000… g?" — instead, you ask about a range of values.

SECTION 8

Connections to Advanced Theory

The concepts you have learned here serve as stepping stones to more advanced probability and statistics. In the IB course and beyond, continuous distributions extend into powerful named distributions such as the normal distribution, the exponential distribution, and the uniform distribution. The skills of setting up and evaluating integrals to find k, compute means, and determine variances apply directly to every named continuous distribution you will encounter.

This Lesson (General pdf)Advanced Topics
Generic f(x) with polynomial expressionsNamed pdfs: normal (bell curve), exponential (decay), uniform (flat)
∫ f(x) dx = 1 to find constantsParameters μ, σ, λ characterise the distribution automatically
Manual computation of E(X) and Var(X)Formulas built into GDC and formula booklet (e.g., E(X) = 1/λ for exponential)
CDF found by integrationCDF tables and technology-based look-ups (e.g., normal CDF)

How this lesson connects to later IB topics

At university level, you would encounter moment-generating functions and multivariate density functions that extend these ideas to multiple random variables simultaneously. The essential intuition — probability as area under a curve — remains unchanged even at the most advanced levels.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

Explain why P(X = 3) = 0 for a continuous random variable X, even though f(3) might be a positive number.
Show answer
For a continuous random variable, probability is defined as area under the pdf curve. A single point has zero width, so the "area" of a rectangle with zero width is zero, regardless of the height f(3). This is fundamentally different from discrete variables, where each individual outcome can have a positive probability. In practical terms, while values near 3 have positive probability over a small interval, the probability of getting exactly 3.000… is zero.

Question 2: BASIC CALCULATION

A continuous random variable X has pdf f(x) = cx² for 0 ≤ x ≤ 3, and f(x) = 0 otherwise. Find the value of c.
Show answer
Apply the normalisation condition: ∫ from 0 to 3 of cx² dx = 1. Integrating gives c[x³/3] from 0 to 3 = c(27/3) = 9c. Setting 9c = 1 yields c = 1/9. You can verify: (1/9) × 9 = 1 ✓, and f(x) = x²/9 ≥ 0 for all x in [0, 3], so both pdf conditions are satisfied.

Question 3: INTERMEDIATE

Using the pdf from Problem 2, f(x) = x²/9 for 0 ≤ x ≤ 3, find E(X) and Var(X).
Show answer
E(X) = ∫ from 0 to 3 of x · (x²/9) dx = (1/9) ∫ from 0 to 3 of x³ dx = (1/9)[x⁴/4] from 0 to 3 = (1/9)(81/4) = 81/36 = 9/4 = 2.25. For variance, first find E(X²) = ∫ from 0 to 3 of x² · (x²/9) dx = (1/9) ∫ from 0 to 3 of x⁴ dx = (1/9)[x⁵/5] from 0 to 3 = (1/9)(243/5) = 243/45 = 27/5 = 5.4. Then Var(X) = E(X²) − [E(X)]² = 5.4 − (2.25)² = 5.4 − 5.0625 = 0.3375.

Question 4: APPLIED

The waiting time T (in minutes) for a bus is modelled by the pdf f(t) = (1/8)(4 − t) for 0 ≤ t ≤ 4, and f(t) = 0 otherwise. (a) Verify this is a valid pdf. (b) Find the probability of waiting between 1 and 3 minutes. (c) Find the median waiting time.
Show answer
(a) f(t) = (1/8)(4 − t) ≥ 0 on [0, 4] ✓. Check total area: ∫ from 0 to 4 of (1/8)(4 − t) dt = (1/8)[4t − t²/2] from 0 to 4 = (1/8)[16 − 8] = (1/8)(8) = 1 ✓. (b) P(1 ≤ T ≤ 3) = (1/8)[4t − t²/2] from 1 to 3 = (1/8){[12 − 4.5] − [4 − 0.5]} = (1/8)(4) = 0.5. (c) Solve ∫ from 0 to m of (1/8)(4 − t) dt = 0.5: (1/8)[4m − m²/2] = 0.5 → 4m − m²/2 = 4 → m² − 8m + 8 = 0. Using the quadratic formula: m = (8 ± √(64 − 32))/2 = (8 ± √32)/2. Since m must be in [0, 4], m = (8 − 4√2)/2 = 4 − 2√2 ≈ 1.17 minutes.

Question 5: CRITICAL THINKING

Let f(x) = a + bx for 0 ≤ x ≤ 1, and f(x) = 0 otherwise, where a and b are constants. Given that E(X) = 7/12, find the values of a and b. Then determine whether the mode is at x = 0, x = 1, or somewhere in between.
Show answer
We have two conditions. Normalisation: ∫ from 0 to 1 of (a + bx) dx = [ax + bx²/2] from 0 to 1 = a + b/2 = 1 (equation 1). Expected value: ∫ from 0 to 1 of x(a + bx) dx = [ax²/2 + bx³/3] from 0 to 1 = a/2 + b/3 = 7/12 (equation 2). From equation 1: a = 1 − b/2. Substituting into equation 2: (1 − b/2)/2 + b/3 = 7/12 → 1/2 − b/4 + b/3 = 7/12 → b(1/3 − 1/4) = 7/12 − 1/2 → b(1/12) = 1/12 → b = 1. Then a = 1 − 1/2 = 1/2. So f(x) = 1/2 + x. We must check f(x) ≥ 0: f(0) = 1/2 > 0 and f(1) = 3/2 > 0 ✓. Since f(x) = 1/2 + x is an increasing linear function on [0, 1], its maximum occurs at x = 1. The mode is therefore x = 1, the right endpoint of the domain.

SUMMARY

Lesson Summary

Summary

A continuous random variable can take any real value within an interval, and its behaviour is described by a probability density function (pdf) f(x). Two conditions must hold: f(x) ≥ 0 everywhere, and the total area under the curve equals 1. Probability is found by integrating f(x) over an interval: P(a ≤ X ≤ b) = ∫ from a to b of f(x) dx. At any single point, P(X = c) = 0.

The expected value E(X) = ∫ x · f(x) dx gives the mean, while Var(X) = E(X²) − [E(X)]² measures spread. The CDF F(x) accumulates probability from left to right, the mode is the x-value where f(x) is maximised, and the median satisfies F(m) = 0.5. These tools let you model and analyse real-world data that varies smoothly, from waiting times to measurement errors.

Varsity Tutors • IB Mathematics: Analysis and Approaches • Continuous Random Variables — AHL 4.8