# What‘s wrong with my proof of the Law of Total Variance?

According to the Law of Total Variance, $$\operatorname{Var}(X)=\operatorname{E}(\operatorname{Var}(X\mid Y)) + \operatorname{Var}(\operatorname{E}(X\mid Y))$$

When trying to prove it, I write

\begin{aligned} \operatorname{Var}(X) &= \operatorname{E}(X - \operatorname{E}X)^2 \\ &= \operatorname{E}\left\{\operatorname{E}\left[(X - \operatorname{E}X)^2\mid Y\right]\right\} \\ &= \operatorname{E}(\operatorname{Var}(X\mid Y)) \end{aligned}

What's wrong with it?

The third line is wrong, because you don't have $$\text{E}[X|Y]$$ in the second line. For example, if $$Y$$ is Bernoulli(1/2) and $$X$$ is 1 if $$Y$$ is 1 and -1 if $$Y$$ is 0, then $$\text{E}[(X-\text{E}[X|Y])^2|Y] = 0$$ (this is what you want) because $$Y$$ is totally informative of $$X$$, but what you have will give you $$\text{E}[(X-\text{E}[X])^2|Y] = \text{E}[(X-0)^2|Y] = \text{E}[X^2|Y] = 1 \ne 0$$.
The transition from the second to the third line does not follow. Since $$\mathbb{E}(X) \neq \mathbb{E}(X|Y)$$ you have:
$$\mathbb{E}[ (X - \mathbb{E}(X))^2 | Y ] \neq \mathbb{E}[ (X - \mathbb{E}(X|Y))^2 | Y ] = \mathbb{E}[ \mathbb{V}(X|Y) ].$$
In the special case where $$\mathbb{E}(X) = \mathbb{E}(X|Y=y)$$ for all $$y \in \mathbb{R}$$ your working and result would hold, and would be a special case of the more general result.
\require{cancel} \begin{aligned} \operatorname{Var}(X) &= \operatorname{E}(X - \operatorname{E}X)^2 \\ &= \operatorname{E}\left(\operatorname{E}\left[(X - \operatorname{E}X)^2\mid Y\right]\right) \\ &\ne \operatorname E\left( \operatorname E\left[ (X-\operatorname E(X\mid Y))^2 \right] \mid Y \right) \\ &= \operatorname{E}(\operatorname{Var}(X\mid Y)) \end{aligned}