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.

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.

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.

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.

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.

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 ∞ 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) = ∫ 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 ∞ 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(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.

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.

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.
Key quantities derived from a continuous distribution
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

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
Step 1 — Find k using the normalisation conditionSet ∫ 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
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
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
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
Step 5 — Calculate the varianceVar(X) = E(X²) − [E(X)]² = 4.8 − 2² = 4.8 − 4.
Var(X) = 0.8, and the standard deviation σ = √0.8 ≈ 0.894.

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.

Comparing discrete and continuous random variables
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
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.

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.

How this lesson connects to later IB topics
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)

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.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain why P(X = 3) = 0 for a continuous random variable X, even though f(3) might be a positive number.
PROBLEM 2BASIC 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.
PROBLEM 3INTERMEDIATE
Using the pdf from Problem 2, f(x) = x²/9 for 0 ≤ x ≤ 3, find E(X) and Var(X).
PROBLEM 4APPLIED
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.
PROBLEM 5CRITICAL 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.

Lesson 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