Continuous random variables AA HL

A continuous random variable is described by a probability density function, and every probability, mean and median comes from integrating it. This page shows how to use the total area of one to find an unknown constant, how to find a probability, the mode and the median, and how to find the mean and variance from two integrals. Most questions are exact integrals of simple powers, so practise them without a calculator, and keep the working in fractions.

Formulas at a glance

The mean and the variance of a continuous random variable are in the formula booklet. The total area of one, the probability integral, the integral for E(X2)E(X^2) and the median condition are not, so learn them.

Total probability: the area under a probability density function is one, taken where f(x)f(x) is not zero

∫f(x)dx=1\displaystyle\int f(x)\,dx = 1

Not in the booklet

Probability that XX lies between aa and bb

P(a≤X≤b)=∫abf(x)dxP(a\le X\le b)=\displaystyle\int_a^b f(x)\,dx

Not in the booklet

Median mm: half of the area lies to its left

∫−∞mf(x)dx=12\displaystyle\int_{-\infty}^{m} f(x)\,dx=\tfrac12

Not in the booklet

Mean of a continuous random variable

E(X)=∫xf(x)dxE(X)=\displaystyle\int x f(x)\,dx

In the booklet

The second integral, found separately before the subtraction

E(X2)=∫x2f(x)dxE(X^2)=\displaystyle\int x^2 f(x)\,dx

Not in the booklet

Variance

Var(X)=E(X2)−[E(X)]2\text{Var}(X)=E(X^2)-[E(X)]^2

In the booklet

Standard deviation

σ=Var(X)\sigma=\sqrt{\text{Var}(X)}

Not in the booklet

Which method to use

Read what the question asks for, then decide whether it needs one integral of f(x)f(x), a stationary point, or an integral with an extra factor of xx or x2x^2. Always integrate over the interval where f(x)f(x) is not zero.

The question hasUseNotes
An unknown constant kk in f(x)f(x)Set ∫f(x)dx=1\displaystyle\int f(x)\,dx=1 over the given interval and solve for kkOnce kk is found, check that f(x)≥0f(x)\ge0 on the whole interval
The probability that XX lies in a rangeIntegrate f(x)f(x) between the two boundsStrict and non-strict inequalities give the same answer
A function given in two or more piecesIntegrate each piece over its own intervalWhen a range crosses a boundary, add the integrals of the two pieces
The modeThe value of xx where f(x)f(x) is greatestLook for a stationary point, then compare with the ends of the interval
The median mmSolve ∫amf(x)dx=12\displaystyle\int_{a}^{m}f(x)\,dx=\tfrac12, where aa is the lower end of the intervalChoose the solution that lies inside the interval
The meanIntegrate xf(x)x\,f(x) over the intervalThe mean is not always the middle of the interval
The variance or the standard deviationFind E(X)E(X) and E(X2)E(X^2), then E(X2)−[E(X)]2E(X^2)-[E(X)]^2A variance is never negative; take the square root last for the standard deviation

AHL4.14

Continuous random variables

A continuous random variable XX has a probability density function f(x)f(x), and probabilities are areas under its graph, found by integration. The total area is 11, which lets you find unknown constants, and further integrals give the mean, median, mode and variance.

Key terms

What is a probability density function?

It is a function f(x)f(x) with f(x)≥0f(x)\ge0 whose total area is 11. Probability is given by area under the graph, so f(x)f(x) itself is not a probability.

e.g. f(x)=2xf(x)=2x for 0≤x≤10\le x\le1 is valid because ∫012xdx=[x2]01=1\int_0^1 2x\,dx=\left[x^2\right]_0^1=1.

How do you find a probability from f(x)f(x)?

Integrate between the limits: P(a≤X≤b)=∫abf(x)dxP(a\le X\le b)=\int_a^b f(x)\,dx. A single value has probability zero, so strict and non-strict inequalities give the same answer.

e.g. For f(x)=2xf(x)=2x on 0≤x≤10\le x\le1, P(X≤0.5)=∫00.52xdx=0.25P(X\le0.5)=\int_0^{0.5}2x\,dx=0.25.

What are the mode and the median?

The mode is the value of xx at which f(x)f(x) is greatest, which may be a stationary point or an endpoint of the domain. The median mm splits the area in half, so the area up to mm is 0.50.5.

e.g. For f(x)=2xf(x)=2x on 0≤x≤10\le x\le1, the mode is 11, and the median satisfies m2=0.5m^2=0.5, so m=12≈0.707m=\dfrac{1}{\sqrt2}\approx0.707.

Worked example, step by step

The question No calculator needed [6 marks]

The continuous random variable XX has probability density function f(x)={kx(3−x),0≤x≤3,0,otherwise,f(x)=\begin{cases}kx(3-x), & 0\le x\le3,\\ 0, & \text{otherwise,}\end{cases} where kk is a constant.

(a) Show that k=29k=\dfrac29.

(b) Find the mode of XX.

(c) Find E(X)E(X).

Worked solution: worked example

Answer: (a) k=29k=\dfrac29 (b) mode =32=\dfrac32 (c) E(X)=32E(X)=\dfrac32

Step 1 - Use the total area.

The total area under a probability density function is 11, and f(x)f(x) is zero outside 0≤x≤30\le x\le3, so ∫03kx(3−x)dx=1.\int_0^3 kx(3-x)\,dx=1. M1 - Use ∫03f(x)dx=1\displaystyle\int_0^3 f(x)\,dx=1

Why? Only the interval where f(x)f(x) is not zero contributes, so those are the limits. The constant kk comes outside the integral.

Step 2 - Evaluate and solve for kk.

k∫03(3x−x2)dx=k[3x22−x33]03=k(272−9)=9k2.k\int_0^3(3x-x^2)\,dx=k\left[\dfrac{3x^2}{2}-\dfrac{x^3}{3}\right]_0^3=k\left(\dfrac{27}{2}-9\right)=\dfrac{9k}{2}. Then 9k2=1\dfrac{9k}{2}=1, so k=29k=\dfrac29. A1 - 9k2=1\dfrac{9k}{2}=1, so k=29k=\dfrac29 (complete working)

Why? Expand the bracket first so that each term is a simple power. Finishing at k=29k=\dfrac29 completes the "show that".

Step 3 - Find the mode.

The mode is the value of xx at which f(x)f(x) is greatest. With f(x)=29(3x−x2)f(x)=\dfrac29(3x-x^2), f′(x)=29(3−2x)=0⇒x=32.f'(x)=\dfrac29(3-2x)=0\quad\Rightarrow\quad x=\dfrac32. The graph of ff is a downward parabola, so this stationary point is the maximum and the mode is 32\dfrac32. M1 - Set f′(x)=0f'(x)=0 to find the maximum of ff A1 - mode =32=\dfrac32

Why? The mode comes from where the density is largest, not from an integral. A downward parabola has its greatest value at its stationary point, so no further check is needed.

Step 4 - Set up the mean.

E(X)=∫03xf(x)dx=∫03x⋅29x(3−x)dx=29∫03(3x2−x3)dx.E(X)=\int_0^3 x\,f(x)\,dx=\int_0^3 x\cdot\dfrac29x(3-x)\,dx=\dfrac29\int_0^3(3x^2-x^3)\,dx. M1 - Substitute into E(X)=∫03xf(x)dxE(X)=\displaystyle\int_0^3 x\,f(x)\,dx

Why? The mean integrates xx times the density over the interval where the density is not zero. Multiplying by xx raises each power by one.

Step 5 - Evaluate.

E(X)=29[x3−x44]03=29(27−814)=29×274=32.E(X)=\dfrac29\left[x^3-\dfrac{x^4}{4}\right]_0^3=\dfrac29\left(27-\dfrac{81}{4}\right)=\dfrac29\times\dfrac{27}{4}=\dfrac32. A1 - E(X)=32E(X)=\dfrac32

Why? Here the mean equals the mode, which is expected because the graph of ff is symmetrical about x=32x=\dfrac32. That is a quick check, not a method.

Marks (6):
M1 Use ∫03f(x)dx=1\displaystyle\int_0^3 f(x)\,dx=1
A1 9k2=1\dfrac{9k}{2}=1, so k=29k=\dfrac29 (complete working)
M1 Set f′(x)=0f'(x)=0 to find the maximum of ff
A1 mode =32=\dfrac32
M1 Substitute into E(X)=∫03xf(x)dxE(X)=\displaystyle\int_0^3 x\,f(x)\,dx
A1 E(X)=32E(X)=\dfrac32

Now you try: enter your answers to be marked

These are real practice questions. Type your answer in each box and press Mark it. The worked solution and mark scheme appear straight away, and your first attempt is the one that counts. Use the keyboard for powers, roots and trig, and the working box for your notes.

1
Easy
No calc
[3 marks]
A continuous random variable XX has pdf f(x)=k(1−x)f(x) = k(1-x) for 0≤x≤10 \leq x \leq 1, zero otherwise.
(a)  Find kk.
[2]
(b)  Find P(X<12)P\!\left(X < \tfrac{1}{2}\right).
[1]
Fractions & powers
Other

Worked solution: practice question 1

2
Medium
No calc
[2 marks]
A continuous random variable XX has pdf f(x)=3x2f(x) = 3x^2 for 0≤x≤10 \leq x \leq 1.

Find the median of XX.
[2]
Fractions & powers
Other

Worked solution: practice question 2

3
Hard
No calc
[6 marks]
A continuous random variable XX has pdf f(x)=38x2f(x) = \dfrac{3}{8}x^2 for 0≤x≤20 \leq x \leq 2, zero otherwise.
(a)  Find E(X)E(X).
[2]
(b)  Find Var(X)\text{Var}(X).
[4]
Fractions & powers
Other

Worked solution: practice question 3

Your score so far: 0 out of 11 marks

Common mistakes

  • Integrating over the wrong domain. f(x)f(x) is only nonzero on the interval given in the question - integrating from −∞-\infty to ∞\infty, or over the wrong bounds entirely, throws off every answer that follows.
  • Treating f(x)f(x) as a probability. f(x)f(x) is a density, not P(X=x)P(X=x) - for a continuous variable, P(X=x)P(X=x) is always 00 for any single value; only an integral over a range gives an actual probability.
  • Skipping the subtraction step in the variance formula. It is easy to compute E(X2)E(X^2) correctly and then forget to subtract [E(X)]2[E(X)]^2 - the variance is never just E(X2)E(X^2) on its own.

Try some questions on continuous random variables

Syllabus content covered

CodeSyllabus content
AHL4.14Continuous random variables and their probability density functions, including piecewise functions. Mode and median of continuous random variables: a value at which the probability density function has a maximum value is called a mode, and the median mm satisfies ∫−∞mf(x)dx=12\displaystyle\int_{-\infty}^{m}f(x)\,dx=\tfrac12. Mean, variance and standard deviation of continuous random variables. Use of the notation E(X)E(X), E(X2)E(X^2), Var(X)\text{Var}(X), where Var(X)=E(X2)−[E(X)]2\text{Var}(X)=E(X^2)-[E(X)]^2 and related formulae.

Official IB source: Mathematics: analysis and approaches subject brief (PDF, ibo.org).

Quick questions

How do you find an unknown constant in a probability density function?

Set ∫f(x)dx=1\int f(x)\,dx = 1 over the domain where f(x)f(x) is nonzero, since total probability must equal 1, then solve for the constant.

How do I check that a piecewise function is a valid probability density function?

Check that each piece is non-negative on its own interval. Then integrate each piece over its own interval and confirm that the areas add up to 11.

How do I find the variance of a continuous random variable?

Find E(X)=∫xf(x)dxE(X)=\int xf(x)\,dx and E(X2)=∫x2f(x)dxE(X^2)=\int x^2f(x)\,dx over the domain, then use Var(X)=E(X2)−[E(X)]2\text{Var}(X)=E(X^2)-[E(X)]^2. The standard deviation is the square root of the variance.

Can f(x) be greater than 1?

Yes, because f(x)f(x) is a density, not a probability. It only has to keep the total area equal to 11: for example, f(x)=2f(x)=2 on 0≤x≤0.50\le x\le0.5 has total area 2×0.5=12\times0.5=1.

Ready to practise properly?

Practice questions on every section, marked instantly like the real exam.