Proof of the law of total variance

844 Views Asked by At

I'm looking at the proof here, and am confused about the step from line 2 to line 3. Specifically, why do they drop the conditioning on $X$ and claim $\mathbb{E}[Y^2|X] = \operatorname{var}[Y|X] + \mathbb{E}[Y]^2$?

I would expect this to be true instead: $\mathbb{E}[Y^2|X] = \operatorname{var}[Y|X] + \mathbb{E}[Y|X]^2$

1

There are 1 best solutions below

1
On

Indeed, they should have left it as a conditional

$$\def\V{\operatorname{\mathsf {Var}}}\def\E{\operatorname{\mathsf E}}\begin{align}\V(Y)&=\E(Y^2)-\E^2(Y)&&\text{definition of variance}\\&=\E(\E(Y^2\mid X))-\E^2(\E(Y\mid X))&&\text{law of iterated expectation}\\&=\E\big(\V(Y\mid X)+\E^2(Y\mid X)\big)-\E^2(\E(Y\mid X))&&\text{definition of variance}\\&=\E(\V(Y\mid X))+\E(\E^2(Y\mid X))-\E^2(\E(Y\mid X))&&\text{linearity of expectation}\\&=\E(\V(Y\mid X))+\V(\E(Y\mid X))&&\text{definition of variance} \end{align}$$