Cambridge International AS & A Level · Topic 4.1
A-Level Further Maths 9231 / Topic 4.1 / AS & A Level

Change the variable, keep the probability.

Once you have the pdf of \(X\), one integral gives the mean of any function of it: \(E(X^{2})\), \(E(1/X)\), \(E(\sqrt{X})\) or \(E(e^{X})\). And if \(Y\) is a function of \(X\), the CDF carries the probabilities straight across: \(P(Y \le y)\) is a statement about \(X\), so the CDF of \(Y\) comes from the CDF of \(X\), and differentiating gives its pdf.

The key idea

For a continuous random variable \(X\) with pdf \(f(x)\), the general result is \(E\big(g(X)\big) = \displaystyle\int g(x)\,f(x)\,dx\) over the range of \(X\); in particular \(\operatorname{Var}(X) = E(X^{2}) - [E(X)]^{2}\). For \(Y = g(X)\) with \(g\) increasing, \(G(y) = P(Y \le y) = P\big(X \le g^{-1}(y)\big) = F\big(g^{-1}(y)\big)\); for \(g\) decreasing the inequality flips, so \(G(y) = 1 - F\big(g^{-1}(y)\big)\). Differentiate \(G\) to get the pdf of \(Y\), and always state the new range of \(y\).

x f(x) 1 2 0.5 1 y g(y) 2 4 6 8 0.5 1 median √2 f(x) = x/2, 0 ≤ x ≤ 2 median 2√2 g(y) = (1/6)y^(−1/3), 0 < y ≤ 8 Y = X³
Fig. 1: the pdf of X (left) and the pdf of Y = X^3 (right). The shaded areas are both 0.5: the median of Y is the cube of the median of X, but the shapes are very different
Section 01

One integral for any function of X.

You already know \(E(X) = \displaystyle\int x f(x)\,dx\). The same idea works for any function: weight each value \(g(x)\) by the density \(f(x)\) and integrate over the range of \(X\). This is the general result \(E\big(g(X)\big) = \displaystyle\int g(x)\,f(x)\,dx\). You do NOT need the distribution of \(g(X)\) to find its mean.

Worked example Mean, variance and a linear check
\(X\) has pdf \(f(x) = \dfrac{3}{8}x^{2}\) for \(0 \le x \le 2\) and 0 otherwise. Find \(E(X)\), \(\operatorname{Var}(X)\) and \(E(2X + 1)\).
  1. \[E(X) = \int_{0}^{2} \tfrac{3}{8}x^{3}\,dx = \tfrac{3}{8}\left[\tfrac{x^{4}}{4}\right]_{0}^{2} = \tfrac{3}{8}\times 4 = \tfrac{3}{2}\]
  2. \[E(X^{2}) = \int_{0}^{2} \tfrac{3}{8}x^{4}\,dx = \tfrac{3}{8}\times\tfrac{32}{5} = \tfrac{12}{5}\]
  3. \[\operatorname{Var}(X) = \tfrac{12}{5} - \left(\tfrac{3}{2}\right)^{2} = \tfrac{48}{20} - \tfrac{45}{20} = \tfrac{3}{20}\]
  4. \(E(2X + 1) = 2\times\tfrac{3}{2} + 1 = 4\). Integrating \((2x + 1)f(x)\) gives the same 4, a useful check.
Answer: \(E(X) = \frac{3}{2}\), \(\operatorname{Var}(X) = \frac{3}{20}\), \(E(2X + 1) = 4\)
Worked example Non-linear functions
\(X\) has pdf \(f(x) = 2x\) for \(0 \le x \le 1\) and 0 otherwise. Find \(E\!\left(\dfrac{1}{X}\right)\) and \(E(\sqrt{X})\), and compare \(E\!\left(\dfrac{1}{X}\right)\) with \(\dfrac{1}{E(X)}\).
  1. \[E\!\left(\tfrac{1}{X}\right) = \int_{0}^{1} \tfrac{1}{x}\cdot 2x\,dx = \int_{0}^{1} 2\,dx = 2\]
  2. \[E(\sqrt{X}) = \int_{0}^{1} 2x^{3/2}\,dx = 2\left[\tfrac{2}{5}x^{5/2}\right]_{0}^{1} = \tfrac{4}{5}\]
  3. \(E(X) = \displaystyle\int_{0}^{1} 2x^{2}\,dx = \tfrac{2}{3}\), so \(\dfrac{1}{E(X)} = \tfrac{3}{2}\), which is NOT \(E\!\left(\dfrac{1}{X}\right) = 2\).
Answer: \(E\!\left(\frac{1}{X}\right) = 2\), \(E(\sqrt{X}) = \frac{4}{5}\); \(E\!\left(\frac{1}{X}\right) \ne \frac{1}{E(X)}\)
Your turn
For the same \(X\) (pdf \(2x\) on \([0, 1]\)), find \(E(e^{X})\) exactly.
Examiner trap

Only LINEAR functions pass through \(E\): \(E(2X + 1) = 2E(X) + 1\), but \(E(X^{2}) \ne [E(X)]^{2}\), \(E(1/X) \ne 1/E(X)\) and \(E(\sqrt{X}) \ne \sqrt{E(X)}\). For anything non-linear, integrate \(g(x)f(x)\).

Section 02

From F to G: increasing functions.

Now suppose you want the whole distribution of \(Y = g(X)\), not just its mean. The safe route is through the CDF, because \(P(Y \le y)\) can be rewritten as a statement about \(X\). If \(g\) is increasing on the range of \(X\), then \(Y \le y\) exactly when \(X \le g^{-1}(y)\).

Worked example Y = X cubed
\(X\) has CDF \(F(x) = \dfrac{x^{2}}{4}\) for \(0 \le x \le 2\). Find the CDF and the pdf of \(Y = X^{3}\), and check the pdf.
  1. When \(x\) runs from 0 to 2, \(y = x^{3}\) runs from 0 to 8.
  2. \[\begin{aligned} G(y) &= P(X^{3} \le y) = P\big(X \le y^{1/3}\big) \\ &= F\big(y^{1/3}\big) = \tfrac{1}{4}y^{2/3}, \quad 0 \le y \le 8 \end{aligned}\]
  3. \[g(y) = G'(y) = \tfrac{1}{4}\times\tfrac{2}{3}y^{-1/3} = \tfrac{1}{6}y^{-1/3}, \quad 0 < y \le 8\]
  4. Check: \(\displaystyle\int_{0}^{8} \tfrac{1}{6}y^{-1/3}\,dy = \tfrac{1}{6}\left[\tfrac{3}{2}y^{2/3}\right]_{0}^{8} = \tfrac{1}{4}\times 4 = 1\). See Fig. 1.
Answer: \(G(y) = \frac{1}{4}y^{2/3}\) and \(g(y) = \frac{1}{6}y^{-1/3}\) for \(0 < y \le 8\), 0 otherwise
Worked example Y = X squared, X positive
\(X\) has CDF \(F(x) = \dfrac{x^{3}}{8}\) for \(0 \le x \le 2\). Find the pdf of \(Y = X^{2}\) and use it to find \(E(Y)\).
  1. \(X \ge 0\), so \(x^{2}\) is increasing here and \(Y\) runs from 0 to 4.
  2. \[G(y) = P\big(X \le \sqrt{y}\big) = \tfrac{1}{8}y^{3/2} \;\Rightarrow\; g(y) = \tfrac{3}{16}y^{1/2}, \quad 0 \le y \le 4\]
  3. \[E(Y) = \int_{0}^{4} \tfrac{3}{16}y^{3/2}\,dy = \tfrac{3}{16}\times\tfrac{2}{5}\times 32 = \tfrac{12}{5}\]
  4. This matches \(E(X^{2}) = \tfrac{12}{5}\) from the first worked example (the same \(X\)), as the general result says it must.
Answer: \(g(y) = \frac{3}{16}\sqrt{y}\) for \(0 \le y \le 4\), and \(E(Y) = \frac{12}{5}\)
Your turn
\(X\) has CDF \(F(x) = \dfrac{x}{2}\) for \(0 \le x \le 2\). Find the pdf of \(Y = X^{3}\).
Examiner trap

Do not substitute \(x = y^{1/3}\) into the pdf \(f(x)\): that skips the chain rule factor and the result does not integrate to 1. Go through the CDF, and write the NEW range of \(y\), not the old range of \(x\).

Stage 1 · Learn

Check your understanding

Four quick checks. Each correct answer earns XP and records this skill on your profile.

Quick check+10 XP

\(X\) has pdf \(f(x) = 2x\) for \(0 \le x \le 1\). Find \(E(X^{2})\).

Quick check+10 XP

\(E(X) = 3\) and \(E(X^{2}) = 10\). Find \(\operatorname{Var}(X)\).

Quick check+10 XP

\(X\) is positive with CDF \(F(x)\), and \(Y = X^{3}\). Which expression is the CDF \(G(y)\) of \(Y\)?

Quick check+10 XP

\(X\) is positive with CDF \(F(x)\), and \(Y = \dfrac{1}{X}\). Which expression is \(G(y) = P(Y \le y)\)?

Section 03

Decreasing functions and medians.

If \(g\) is decreasing, a small \(Y\) comes from a large \(X\), so the inequality turns round: \(Y \le y\) exactly when \(X \ge g^{-1}(y)\). That gives \(G(y) = 1 - F\big(g^{-1}(y)\big)\). The commonest case is \(Y = \dfrac{1}{X}\) with \(X\) positive.

Worked example Y = 1/X
\(X\) has pdf \(f(x) = \dfrac{2}{x^{2}}\) for \(1 \le x \le 2\). Find the CDF of \(Y = \dfrac{1}{X}\) and identify the distribution of \(Y\).
  1. \(F(x) = \displaystyle\int_{1}^{x} \tfrac{2}{t^{2}}\,dt = 2 - \tfrac{2}{x}\) for \(1 \le x \le 2\).
  2. \(x = 1 \to y = 1\) and \(x = 2 \to y = \tfrac{1}{2}\), so \(\tfrac{1}{2} \le y \le 1\).
  3. \[\begin{aligned} G(y) &= P\!\left(X \ge \tfrac{1}{y}\right) = 1 - F\!\left(\tfrac{1}{y}\right) \\ &= 1 - (2 - 2y) = 2y - 1 \end{aligned}\]
  4. \(g(y) = 2\) for \(\tfrac{1}{2} \le y \le 1\): constant, and \(2\times\tfrac{1}{2} = 1\) checks.
Answer: \(G(y) = 2y - 1\) for \(\frac{1}{2} \le y \le 1\): \(Y\) is uniform on \(\left[\frac{1}{2}, 1\right]\)
Worked example Median of Y from the median of X
\(X\) has CDF \(F(x) = x^{2}\) for \(0 \le x \le 1\). Find the pdf of \(Y = \dfrac{1}{X}\), check it, and find the median of \(Y\) in two ways.
  1. \(0 < x \le 1\) gives \(y \ge 1\). \(G(y) = 1 - F\!\left(\tfrac{1}{y}\right) = 1 - \dfrac{1}{y^{2}}\), so \(g(y) = \dfrac{2}{y^{3}}\) for \(y \ge 1\).
  2. Check: \(\displaystyle\int_{1}^{\infty} \tfrac{2}{y^{3}}\,dy = \left[-\tfrac{1}{y^{2}}\right]_{1}^{\infty} = 0 - (-1) = 1\).
  3. Directly: \(1 - \dfrac{1}{m^{2}} = \dfrac{1}{2}\), so \(m = \sqrt{2}\).
  4. Via \(X\): \(x^{2} = \tfrac{1}{2}\) gives median \(\tfrac{1}{\sqrt{2}}\) for \(X\), and \(1 \big/ \tfrac{1}{\sqrt{2}} = \sqrt{2}\). They agree.
Answer: \(g(y) = \frac{2}{y^{3}}\) for \(y \ge 1\); the median of \(Y\) is \(\sqrt{2}\)
Examiner trap

With a decreasing function, \(G(y) = F\big(g^{-1}(y)\big)\) is WRONG: in the first example it gives \(2 - 2y\), which falls as \(y\) rises, so it cannot be a CDF, and its derivative \(-2\) is negative. Flip the inequality: \(G(y) = 1 - F\big(g^{-1}(y)\big)\).

Stage 2 · Exam

Exam-style questions

Unlocks once the four checks above are done. Worth more XP, written to AS & A Level Further Mathematics Paper 1 to 4 standard.

Finish the four checks above to unlock the exam questions
Exam style+20 XP

\(X\) has pdf \(f(x) = \dfrac{3}{16}\sqrt{x}\) for \(0 \le x \le 4\). Find \(E(\sqrt{X})\).

Exam style+20 XP

\(X\) has CDF \(F(x) = \dfrac{x^{2}}{9}\) for \(0 \le x \le 3\). Find the pdf of \(Y = X^{3}\).

Exam style+20 XP

The positive random variable \(X\) has median 1.6. Find the median of \(Y = X^{2}\).

Exam style+20 XP

\(X\) has CDF \(F(x) = 2 - \dfrac{2}{x}\) for \(1 \le x \le 2\). Find the CDF of \(Y = \dfrac{1}{X}\).

Skill unlocked

Expectations integrated, related variables found.

This skill is now recorded on your profile. Keep the chain going.

-Rank -Level -Score -Topics
Go deeper · practice
Six original Cambridge-style questions
Mean and variance by integration, \(E(1/X)\) and \(E(e^{X})\), the CDF and pdf of \(Y = X^{3}\), \(Y = \sqrt{X}\) and \(Y = 1/X\), and medians carried across.