Scribe logoScribeNotes & practice
Sign inStart free
  1. Notes
  2. ›IB Mathematics: Analysis and Approaches
  3. ›4 Statistics and probability
  4. ›4.14 Continuous random variables

IB Mathematics: Analysis and Approaches · Topic 4 · Statistics and probability

4.14 Continuous random variables

Describe a continuous random variable by its density function, find probabilities as areas, and calculate its mean, mode, median and variance.

  • 4 min read
  • 5 parts
  • 10 questions
  • Draft
  • HL only
Start a Quick 5 on this topic→Jump to the 10 questions
1/5A continuous random variable can take any value in an interval
  1. 1A continuous random variable can take any value in an interval
  2. 2A density function turns probability into area
  3. 3The expected value is a weighted integral of x
  4. 4Variance measures spread through squared distances
  5. 5Mode and median come from the curve and its area
  6. Check your recall
  7. Practice: 10 questions
1

Part 1 of 5: A continuous random variable can take any value in an interval

A bus may arrive at any moment in a ten-minute window. The waiting time is not limited to whole numbers, so it can take any value in an interval. Such a quantity is a continuous random variable.

There are infinitely many possible values, so we cannot list them with probabilities. Probability is described over ranges instead. For a continuous variable, P(X=a)=0P(X=a)=0P(X=a)=0 for every single value aaa. Strict and non-strict inequalities therefore give the same probability, so P(X<a)=P(X≤a)P(X<a)=P(X\le a)P(X<a)=P(X≤a). Every question about a continuous variable concerns an interval.

Key term

continuous random variable

A continuous random variable is a random variable that can take any value in an interval of real numbers.

Part 1 done

2

Part 2 of 5: A density function turns probability into area

Single values carry no probability, so a curve describes the distribution instead. The curve is the probability density function, written f(x)f(x)f(x). The probability that XXX lies between aaa and bbb is the area under the curve between them: P(a<X<b)=∫abf(x) dxP(a<X<b)=\int_a^b f(x)\,dxP(a<X<b)=∫ab​f(x)dx.

Two conditions make fff valid. First, f(x)≥0f(x)\ge0f(x)≥0 for all xxx, because a negative height would give a negative probability. Second, the total area is 1, so ∫−∞∞f(x) dx=1\int_{-\infty}^{\infty}f(x)\,dx=1∫−∞∞​f(x)dx=1.

Worked example

Finding k and a probability

f(x)=kxf(x)=kxf(x)=kx for 0≤x≤40\le x\le40≤x≤4, and f(x)=0f(x)=0f(x)=0 otherwise. Find kkk, then P(1≤X≤3)P(1\le X\le3)P(1≤X≤3).
  1. 1
    The total area must be 1: ∫04kx dx=1\int_0^4 kx\,dx=1∫04​kxdx=1.
  2. 2
    [kx22]04=8k=1\left[\frac{kx^2}{2}\right]_0^4=8k=1[2kx2​]04​=8k=1, so k=18k=\frac{1}{8}k=81​.
  3. 3
    P(1≤X≤3)=∫13x8 dx=[x216]13P(1\le X\le3)=\int_1^3\frac{x}{8}\,dx=\left[\frac{x^2}{16}\right]_1^3P(1≤X≤3)=∫13​8x​dx=[16x2​]13​.
  4. 4
    =916−116=12=\frac{9}{16}-\frac{1}{16}=\frac{1}{2}=169​−161​=21​.

Answer: k=18k=\frac18k=81​ and P(1≤X≤3)=12P(1\le X\le3)=\frac12P(1≤X≤3)=21​.

Common mistake

The value f(x)f(x)f(x) is a height, not a probability. It can exceed 1 when the interval is narrow. Only areas give probabilities.

Key term

probability density function

A probability density function is a function f(x)≥0f(x)\ge0f(x)≥0 with total area 1, whose area between aaa and bbb gives P(a<X<b)P(a<X<b)P(a<X<b).

Part 2 done

Quick check

One question on the part you just read

Easy

State which quantity is a continuous random variable.
Show answer and explanation

Answer: B · Worked explanation

Time can take any value in an interval, including fractions of a second, so it is continuous. Goals, absences and die scores are counts or whole-number outcomes, so each can be listed value by value. Always check whether a quantity can be measured on a continuous scale before choosing a model.
3

Part 3 of 5: The expected value is a weighted integral of x

Next we describe the centre of the distribution. For a discrete variable the mean is a sum of each value times its probability. For a continuous variable the sum becomes an integral, because the values are spread along a line.

The expected value is E(X)=μ=∫−∞∞x f(x) dxE(X)=\mu=\int_{-\infty}^{\infty}x\,f(x)\,dxE(X)=μ=∫−∞∞​xf(x)dx. In practice, integrate only where fff is not zero. It is the long-run average of many observations, and it need not be a likely value. Its value always lies between the smallest and largest possible values of XXX.

Worked example

Expected value for the density f(x) = x/8

Find E(X)E(X)E(X) for f(x)=x8f(x)=\frac{x}{8}f(x)=8x​ on 0≤x≤40\le x\le40≤x≤4.
  1. 1
    E(X)=∫04x⋅x8 dx=∫04x28 dxE(X)=\int_0^4 x\cdot\frac{x}{8}\,dx=\int_0^4\frac{x^2}{8}\,dxE(X)=∫04​x⋅8x​dx=∫04​8x2​dx.
  2. 2
    =[x324]04=\left[\frac{x^3}{24}\right]_0^4=[24x3​]04​.
  3. 3
    =6424=83=\frac{64}{24}=\frac{8}{3}=2464​=38​.

Answer: E(X)=83≈2.67E(X)=\frac{8}{3}\approx2.67E(X)=38​≈2.67.

Notice that the mean lies closer to the end where the density is larger. It is the balance point of the area.

Key term

expected value

The expected value of a continuous random variable is E(X)=μ=∫x f(x) dxE(X)=\mu=\int x\,f(x)\,dxE(X)=μ=∫xf(x)dx, taken over all values of xxx.

Part 3 done

4

Part 4 of 5: Variance measures spread through squared distances

The mean says where the distribution is centred. It does not say how far values spread out. The variance is defined as Var(X)=E((X−μ)2)\mathrm{Var}(X)=E\big((X-\mu)^2\big)Var(X)=E((X−μ)2). A more convenient form is Var(X)=E(X2)−[E(X)]2\mathrm{Var}(X)=E(X^2)-\big[E(X)\big]^2Var(X)=E(X2)−[E(X)]2.

Find E(X2)E(X^2)E(X2) by integrating x2f(x)x^2f(x)x2f(x) over the interval. Then subtract the square of the mean. The standard deviation is the square root of the variance, and it has the same units as XXX. Variance is never negative, because it averages squared distances. A larger variance means a wider spread of values.

Worked example

Variance for the density f(x) = x/8

Find Var(X)\mathrm{Var}(X)Var(X) for f(x)=x8f(x)=\frac{x}{8}f(x)=8x​ on 0≤x≤40\le x\le40≤x≤4, given E(X)=83E(X)=\frac{8}{3}E(X)=38​.
  1. 1
    E(X2)=∫04x2⋅x8 dx=[x432]04=25632=8E(X^2)=\int_0^4 x^2\cdot\frac{x}{8}\,dx=\left[\frac{x^4}{32}\right]_0^4=\frac{256}{32}=8E(X2)=∫04​x2⋅8x​dx=[32x4​]04​=32256​=8.
  2. 2
    [E(X)]2=(83)2=649\big[E(X)\big]^2=\left(\frac{8}{3}\right)^2=\frac{64}{9}[E(X)]2=(38​)2=964​.
  3. 3
    Var(X)=8−649=89\mathrm{Var}(X)=8-\frac{64}{9}=\frac{8}{9}Var(X)=8−964​=98​.

Answer: Var(X)=89≈0.889\mathrm{Var}(X)=\frac{8}{9}\approx0.889Var(X)=98​≈0.889.

Common mistake

The quantity E(X2)E(X^2)E(X2) is not [E(X)]2\big[E(X)\big]^2[E(X)]2. Here they are 8 and about 7.11.

Key term

variance

The variance of a random variable is Var(X)=E(X2)−[E(X)]2\mathrm{Var}(X)=E(X^2)-\big[E(X)\big]^2Var(X)=E(X2)−[E(X)]2, and it measures spread in squared units of XXX.

Part 4 done

Quick check

One question on the part you just read

Easy

State a condition that every probability density function f(x)f(x)f(x) must satisfy.
Show answer and explanation

Answer: C · Worked explanation

Total probability is 1, so the total area under fff must be 1. The height f(x)f(x)f(x) can exceed 1 when the interval is narrow, and it is not a probability, because P(X=x)=0P(X=x)=0P(X=x)=0 for a continuous variable. Check any proposed condition by testing it on a narrow uniform density, where the height can be large.
5

Part 5 of 5: Mode and median come from the curve and its area

Two more measures of centre use the curve itself. The mode is the value of xxx where f(x)f(x)f(x) is greatest. Look for a turning point where f′(x)=0f'(x)=0f′(x)=0, and also compare the values at the ends of the interval.

The median mmm splits the area into two equal halves. Solve ∫−∞mf(x) dx=12\int_{-\infty}^{m}f(x)\,dx=\frac{1}{2}∫−∞m​f(x)dx=21​, starting the integral where fff begins.

Figure 1. The density rises from 0 to 4. The mean, median and mode are marked, with the mean furthest left.

Worked example

Mode and median for the density f(x) = x/8

Find the mode and median of f(x)=x8f(x)=\frac{x}{8}f(x)=8x​ on 0≤x≤40\le x\le40≤x≤4.
  1. 1
    fff increases across the interval, so its greatest value is at x=4x=4x=4.
  2. 2
    Median: ∫0mx8 dx=m216=12\int_0^m\frac{x}{8}\,dx=\frac{m^2}{16}=\frac{1}{2}∫0m​8x​dx=16m2​=21​.
  3. 3
    So m2=8m^2=8m2=8 and m=22m=2\sqrt{2}m=22​.

Answer: The mode is 4 and the median is 22≈2.832\sqrt{2}\approx2.8322​≈2.83.

Here the mean ≈2.67\approx2.67≈2.67 lies below the median ≈2.83\approx2.83≈2.83, which lies below the mode 4. The long tail on the left pulls the mean down. A long tail on the right would reverse this order.

Key terms · tap one for its definition

mode

The mode of a continuous random variable is the value of xxx at which f(x)f(x)f(x) takes its greatest value.

median

The median mmm of a continuous random variable is the value for which P(X≤m)=12P(X\le m)=\frac{1}{2}P(X≤m)=21​, so half the area lies below it.

Note read

Check your recall[14 marks]

6 written questions. Answer each one in your head or on paper, then open the mark scheme.

  1. 1.State[2 marks]

    State the two conditions that a function f(x)f(x)f(x) must satisfy to be a probability density function.

    Show mark schemeHide mark scheme

    Model answer

    f(x)≥0f(x)\ge0f(x)≥0 for all xxx, and the total area under the curve is 1, so ∫−∞∞f(x) dx=1\int_{-\infty}^{\infty}f(x)\,dx=1∫−∞∞​f(x)dx=1.

    • 1 mark for stating that f(x)≥0f(x)\ge0f(x)≥0 for all xxx
    • 1 mark for stating that the total area under the curve (the integral over all xxx) equals 1
  2. 2.Calculate[2 marks]

    Calculate kkk for a continuous random variable with f(x)=kx2f(x)=kx^2f(x)=kx2 for 0≤x≤30\le x\le30≤x≤3, and f(x)=0f(x)=0f(x)=0 otherwise.

    Show mark schemeHide mark scheme

    Model answer

    ∫03kx2 dx=[kx33]03=9k=1\int_0^3 kx^2\,dx=\left[\frac{kx^3}{3}\right]_0^3=9k=1∫03​kx2dx=[3kx3​]03​=9k=1, so k=19k=\frac{1}{9}k=91​.

    • 1 mark for setting ∫03kx2 dx=1\int_0^3 kx^2\,dx=1∫03​kx2dx=1 and integrating to obtain 9k9k9k
    • 1 mark for obtaining k=19k=\frac{1}{9}k=91​
  3. 3.Calculate[2 marks]

    Calculate P(X>2)P(X>2)P(X>2) for a continuous random variable with f(x)=x29f(x)=\frac{x^2}{9}f(x)=9x2​ for 0≤x≤30\le x\le30≤x≤3, and f(x)=0f(x)=0f(x)=0 otherwise.

    Show mark schemeHide mark scheme

    Model answer

    P(X>2)=∫23x29 dx=[x327]23=1−827=1927≈0.704P(X>2)=\int_2^3\frac{x^2}{9}\,dx=\left[\frac{x^3}{27}\right]_2^3=1-\frac{8}{27}=\frac{19}{27}\approx0.704P(X>2)=∫23​9x2​dx=[27x3​]23​=1−278​=2719​≈0.704.

    • 1 mark for setting up ∫23x29 dx\int_2^3\frac{x^2}{9}\,dx∫23​9x2​dx with the correct limits
    • 1 mark for obtaining 1927≈0.704\frac{19}{27}\approx0.7042719​≈0.704
  4. 4.Determine[3 marks]

    Determine E(X)E(X)E(X) for a continuous random variable with f(x)=x29f(x)=\frac{x^2}{9}f(x)=9x2​ for 0≤x≤30\le x\le30≤x≤3, and f(x)=0f(x)=0f(x)=0 otherwise.

    Show mark schemeHide mark scheme

    Model answer

    E(X)=∫03x⋅x29 dx=∫03x39 dx=[x436]03=8136=94E(X)=\int_0^3 x\cdot\frac{x^2}{9}\,dx=\int_0^3\frac{x^3}{9}\,dx=\left[\frac{x^4}{36}\right]_0^3=\frac{81}{36}=\frac{9}{4}E(X)=∫03​x⋅9x2​dx=∫03​9x3​dx=[36x4​]03​=3681​=49​.

    • 1 mark for setting up ∫03x f(x) dx\int_0^3 x\,f(x)\,dx∫03​xf(x)dx
    • 1 mark for integrating to obtain x436\frac{x^4}{36}36x4​
    • 1 mark for obtaining 94=2.25\frac{9}{4}=2.2549​=2.25
  5. 5.Explain[2 marks]

    Explain why P(X=2)=0P(X=2)=0P(X=2)=0 for a continuous random variable XXX.

    Show mark schemeHide mark scheme

    Model answer

    Probability is the area under the density curve. A single value has no width, so the area above it is zero.

    • 1 mark for stating that probability is area under the density curve
    • 1 mark for explaining that a single value has zero width, so zero area
  6. 6.Determine[3 marks]

    Determine the median of a continuous random variable with f(x)=2xf(x)=2xf(x)=2x for 0≤x≤10\le x\le10≤x≤1, and f(x)=0f(x)=0f(x)=0 otherwise.

    Show mark schemeHide mark scheme

    Model answer

    ∫0m2x dx=m2=12\int_0^m 2x\,dx=m^2=\frac{1}{2}∫0m​2xdx=m2=21​, so m=12≈0.707m=\frac{1}{\sqrt{2}}\approx0.707m=2​1​≈0.707.

    • 1 mark for setting ∫0m2x dx=12\int_0^m 2x\,dx=\frac{1}{2}∫0m​2xdx=21​
    • 1 mark for obtaining m2=12m^2=\frac{1}{2}m2=21​
    • 1 mark for obtaining m≈0.707m\approx0.707m≈0.707

Practice this topic

10 quick-fire multiple-choice questions, easy to hard. Tap an answer to see if you're right and the worked explanation. (The written questions with mark schemes are under “Check your recall” above.)

0 right0 of 10 answered

Includes the 2 quick checks in the note above.

3.

Easy·State[1 mark]

State the value of P(X=3)P(X=3)P(X=3) for a continuous random variable XXX with density f(x)f(x)f(x).
Show answer and explanation

Answer: B · Worked explanation

A single value has no width, so there is no area above it and the probability is 0. The height f(3)f(3)f(3) is a density, not a probability. The area to the left of 3 is P(X<3)P(X<3)P(X<3), which is a different quantity.
4.

Medium·Calculate[2 marks]

Calculate kkk when f(x)=kx2f(x)=kx^2f(x)=kx2 for 0≤x≤20\le x\le20≤x≤2, and f(x)=0f(x)=0f(x)=0 otherwise.
Show answer and explanation

Answer: B · Worked explanation

The total area is ∫02kx2 dx=8k3=1\int_0^2 kx^2\,dx=\frac{8k}{3}=1∫02​kx2dx=38k​=1, so k=38k=\frac{3}{8}k=83​. The value 18\frac{1}{8}81​ comes from integrating kx2kx^2kx2 as kx3kx^3kx3 and forgetting to divide by 3. The value 83\frac{8}{3}38​ is the reciprocal. Always set the total area equal to 1 first, because kkk scales the whole density.
5.

Medium·Calculate[2 marks]

Calculate P(X>1)P(X>1)P(X>1) when f(x)=38x2f(x)=\frac{3}{8}x^2f(x)=83​x2 for 0≤x≤20\le x\le20≤x≤2, and f(x)=0f(x)=0f(x)=0 otherwise.
Show answer and explanation

Answer: B · Worked explanation

P(X>1)=∫1238x2 dx=[x38]12=1−18=78P(X>1)=\int_1^2\frac{3}{8}x^2\,dx=\left[\frac{x^3}{8}\right]_1^2=1-\frac{1}{8}=\frac{7}{8}P(X>1)=∫12​83​x2dx=[8x3​]12​=1−81​=87​. The value 18\frac{1}{8}81​ is P(X<1)P(X<1)P(X<1), the area below 1, which is the complementary tail. The value 12\frac{1}{2}21​ would need a flat density. Integrate between the stated limits only, and check that the two tail probabilities 18\frac{1}{8}81​ and 78\frac{7}{8}87​ add to 1.
6.

Medium·Calculate[2 marks]

Calculate E(X)E(X)E(X) when f(x)=x2f(x)=\frac{x}{2}f(x)=2x​ for 0≤x≤20\le x\le20≤x≤2, and f(x)=0f(x)=0f(x)=0 otherwise.
Show answer and explanation

Answer: B · Worked explanation

E(X)=∫02x⋅x2 dx=[x36]02=86=43E(X)=\int_0^2 x\cdot\frac{x}{2}\,dx=\left[\frac{x^3}{6}\right]_0^2=\frac{8}{6}=\frac{4}{3}E(X)=∫02​x⋅2x​dx=[6x3​]02​=68​=34​. The value 1 is the midpoint of the interval, which would be the mean only for a flat density. This density is higher near 2, so the mean lies above 1. Check that the mean lies within the interval where the density is positive, which 43\frac{4}{3}34​ does.
7.

Medium·Calculate[2 marks]

Calculate Var(X)\mathrm{Var}(X)Var(X) when f(x)=x2f(x)=\frac{x}{2}f(x)=2x​ for 0≤x≤20\le x\le20≤x≤2, and f(x)=0f(x)=0f(x)=0 otherwise, with E(X)=43E(X)=\frac{4}{3}E(X)=34​.
Show answer and explanation

Answer: B · Worked explanation

E(X2)=∫02x32 dx=[x48]02=2E(X^2)=\int_0^2\frac{x^3}{2}\,dx=\left[\frac{x^4}{8}\right]_0^2=2E(X2)=∫02​2x3​dx=[8x4​]02​=2. Then Var(X)=2−(43)2=29\mathrm{Var}(X)=2-\left(\frac{4}{3}\right)^2=\frac{2}{9}Var(X)=2−(34​)2=92​. The value 23\frac{2}{3}32​ subtracts E(X)E(X)E(X) instead of its square. Squaring the mean matters, because the second moment and the square of the mean are different quantities. The value 2 is the second moment alone. A variance must be positive, which 29\frac{2}{9}92​ is.
8.

Hard·Determine[2 marks]

Determine the median to 3 significant figures when f(x)=38x2f(x)=\frac{3}{8}x^2f(x)=83​x2 for 0≤x≤20\le x\le20≤x≤2, and f(x)=0f(x)=0f(x)=0 otherwise.
Show answer and explanation

Answer: B · Worked explanation

The median satisfies ∫0m38x2 dx=m38=12\int_0^m\frac{3}{8}x^2\,dx=\frac{m^3}{8}=\frac{1}{2}∫0m​83​x2dx=8m3​=21​, so m3=4m^3=4m3=4 and m≈1.59m\approx1.59m≈1.59. The value 1.50 is the mean, which does not split the area equally. The value 1.00 is the midpoint of the interval, which also ignores the shape of the density. The median depends on the whole shape of the density, not just the interval ends.
9.

Hard·Determine[2 marks]

Determine the mode when f(x)=34x(2−x)f(x)=\frac{3}{4}x(2-x)f(x)=43​x(2−x) for 0≤x≤20\le x\le20≤x≤2, and f(x)=0f(x)=0f(x)=0 otherwise.
Show answer and explanation

Answer: B · Worked explanation

Differentiate: f′(x)=34(2−2x)f'(x)=\frac{3}{4}(2-2x)f′(x)=43​(2−2x), which is zero at x=1x=1x=1. The ends of the interval give f=0f=0f=0, so x=1x=1x=1 is the maximum. The height f(1)=34f(1)=\frac{3}{4}f(1)=43​ is the greatest value of fff, not the value of xxx where it occurs. Always compare the interior turning point with the end values before naming the mode.
10.

Hard·Calculate[2 marks]

Calculate Var(X)\mathrm{Var}(X)Var(X) when f(x)=16f(x)=\frac{1}{6}f(x)=61​ for 0≤x≤60\le x\le60≤x≤6, and f(x)=0f(x)=0f(x)=0 otherwise.
Show answer and explanation

Answer: A · Worked explanation

E(X)=∫06x6 dx=3E(X)=\int_0^6\frac{x}{6}\,dx=3E(X)=∫06​6x​dx=3 and E(X2)=∫06x26 dx=[x318]06=12E(X^2)=\int_0^6\frac{x^2}{6}\,dx=\left[\frac{x^3}{18}\right]_0^6=12E(X2)=∫06​6x2​dx=[18x3​]06​=12. So Var(X)=12−32=3\mathrm{Var}(X)=12-3^2=3Var(X)=12−32=3. The value 12 is E(X2)E(X^2)E(X2), with the square of the mean not yet subtracted. The value 9 is the squared mean alone, and 21 comes from adding 12 and 9 instead of subtracting. A uniform density on an interval of length 6 has variance 6212=3\frac{6^2}{12}=31262​=3, which agrees.

Keep going

Next topic5.1 Limits and the derivativePrevious topic4.13 Bayes' theorem

More in Topic 4 · Statistics and probability

  1. 4.6Combined events and diagramsNotes · 10 questions
  2. 4.7Discrete random variablesNotes · 10 questions
  3. 4.8Binomial distributionNotes · 10 questions
  4. 4.9Normal distributionNotes · 10 questions
  5. 4.10Regression of x on yNotes · 10 questions
  6. 4.11Conditional probability and independenceNotes · 10 questions
  7. 4.12Standardizing normal variablesNotes · 10 questions
  8. 4.13Bayes' theoremNotes · 10 questions· HL only
  9. 4.14Continuous random variablesNotes · 10 questions· HL only

All IB Mathematics: Analysis and Approaches topics →

Draft: written by Scribe and checked automatically, not yet by a subject reviewer.

Practice questions are original, written by Scribe and checked automatically for correctness.

Topic codes follow the official numbering. Not endorsed by IB Diploma Programme or any exam board.

On this page

0/5 read

  1. 1A continuous random variable can take any value in an interval
  2. 2A density function turns probability into area
  3. 3The expected value is a weighted integral of x
  4. 4Variance measures spread through squared distances
  5. 5Mode and median come from the curve and its area
  6. Check your recall
  7. Practice: 10 questions
All coursesScribeHow it worksPricingPrivacyTerms

Notes and questions are written by Scribe in our own words. Topic codes follow the official course numbering so you can find your place. Not produced or endorsed by the IB, College Board, AQA, OCR, Pearson Edexcel or any exam board.

© 2026 Scribe

Density with mean, median and mode

Probability density f(x)0123400.10.20.30.40.50.6x
  • f(x) = x/8
  • Mean ≈ 2.67
  • Median ≈ 2.83
  • Mode, x = 4