Expectation and Variance by Integration
The mean and variance of a continuous variable are integrals against the density, and the same linearity rules from the discrete case still hold.
What a learner can do afterwards
- Compute the mean and variance of a continuous variable by integration
- Use linearity of expectation without assuming independence
- Find the expected value of a function of a random variable
1 · Read
For density f, E[X] = ∫ x f(x) dx over its full range, provided ∫ |x| f(x) dx is finite. This replaces a probability-weighted sum with an integral. For integers n ≥ 0, an antiderivative of x^n is x^(n+1)/(n+1). Integrate polynomials term by term; evaluate at the upper endpoint and subtract the lower value. For X uniform on [0, 8], E[X] = ∫₀⁸ x/8 dx = [x²/16]₀⁸ = 4.
Find the second moment by integrating x² f(x). For the same uniform variable, E[X²] = ∫₀⁸ x²/8 dx = 64/3. Variance is E[(X - E[X])²] = E[X²] - (E[X])², so it is 64/3 - 16 = 16/3. It cannot be negative because squared deviations are nonnegative.
For finite expectations, E[aX + bY + c] = aE[X] + bE[Y] + c, even when X and Y are dependent. More generally, E[g(X)] = ∫ g(x) f(x) dx when ∫ |g(x)| f(x) dx is finite. A nonlinear g usually needs this integral: E[g(X)] need not equal g(E[X]).
Integration by parts uses ∫ u dv = uv - ∫ v du. For f(x) = λe^(-λx), x ≥ 0, λ > 0, choose dv = f(x)dx and v = -e^(-λx). Taking u = x gives E[X] = 1/λ; taking u = x² gives E[X²] = (2/λ)E[X] = 2/λ². Thus Var(X) = 1/λ². Evaluate each integral from 0 to a finite bound, then let that bound tend to ∞. The boundary terms vanish because exponential decay beats these powers.
To check a reported variance, identify what was calculated. E[X²] is the second moment, not yet the variance. With finite second moment, complete Var(X) = E[X²] - (E[X])². Subtract the squared mean, not the mean. Only when the mean is zero do variance and second moment agree.
Integrate x against the density for the mean, then subtract the squared mean from E[X squared] for the variance.
Lesson and questions written for this dataset using standard definitions of continuous expectation and variance.
Readings and extra questions written for this dataset. The flashcards were drafted from collected fact candidates whose individual sources were not recorded.
2 · Watch
Take it off screen
Where it sits
Learn first
Optional connections
Where this leads
Jobs that lean on this skill. Follow one to see everything it is built on.
13 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.