Find conditional expectation $\mathbb{E}(Y|X)$. Let $\Omega = [-1/2, 1/2]$, and $\mathbb{P}$ be Lebesgue measure, and $\mathscr{F}$ be the set of Borel sets on $[-1/2, 1/2]$. Knowing that $X(\omega) = \omega^2$, and $Y(\omega)=I_{[-\frac{1}{2},0]}(\omega) + 2I_{[\frac{1}{4},\frac{1}{2}]}(\omega)$ find $\mathbb{E}(Y|X)$.
What I tried to do is find the density of $Y|X$, which can be denoted as $P(Y=k|X=x)=\frac{f_{X|Y=k}(x)P(Y=k)}{f_X(x)}$. The thing is I cannot find the density $f_{X|Y=k}(x)$, even though I am able to find $\mathbb{E}(X|Y)$.
Any tips on how to tackle this problem?
 A: Intuitively, if $X(\omega) \in [0, 1/16)$, then $\omega \in (-1/4, 1/4)$, under which case $Y(\omega) = 1$ if $\omega \in (-1/4, 0]$ and $Y(\omega) = 0$ if $\omega \in (0, 1/4]$, hence 
$$E[Y|X]_\omega = (1 \times 1/4 + 0 \times 1/4) \times 2 = 1/2.$$ 
(Notice that given $\omega$ is restricted to $(-1/4, 1/4)$, the probability space shrank.) With a similar argument, we can show that if $X(\omega) \in [1/16, 1/4]$, or $|\omega| > 1/4$, then 
$$E[Y|X]_\omega = (1 \times 1/4 + 2 \times 1/4) \times 2 = 3/2.$$
In a compact way, we obtain that 
$$\boxed{E[Y|X]_\omega = \frac{1}{2}I_{[0, 1/16)}(X(\omega)) + \frac{3}{2}I_{[1/16, 1/4]}(X(\omega)).} \tag{$*$}$$
To show $(*)$ indeed gives $E[Y|X]$ rigorously, we need to check it is $\sigma(X)$-measurable (which is obvious in view of the right hand side of $(*)$ is a function of $X$) and for any $H \in \sigma(X)$, it holds that
$$\int_H \left[\frac{1}{2}I_{[0, 1/16)}(X(\omega)) + \frac{3}{2}I_{[1/16, 1/4]}(X(\omega))\right] dP = \int_H Y dP. \tag{$**$}$$
To show $(**)$, take $H = [\omega: X(\omega) \leq x] = [-\sqrt{x}, \sqrt{x}]$ for any fixed $x \in [0, 1/4]$ as it represents a general element in $\sigma(X)$. Straightforward calculation gives that (where $\lambda$ denotes the Lebesgue measure):
\begin{align}
\int_H Y dP = \sqrt{x} + 2\lambda((0, \sqrt{x}] \cap [1/4, 1/2]) \tag{1}
\end{align}
and
\begin{align}
& \int_H \left[\frac{1}{2}I_{[0, 1/16)}(X(\omega)) + \frac{3}{2}I_{[1/16, 1/4]}(X(\omega))\right] dP \\
= & \frac{1}{2}\lambda([-\sqrt{x}, \sqrt{x}] \cap (-1/4, 1/4)) + \frac{3}{2}\lambda([-\sqrt{x}, \sqrt{x}] \cap [[-1/2, -1/4] \cup [1/4, 1/2]]) \tag{2}
\end{align}
Further simplification shows that both of the right hand sides of $(1)$ and $(2)$ equal to
\begin{align}
\begin{cases}
\sqrt{x} & 0 \leq x < \frac{1}{16}, \\
3\sqrt{x} - \frac{1}{2} & \frac{1}{16} \leq x \leq \frac{1}{4}.
\end{cases}
\end{align}
Hence we are done.
