A problem on conditional expectation I am studying conditional expectation and found some problems. I tried to solve them to understand the subject better, but I'm stuck now.
Let $X$ be a random variable with strictly positive density (on the whole real line). Find the following conditional expectations: $E[X|X^2]$, $E[X||X|]$, $E[X|sin(X)]$.
Since these problems are given together I assume that there is some 'general' trick to solve them. Can anyone give me a hint?
 A: Recall that $E[X\mid Y]$ is defined as any random variable $u(Y)$ such that, for every measurable bounded function $v$, $E[Xv(Y)]=E[u(Y)v(Y)]$. When $Y=w(X)$, this yields the condition that, for every suitable $v$,
$$
E[Xv(w(X))]=E[u(w(X))v(w(X))].
$$
If $w:x\mapsto x^2$, then $E[Xv(X^2)]=E[u(X^2)v(X^2)]$, hence
$$
\int xv(x^2)f_X(x)\mathrm dx=\int u(x^2)v(x^2)f_X(x)\mathrm dx.
$$
Let $x=\sqrt{y}$ on $x\gt0$ and $x=-\sqrt{y}$ on $x\lt0$, then $2x\mathrm dx=\mathrm dy$ hence
$$
\int_\mathbb Rxv(x^2)f_X(x)\mathrm dx=\int_0^\infty v(y)(f_X(\sqrt{y})-f_X(-\sqrt{y}))\mathrm dy,
$$
and
$$
\int_\mathbb R u(x^2)v(x^2)f_X(x)\mathrm dx=\int_0^\infty u(y)v(y)(f_X(\sqrt{y})+f_X(-\sqrt{y}))\frac{\mathrm dy}{\sqrt{y}},
$$
By identification,
$$
u(y)=\sqrt{y}\frac{f_X(\sqrt{y})-f_X(-\sqrt{y})}{f_X(\sqrt{y})+f_X(-\sqrt{y})}.
$$
Likewise, if $w:x\mapsto|x|$,
$$
u(y)=y\frac{f_X(y)-f_X(y)}{f_X(y)+f_X(y)}.
$$
Finally, if $w:x\mapsto\sin(x)$,
$$
u(y)=\frac{\sum\limits_xxf_X(x)}{\sum\limits_xf_X(x)},
$$
where, for every $y$ in $[-1,1]$, the sums in the numerator and in the denominator are over the set $S(y)=\{x\mid\sin(x)=y\}$. This last formula for $u(y)$ when $w:x\mapsto\sin(x)$ may explain the two previous ones when $w:x\mapsto x^2$ and $w:x\mapsto|x|$.
Note that this last formula, replacing  $S(y)$ by $S_g(y)=\{x\mid g(x)=y\}$, yields $E[X\mid g(X)]$ as long as $|g'(x)|$ depends only on $g(x)$, that is, as long as $g(x_1)=g(x_2)$ implies $g'(x_1)=\pm g'(x_2)$ (otherwise the sums need to be weighted by the values of $|g'(x)|$ for every $x$ in $S_g(y)$).
A: Let's suppose the density is f(x).  Then the second is $$E[X|\;|X|=y] = \dfrac{\displaystyle\sum_{x:|x|=y} xf(x)}{\displaystyle\sum_{x:|x|=y} f(x)}$$  and similarly for the other two
You could simplify this slightly to $y\dfrac{f(y)-f(-y)}{f(y)+f(-y)}$ and something broadly similar for the first question, but this is not so easy for the third.
