Course contentsShow
← Mathematics
Lesson 2935 of 3,12158. Joint and Limit BehaviorFree lesson

The Law of Total Probability for Random Variables

Use marginal distributions to compute unconditional probabilities and expectations by conditioning on another variable.

The Law of Total Probability for Random Variables

You'll learn how to compute unconditional probabilities and expectations by cleverly conditioning on another variable and then "averaging out" over all its possibilities.

The Core Idea

Imagine you want to find the overall expected value of some random variable (Y), but it's complicated to compute directly. The Law of Total Probability (also called the Law of Total Expectation when dealing with expectations) says you can break this problem into simpler pieces by conditioning on another variable (X).

Here's the magic formula:

E[Y]=E[E[Y∣X]]E[Y] = E[E[Y|X]]

In words: The unconditional expectation of (Y) equals the expectation of the conditional expectation of (Y) given (X).

Think of it like this: First, compute (E[Y|X=x]) for each possible value of (x). This gives you a function of (x). Then take the expectation of that function with respect to (X)'s distribution—essentially a weighted average where weights come from the marginal distribution of (X).

Why This Works

You're partitioning the sample space based on the values of (X). Within each partition, you compute the expected value of (Y). Then you average these conditional expectations according to how likely each partition is.

For discrete (X): E[Y]=∑xE[Y∣X=x]⋅P(X=x)E[Y] = \sum_x E[Y|X=x] \cdot P(X=x)

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

This extends to probabilities too: (P(Y \in A) = E[P(Y \in A | X)]).

Key Takeaway: The Law of Total Probability lets you compute hard-to-find unconditional quantities by conditioning on a helpful variable and then integrating/summing over its marginal distribution.