Let $X,Y$ be integrable random variables defined in a probability space $(\Omega,F,\mathbb{P})$. Assume $X=Y$ a.s., prove that a.s. we have $\mathbb{E}(X|Y)=Y$ and $\mathbb{E}(Y|X)=X$
My attempt: I know the definition of conditional expectation: $$\mathbb{E}(X|Y=y)=\frac{\mathbb{E}(X\mathbb{1}_{Y=y})}{\mathbb{P}(Y=y)}$$ Also the one of conditional probability: $$\mathbb{P}(X|Y)=\frac{\mathbb{P}(X\cap Y)}{\mathbb{P}(Y)}$$ So we can rewrite the conditional expectation as $$\mathbb{E}(X|Y=y)=\frac{\mathbb{E}(X\mathbb{1}_{Y=y})\mathbb{P}(X|Y=y)}{\mathbb{P}(X\cap \{Y=y\})}$$ Furthermore, since $X=Y$ a.s., we have $\mathbb{P}(X=Y)=1$. Where can I put this condition in my equation? Can I say that $\mathbb{P}(X\cap \{Y=y\})=\mathbb{P}(X=Y=y)$? I don't think it is quite right... I don't know how to obtain that $\mathbb{E}(X|Y)=Y$, and I guess that to find $\mathbb{E}(Y|X)=X$ is just analogous. Any suggestion pls?
The conditional expecation of a random variable $X$ conditioned on a sigma-Algebra $\mathcal{G}$, $$\mathbb{E}[X \vert \mathcal{G}]$$ is defined as the $\mathcal{G}$-measurable $L^1$ random variable such that
$$\int_A \mathbb{E}[X \vert \mathcal{G}] d \mathbb{P} = \int_A X d\mathbb{P},$$ for all $A$ in $\mathcal{G}$, where this definition holds up to $a.s.$-uniqueness.
Now since $X=Y$ $a.s.$ we have
$$\int_A Y d \mathbb{P} = \int_A X d\mathbb{P}$$,
and of course $Y$ is $Y-$measurable so $$\mathbb{E}[X \vert Y] = Y \ \ a.s.$$