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

Given $X,Y \in L^2(\Omega,\mathscr{F},\Bbb{P})$ such that

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

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

show that $\Bbb{P}(X = Y ) = 1.$

$Attempt:$

I can see that $\mathbb{E}[X|Y] = Y$ means

$$\int_{\{Y\in{A}\}}X \, d\Bbb{P} = \int_{\{Y\in{A}\}}Y \, d\Bbb{P}$$ for any $A \subset{\Bbb{R}}$ Borel, so

$$\int_{\{Y\in{A}\}}X - Y \, d\Bbb{P} = 0$$ over any such sets. Similarly for sets of the form $\{X \in A \}$.

Now if I could show that $\int_U X - Y \, d\Bbb{P} = 0$ for any set $U \subset \Omega$ of the form $\{X \lt a, Y \lt b\}$ for $a,b \in \Bbb{R}$ then I'd be done, because sets of that form are a $\pi$-system that generates $\sigma(X,Y)$, so I'd have (by a lemma) that the integral of $X-Y$ vanishes on all $\sigma(X,Y)$ sets - so of course, it would be zero. But I can't work out how to do that.

I'm given the hint that $$\int_{ \{ X \gt c, Y \le c \} } X - Y \, d\Bbb{P} + \int_{ \{ X \le c, Y \le c \} } X - Y \, d\Bbb{P} = 0 \; \text{for all} \; c$$

because that's the integral over $\{Y\le c\}$, a set of the above form. With the condition that $X$ and $Y$ are integrable, this is exercise 9.2 in Williams' "Probability with Martingales". Driving me up the wall to get so stuck on what seems such a simple exercise!

• Williams asks for the case when X and Y are integrable, not necessarily square integrable. The method to solve this case is quite different from the one used in the accepted answer and, indeed, fully uses the hint provided in the book and recalled in your question.
– Did
Apr 15, 2015 at 19:38
• Damn you're right. I don't know why I read $L^2$ , I guess I've been doing too much Hilbert spaces. Apr 15, 2015 at 20:43
• Jun 23, 2019 at 20:12
• math.stackexchange.com/q/666843/321264 Mar 9, 2020 at 10:45

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. • Absolutely wonderful, thank you. Didn't need to faff around with integrals over this set or that one. Apr 15, 2015 at 19:16 • @LatimerLeviosa, You are welcome. – ki3i Apr 15, 2015 at 19:22 • @Did, I haven't looked at Williams; I simply used square-integrability as that was what the OP indicated. Yes, for$\mathbb L^1(P)$the proof is indeed different. – ki3i Apr 15, 2015 at 19:42 • I just realised that I did want$L^1$after all, feeling foolish. I'm gonna change the question and I guess I have to dis-accept your answer, but I've still given a +1 so hope that's okay! If you or anyone else could give the$L^1$case that'd be great... Apr 15, 2015 at 20:50 • @LatimerLeviosa Not the thing to do, leave the$L^2\$ condition and, if you want to see Williams' exercise solved, ask another question.
– Did
Apr 15, 2015 at 20:51