Course contentsShow
← Mathematics
Lesson 2854 of 3,12156. Probability — Random VariablesFree lesson

Expectation of Functions of Random Variables

Calculate E[g(X)] for functions g using the Law of the Unconscious Statistician without finding the distribution of g(X).

Expectation of Functions of Random Variables

You'll learn: How to calculate the expected value of a transformed random variable without first finding its distribution.

The Core Idea

Suppose you have a random variable X with a known PMF (discrete) or PDF (continuous), and you want to find the expected value of some function g(X) — maybe X², eˣ, or √X.

The naive approach would be to:

  1. Find the distribution of the new random variable Y = g(X)
  2. Calculate E[Y] from this new distribution

But there's a shortcut! The Law of the Unconscious Statistician (LOTUS) lets you calculate E[g(X)] directly using X's distribution, without ever finding g(X)'s distribution.

How It Works

For discrete X: E[g(X)]=∑all xg(x)⋅P(X=x)E[g(X)] = \sum_{\text{all } x} g(x) \cdot P(X = x)

For continuous X: E[g(X)]=∫−∞∞g(x)⋅fX(x) dxE[g(X)] = \int_{-\infty}^{\infty} g(x) \cdot f_X(x) \, dx

You simply weight each transformed value g(x) by the original probability/density at x.

Why "Unconscious"?

The name is tongue-in-cheek: you're computing an expectation "as if" you forgot that g(X) is itself a random variable, treating it instead as just a function applied to X's values.

Example

If X is the roll of a fair die and g(X) = X², then: E[X2]=12⋅16+22⋅16+32⋅16+42⋅16+52⋅16+62⋅16=916E[X²] = 1²·\frac{1}{6} + 2²·\frac{1}{6} + 3²·\frac{1}{6} + 4²·\frac{1}{6} + 5²·\frac{1}{6} + 6²·\frac{1}{6} = \frac{91}{6}

No need to find the PMF of X² first!

Key Takeaway: LOTUS lets you calculate E[g(X)] by applying g directly within the expectation formula using X's original distribution—a powerful computational shortcut.