SD4, SD5 - Continuous expectation and variance

SD4, SD5 - Continuous expectation and variance

SD4 uses a density to find a continuous variable's mean, variance and standard deviation. SD5 extends those calculations to functions of the variable, including changes of scale and inverse powers. You will connect weighted sums to integrals and check that the moments you calculate actually exist.

First and second moments as integrals

If XX has density 2x2x on [0,1][0,1], does doubling its values double its variance? First we need to measure the distribution's centre and spread.

For a discrete variable, expectation is a weighted sum of values: multiply each value by its probability and add. A continuous density distributes probability over small intervals instead. Near xx, a strip of width Δx\Delta x has probability approximately f(x)Δxf(x)\Delta x. Its contribution to the mean is approximately xf(x)Δxxf(x)\Delta x. Adding strips and taking a limit gives an integral.

Continuous moments

For a variable with pdf ff,

μ=E(X)=∫−∞∞xf(x) dx,E(X2)=∫−∞∞x2f(x) dx.\mu=E(X)=\int_{-\infty}^{\infty}xf(x)\,\mathrm{d}x, \qquad E(X^2)=\int_{-\infty}^{\infty}x^2f(x)\,\mathrm{d}x.

The first is the first moment or mean; the second is the second moment, not the variance. Use the whole support, splitting into pieces if needed. These formulae are required knowledge and are not printed in the AQA formula booklet.

A finite mean requires ∫∣x∣f(x) dx<∞\int |x|f(x)\,\mathrm{d}x<\infty. A finite second moment requires ∫x2f(x) dx<∞\int x^2f(x)\,\mathrm{d}x<\infty. All nonnegative integer powers of a bounded variable have finite moments, but unbounded supports or functions that grow without bound need convergence checks. A formal subtraction of divergent integrals is not an expectation.

Worked example 1: moments of a rising density

Question. XX has pdf f(x)=2xf(x)=2x for 0≤x≤10\leq x\leq1, zero otherwise. Find E(X)E(X) and E(X2)E(X^2).

Plan. Weight the density once by xx and once by x2x^2, using its full support.

E(X)=∫01x(2x) dx=2[x33]01=23,E(X)=\int_0^1 x(2x)\,\mathrm{d}x =2\left[\frac{x^3}{3}\right]_0^1=\frac23, E(X2)=∫01x2(2x) dx=2[x44]01=12.E(X^2)=\int_0^1 x^2(2x)\,\mathrm{d}x =2\left[\frac{x^4}{4}\right]_0^1=\frac12.

Answer. E(X)=2/3E(X)=2/3, E(X2)=1/2E(X^2)=1/2.

Check. On [0,1][0,1], 0≤x2≤x≤10\leq x^2\leq x\leq1. The answers obey 0≤1/2≤2/3≤10\leq1/2\leq2/3\leq1. The mean is above 1/21/2, consistent with density concentrated towards 1.

Stretch the same triangular shape to twice the horizontal range. The density must become lower so its area remains 1.

Worked example 2: stretching the support

Question. YY has pdf f(y)=y/2f(y)=y/2 for 0≤y≤20\leq y\leq2, zero otherwise. Find E(Y)E(Y) and E(Y2)E(Y^2).

Plan. Repeat the moment integrals with the new density and new upper bound.

E(Y)=∫02y(y2) dy=[y36]02=43,E(Y)=\int_0^2 y\left(\frac y2\right)\,\mathrm{d}y =\left[\frac{y^3}{6}\right]_0^2=\frac43, E(Y2)=∫02y2(y2) dy=[y48]02=2.E(Y^2)=\int_0^2 y^2\left(\frac y2\right)\,\mathrm{d}y =\left[\frac{y^4}{8}\right]_0^2=2.

Answer. E(Y)=4/3E(Y)=4/3, E(Y2)=2E(Y^2)=2.

Check. Put y=2uy=2u in these two integrals. They become twice and four times the corresponding integrals in Worked example 1: 2(2/3)=4/32(2/3)=4/3 and 4(1/2)=24(1/2)=2.

The mean is a balance point of the probability distribution. It is not obtained by dividing ∫xf(x) dx\int xf(x)\,\mathrm{d}x by the support width: the probability weights already total 1. Integrating f(x)f(x) alone finds total probability, not a mean.

Watch out

Wrong: E(X2)=[E(X)]2E(X^2)=[E(X)]^2. The first weights squared values; the second squares one average. In Worked example 1 they are 1/21/2 and 4/94/9, which differ.

Compute both moments for a fresh density.

Mean, variance and standard deviation

Spread measures distances from the mean. Squaring those distances avoids cancellation between values on opposite sides of it.

Variance and standard deviation

When the second moment is finite, the variance is

Var⁡(X)=E((X−μ)2)=E(X2)−[E(X)]2,μ=E(X).\operatorname{Var}(X)=E\bigl((X-\mu)^2\bigr) =E(X^2)-[E(X)]^2,\qquad \mu=E(X).

The standard deviation is the nonnegative square root,

σ=Var⁡(X).\sigma=\sqrt{\operatorname{Var}(X)}.

These random-variable moment formulae are required knowledge and are not printed in the AQA formula booklet.

Why does the computational shortcut work? Expand the square, integrate, and use the facts that the total probability is 1 and the first moment is μ\mu:

∫(x−μ)2f(x) dx=∫x2f(x) dx−2μ∫xf(x) dx+μ2∫f(x) dx=E(X2)−2μ2+μ2=E(X2)−μ2.\begin{aligned} \int(x-\mu)^2f(x)\,\mathrm{d}x &=\int x^2f(x)\,\mathrm{d}x -2\mu\int xf(x)\,\mathrm{d}x +\mu^2\int f(x)\,\mathrm{d}x\\ &=E(X^2)-2\mu^2+\mu^2 =E(X^2)-\mu^2. \end{aligned}

All integrals here cover the whole support. The original squared-distance expression proves that variance cannot be negative. If you obtain a small negative result numerically, retain more precision in the moments; a substantial negative value signals an error.

Worked example 3: finding spread from moments

Question. A variable has pdf f(x)=2xf(x)=2x on [0,1][0,1], zero otherwise. Its moments are E(X)=2/3E(X)=2/3 and E(X2)=1/2E(X^2)=1/2. Find its variance and standard deviation.

Plan. Subtract the square of the mean from the second moment, then take the square root.

Var⁡(X)=12−(23)2=9−818=118.\operatorname{Var}(X)=\frac12-\left(\frac23\right)^2 =\frac{9-8}{18}=\frac1{18}. σX=118=26.\sigma_X=\sqrt{\frac1{18}}=\frac{\sqrt2}{6}.

Answer. Variance 1/181/18, standard deviation 2/6\sqrt2/6, approximately 0.2360.236.

Check. Directly integrating squared distances gives

∫01(x−23)2(2x) dx=12−89+49=118.\int_0^1\left(x-\frac23\right)^2(2x)\,\mathrm{d}x =\frac12-\frac89+\frac49=\frac1{18}.

Return to the stretched density from Worked example 2. Only the horizontal scale changes, allowing a direct comparison of spread.

Worked example 4: spread after stretching

Question. A variable has pdf f(y)=y/2f(y)=y/2 on [0,2][0,2], zero otherwise. Its moments are E(Y)=4/3E(Y)=4/3 and E(Y2)=2E(Y^2)=2. Find its variance and standard deviation.

Plan. Apply the same subtraction without rounding either moment.

Var⁡(Y)=2−(43)2=18−169=29,\operatorname{Var}(Y)=2-\left(\frac43\right)^2 =\frac{18-16}{9}=\frac29, σY=29=23.\sigma_Y=\sqrt{\frac29}=\frac{\sqrt2}{3}.

Answer. Variance 2/92/9, standard deviation 2/3\sqrt2/3.

Check. Substitute y=2uy=2u in the squared-distance integral:

∫02(y−43)2y2 dy=4∫01(u−23)2(2u) du=4(118)=29.\int_0^2\left(y-\frac43\right)^2\frac y2\,\mathrm{d}y =4\int_0^1\left(u-\frac23\right)^2(2u)\,\mathrm{d}u =4\left(\frac1{18}\right)=\frac29.

The standard deviation doubles, while the variance quadruples.

If values are measured in centimetres, the mean and standard deviation are in centimetres but the variance is in square centimetres. This units difference helps explain why a scale factor is squared in variance.

Watch out

Wrong: subtract E(X)E(X) instead of [E(X)]2[E(X)]^2, or report the variance as the standard deviation. Keep exact moments until the final subtraction and take a nonnegative square root.

Use supplied moments to focus on that distinction.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account