Source: Introduction to Statistics, Purdue University
Tags: expected value, mean, variance, standard deviation, continuous random variable, E(X), Var(X), sigma, STAT
Difficulty: Intermediate | Prerequisites: PDF and CDF (first part of Chapter 6), basic integration.
Once you know how to describe a continuous random variable with a PDF, the next question is: what is its centre, and how spread out is it? Expected value and variance answer those questions for continuous distributions, using integrals rather than summations. These are the continuous versions of the mean and variance you already computed for discrete random variables in Chapter 5. Mastering these calculations is essential for the normal distribution and all the inference that follows.
The expected value E(X) of a continuous variable is found by integrating x times the PDF. The variance uses the shortcut Var(X) = E(X²) − [E(X)]², where E(X²) is found by integrating x² times the PDF. The standard deviation is the square root of the variance.
Expected value (mean), E(X) or μ_X
The long-run average value of a random variable, weighted by its probability. For a continuous variable, it is computed as the integral of x·f(x) over the entire range.
Think of it as: the balance point of the density curve. If you cut the curve out of cardboard, E(X) is where it would balance on a knife-edge.
E(g(X))
The expected value of a function of X. Instead of integrating x·f(x), you integrate g(x)·f(x). A common special case is g(x) = x², used to find E(X²) for the variance shortcut.
In simple terms: if you transform every outcome by some function g before averaging, this is how you compute that average.
Variance, Var(X) or σ²_X
A measure of how spread out the distribution is around the mean. Defined as E[(X − μ)²], the average squared distance from the mean.
Think of it as: how far, on average (in squared units), the variable wanders from its centre.
Standard deviation, σ_X
The square root of the variance. It brings the spread measure back into the same units as X, making it easier to interpret.
In simple terms: if the variance is in "squared units," the standard deviation is in the original units.
Shortcut formula for variance
Var(X) = E(X²) − [E(X)]². This avoids having to subtract μ from every x before squaring. Compute E(X) and E(X²) separately, then combine.
The idea is the same in both cases: weight each possible value by how likely it is, then add up.
Discrete: E(X) = Σ x·p(x), where p(x) is the PMF
Continuous: E(X) = μ_X = ∫ from −∞ to ∞ of x·f(x) dx
For a function of X:
Discrete: E(g(X)) = Σ g(x)·p(x)
Continuous: E(g(X)) = ∫ from −∞ to ∞ of g(x)·f(x) dx
The continuous case replaces the sum with an integral and the PMF with the PDF. Everything else carries over.
Given f(x) = x/2 for 0 ≤ x ≤ 2, and 0 elsewhere.
E(X) = ∫ from 0 to 2 of x · (x/2) dx = (1/2) · ∫ from 0 to 2 of x² dx = (1/2) · (x³/3) from 0 to 2 = (1/6) · (8 − 0) = 4/3 ≈ 1.333
The expected value of X is 4/3.
Var(X) = E[(X − μ_X)²] = ∫ from −∞ to ∞ of (x − μ_X)² · f(x) dx
This is the expected squared deviation from the mean. Computing it directly requires knowing μ_X first, then integrating (x − μ)² · f(x).
The more practical approach:
Var(X) = E(X²) − [E(X)]²
This requires two integrals: one for E(X), one for E(X²). Both are straightforward.
Continuing with f(x) = x/2 for 0 ≤ x ≤ 2.
Step 1: E(X) = 4/3 (computed in the previous section).
Step 2: Find E(X²).
E(X²) = ∫ from 0 to 2 of x² · (x/2) dx = (1/2) · ∫ from 0 to 2 of x³ dx = (1/2) · (x⁴/4) from 0 to 2 = (1/8) · (16 − 0) = 2
Step 3: Apply the shortcut.
Var(X) = E(X²) − [E(X)]² = 2 − (4/3)² = 2 − 16/9 = 18/9 − 16/9 = 2/9
Step 4: Standard deviation.
σ = √(Var(X)) = √(2/9) ≈ 0.471
The standard deviation σ_X tells you that the typical distance of X from its mean of 4/3 is about 0.47 units.
Expected value (continuous):
E(X) = \mu_X = \int_{-\infty}^{\infty} x \cdot f(x)\, dxExpected value of a function of X:
E(g(X)) = \int_{-\infty}^{\infty} g(x) \cdot f(x)\, dxVariance (definition):
\text{Var}(X) = E[(X - \mu_X)^2] = \int_{-\infty}^{\infty} (x - \mu_X)^2 \cdot f(x)\, dxVariance (shortcut):
\text{Var}(X) = E(X^2) - [E(X)]^2Standard deviation:
\sigma_X = \sqrt{\text{Var}(X)}Expected value shows up whenever you need the "average" outcome of a continuous process: the mean lifespan of a lightbulb, the average wait time in a queue, or the expected return on an investment. Variance and standard deviation quantify risk and consistency. In manufacturing, a small σ means parts are tightly clustered around the target dimension; in finance, a large σ signals a volatile asset.
Students sometimes try to compute E(X²) by squaring E(X). These are not the same. E(X²) ≠ [E(X)]². The difference between them is the variance.
Forgetting to use the shortcut formula and attempting to integrate (x − μ)²·f(x) directly is common. The shortcut Var(X) = E(X²) − [E(X)]² is almost always simpler.
Some students confuse the integration limits. You integrate only over the support of the PDF (the interval where f(x) is non-zero), not from −∞ to ∞ literally, since f(x) = 0 outside the support.
Variance cannot be negative. If your calculation yields a negative number, check your arithmetic, most likely in squaring E(X) or evaluating the integral bounds.
⚠️ You will almost certainly be asked to compute E(X), E(X²), Var(X), and σ for a given PDF. Have the shortcut formula memorised.
⚠️ Exam questions often give you E(X) and ask for Var(X), or give Var(X) and ask for σ. Know how to move between all three.
⚠️ Setting up the integral correctly (the right function of x times the PDF, with the right limits) is worth the most marks. Write out the setup before evaluating.
⚠️ If the question asks for E(g(X)) for some function g (for example, E(3X + 2)), remember to integrate g(x)·f(x), or use the linearity property: E(aX + b) = a·E(X) + b.
True or False: E(X²) = [E(X)]².
Answer: False. These are equal only when Var(X) = 0 (a degenerate case). In general, E(X²) > [E(X)]².
Fill in the blank: The shortcut formula for variance is Var(X) = ______ − ______.
Answer: E(X²) − [E(X)]².
True or False: The standard deviation can be negative.
Answer: False. σ = √(Var(X)), and the square root of a non-negative number is non-negative.
Fill in the blank: To compute E(X) for a continuous variable, you integrate ______ times the PDF.
Answer: x.
True or False: If f(x) = x/2 on [0, 2], then E(X) = 1 (the midpoint of the interval).
Answer: False. E(X) = 4/3 ≈ 1.333. The PDF is not uniform, so the mean is not the midpoint.
Q: Given f(x) = 3x² for 0 ≤ x ≤ 1 and 0 elsewhere, find E(X).
A: E(X) = ∫ from 0 to 1 of x · 3x² dx = 3 · ∫ x³ dx from 0 to 1 = 3 · (1/4) = 3/4 = 0.75.
Q: For the same PDF, find E(X²).
A: E(X²) = ∫ from 0 to 1 of x² · 3x² dx = 3 · ∫ x⁴ dx from 0 to 1 = 3 · (1/5) = 3/5 = 0.6.
Q: What is Var(X) for f(x) = 3x² on [0, 1]?
A: Var(X) = E(X²) − [E(X)]² = 0.6 − (0.75)² = 0.6 − 0.5625 = 0.0375.
Q: What is the standard deviation?
A: σ = √(0.0375) ≈ 0.1936.
Q: Given f(x) = x/2 for 0 ≤ x ≤ 2, compute E(2X + 1).
A: E(2X + 1) = 2·E(X) + 1 = 2·(4/3) + 1 = 8/3 + 1 = 11/3 ≈ 3.667. You can use the linearity of expectation here rather than integrating (2x + 1)·f(x) directly.
Expected value and variance connect directly to the normal distribution (Chapter 7), where the entire distribution is defined by just μ and σ. The concept of E(g(X)) is also the basis for moment-generating functions, which appear in more advanced courses. In hypothesis testing and confidence intervals later in the course, everything revolves around the mean and standard deviation of sampling distributions, so these calculations are foundational.
expected value, mean of continuous variable, E(X), E(X squared), variance, Var(X), standard deviation, sigma, shortcut formula, continuous random variable, integration, moment, LOTUS (law of the unconscious statistician), Purdue STAT, Chapter 6, intro statistics