I want to prove that for $X,Y$ in $L^2$ and $E[X|Y] = Y$ and $E[Y|X]=X$ almost surely, $X=Y$ almost surely.
I came up with the following solution:
$X = E[Y|X] = E[E[X|Y]|Y] = E[X|Y] = Y$, where all of the equalities hold almost surely and the tower property was used.
Is this proof correct and did I use the fact that $X,Y$ are in $L^2$ implicitly?