Given $\mathbb{E}[X|Y] = Y$ a.s. and $\mathbb{E}[Y|X] = X$ a.s. show $X = Y$ a.s.

Solution 1:

Since

$\mathbb E[X^2] = \mathbb E[X\mathbb E[Y|X]] = \mathbb E[\mathbb E[XY|X]] = \mathbb E[XY]= \mathbb E[\mathbb E[XY|Y]] = \mathbb E[Y\mathbb E[X|Y]] = \mathbb E[Y^2], $

observe that $$ \mathbb E[(X-Y)^2]=\mathbb E[X^2+Y^2-2XY]=0, $$

which implies that $X$ and $Y$ differ on a set of measure zero.


For the weaker condition where $X$ and $Y$ are merely integrable we proceed as follows. Choose an arbitrary rational number $c\in\mathbb Q$. Note that

$$ \mathbb E[(X-Y){\bf 1}_{Y\leqslant c}]=\mathbb E[(X-Y){\bf 1}_{Y\leqslant c}{\bf 1}_{X\leqslant c}]+\mathbb E[(X-Y){\bf 1}_{Y\leqslant c}{\bf 1}_{X> c}]\tag{1} $$ Reversing the roles of $X$ and $Y$ gives $$ \mathbb E[(X-Y){\bf 1}_{X\leqslant c}]=\mathbb E[(X-Y){\bf 1}_{X\leqslant c}{\bf 1}_{Y\leqslant c}]+\mathbb E[(X-Y){\bf 1}_{X\leqslant c}{\bf 1}_{Y> c}]\tag{2} $$ The lhs of each of (1) and (2) is zero, since $\mathbb E[(X-Y){\bf 1}_{X\leqslant c}]=\mathbb E[(X-\mathbb E[X|Y]){\bf 1}_{X\leqslant c}]=$$\mathbb E[X{\bf 1}_{X\leqslant c}]-\mathbb E[X{\bf 1}_{X\leqslant c}]=0$, for instance. This, in turn, implies from (1) and (2) that $$ \mathbb E[(X-Y){\bf 1}_{X\leqslant c}{\bf 1}_{Y> c}]=\mathbb E[(X-Y){\bf 1}_{Y\leqslant c}{\bf 1}_{X> c}],\tag{3} $$

a proposition that equates a surely non-positive number to a surely non-negative number. Thus, the lhs and rhs of (3) are surely zero. The events $[X\leqslant c]\cap[Y> c]$ and $[Y\leqslant c]\cap[X> c]$, therefore, must each be null events. But this holds for all $c$, so that (by countable unions) the events

$$[X<Y]=\bigcup_{c\in\mathbb Q}[X\leqslant c]\cap[Y> c]\ \ \text{and}\ \ [Y<X]=\bigcup_{c\in\mathbb Q}[Y\leqslant c]\cap[X> c]$$

are also null events. That is, $[X\ne Y]$ is a null event. This completes the proof.