σ-field expectation problem 
Let $\mathcal F$ and $\mathcal G$ be two σ-fields and suppose $\mathcal G⊂\mathcal F$. Let $X$ be an $\mathcal F$-measurable random variable and $Y$ be a $\mathcal G$-measurable random variable. Assume that $E(X^2)<∞$ and $E(Y^2)<∞$. Show that $$E(X-E(X\mid\mathcal{G}))^2\leqslant E(X-Y)^2.$$

Thank you for helping.
 A: $Y$ and $\mathbb{E}\left[X\mid\mathcal{G}\right]$ are both $\mathcal{G}$-measurable
so that: $$\mathbb{E}\left(XY\right)=\mathbb{E}\left(\mathbb{E}\left[XY\mid\mathcal{G}\right]\right)=\mathbb{E}\left(\mathbb{E}\left[X\mid\mathcal{G}\right]Y\right)$$
and likewise: $$\mathbb{E}\left(X\mathbb{E}\left[X\mid\mathcal{G}\right]\right)=\mathbb{E}\left(\mathbb{E}\left[X\mathbb{E}\left[X\mid\mathcal{G}\right]\mid\mathcal{G}\right]\right)=\mathbb{E}\left(\mathbb{E}\left[X\mid\mathcal{G}\right]^{2}\right)$$
This tells us that: $$\mathbb{E}\left(X-\mathbb{E}\left[X\mid\mathcal{G}\right]\right)\left(\mathbb{E}\left[X\mid\mathcal{G}\right]-Y\right)=$$$$\mathbb{E}\left(X\mathbb{E}\left[X\mid\mathcal{G}\right]\right)-\mathbb{E}\left(XY\right)-\mathbb{E}\left(\mathbb{E}\left[X\mid\mathcal{G}\right]^{2}\right)+\mathbb{E}\left(\mathbb{E}\left[X\mid\mathcal{G}\right]Y\right)=0$$
so that $$\mathbb{E}\left(X-Y\right)^{2}=\mathbb{E}\left(X-\mathbb{E}\left[X\mid\mathcal{G}\right]+\mathbb{E}\left[X\mid\mathcal{G}\right]-Y\right)^{2}=$$$$\mathbb{E}\left(X-\mathbb{E}\left[X\mid\mathcal{G}\right]\right)^{2}+\mathbb{E}\left(\mathbb{E}\left[X\mid\mathcal{G}\right]-Y\right)^{2}\geq\mathbb{E}\left(X-\mathbb{E}\left[X\mid\mathcal{G}\right]\right)^{2}$$
