[proofplan]
We decompose the centered [random variable](/page/Random%20Variable) $X - \mathbb E[X]$ into the sum of the fluctuation around its conditional mean and the fluctuation of the conditional mean around the global mean. Expanding the square gives three terms. The first term is the expectation of the conditional variance, the second is the variance of the [conditional expectation](/page/Conditional%20Expectation), and the mixed term vanishes because $X - \mathbb E[X \mid \mathcal G]$ has conditional expectation zero given $\mathcal G$.
[/proofplan]
[step:Introduce the conditional mean and center the decomposition]
Let
\begin{align*}
Y := \mathbb E[X \mid \mathcal G]
\end{align*}
denote the conditional expectation of $X$ given $\mathcal G$, and let
\begin{align*}
m := \mathbb E[X].
\end{align*}
Since $X \in L^2(\Omega,\mathcal F,\mathbb P)$, the conditional expectation $Y$ belongs to $L^2(\Omega,\mathcal G,\mathbb P)$, and hence all random variables below are integrable. By the defining property of conditional expectation applied to the constant function $1$, we have
\begin{align*}
\mathbb E[Y] = \mathbb E[X] = m.
\end{align*}
Therefore
\begin{align*}
X - m = (X - Y) + (Y - m).
\end{align*}
[guided]
We separate the total deviation of $X$ from its mean into two pieces. Define
\begin{align*}
Y := \mathbb E[X \mid \mathcal G]
\end{align*}
to be the conditional mean of $X$ given the information encoded by $\mathcal G$, and define
\begin{align*}
m := \mathbb E[X].
\end{align*}
Because $\mathbb E[X^2] < \infty$, the random variable $X$ is square-integrable, and conditional expectation preserves square-integrability. Thus $Y \in L^2(\Omega,\mathcal G,\mathbb P)$, so the quantities $(X-Y)^2$, $(Y-m)^2$, and $(X-Y)(Y-m)$ are integrable.
The defining property of conditional expectation says that integrating $Y=\mathbb E[X \mid \mathcal G]$ over any event in $\mathcal G$ gives the same result as integrating $X$ over that event. Applying this to the whole event $\Omega \in \mathcal G$ gives
\begin{align*}
\mathbb E[Y] = \mathbb E[X] = m.
\end{align*}
Now write the centered variable $X-m$ as
\begin{align*}
X - m = X - Y + Y - m = (X - Y) + (Y - m).
\end{align*}
The term $X-Y$ is the residual after conditioning, while $Y-m$ is the fluctuation of the conditional mean itself.
[/guided]
[/step]
[step:Expand the square and isolate the mixed term]
Taking squares and expectations gives
\begin{align*}
\operatorname{Var}(X)
&= \mathbb E[(X-m)^2] \\
&= \mathbb E[((X-Y)+(Y-m))^2] \\
&= \mathbb E[(X-Y)^2]
+ 2\mathbb E[(X-Y)(Y-m)]
+ \mathbb E[(Y-m)^2].
\end{align*}
It remains to identify the first and third terms and prove that the mixed term is zero.
[/step]
[step:Show that the mixed term vanishes by conditioning on $\mathcal G$]
The random variable $Y-m$ is $\mathcal G$-measurable and square-integrable. Since $Y=\mathbb E[X \mid \mathcal G]$, the defining property of conditional expectation gives
\begin{align*}
\mathbb E[(Y-m)X] = \mathbb E[(Y-m)Y].
\end{align*}
Subtracting the right-hand side from the left-hand side yields
\begin{align*}
\mathbb E[(X-Y)(Y-m)]
&= \mathbb E[(Y-m)X] - \mathbb E[(Y-m)Y] \\
&= 0.
\end{align*}
Therefore
\begin{align*}
\operatorname{Var}(X)
=
\mathbb E[(X-Y)^2]
+
\mathbb E[(Y-m)^2].
\end{align*}
[/step]
[step:Identify the two remaining terms as conditional and marginal variances]
By the definition of conditional variance,
\begin{align*}
\operatorname{Var}(X \mid \mathcal G)
=
\mathbb E[(X-Y)^2 \mid \mathcal G].
\end{align*}
Taking expectations and using the [tower property of conditional expectation](/theorems/1150) gives
\begin{align*}
\mathbb E[\operatorname{Var}(X \mid \mathcal G)]
&=
\mathbb E\left[\mathbb E[(X-Y)^2 \mid \mathcal G]\right] \\
&=
\mathbb E[(X-Y)^2].
\end{align*}
Since $\mathbb E[Y]=m$, the variance of $Y=\mathbb E[X \mid \mathcal G]$ is
\begin{align*}
\operatorname{Var}(\mathbb E[X \mid \mathcal G])
&=
\operatorname{Var}(Y) \\
&=
\mathbb E[(Y-m)^2].
\end{align*}
Substituting these identities into the previous equality gives
\begin{align*}
\operatorname{Var}(X)
=
\mathbb E[\operatorname{Var}(X \mid \mathcal G)]
+
\operatorname{Var}(\mathbb E[X \mid \mathcal G]).
\end{align*}
This is the desired identity.
[/step]