# Conditional Expectation of X given X^2

What can we say about $E[X|X^2]$ in general? And if $X$ has density $f$ respect the Lebesgue measure?

I also obtained the same result as @sds:

Notice that $\sigma(X^{2}) = \sigma(|X|)$. So by definition, for any $A \in \sigma(|X|)$ we have

$$\int_{A} \Bbb{E} [X | X^{2}] \, d\Bbb{P} = \int_{A} X \, d\Bbb{P}.$$

On the other hand, since $\Bbb{E}[X | X^{2}]$ is $\sigma(|X|)$-measurable, there exists a Borel-measurable function $g : \Bbb{R} \to \Bbb{R}$ such that $\Bbb{E}[X|X^{2}] = g(|X|)$, i.e., $g(|X|)$ is a version of this conditional expectation. So if $X$ has density $f(x)$, then the density of $|X|$ is

$$\frac{d}{dx} \Bbb{P}(|X| \leq x) = \frac{d}{dx} (F(x) - F(-x)) = f(x) + f(-x), \quad x \geq 0$$

and for any event $A = \{ |X| \leq a \}$ for $a > 0$,

$$\int_{0}^{a} g(x) (f(x) + f(-x)) \, dx = \int_{A} g(|X|) \, d\Bbb{P} = \int_{A} X \, d\Bbb{P} = \int_{-a}^{a} x f(x) \, dx.$$

Differentiation both sides with respect to $a$, we have

$$g(x) = x \frac{f(x) - f(-x)}{f(x) + f(-x)} \quad \text{a.s.}$$

Therefore it follows that

$$\Bbb{E}(X | X^{2}) = g(|X|) = |X| \frac{f(|X|) - f(-|X|)}{f(|X|) + f(-|X|)}.$$

By definition, \begin{align} E[X\;|\;X^2=u^2] &= \sum_x xP(X=x\;|\;X^2=u^2) \\ & = u\frac{P(X=u \;\&\; X^2=u^2)}{P(X^2=u^2)}-u\frac{P(X=-u \;\&\; X^2=u^2)}{P(X^2=u^2)} \\ & =u\frac{P(X=u)-P(X=-u)}{P(X=u)+P(X=-u)} \end{align}

The last step is because $$P(X^2=u^2)=P(X=u)+P(X=-u)$$ when $$u\ne 0$$ (and when $$u=0$$, we multiply by $$u$$ anyway) and \begin{align} P(X=u \;\&\; X^2=u^2) &= P(X=u) \\ P(X=-u \;\&\; X^2=u^2) &= P(X=-u) \\ \end{align}

If $$X$$ has a density $$f$$, then

$$E[X\;|\;X^2=u^2] = u\frac{f(u)-f(-u)}{f(u)+f(-u)}$$

by taking a limit.

Let $$h:\mathbb{R}\rightarrow\mathbb{R}$$ be a measurable function such that $$h(X)\in L_1(P)$$.

If the law of $$X$$ has density $$f$$ with respect to the Lebesgue measure on $$\mathbb{R}$$, then $$P[X^2\leq y]=\int^{\sqrt{y}}_{-\sqrt{y}}f(x)\,dx$$ ans so, the law of $$X^2$$ also has density, namely $$f_{X^2}(y)=P[X^2\in dy](y)=\frac{f(-\sqrt{y})+f(\sqrt{y})}{2\sqrt{y}}\mathbb{1}_{(0,\infty)}(y)$$ For any bounded measurable function $$g:(0,\infty)\rightarrow\mathbb{R}$$ Set $$H(X^2)=E[h(X)|X^2]$$. Then \begin{align} E[g(X^2)h(X)]=E\big[g(X^2)H(X^2)\big] \tag{1}\label{one} \end{align} The left hand-side of the expression above is \begin{align} \int_{\mathbb{R}} g(x^2)h(x)f(x)\,dx &=\int^0_{-\infty}+\int^\infty_0 g(x^2)h(x)f(x)\,dx\\ &=\int^\infty_0 g(u)h(-\sqrt{u})f(-\sqrt{u})\frac{du}{2\sqrt{u}}+\int^\infty_0 g(u)h(\sqrt{u})f(\sqrt{u})\frac{du}{2\sqrt{u}}\\ &=\int^\infty_0 g(u)\frac{h(-\sqrt{u})f(-\sqrt{u})+h(\sqrt{u})f(\sqrt{u})}{f(-\sqrt{u})+f(\sqrt{u})}\frac{f(-\sqrt{u})+f(\sqrt{u})}{2\sqrt{u}}\,du\\ &=\int^\infty_0g(u)\frac{h(-\sqrt{u})f(-\sqrt{u})+h(\sqrt{u})f(\sqrt{u})}{f(-\sqrt{u})+f(\sqrt{u})}f_{X^2}(u)\,du \end{align} The right-hanside of \eqref{one} is $$\int^\infty_0 g(u) H(u) f_{X^2}(u)\,du$$ Putting things together, we obtain that \begin{align} H(X^2)=E[h(X)|X^2]&=\frac{h(-\sqrt{X^2})f(-\sqrt{X^2})+h(\sqrt{X^2})f(\sqrt{X^2})}{f(-\sqrt{X^2})+f(\sqrt{X^2})}\\ &=\frac{h(-|X|)f(-|X|)+h(|X|)f(|X|)}{f(-|X|)+f(|X|)} \end{align} In particular, if $$h(y)=y$$ and $$X^2\in L_1(P)$$

$$E[X|X^2]=|X|\frac{(f(|X|)-f(|X|))}{f(-|X|)+f(|X|)}$$