I am trying to use the law of total variance which is

$$\operatorname{Var}(X) = \text{Var}(E(X\mid Y)) + E(\operatorname{Var}(X\mid Y))$$

But I honestly have no idea how to compute either one of these terms. I have the following example:

Let $y$ be the value you get when rolling a 4-sided die. Then you roll $y$ 6-sided dice. Let $x$ be the sum of all the values. What is the variance of $x$?

I know that $E(y) = 5/2$ and $\operatorname{Var}(y) = 5/4$ by use of $\operatorname{Var}(y) = E(y^2) - E(y)^2$, but I don't know how to compute the conditional terms properly above.

I already know the answer is $1085/48$ but want to know how to get there.


I'm going to follow the notation you used initially and use capital $X$ and capital $Y$ rather than $x$ and $y$ for the random variables.

$Y=1,\,2,\,3,\,\text{ or } 4$ each with probability $\dfrac 1 4$.

$\operatorname{E}(Y) = 2.5$ and $\operatorname{var}(Y) = 1.25$.

$X$ is the sum of the outcomes when $Y$ dice are thrown.

The outcome when one die is thrown has expectation $3.5$ and variance $\dfrac{35}{12} = 2.916666\ldots\,$.

$$ \operatorname{E}(X\mid Y) = \underbrace{3.5 + \cdots + 3.5}_{Y \text{ terms}} = 3.5Y. $$ $$ \operatorname{var}(X\mid Y) = \underbrace{\frac{35}{12} + \cdots + \frac{35}{12}}_{Y \text{ terms}} = \frac{35}{12} Y. $$ So $$ \operatorname{var}(\operatorname{E}(X\mid Y)) = \operatorname{var}(3.5 Y) = 3.5^2 \operatorname{var}(Y) = 3.5^2 \times 1.25. $$ $$ \operatorname{E}(\operatorname{var}(X\mid Y)) = \operatorname{E}\left( \frac{35}{12} Y \right) = \frac{35}{12} \operatorname{E}(Y) = \frac{35}{12}\times 2.5. $$


The way to evaluate the nested expectations and variances is to regard $y$ as fixed (deterministic) in the inner calculation, then regard it as random in the outer.

So for example, if you roll $y$ 6-sided dice (that are fair and numbered from $1$ to $6$), and $X$ represents the sum of the values rolled, then $$\operatorname{E}[X \mid Y] = \operatorname{E}[X_1 + X_2 + \cdots + X_Y \mid Y] = \sum_{i=1}^Y \operatorname{E}[X_i] = \frac{7}{2} Y,$$ where $X_i$ is the roll of the $i^{\rm th}$ six-sided die. Since each such roll is independent and identically distributed, with mean $7/2$, we obtain the above result. Then we calculate the variance of this expression: $$\operatorname{Var}[7Y/2] = \frac{49}{4} \operatorname{Var}[Y] = \ldots,$$ which I leave to you to finish from your own previous calculations.

Similarly, $$\operatorname{Var}[X \mid Y] = \operatorname{Var}[X_1 + X_2 + \cdots + X_Y \mid Y] \overset{\text{ind}}{=} \sum_{i=1}^Y \operatorname{Var}[X_i],$$ where in this case we are able to claim that the variance of the conditional sum is equal to the sum of the variances only because of the independence of the $X_i$s.

The takeaway is that the inner calculation will always result in a function of the random variable on which the conditioning takes place.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.