From a Bounded Density to Mean and Variance
For a continuous random variable, a density assigns probability across intervals rather than to individual points. To find its mean and variability, we integrate over the variable’s support. When a density is given only up to a constant, the first task is to determine that constant: every later calculation depends on using a correctly normalized density.
This tutorial works through bounded densities from normalization to standard deviation. The examples emphasize the setup and evaluation of each integral, along with checks that help detect an incorrect support, a missing constant, or an algebra error.
If the density is written as \(f_X(x)=c\,g(x)\) on \([a,b]\), first use the total-probability condition to find \(c\):
provided \(g(x)\) is nonnegative on the stated support and its integral is positive and finite. After finding \(c\), use the resulting density—not the unnormalized function \(g\)—in the moment integrals. A density has units reciprocal to those of \(X\); probabilities are areas under the density and are dimensionless.
Why the Second Moment Gives the Variance
Variance measures the expected squared distance from the mean \(\mu=E[X]\). Thus, by definition, \(\operatorname{Var}(X)=E[(X-\mu)^2]\). For a bounded density, the expectation is an integral over its support. Expanding the square gives the computational formula:
The fourth line uses both \(E[X]=\mu\) and \(\int_a^b f_X(x)\,dx=1\). This explains why normalization matters not only for probabilities but also for the variance formula. The variance has squared units; the standard deviation, obtained by taking its nonnegative square root, has the same units as \(X\).
Worked Examples
Worked Example: A Density Proportional to \(x\)
A hypothetical bounded measurement \(X\), in units, has density \(f_X(x)=cx\) for \(0\le x\le2\), and zero otherwise. Find \(c\), the mean, the second raw moment, the variance, and the standard deviation. Use exact values until the final standard-deviation calculation.
Method. Normalize first, then evaluate the first and second moment integrals. This avoids the common mistake of integrating \(x\) or \(x^2\) against \(cx\) before determining the density’s scale.
1. Find the constant. Since the total probability must be one,
The normalized density is \(f_X(x)=x/2\) on \([0,2]\). It is nonnegative there, and its integral is \((1/2)(2)=1\).
2. Find the mean.
3. Find the second raw moment.
4. Find variance and standard deviation.
Check. The mean \(4/3\) lies in the support \([0,2]\), and the variance \(2/9\) is nonnegative. The standard deviation is reported to four decimal places. The common mistake avoided here is using \(\int_0^2 x^2\,dx\) for the second moment; the integrand must be \(x^2 f_X(x)\), including the density factor \(x/2\).
Worked Example: A Decreasing Linear Density
A hypothetical continuous score \(X\) has density \(f_X(x)=c(3-x)\) for \(0\le x\le3\), and zero otherwise. Calculate the normalization constant, mean, second raw moment, variance, and standard deviation.
Method. Integrate the kernel to normalize, then multiply it by \(x\) and \(x^2\) for the two moments. A frequent trap is to forget that the factor \(3-x\) remains in each moment integrand.
1. Normalize.
The density is nonnegative on \([0,3]\), and the calculated constant makes its integral one.
2. Calculate the mean.
3. Calculate the second raw moment.
4. Calculate variance and standard deviation.
Check. The mean \(1\) is within the support, and the variance is positive. The standard deviation is rounded to four decimal places. If the factor \(3-x\) were omitted from the moment integrals, the resulting values would not describe this density.
Worked Example: A Symmetric Quadratic Density on a Wider Interval
A hypothetical continuous quantity \(X\), measured in units, has density \(f_X(x)=cx(4-x)\) for \(0\le x\le4\), and zero otherwise. Find all five requested quantities: \(c\), \(E[X]\), \(E[X^2]\), \(\operatorname{Var}(X)\), and the standard deviation.
Method. Normalize the quadratic kernel, then evaluate each moment directly. The support is wider than in the previous examples, so retain the endpoints carefully when evaluating the antiderivatives.
1. Normalize.
The kernel \(x(4-x)\) is nonnegative throughout \([0,4]\), so this constant gives a valid nonnegative density.
2. Find the mean.
3. Find the second raw moment.
4. Find variance and standard deviation.
Check. The density integrates to one, the mean \(2\) lies in \([0,4]\), and the variance is positive. The standard deviation is rounded to four decimal places. The common mistake avoided is subtracting the mean, rather than its square, from the second raw moment.
Checks That Make the Calculation More Reliable
A continuous mean and variance calculation is a sequence of related integrals. A correct-looking final number can still come from an incorrect density or a misplaced endpoint, so check the work at each stage:
- Check the density. The constant should make the integral over the full support equal to one, and the density should not be negative on that support.
- Check the integrands. For the mean, use \(x f_X(x)\); for the second raw moment, use \(x^2 f_X(x)\). Do not integrate the powers of \(x\) alone.
- Check the mean’s location. For a density supported on \([a,b]\), the mean must lie between \(a\) and \(b\).
- Check variance and units. Variance must be nonnegative and is in squared units. Standard deviation is its nonnegative square root and is in the original units.
The computational formula is convenient, but the central definition remains \(\operatorname{Var}(X)=E[(X-E[X])^2]\). Squared deviations cannot average to a negative value; if \(E[X^2]-(E[X])^2\) is negative, revisit the normalization and moment arithmetic. These steps are aligned with the SOA VEE Mathematical Statistics syllabus.
Check Your Understanding
For each density, find the normalization constant, mean, second raw moment, variance, and standard deviation. Give standard deviations to four decimal places.
- A density is \(f_X(x)=c\) on \(0\le x\le5\), and zero otherwise. (Answer: \(c=1/5\), \(E[X]=5/2\), \(E[X^2]=25/3\), \(\operatorname{Var}(X)=25/12\), standard deviation \(1.4434\).)
- A density is \(f_X(x)=cx^2\) on \(0\le x\le2\), and zero otherwise. (Answer: \(c=3/8\), \(E[X]=3/2\), \(E[X^2]=12/5\), \(\operatorname{Var}(X)=3/20\), standard deviation \(0.3873\).)
- A density is \(f_X(x)=c(2-x)\) on \(0\le x\le2\), and zero otherwise. (Answer: \(c=1/2\), \(E[X]=2/3\), \(E[X^2]=2/3\), \(\operatorname{Var}(X)=2/9\), standard deviation \(0.4714\).)
- A density is \(f_X(x)=cx(2-x)\) on \(0\le x\le2\), and zero otherwise. (Answer: \(c=3/4\), \(E[X]=1\), \(E[X^2]=6/5\), \(\operatorname{Var}(X)=1/5\), standard deviation \(0.4472\).)
- A density is \(f_X(x)=c(1+x)\) on \(-1\le x\le1\), and zero otherwise. (Answer: \(c=1/2\), \(E[X]=1/3\), \(E[X^2]=1/3\), \(\operatorname{Var}(X)=2/9\), standard deviation \(0.4714\).)