Resources For Teachers For Tutors For Students & Parents Pricing
Year 12 Methods (Unit 3 & 4) Continuous random variables

Mean and median for a continuous random variable

20 practice questions 0 video lessons Theory + worked examples

In Year 12 Mathematical Methods (Queensland, QCAA), the mean, median and mode summarise a continuous random variable \(X\) described by a probability density function \(f\). The mean (expected value) is \(\mu=E(X)=\int x\,f(x)\,dx\); the median \(m\) splits the total area in half, \(\int_{a}^{m} f(x)\,dx=\tfrac12\); and the mode is the \(x\) that maximises \(f\).

A continuous random variable \(X\) is described by a probability density function \(f\), where \(f(x)\ge 0\) and the total area is \(\int f(x)\,dx=1\). Probabilities are areas: \(P(a\le X\le b)=\int_a^b f(x)\,dx\).

The mean, or expected value, is the balance point of the distribution: \(\mu=E(X)=\int x\,f(x)\,dx\) over the support. Each value \(x\) is weighted by its density \(f(x)\) — note the extra factor of \(x\), without which the integral is just \(1\).

The median \(m\) is the value with equal area on each side: \(\int_{a}^{m} f(x)\,dx=\tfrac12\) (equivalently \(F(m)=\tfrac12\)). The mode is the value of \(x\) that maximises \(f(x)\) — the highest point of the density, found from \(f'(x)=0\) or at an endpoint.

For a function of \(X\), the expected value is \(E(g(X))=\int g(x)\,f(x)\,dx\); for example \(E(X^{2})=\int x^{2} f(x)\,dx\).

Key idea. Mean \(=\int x f\,dx\) (weight by \(x\)); median \(=\) the \(x\) that halves the area; mode \(=\) the \(x\) that maximises \(f\). They agree only when \(f\) is symmetric.
The mean as the balance point of a densityA ramp-shaped density f(x)=x/2 on the interval from 0 to 2, with a dashed vertical line at the mean mu = 4/3. x f μ=4/3
Mean \(\mu=\int x f\,dx=\dfrac43\): the balance point of the density
The median splits the area into two equal halvesA ramp density f(x)=x/8 on 0 to 4; a dashed vertical line at the median splits the shaded area into two equal halves, each of area one half. x f ½ ½ m
Median \(m\): the two shaded halves each have area \(\tfrac12\)

The mean (expected value) weights each \(x\) by its density:

\[\mu=E(X)=\int x\,f(x)\,dx\]
μ=xf(x)dx

The median \(m\) halves the total area:

\[\int_{a}^{m} f(x)\,dx=\tfrac12 \qquad\Longleftrightarrow\qquad F(m)=\tfrac12\]
amf(x)dx=12

The mode maximises the density, and the expected value of a function integrates \(g(x)f(x)\):

\[\text{mode}=\underset{x}{\arg\max}\,f(x) \qquad E\big(g(X)\big)=\int g(x)\,f(x)\,dx\]
E(g(X))=g(x)f(x)dx
Linearity. Expectation is linear: \(E(aX+b)=a\,E(X)+b\). For example, once \(E(X)=2.5\), \(E(2X+1)=2(2.5)+1=6\) — no new integral needed.

How to find the mean, median and mode

  1. Mean. Form \(x\,f(x)\), integrate over the support and evaluate: \(\mu=\int x f(x)\,dx\). Keep the factor of \(x\).
  2. Median. Set the lower-tail area to \(\tfrac12\): \(\int_{a}^{m} f(x)\,dx=\tfrac12\), then solve the resulting equation for \(m\) (exactly, or with technology).
  3. Mode. Maximise \(f\): solve \(f'(x)=0\) for an interior maximum (confirm with \(f''<0\) or a sign test). If \(f\) is increasing or decreasing throughout, the mode is the corresponding endpoint.
  4. Function of \(X\). For \(E(g(X))\) integrate \(g(x)f(x)\); e.g. \(E(X^{2})=\int x^{2} f(x)\,dx\). Remember \(E(X^{2})\ne (E(X))^{2}\).
Symmetry shortcut. If \(f\) is symmetric about a centre \(c\), then \(\mu=m=c\) immediately — no integration needed for the mean or median.
Example 1 — Mean of a density
\(X\) has \(f(x)=\dfrac{x}{2}\) on \([0,2]\). Find the mean \(\mu\).
Solution

Integrate \(x\,f(x)\) over \([0,2]\).

\(\mu\)\(=\)\(\displaystyle\int_{0}^{2} x\cdot\dfrac{x}{2}\,dx\)
\(\)\(=\)\(\dfrac12\left[\dfrac{x^{3}}{3}\right]_{0}^{2}=\dfrac12\cdot\dfrac83\)
\(\mu\)\(=\)\(\dfrac43\)

The mean is \(\mu=\dfrac43\).

μ=43
Example 2 — Median (equal areas)
\(X\) has \(f(x)=\dfrac{x}{8}\) on \([0,4]\). Find the median \(m\).
Solution

Set the lower-tail area to \(\tfrac12\) and solve.

\(\displaystyle\int_{0}^{m}\dfrac{x}{8}\,dx\)\(=\)\(\dfrac12\)
\(\dfrac{m^{2}}{16}\)\(=\)\(\dfrac12\Rightarrow m^{2}=8\)
\(m\)\(=\)\(2\sqrt2\approx2.83\)
Median of f(x)=x/8 splitting the area in halfThe ramp density f(x)=x/8 on 0 to 4 with the two shaded halves meeting at the median 2 root 2. x f ½ ½ 2√2

The median is \(m=2\sqrt2\).

m=22
Example 3 — Mode (maximise \(f\))
\(X\) has \(f(x)=\dfrac{3}{32}x(4-x)\) on \([0,4]\). Find the mode.
Solution

The mode maximises \(f\); solve \(f'(x)=0\).

\(f'(x)\)\(=\)\(\dfrac{3}{32}(4-2x)\)
\(f'(x)=0\)\(\Rightarrow\)\(x=2\)
\(f''(x)\)\(=\)\(-\dfrac{3}{16}<0\) (maximum)

The mode is \(x=2\).

mode=2
Example 4 — \(E(X^{2})\) versus \((E(X))^{2}\)
\(X\) is uniform on \([0,2]\), \(f(x)=\dfrac12\). Find \(E(X^{2})\).
Solution

Integrate \(x^{2} f(x)\); this is not the mean squared.

\(E(X^{2})\)\(=\)\(\displaystyle\int_{0}^{2} x^{2}\cdot\dfrac12\,dx\)
\(\)\(=\)\(\dfrac12\cdot\dfrac83=\dfrac43\)
\((E(X))^{2}\)\(=\)\(1^{2}=1\neq\dfrac43\)

So \(E(X^{2})=\dfrac43\), larger than \((E(X))^{2}=1\).

E(X2)=43

Common pitfalls

The median is not always the mean. They coincide only for a symmetric density. For a skewed \(f\), compute each separately — do not assume \(m=\mu\).
Keep the factor of \(x\) in the mean. The mean is \(\int x f(x)\,dx\), not \(\int f(x)\,dx\) (which is just \(1\)). The \(x\) weights each value by its likelihood.
The median condition is on the area, not the height. Solve \(\int_{a}^{m} f=\tfrac12\), not \(f(m)=\tfrac12\). The half is an area.
Check the endpoints for the mode. If \(f\) is increasing or decreasing across the whole interval, \(f'(x)=0\) has no interior solution and the mode is an endpoint.

Frequently asked questions

How do you find the mean of a continuous random variable?

Integrate \(x\,f(x)\) over the support: \(\mu=\int x f(x)\,dx\). Multiply \(x\) by the density, integrate, and evaluate. Do not drop the factor of \(x\).

How do you find the median?

Set the lower-tail area to a half: \(\int_{a}^{m} f(x)\,dx=\tfrac12\) (that is \(F(m)=\tfrac12\)), then solve for \(m\).

Is the median the same as the mean?

Only when \(f\) is symmetric, in which case both equal the centre. For a skewed density they differ, so compute each on its own.

How do you find the mode?

Maximise \(f\): solve \(f'(x)=0\) for an interior peak (check \(f''<0\)); if \(f\) is monotone the mode is an endpoint.

What is \(E(X^2)\)?

\(E(X^{2})=\int x^{2} f(x)\,dx\). It is the expected value of the function \(x^{2}\), and is generally larger than \((E(X))^{2}\).

Do you use the factor of \(x\) when finding the mean?

Yes. Integrating \(f\) alone gives \(1\); the mean needs the \(x\) weight: \(\mu=\int x f(x)\,dx\).

Create a free accountTrack your progress and save your work as you go.
Create free account