Prove that two random variables are equal almost surely

conditional-expectationmeasure-theoryprobability theory

This is a problem from Durret's probability textbook. Show that if $X,Y$ are random variables with $E(Y|\mathcal{G})=X$ and $EY^2=EX^2\leq\infty$, then $X=Y$ a.s.

My question is, by the definition of conditional expectation, $\forall A\in \mathcal{F}$,
$$\int_{A} YdP = \int_{A} E(Y|\mathcal{G})dP=\int_{A} XdP$$
Doesn't this already imply that $X=Y$ a.s? Why do we need the condition that $EY^2=EX^2\leq\infty$?

Best Answer

The equation $\int_A XdP=\int_AYDP$ holds only for $A \in \mathcal G$ and not for all $A \in \mathcal F$. So we cannot conlude that $X=Y$ a.s. using just the definition.

We have $EY^{2}=EX^{2}=E(E(Y|\mathcal G))^{2}\leq E E(Y^{2}|\mathcal G)) =EY^{2}$. Hence, we must have equality throughout. And the fact that $EE(Y|\mathcal G)^{2}=EE(Y^{2}|\mathcal G)$ a.s implies that $E(Y-E(Y\mathcal G))^{2}=0$ as seen by expanding the square. It follows now that $Y$ is (a.s equal to a r.v. which is) $\mathcal G$ measurable and hence $X=E(Y|\mathcal G)=Y$ a.s.