I have to show for two random variables $X, Y$ with $\Bbb E[X\mid\mathcal{G}] = Y$ and $\Bbb E[X^2] =\Bbb E[Y^2] < \infty $ that they are almost surely $X = Y$.
I believe that the formula proven here has to be used.
Another result we can use is that $\Bbb E[X Y] = \Bbb E\bigl[X \Bbb E[X\mid \mathcal{G}]\bigr] = \Bbb E\bigl[\Bbb E[X\mid \mathcal{G}]^2\bigr] = \Bbb E[Y^2]$, so we get the following formula:
$$\Bbb E\bigl[(Y-\Bbb E[X \mid \mathcal{F}])^2\bigr]=\Bbb E\bigl[(X-\Bbb E[X \mid \mathcal{F}])^2\bigr] \quad \text{ for any } \mathcal{F}\subseteq \mathcal{G}$$
I don't know if that is helpful... Do you have any ideas how to proceed?
Using what you said (i.e. $\mathbf{E}[XY] = \mathbf{E}[Y^2]$), we have
$$\mathbf{E}[(X - Y)^2] = \mathbf{E}[X^2] - 2\mathbf{E}[XY] + \mathbf{E}[Y^2] = \mathbf{E}[X^2] - \mathbf{E}[Y^2] = 0$$
the result follows immediately from the positivity of $(X-Y)^2$.