Let $X,Y: \Omega \to \mathbb{R}$ be two discrete random variables on a probability space $(\Omega, \mathcal{F}, \mathbb{P})$, and $\mathbb{E}[|X|]< \infty$.
Suppose that $\mathbb{E}[X|Y=y] = y^2$ for all $y \in \mathbb{R}$ with $\mathbb{P}(Y=y) > 0$. Is the following true?
$$\mathbb{E}[X|Y] = Y^2 \quad\mathbb{P}-a.e.$$
If it is true, I have to show that $\{\mathbb{E}[X|Y] \neq Y^2\}$ has probability $0$.
Suppose $\omega \in \{\mathbb{E}[X|Y] \neq Y^2\}$. Write $\mathbb{E}[X|Y] = g \circ Y$ with $g(y) = \mathbb{E}[X|Y = y]$ and also write $m= Y(\omega)$. Then
$$\mathbb{E}[X\mid Y](\omega) = g(m) = \mathbb{E}[X|Y=m] \neq m^2$$
and thus $$\mathbb{P}(Y= Y(\omega)) = \mathbb{P}(Y=m) = 0$$
Thus $\omega \in \{\omega \in \Omega \mid \mathbb{P}(Y = Y(\omega)) = 0\}$. I don't think this gives anything useful.
Any ideas how I can solve this?
Let $g(y)\equiv\mathbb{E}[X\mid Y=y]$. By definition, $\mathbb{E}\left[X\mid Y\right]\equiv g(Y)$.
Suppose $g(y)=y^{2}$ for all $y$ such that $\mathbb{P}(Y=y)>0$. Let $$E\equiv\left\{\omega\colon\mathbb{P}(Y=Y(\omega))>0\right\}.$$ Then, $g(Y)=Y^{2}$ on $E$. Moreover, since $Y$ is discrete, we can write $E$ as a countable union of disjoint sets $E_{y}\equiv\{\omega\colon Y(\omega)=y\}$. In particular, $$ \mathbb{P}(E) =\mathbb{P}\left(\bigcup_{y\colon\mathbb{P}(Y=y)>0}E_{y}\right) =\sum_{y\colon\mathbb{P}(Y=y)>0}\mathbb{P}(Y=y) =\sum_y\mathbb{P}(Y=y) =1. $$
Remark. There is nothing special about the choice of $y \mapsto y^2$.