IB Mathematics: Analysis and Approaches HL — Topic 4
Continuous random variables
Probability densities, centre and spread.
Learning goal
Use continuous probability models to calculate probabilities, describe centre and spread, and predict the effect of a change of scale.
Syllabus link
AHL 4.14 Continuous densities, including piecewise functions; mean, median, mode, variance, standard deviation, fair games and linear transformations.
Big idea
For a continuous random variable, probability is an area. Integration turns a density curve into probabilities and averages.
Key relationship
\(\Prob(a\leq X\leq b)=\int_a^b f(x)\dd x\)
The curve is \(y=f(x)\); the probability is an area beneath it.
What is this topic about?
A continuous random variable models a measurement that can take any value within an interval. For example, let \(X\) be a waiting time, in seconds. Capital \(X\) names the random variable; lower-case \(x\) is a possible value, such as \(x=2.4\) seconds.
Normal distributions are one example. Here we study other densities using integration.
The density function and its graph
The probability density function (pdf) is the function \(f\). When we draw its graph, we plot the curve \(\boldsymbol{y=f(x)}\).
\(x\) represents a possible value of the random variable \(X\).
\(y=f(x)\) is the height of the curve: the probability density at \(x\).
The area between this curve and the \(x\)-axis, from \(x=a\) to \(x=b\), gives the probability that \(X\) lies between \(a\) and \(b\).
Probability is an area
The shaded area under \(y=f(x)\) is \[\Prob(a\leq X\leq b)=\int_a^b f(x)\dd x.\] The height \(f(x)\) is a density; it is the area over an interval that gives a probability.

Prerequisites: definite integrals, equations, piecewise functions, finding maxima with derivatives, and basic probability notation.
Probability density functions
The two conditions for a valid density
For a valid density, \(y=f(x)\) lies on or above the \(x\)-axis, with total area 1: \[\boxed{f(x)\geq0}\quad\text{and}\quad \boxed{\int_{-\infty}^{\infty}f(x)\dd x=1}.\] The limits \(-\infty\) to \(\infty\) mean “include all possible values”. If \(f(x)=0\) outside \([a,b]\), the integral is simply \(\int_a^b f(x)\dd x\).
Worked example 1 — A density can be greater than 1
Show that \(f(x)=\begin{cases}3x^2,&0\leq x\leq1,\\0,&\text{otherwise}\end{cases}\) is a valid pdf.
Solution
On \([0,1]\), \(3x^2\geq0\). Outside this interval the density is zero. Also, \[\int_0^1 3x^2\dd x=[x^3]_0^1=1.\] Both conditions hold, so this is a valid density, even though \(f(1)=3\).

Density is not probability
It is probability that lies between 0 and 1. There is no general upper bound of 1 on \(f(x)\): its area, rather than its height, gives probability.
Worked example 2 — Find a normalising constant
A normalising constant is chosen so that the total area under the density is 1. Find \(k\) for \(f(x)=\begin{cases}kx^2,&0\leq x\leq2,\\0,&\text{otherwise}.\end{cases}\)
Solution
\[\begin{aligned} \int_0^2 kx^2\dd x&=1\\ k\left[\frac{x^3}{3}\right]_0^2&=\frac{8k}{3}=1\\ k&=\frac38. \end{aligned}\] Since \(\frac38x^2\geq0\) on \([0,2]\), the non-negativity condition is also satisfied.
The density is \(f(x)=\frac38x^2\) on \([0,2]\), and zero otherwise.
Related tutorial: Continuous random variables and probability
An introduction to calculating probabilities using a density function.
Calculating probabilities as areas
Choose limits from the event and the model
\[\Prob(a\leq X\leq b)=\int_a^b f(x)\dd x.\] For a continuous model with a density, \(\Prob(X=c)=\int_c^c f(x)\dd x=0\): a single vertical line has zero area. Thus \(<\) and \(\leq\) give the same probability; so do \(>\) and \(\geq\).
Zero probability at one exact point does not put that value outside the model. A measurement rounded to \(1.0\) (to the nearest tenth) represents an interval, \(0.95\leq X<1.05\), which can have positive probability.
Worked example 3 — Left tail, interval and right tail
Let \(f(x)=\begin{cases}\frac34x(2-x),&0\leq x\leq2,\\0,&\text{otherwise}.\end{cases}\) Find:
\(\Prob(X\leq1.5)\);
\(\Prob(0.5\leq X\leq1)\);
\(\Prob(X\geq1)\).
Solution
An antiderivative on \([0,2]\) is \(\frac34x^2-\frac14x^3\). Use only the part of the interval where the density is non-zero.
Left tail: \[\Prob(X\leq1.5)=\int_0^{3/2}\frac34x(2-x)\dd x =\left[\frac34x^2-\frac14x^3\right]_0^{3/2} =\frac{27}{32}\approx0.844.\]
Between two values: \[\Prob(0.5\leq X\leq1)=\int_{1/2}^1\frac34x(2-x)\dd x =\left[\frac34x^2-\frac14x^3\right]_{1/2}^{1} =\frac12-\frac5{32}=\frac{11}{32}\approx0.344.\]
Right tail: \[\Prob(X\geq1)=\int_1^2\frac34x(2-x)\dd x =1-\int_0^1\frac34x(2-x)\dd x=1-\frac12=\frac12.\] We subtracted the left-hand area from the total area 1. Symmetry about \(x=1\) also gives equal areas on either side.



Do not extend a formula beyond its stated interval
Here the polynomial applies only on \([0,2]\); outside this interval, \(f(x)=0\). Hence \(\Prob(X\leq-1)=0\) and \(\Prob(X\leq3)=1\). Do not extend the polynomial beyond \([0,2]\) when integrating.
Check: a probability must lie in \([0,1]\). Otherwise recheck the density, limits and arithmetic.
Piecewise densities: split the integral
Different formulas may describe different parts of the same density. Split an integral wherever the formula changes, then add the contributions.
Probability given a condition: \(\Prob(A\mid B)=\frac{\Prob(A\cap B)}{\Prob(B)}\), where \(\Prob(B)>0\). The symbol \(\mid\) means “given that”: restrict attention to \(B\), then find the fraction that also belongs to \(A\).
Worked example 4 — A triangular piecewise model
Let \[f(x)=\begin{cases} \frac23(x-1),&1\leq x\leq2,\\[2pt] \frac13(4-x),&2<x\leq4,\\[2pt] 0,&\text{otherwise}. \end{cases}\]
Show that \(f\) is a valid density.
Find \(\Prob(1.5\leq X\leq3)\).
Find \(\Prob(X>3\mid X>2)\).

Solution
Both formulas are non-negative on their stated intervals. The total area is \[\begin{aligned} \int_1^2\frac23(x-1)\dd x+\int_2^4\frac13(4-x)\dd x &=\left[\frac{(x-1)^2}{3}\right]_1^2 +\left[-\frac{(4-x)^2}{6}\right]_2^4\\ &=\frac13+\frac23=1. \end{aligned}\] Equivalently, use the two triangle areas: \(\frac12(1)(\frac23)+\frac12(2)(\frac23)=1\).
The interval crosses \(x=2\), so \[\begin{aligned} \Prob(1.5\leq X\leq3) &=\int_{3/2}^2\frac23(x-1)\dd x+\int_2^3\frac13(4-x)\dd x\\ &=\left(\frac13-\frac1{12}\right)+\left(-\frac16+\frac46\right) =\frac14+\frac12=\frac34. \end{aligned}\]
The event \(X>3\) is contained in \(X>2\). Hence \[\Prob(X>3\mid X>2)=\frac{\Prob(X>3)}{\Prob(X>2)} =\frac{\int_3^4(4-x)/3\dd x}{2/3}=\frac{1/6}{2/3}=\frac14.\]
Notice: the numerator simplifies to \(\Prob(X>3)\) because \(X>3\) already implies \(X>2\). This simplification depends on the events being nested.
The mean: an average weighted by density
Three ways to describe the centre
Mean: the long-run average. Median: the value with half the probability on each side. Mode: a value where the density is greatest. These need not coincide.
A thin strip near \(x\), of small width \(\Delta x\), has probability approximately \(f(x)\Delta x\). Its contribution to the average is approximately \(x f(x)\Delta x\). Adding the contributions leads to an integral.
Expected value of a continuous random variable
\[\boxed{\mu=\E(X)=\int_{-\infty}^{\infty}x f(x)\dd x}\] Integrate over the stated range of the density, splitting at formula changes. The mean describes the long-run average of repeated observations.
Worked example 5 — A linear density
Let \(f(x)=\begin{cases}\frac{x}{2},&0\leq x\leq2,\\0,&\text{otherwise}.\end{cases}\) Find \(\E(X)\).
Solution
First, the model is normalised: \(\int_0^2\frac{x}{2}\dd x=[x^2/4]_0^2=1\). \[\begin{aligned} \E(X)&=\int_0^2x\left(\frac{x}{2}\right)\dd x\\ &=\frac12\left[\frac{x^3}{3}\right]_0^2 =\frac43. \end{aligned}\]
The mean is \(\frac43\). The greater density near 2 pulls the mean above 1.
Worked example 6 — Mean of a piecewise distribution
Find the mean of the triangular model from worked example 4.
Solution
\[\begin{aligned} \E(X)&=\int_1^2x\,\frac23(x-1)\dd x+\int_2^4x\,\frac13(4-x)\dd x\\ &=\frac23\left[\frac{x^3}{3}-\frac{x^2}{2}\right]_1^2 +\frac13\left[2x^2-\frac{x^3}{3}\right]_2^4\\ &=\frac59+\frac{16}{9}=\frac73. \end{aligned}\]
The mean is \(\frac73\approx2.33\), which lies within the model’s range \([1,4]\).
The extra factor matters
\(\int f(x)\dd x\) over the whole range gives 1, not the mean. To calculate \(\E(X)\), integrate \(\boldsymbol{x f(x)}\).
Related tutorial: Mean of a continuous random variable
A further worked example using \(f(x)=\frac38x^2\) on \([0,2]\); its mean is \(\frac32\).
The median: divide the probability in half
The median \(m\)
\[\boxed{\Prob(X\leq m)=\int_{-\infty}^{m}f(x)\dd x=\frac12}\] The vertical line \(x=m\) divides the area under \(y=f(x)\) into two equal parts. The median need not be the midpoint of the range or the mean.
Worked example 7 — A median found by integration
Let \(f(x)=\frac38x^2\) for \(0\leq x\leq2\), and zero otherwise. Find the median.
Solution
\[\begin{aligned} \int_0^m\frac38x^2\dd x&=\frac12\\ \left[\frac{x^3}{8}\right]_0^m&=\frac12\\ \frac{m^3}{8}&=\frac12\quad\Longrightarrow\quad m=\sqrt[3]{4}\approx1.59. \end{aligned}\]

There is probability \(\frac12\) on each side of \(m=\sqrt[3]{4}\).
Worked example 8 — Locate a piecewise median first
Find the median of the triangular model in worked example 4.
Solution
For the triangular model in worked example 4, \(\Prob(X\leq2)=\frac13<\frac12\). Therefore the median lies in the second interval, \(2<m<4\).
Using the definition, the area to the left of \(m\) gives \[\underbrace{\frac13}_{\text{area from 1 to 2}}+\int_2^m\frac{4-x}{3}\dd x=\frac12.\] An equivalent, shorter calculation uses the area to the right of \(m\), which must also be \(\frac12\): \[\begin{aligned} \int_m^4\frac{4-x}{3}\dd x&=\frac12\\ \frac{(4-m)^2}{6}&=\frac12\\ (4-m)^2&=3\quad\Longrightarrow\quad m=4\pm\sqrt3. \end{aligned}\] Only \(4-\sqrt3\) lies in \((2,4)\).
The median is \(m=4-\sqrt3\approx2.27\).
Finding an unknown probability boundary
Known boundary or known probability?
To find a probability, the limits are known: evaluate the area integral. To find an unknown boundary \(q\), write an equation for the required area and solve it. \[\Prob(X\leq q)=p\quad\Longrightarrow\quad\int_a^q f(x)\dd x=p,\] where \(a\) is the lower end of the model’s range. For a median, \(p=0.5\); for an 80th percentile, \(p=0.8\). If the range is unbounded below, use \(-\infty\) instead of \(a\).
Worked example 9 — Numerical boundaries — [CALCULATOR]
Let \(X\) have density \(f(x)=12x^2(1-x)\) for \(0\leq x\leq1\), and zero otherwise. Find the median \(m\) and the value \(q\) for which \(\Prob(X\leq q)=0.8\). Give both to three significant figures.
Solution
Median: write and evaluate the area integral. \[\begin{aligned} \int_0^m12x^2(1-x)\dd x&=0.5\\ \left[4x^3-3x^4\right]_0^m&=0.5\\ 4m^3-3m^4&=0.5,\qquad 0<m<1. \end{aligned}\] TI-Nspire CX: in Scratchpad Calculate, insert
nSolvefrom the Catalog (or type it). Using an unassigned variable \(x\), enternSolve(4*x^3-3*x^4=0.5,x,0,1)The last two entries restrict the search to \([0,1]\). The result is \(0.614272\ldots\), so \(m\approx0.614\).
Boundary for probability 0.8. \[\int_0^q12x^2(1-x)\dd x=0.8 \quad\Longrightarrow\quad 4q^3-3q^4=0.8.\] Change the right-hand side in the calculator command:
nSolve(4*x^3-3*x^4=0.8,x,0,1)This gives \(q=0.787682\ldots\approx0.788\).
The median is approximately 0.614. There is probability 0.8 to the left of \(q\approx0.788\), and probability 0.2 to its right.
Check: use the unrounded values in \(4x^3-3x^4\) to recover 0.5 and 0.8 respectively. Round only the final answers.
A probability is not a position on the horizontal axis
In part b, \(0.8\) is an area, while \(q\) is an \(x\)-value. Setting \(q=0.8\) would give left-hand area \(4(0.8)^3-3(0.8)^4=0.8192\), not 0.8.
Quick check B
For this same density, write an equation and a valid interval for \(r\) if \(\Prob(X>r)=0.1\). Do not solve it.
The mode: where the density is greatest
Find a maximum of the density
A mode is an \(x\)-value at which the density reaches its greatest height. Check stationary points, endpoints and any joins in a piecewise density. Solving \(f'(x)=0\) alone is not enough.
Worked example 10 — An interior mode
Find the mode for \(f(x)=\begin{cases}\frac{\pi}{4}\sin\left(\frac{\pi(x-2)}2\right),&2\leq x\leq4,\\0,&\text{otherwise}.\end{cases}\)
Solution
This is non-negative on \([2,4]\) and its total integral is 1. On \(2<x<4\), \[f'(x)=\frac{\pi^2}{8}\cos\left(\frac{\pi(x-2)}2\right)=0 \quad\Longrightarrow\quad x=3.\] The angle lies between 0 and \(\pi\), so \(\pi/2\) is the only relevant zero of cosine. Since \(f'\) changes from positive to negative and both endpoint densities are zero, \(x=3\) gives the maximum.

![A sine-shaped density on [2,4], with its unique maximum at x = 3 and zero heights at the endpoints.](/assets/img/continuous-random-variables-aa-hl-4-14/sine-mode.png)
The mode is \(3\), not the maximum height \(f(3)=\frac\pi4\).
Worked example 11 — A mode at an endpoint
For \(f(x)=3x^2\) on \([0,1]\) (zero otherwise), find the mode.
Solution
The density \(f\) increases throughout the interval. Its maximum occurs at \(x=1\), so the mode is \(1\). There is no interior maximum to find by solving \(f'(x)=0\).
Interpret the mode carefully
An exact value still has probability zero. Near an interior mode, a very narrow interval has a high probability compared with equally narrow intervals elsewhere. If several points share the greatest density, there can be several modes.
Using symmetry
For the bounded symmetric models in this handout, the mean and a median lie on the line of symmetry. The mode is there too if the density has its unique maximum there; symmetry alone does not determine the mode.
Quick check C
The density \(f(x)=6x(1-x)\) on \([0,1]\) is symmetric about \(x=\frac12\). State the mean and median, then find the mode.
Continuous variance and standard deviation
Spread around the mean
Variance measures spread around the mean, in squared units. Standard deviation is its square root, in the same units as \(X\): \(\sigma=\sqrt{\Var(X)}\). We also write \(\sigma^2=\Var(X)\). A larger standard deviation indicates greater spread.
The second moment, \(\E(X^2)\), is the mean of the squared values of \(X\): square the values first, then take their probability-weighted average. The word “second” refers to the power 2.
\(\E(X^2)\) averages the squares; \([\E(X)]^2\) squares the average. They are generally different. \[\E(X^2)=\int_{-\infty}^{\infty}x^2f(x)\dd x,\qquad \Var(X)=\E(X^2)-[\E(X)]^2.\] Order of work: mean, second moment, variance, then standard deviation. Integrate over the stated range, splitting at formula changes.
Worked example 12 — How variable is an app’s launch time?
The launch time \(X\), in seconds, has density \(f(x)=\begin{cases}\frac{(x-3)^2}{9},&0\leq x\leq3,\\0,&\text{otherwise}.\end{cases}\) Find the mean, variance and standard deviation.
Solution
Mean. Multiply the density by \(x\): \[\begin{aligned} \mu&=\frac19\int_0^3x(x-3)^2\dd x =\frac19\int_0^3(x^3-6x^2+9x)\dd x\\ &=\frac19\left[\frac{x^4}{4}-2x^3+\frac92x^2\right]_0^3 =\frac34\text{ seconds}. \end{aligned}\]
Second moment and variance. Multiply the density \(f(x)\) by \(x^2\), then integrate: \[\begin{aligned} \E(X^2)&=\int_0^3 x^2\left(\frac{(x-3)^2}{9}\right)\dd x =\frac19\int_0^3(x^4-6x^3+9x^2)\dd x\\ &=\frac19\left[\frac{x^5}{5}-\frac32x^4+3x^3\right]_0^3 =\frac9{10}\text{ seconds}^2. \end{aligned}\] Now subtract the square of the mean: \[\begin{aligned} \bigl[\E(X)\bigr]^2&=\left(\frac34\right)^2=\frac9{16},\\[3pt] \Var(X)&=\frac9{10}-\frac9{16}=\frac{27}{80}\text{ seconds}^2. \end{aligned}\]
Standard deviation.
\[\sigma=\sqrt{\frac{27}{80}}=\frac{3\sqrt{15}}{20}\approx0.581\text{ seconds}.\]
The long-run mean launch time is 0.75 s, with standard deviation 0.581 s.
Terminology note
The mean squared deviation from the mean is the probability-weighted average of \((X-\mu)^2\), where \(\mu=\E(X)\). This is variance: \(\Var(X)=\E((X-\mu)^2)\).
Linear transformations of a random variable
For \(Y=aX+b\), with constants \(a\) and \(b\)
\[\boxed{\E(Y)=a\E(X)+b}\qquad \boxed{\Var(Y)=a^2\Var(X)}\qquad \boxed{\sigma_Y=|a|\sigma_X}.\] For a continuous variable \(X\), adding \(b\) shifts the distribution. Multiplying by \(a\) rescales it; a negative \(a\) also reverses its direction.
Worked example 13 — A fixed amount plus a variable amount
For app launch time \(X\) in seconds, \(\E(X)=\frac34\) and \(\Var(X)=\frac{27}{80}\). A simulator’s launch time \(Y=5+2X\) seconds doubles \(X\) and adds a fixed 5-second delay. Find the mean, variance and standard deviation of \(Y\).
Solution
\(\E(Y)=5+2\left(\frac34\right)=\frac{13}{2}=6.5\) seconds.
\(\Var(Y)=2^2\left(\frac{27}{80}\right)=\frac{27}{20}\) seconds\(^2\).
\(\sigma_Y=2\sqrt{\frac{27}{80}}=\sqrt{\frac{27}{20}}\approx1.16\) seconds.
Adding 5 changes the mean; doubling \(X\) doubles the standard deviation.
Worked example 14 — A negative multiplier
For the same launch time \(X\), a performance score starts at 10 points and loses 2 points per second of launch time. Let \(Z=10-2X\) be this score, in points.
Solution
\(\E(Z)=10-2\left(\frac34\right)=\frac{17}{2}\) points.
\(\Var(Z)=(-2)^2\left(\frac{27}{80}\right)=\frac{27}{20}\) points\(^2\).
\(\sigma_Z=|-2|\sqrt{\frac{27}{80}}=\sqrt{\frac{27}{20}}\) points.
A negative multiplier cannot produce a negative standard deviation.
See the change: \(U=X+5\) shifts the density; \(Y=5+2X\) also stretches it horizontally by a factor of 2. Its density heights are halved so that the total area remains 1. All times are in seconds.

Why is \(b\) absent from the variance? Every value and its mean shift equally: \[Y-\E(Y)=aX+b-(a\mu+b)=a(X-\mu).\] Squaring these deviations gives the factor \(a^2\). Taking their average gives \(\Var(Y)=a^2\Var(X)\). Keep the transformation linear: these rules apply to \(aX+b\). In particular, \(\E(X^2)\) is generally not \([\E(X)]^2\), and the variance rule does not apply to \(X^2\).
Quick check D
If \(\E(X)=2\) and \(\Var(X)=5\), find the mean, variance and standard deviation of \(T=3X-4\).
Fair games with a continuous outcome
Define the quantities for one play
| \(X\) | The continuous measurement specified in the game, with its units. |
| \(R\) | The player’s payout from that play, in euros. |
| \(G\) | The player’s net gain after paying to play, in euros: \(G=R-c\). |
| \(c\) | The fixed entry fee for one play, in euros. |
\(X\), \(R\) and \(G\) are random variables; \(c\) is a constant. A mathematically fair game has zero expected net gain: \[\E(G)=0\quad\Longleftrightarrow\quad c=\E(R).\] Fairness does not require a 50% chance of making a profit.
Worked example 15 — Set a fair entry price
On each play, a marker lands at a random position on a 1-metre strip. Let \(X\) be its distance from the left end, in metres. Its density is \[f(x)=\begin{cases}2x,&0\leq x\leq1,\\0,&\text{otherwise}.\end{cases}\] The player receives €12 per metre of distance, so the payout is \(R=12X\) euros and the net gain is \(G=12X-c\) euros. Find the expected payout, the fair entry fee and the expected net gain when entry costs €9.
Solution
First find the mean distance: \[\E(X)=\int_0^1 x(2x)\dd x=\left[\frac{2x^3}{3}\right]_0^1=\frac23\text{ metres}.\] Thus \(\E(R)=12\left(\frac23\right)=8\) euros.
The fair entry price equals the expected payout: \(c=8\) euros.
At a price of €9, \(\E(G)=\E(R)-9=8-9=-1\) euro.
The fair price is €8. A €9 entry price gives an expected loss of €1 per play.
Worked example 16 — Fair does not mean a certain result
For the same marker game, \(c=8\). The payout is still \(R=12X\) euros, and the net gain is now \(G=12X-8\) euros per play. Find the probability of making a profit and the variance of the net gain.
Solution
Find the probability of making a profit. \[G>0\iff12X-8>0\iff X>\frac23.\] \[\Prob(G>0)=\int_{2/3}^1 2x\dd x=\left[x^2\right]_{2/3}^1=\frac59.\]
Find the variance of the net gain. \[\E(X^2)=\int_0^1x^2(2x)\dd x=\frac12,\qquad \Var(X)=\frac12-\left(\frac23\right)^2=\frac1{18}.\] Hence \(\Var(G)=12^2\Var(X)=8\) euros\(^2\), and \(\sigma_G=2\sqrt2\) euros.
The expected net gain is zero, but individual gains and losses still vary.
Choose the right calculation
| Task | Method or formula |
|---|---|
| Check a density | \(f(x)\geq0\) and \(\int_{-\infty}^{\infty}f(x)\dd x=1\) |
| Find a probability | \(\Prob(a\leq X\leq b)=\int_a^b f(x)\dd x\) |
| Find the mean | \(\mu=\E(X)=\int_{-\infty}^{\infty}xf(x)\dd x\) |
| Find the second moment | \(\E(X^2)=\int_{-\infty}^{\infty}x^2f(x)\dd x\) |
| Find the variance | \(\sigma^2=\Var(X)=\E(X^2)-\mu^2\) |
| Find standard deviation | \(\sigma=\sqrt{\Var(X)}\) |
| Find a median \(m\) | \(\int_{-\infty}^{m}f(x)\dd x=\frac12\) |
| Find another boundary \(q\) | For \(\Prob(X\leq q)=p\), solve \(\int_{-\infty}^{q}f(x)\dd x=p\) |
| Find a mode | Find where \(f\) is greatest; check stationary points, joins and endpoints |
| Transform: \(Y=aX+b\) | \(\E(Y)=a\E(X)+b\); \(\Var(Y)=a^2\Var(X)\); \(\sigma_Y=|a|\sigma_X\) |
| Set a fair entry fee | For payout \(R\) and fee \(c\): \(G=R-c\); fairness means \(\E(G)=0\), so \(c=\E(R)\) |
A reliable order of work
Define the random variable and units. Write its range and any formula changes.
If a constant is unknown, use total probability \(=1\) and check non-negativity.
Identify the task: probability, boundary, average, peak or spread.
Write the integral or equation before calculating; split piecewise integrals.
Check: probabilities in \([0,1]\), boundaries in range, variance non-negative, and correct units. Round only the final answer.
Keep these distinctions clear
Height versus area: \(f(x)\) is a density; a probability is an area.
Squares versus average: \(\E(X^2)\) averages the squares; \([\E(X)]^2\) squares the average.
Variance versus standard deviation: variance has squared units; standard deviation has the original units.
Payout versus net gain: subtract the entry fee before interpreting a player’s gain or loss.
Calculator and tutorial references
The numerical solving routine is in worked example 9 in Section 7. Use Scratchpad Calculate; keep the equation in your written solution. For trigonometric densities, use radian mode.
Continuous random variables and probability:youtu.be/uWwHelQHRHk
Mean of a continuous random variable:youtu.be/s_CitraD_So
Scope: the continuous-random-variable component of AHL 4.14. An independent Radford Mathematics resource.
Practice A: build the core skills
Give exact answers unless an approximation is requested. Questions 1–9 can be completed without a calculator. Every function below is the density of \(X\) and is zero outside its stated interval.
1. Density and probability
Let \(f(x)=4\) for \(0\leq x\leq\frac14\).
Show that \(f\) is a valid density.
Find \(\Prob(0.1\leq X\leq0.2)\).
Find \(\Prob(X=0.2)\). Explain why this is not \(f(0.2)\).
2. An unknown normalising constant
Let \(f(x)=k(2x+1)\) for \(0\leq x\leq1\).
Find \(k\) and check that the density is non-negative.
Find \(\Prob(X>\frac12)\).
Find \(\Prob(\frac14\leq X\leq\frac34)\).
3. Piecewise probabilities
Let \(f(x)=x\) for \(0\leq x\leq1\), and \(f(x)=2-x\) for \(1<x\leq2\).
Show that the total area under the density is 1.
Find \(\Prob(\frac12\leq X\leq\frac32)\).
Find \(\Prob(X>\frac32\mid X>1)\), explaining the denominator.
4. Mean, median and mode
Let \(f(x)=2(1-x)\) for \(0\leq x\leq1\).
Find the mean.
Find the median, rejecting any root outside the model’s range.
State the mode. Explain why solving \(f'(x)=0\) does not find it.
5. Spread and units
The error \(X\) in a measurement, in millimetres, has density \(f(x)=\frac34(1-x^2)\) for \(-1\leq x\leq1\).
Show that \(f\) is a valid density.
Use symmetry to state the mean, then calculate \(\E(X^2)\).
Find the variance and standard deviation, with units. Explain why their numerical values are different.
Practice B: connect the ideas
6. A new piecewise model
Let \(X\) have density \(f(x)=\begin{cases}(x-1)/2,&1\leq x\leq2,\\(5-x)/6,&2<x\leq5,\\0,&\text{otherwise}.\end{cases}\)
Find the median, explaining which interval contains it.
Find the mean.
Find \(\E(X^2)\), the variance and the standard deviation.
State the mode and find \(\Prob(X>4)\).
7. Transformations and spread
A duration \(X\), in seconds, has mean 4 seconds and variance 9 seconds\(^2\). A new duration is \(T=2X+3\) seconds. A score is \(Z=30-3X\) points.
Find the mean, variance and standard deviation of \(T\).
Find the mean, variance and standard deviation of \(Z\).
Explain why the added constants do not affect the variances.
8. A continuous fair-game model
On each play, a marker lands on a 2-metre strip. Let \(X\) be its distance from the left end, in metres, with density \(f(x)=\frac38x^2\) on \([0,2]\) (zero otherwise). The payout is €4 per metre: \(R=4X\) euros. With a fixed entry fee of \(c\) euros, the player’s net gain is \(G=4X-c\) euros.
Find the fair entry fee.
Find \(\E(G)\) if the entry fee is €7.
Find \(\Var(R)\). Hence state \(\Var(G)\).
9. A trigonometric density
Let \(f(x)=\frac12\sin x\) for \(0\leq x\leq\pi\), and zero otherwise. Angles are in radians.
Show that \(f\) is a valid density.
Use symmetry to state the mean and median. Find the mode.
Find the variance and standard deviation. You may use \(\int x^2\sin x\dd x=-x^2\cos x+2x\sin x+2\cos x+C\).
Find \(\Prob(\frac\pi3\leq X\leq\frac{2\pi}3)\).
10. Numerical probability boundaries [CALCULATOR]
Let \(f(x)=20x(1-x)^3\) for \(0\leq x\leq1\), and zero otherwise.
Write an integral equation for the median \(m\) and solve it numerically.
Find \(q\) such that \(\Prob(X\leq q)=0.8\).
Find \(\Prob(X>0.8)\). Explain why the boundary \(q\) in part b is not simply 0.8.
Give the boundaries in a and b to three significant figures.
Answers to Practice A
Worked answers — show or hide
1. Density and probability
\(f\geq0\) and \(\int_0^{1/4}4\dd x=4(\frac14)=1\), so this is a valid density.
\(\Prob(0.1\leq X\leq0.2)=\int_{0.1}^{0.2}4\dd x=4(0.2-0.1)=0.4\).
\(\Prob(X=0.2)=0\). The height \(f(0.2)=4\) is a density; the area over a single point is zero.
2. An unknown normalising constant
\(\int_0^1k(2x+1)\dd x=k[x^2+x]_0^1=2k=1\), so \(k=\frac12\). Thus \(f(x)=x+\frac12\geq0\) on \([0,1]\).
\(\Prob(X>\frac12)=\int_{1/2}^1(x+\frac12)\dd x=\left[\frac{x^2}{2}+\frac{x}{2}\right]_{1/2}^1=1-\frac38=\frac58\).
\(\Prob(\frac14\leq X\leq\frac34)=\int_{1/4}^{3/4}(x+\frac12)\dd x=\frac{21}{32}-\frac5{32}=\frac12\).
3. Piecewise probabilities
\(\int_0^1x\dd x+\int_1^2(2-x)\dd x=\frac12+\frac12=1\).
Split where the formula changes: \[\int_{1/2}^1x\dd x+\int_1^{3/2}(2-x)\dd x=\frac38+\frac38=\frac34.\]
\(\Prob(X>1)=\int_1^2(2-x)\dd x=\frac12\) is the probability of the given condition. Since \(X>\frac32\) implies \(X>1\), \[\Prob(X>\tfrac32\mid X>1)=\frac{\int_{3/2}^2(2-x)\dd x}{\Prob(X>1)}=\frac{1/8}{1/2}=\frac14.\]
4. Mean, median and mode
\(\E(X)=\int_0^1x\bigl(2(1-x)\bigr)\dd x=[x^2-\frac23x^3]_0^1=\frac13\).
\(\int_0^m2(1-x)\dd x=\frac12\) gives \(2m-m^2=\frac12\), so \(m=1\pm\frac{\sqrt2}{2}\). Only \(m=1-\frac{\sqrt2}{2}\) lies in \([0,1]\).
\(f'(x)=-2\), so the density decreases throughout \([0,1]\). Its maximum is at the endpoint \(x=0\): mode \(=0\). There is no stationary point to find.
5. Spread and units
\(1-x^2\geq0\) on \([-1,1]\) and \(\int_{-1}^1\frac34(1-x^2)\dd x=\frac34[x-\frac{x^3}{3}]_{-1}^1=1\).
Symmetry about 0 gives \(\E(X)=0\) mm. Also, \[\E(X^2)=\int_{-1}^1x^2\left(\frac34(1-x^2)\right)\dd x =\frac34\left[\frac{x^3}{3}-\frac{x^5}{5}\right]_{-1}^1=\frac15\text{ mm}^2.\]
\(\Var(X)=\frac15-0^2=\frac15\) mm\(^2\); \(\sigma=\sqrt{\frac15}=\frac{\sqrt5}{5}\) mm. Standard deviation is the square root of variance, not the variance itself.
Answers to Practice B: questions 6–8
Worked answers — show or hide
6. A new piecewise model
\(\Prob(X\leq2)=\int_1^2\frac{x-1}{2}\dd x=\frac14<\frac12\), so \(2<m<5\). Using the right-hand area, \[\int_m^5\frac{5-x}{6}\dd x=\frac12 \quad\Longrightarrow\quad \frac{(5-m)^2}{12}=\frac12.\] Thus \(m=5\pm\sqrt6\); only \(\boxed{m=5-\sqrt6}\) lies in \((2,5)\).
Multiply each part of the density by \(x\): \[\begin{aligned} \E(X)&=\int_1^2x\left(\frac{x-1}{2}\right)\dd x+\int_2^5x\left(\frac{5-x}{6}\right)\dd x\\ &=\frac12\left[\frac{x^3}{3}-\frac{x^2}{2}\right]_1^2 +\frac16\left[\frac{5x^2}{2}-\frac{x^3}{3}\right]_2^5\\ &=\frac5{12}+\frac94=\frac83. \end{aligned}\]
Multiply each part by \(x^2\) before integrating: \[\begin{aligned} \E(X^2)&=\int_1^2x^2\left(\frac{x-1}{2}\right)\dd x+\int_2^5x^2\left(\frac{5-x}{6}\right)\dd x\\ &=\frac12\left[\frac{x^4}{4}-\frac{x^3}{3}\right]_1^2 +\frac16\left[\frac{5x^3}{3}-\frac{x^4}{4}\right]_2^5\\ &=\frac{17}{24}+\frac{57}{8}=\frac{47}{6}. \end{aligned}\] Now \(\Var(X)=\frac{47}{6}-(\frac83)^2=\frac{13}{18}\) and \(\sigma=\sqrt{\frac{13}{18}}=\frac{\sqrt{26}}6\).
The first piece increases and the second decreases, meeting at \(x=2\): mode \(=2\). Also, \(\Prob(X>4)=\int_4^5\frac{5-x}{6}\dd x=\frac1{12}\).
7. Transformations and spread
\(\E(T)=2(4)+3=11\) seconds; \(\Var(T)=2^2(9)=36\) seconds\(^2\); \(\sigma_T=\sqrt{36}=6\) seconds.
\(\E(Z)=30-3(4)=18\) points; \(\Var(Z)=(-3)^2(9)=81\) points\(^2\); \(\sigma_Z=\sqrt{81}=9\) points.
Adding a constant shifts each value and the mean equally, leaving deviations from the mean unchanged. Variance is therefore unchanged by that addition.
8. A continuous fair-game model
\(\E(X)=\int_0^2x(\frac38x^2)\dd x=\frac32\) metres. Thus \(\E(R)=4\E(X)=6\) euros. Since \(\E(G)=\E(R)-c\), the fair fee is €6.
\(\E(G)=6-7=-1\) euro: an expected loss of €1 per play.
\(\E(X^2)=\int_0^2x^2(\frac38x^2)\dd x=\frac{12}{5}\) metres\(^2\), so \(\Var(X)=\frac{12}{5}-(\frac32)^2=\frac3{20}\) metres\(^2\). Hence \[\Var(R)=4^2\left(\frac3{20}\right)=\frac{12}{5}\text{ euros}^2.\] The fee is fixed: \(\Var(G)=\Var(R-c)=\Var(R)=\frac{12}{5}\) euros\(^2\).
Answers and quick checks
Worked answers — show or hide
9. A trigonometric density
\(\sin x\geq0\) on \([0,\pi]\) and \(\int_0^\pi\frac12\sin x\dd x=[-\frac12\cos x]_0^\pi=1\).
Symmetry about \(x=\frac\pi2\) gives mean \(=\) median \(=\frac\pi2\). Also \(f'(x)=\frac12\cos x\) changes from positive to negative at \(\frac\pi2\), and both endpoint densities are zero. Hence mode \(=\frac\pi2\).
\(\E(X^2)=\int_0^\pi x^2(\frac12\sin x)\dd x=\frac12[-x^2\cos x+2x\sin x+2\cos x]_0^\pi=\frac{\pi^2-4}{2}\). Thus \[\Var(X)=\frac{\pi^2-4}{2}-\left(\frac\pi2\right)^2=\frac{\pi^2}{4}-2, \qquad \sigma=\sqrt{\frac{\pi^2}{4}-2}.\]
\(\Prob(\frac\pi3\leq X\leq\frac{2\pi}3)=\int_{\pi/3}^{2\pi/3}\frac12\sin x\dd x=[-\frac12\cos x]_{\pi/3}^{2\pi/3}=\frac12\).
10. Numerical probability boundaries
Set \(\int_0^m20x(1-x)^3\dd x=0.5\). Expanding and integrating gives \[\left[10x^2-20x^3+15x^4-4x^5\right]_0^m=0.5.\] Solve \(10m^2-20m^3+15m^4-4m^5=0.5\) with \(0<m<1\), giving \(m\approx0.314\).
Similarly solve \(10q^2-20q^3+15q^4-4q^5=0.8\) in \((0,1)\), giving \(q\approx0.490\).
\(\Prob(X>0.8)=\int_{0.8}^1 20x(1-x)^3\dd x=0.00672\). At \(x=0.8\), the left-hand area is \(1-0.00672=0.99328\). In part b, the required area is 0.8; its boundary is \(q\approx0.490\), not 0.8.
Quick-check answers
ATotal area \(=k(\frac12)=1\), so \(k=2\). A density can exceed 1: its area over the full range must be 1.
B\(\Prob(X>r)=0.1\) means \(\Prob(X\leq r)=0.9\). Hence \[\int_0^r12x^2(1-x)\dd x=0.9 \quad\Longrightarrow\quad4r^3-3r^4=0.9,\quad 0<r<1.\] Equivalently, use \(\int_r^1 12x^2(1-x)\dd x=0.1\).
CSymmetry gives mean \(=\) median \(=\frac12\). Since \(f'(x)=6-12x\), the derivative is positive before \(\frac12\) and negative after it. The endpoint densities are zero, so mode \(=\frac12\) too.
D\(\E(T)=3(2)-4=2\); \(\Var(T)=3^2(5)=45\); \(\sigma_T=\sqrt{45}=3\sqrt5\).
Self-check: can you explain why you chose each integral, its limits and any split points? If not, revisit the corresponding example before attempting a fresh question.