6.2. Expected Value and Variance of Continuous Random Variables

Now that we understand how probability density functions work for continuous random variables, we need to extend our concepts of expected value and variance from the discrete world. The core ideas remain the same—we still want to measure the center and spread of a distribution— but the mathematical machinery shifts from summation to integration. This transition reveals the beautiful parallel structure between discrete and continuous probability theory.

Road Map 🧭

  • Extend expected value from discrete sums to continuous integrals.

  • Apply the Law of the Unconscious Statistician (LOTUS) for functions of continuous random variables.

  • Understand that linearity and additivity properties of expected values remain unchanged.

  • Define variance using integration and master the computational shortcut.

  • Explore properties of variance for linear transformations and sums of independent variables.

6.2.1. From Discrete Sums to Continuous Integrals

The expected value of a discrete random variable involved summing each possible value, weighted by its probability. For continuous random variables, we replace this discrete sum with a continuous integral, weighing each possible value by its probability density.

Definition

The expected value of a continuous random variable \(X\), denoted \(E[X]\) or \(\mu_X\), is the continuously weighted average of all values in its support:

\[\mu_X = E[X] = \int_{-\infty}^{\infty} x \cdot f_X(x) \, dx\]

This integral represents the “balance point” or center of mass of the probability distribution. Just as in the discrete case, values with higher probability density contribute more to the overall average.

Comparison with the Discrete Case

Discrete \(E[X]\)

Continuous \(E[X]\)

\(\sum_{x \in \text{supp}(X)} x \cdot p_X(x)\)

\(\int_{-\infty}^{\infty} x \cdot f_X(x) \, dx = \int_{\text{supp}(X)}x \cdot f_X(x) \, dx\)

The summation becomes an integration, and the probability mass function \(p_X(x)\) is replaced by the probability density function \(f_X(x)\). Although the integral is formally taken over the entire real line \((-\infty, \infty)\) in the general definition of continuous expectation, only values of \(x\) within the support contribute meaningfully to the computation, since \(f_X(x) = 0\) outside \(\text{supp}(X)\). Thus, the integral is effectively taken over the support—just as the summation is in the discrete case.

Remark: The Absolute Integrability Condition

For the expected value of \(X\) to be well-defined and finite, \(X\) must satisfy

\[\int_{-\infty}^{\infty} |x| \cdot f_X(x) \, dx < \infty.\]

All continuous distributions we encounter in this course satisfy this condition.

6.2.2. The Law of the Unconscious Statistician (LOTUS) for Continuous Random Variables

Just as in the discrete case, we often want to find the expected value of some function of a random variable, like \(E[X^2]\) or \(E[e^X]\). The Law of the Unconscious Statistician (LOTUS) extends naturally to continuous random variables.

Theorem: LOTUS

If \(X\) is a continuous random variable with PDF \(f_X(x)\), and \(g(x)\) is a function, then:

\[E[g(X)] = \int_{-\infty}^{\infty} g(x) \cdot f_X(x) \, dx\]

The Power of LOTUS

This theorem is remarkably powerful because it allows us to compute \(E[g(X)]\) directly without having to find the PDF of the new random variable \(Y = g(X)\) Instead, we simply plug \(g(x)\) into our expectation integral and use the original PDF \(f_X(x)\).

Example💡: Expected value of functions of \(X\)

Consider a continuous random variable \(X\) with PDF

\[\begin{split}f_X(x) = \begin{cases} &2x, &0 \leq x \leq 1\\ &0, & \text{ elsewhere } \end{cases}.\end{split}\]

Find \(E[X], E[X^2]\), and \(E[\sqrt{X}]\).

  • Find \(E[X]\) using the definition

    \[E[X] = \int_0^1 x \cdot (2x) \, dx = \int_0^1 2x^2 \, dx = 2 \cdot \frac{x^3}{3}\Bigg\rvert_0^1 = \frac{2}{3}\]
  • Apply LOTUS for \(E[X^2]\) and \(E[\sqrt{X}]\)

\[E[X^2] = \int_0^1 x^2 \cdot (2x) \, dx = \int_0^1 2x^3 \, dx = 2 \cdot \frac{x^4}{4}\Bigg\rvert_0^1 = \frac{1}{2}\]
\[E[\sqrt{X}] = \int_0^1 x^{1/2} \cdot 2x \, dx = \int_0^1 2x^{3/2} \, dx = 2\cdot \frac{2}{5}x^{5/2}\Bigg\rvert_{0}^1 = \frac{4}{5}\]

6.2.3. Properties of Expected Value: Unchanged by Continuity

The fundamental properties of expected value that we learned for discrete random variables apply unchanged to continuous random variables. The only difference is that we use integration instead of summation to compute the expected values.

Linearity of Expectation

For any continuous random variable \(X\) and constants \(a\) and \(b\):

\[E[aX + b] = aE[X] + b\]

Proof of linearity of expectation

\[\begin{split}\begin{align} E[aX + b] &= \int_{-\infty}^{\infty} (ax + b) \cdot f_X(x) \, dx \\ &= a\int_{-\infty}^{\infty} x \cdot f_X(x) \, dx + b\int_{-\infty}^{\infty} f_X(x) \, dx \\ &= aE[X] + b \cdot 1 \\ &= aE[X] + b \end{align}\end{split}\]

Additivity of Expectation

For any set of continuous random variables \(X_1, X_2, \cdots, X_n\),

\[E[X_1 + X_2 + \cdots + X_n] = E[X_1] + E[X_2] + \cdots + E[X_n]\]

The remarkable fact is that additivity holds regardless of any dependence between the variables.

6.2.4. Variance for Continuous Random Variables

The concept of variance also translates directly from discrete to continuous random variables.

Definition

The variance of a continuous random variable \(X\) is the expected value of the squared deviation from the mean:

\[\sigma_X^2 = \text{Var}(X) = E[(X - \mu_X)^2] = \int_{-\infty}^{\infty} (x - \mu_X)^2 \cdot f_X(x) \, dx\]

Computational Shortcut for Variance

Just as in the discrete case, we have the much more convenient computational formula:

\[\sigma_X^2 = E[X^2] - (E[X])^2\]

Standard Deviation

The standard deviation is the square root of the variance:

\[\sigma_X = \sqrt{\text{Var}(X)}\]

Example💡: Computing Variance

For the random variable \(X\) with PDF

\[\begin{split}f_X(x) = \begin{cases} &2x, &0 \leq x \leq 1\\ &0, &\text{ elsewhere } \end{cases},\end{split}\]

compute \(\text{Var}(X)\) and \(\sigma_X\).

Using \(E[X]\) and \(E[X^2]\) obtained in the previous example, apply the computational shortcut:

\[\text{Var}(X) = E[X^2] - (E[X])^2 = \frac{1}{2} - \left(\frac{2}{3}\right)^2 = \frac{1}{2} - \frac{4}{9} = \frac{9-8}{18} = \frac{1}{18}\]

Therefore, \(\sigma_X = \sqrt{1/18} = 1/(3\sqrt{2}) \approx 0.236\).

6.2.5. Properties of Variance for Continuous Random Variables

The variance properties we learned for discrete random variables apply without modification to continuous random variables.

Variance of Linear Transformations

For any continuous random variable \(X\) and constants \(a\) and \(b\):

\[\text{Var}(aX + b) = a^2 \text{Var}(X)\]

Recall that:

  • Adding a constant (\(b\)) doesn’t change how spread out a distribution is—it just shifts its location.

  • Multiplying by a constant (\(a\)) scales the variance by \(a^2\).

Variance of Sums for Independent Variables

When \(X\) and \(Y\) are independent continuous random variables:

\[\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y).\]

This extends to any number of mutually independent variables:

\[\text{Var}(X_1 + X_2 + \cdots + X_n) = \text{Var}(X_1) + \text{Var}(X_2) + \cdots + \text{Var}(X_n).\]

Be Cautious 🛑

The additivity of variances only applies when the random variables are independent. This means that the mutual independence of all terms involved must be provided or shown before the rule is applied.

For dependent variables, we need to account for covariance terms.

6.2.6. Covariance and Correlation: A Brief Introduction

When dealing with multiple continuous random variables that may be dependent, we need measures of how they vary together. The concepts of covariance and correlation also extend to continuous random variables.

Covariance

The covariance between continuous random variables \(X\) and \(Y\) is:

\[\text{Cov}(X,Y) = E[(X - \mu_X)(Y - \mu_Y)] = E[XY] - \mu_X\mu_Y\]

Correlation

The correlation coefficient is:

\[\rho_{X,Y} = \frac{\text{Cov}(X,Y)}{\sigma_X \sigma_Y}.\]

As before, correlation is unitless and bounded between -1 and +1.

Note

Working with joint distributions of continuous random variables involves multivariable calculus and is beyond the scope of this course. We’ll focus on single continuous random variables in the remainder of this chapter.

6.2.7. Bringing It All Together

Key Takeaways 📝

  1. Expected value for continuous random variables uses integration instead of summation, but represents the same concept: a weighted average using probability densities as weights.

  2. All expectation properties (LOTUS, linearity, additivity) remain unchanged—only the computational method (integration vs. summation) differs.

  3. Variance maintains the same conceptual meaning and computational shortcut.

  4. Variance properties for linear transformations and sums of independent variables apply identically to continuous random variables.

The transition from discrete to continuous random variables preserves all the fundamental relationships we’ve learned, while replacing the discrete machinery of summation with the continuous machinery of integration. This parallel structure demonstrates the elegant unity underlying probability theory, whether we’re counting discrete outcomes or measuring continuous quantities.

Exercises

  1. Basic Expected Value: For the PDF

    \[\begin{split}f_X(x) = \begin{cases} &3x^2, &0 ≤ x ≤ 1\\ &0 &\text{ elsewhere} \end{cases},\end{split}\]
    1. Find \(E[X]\).

    2. Find \(E[X^2]\).

    3. Find \(Var(X)\).

    4. Find \(E[2X + 3]\).

    5. Find \(Var(3X - 1)\).

  2. Piecewise PDF: Consider the PDF:

    \[\begin{split}f_X(x) = \begin{cases} &x/2, &0 ≤ x ≤ 2\\ &(4-x)/2, &2 < x ≤ 4\\ &0, &\text{ elsewhere} \end{cases}\end{split}\]
    1. Verify this is a legitimate PDF.

    2. Find \(E[X]\).

    3. Find \(Var(X)\).

  3. Linear Transformations: For \(X\) with \(E[X] = 5\) and \(Var(X) = 4\), find:

    1. \(E[3X - 7]\).

    2. \(\sigma_{3X - 7}\).