I'm studying probability following Shiryaev's book, and I'm trying to understand how the Radon-Nikodym theorem applies in an actual case where I can calculate the conditional expectation of a random variable $X$ given a sub $\sigma$-field $\mathcal{G}$ in the $(\Omega,\mathcal{F}, \mathbb{P})$ from this theorem.
The book says that the conditional expectation $E(X|\mathcal{G})$ is the Radon-Nikodym derivative:
$$ E(X|\mathcal{G}) = \dfrac{d\mathbb{Q}}{d\mathbb{P}}(\omega), $$ where:
$$ Q(A) = \int_A Xd\mathbb{P} \ \ , \ A \in \mathcal{G} $$
I understand that the theorem is important to ensure the existance of the conditional expectation, but I am having trouble in actually using the theorem to actually FIND the random variable $E(X|\mathcal{G})$.
So I considered a toy example then to see how the theorem applies, and did it also by the definition. Consider a probability space $(\Omega, \mathcal{F}, \mathbb{P})$ with $\Omega= (0,1]$, $\mathcal{F}$ the Borel set in $(0,1]$ and $\mathbb{P}$ the Lebesgue measure and consider the random variable $X(\omega)=\omega$. Consider in the same probability space $Y(\omega)= \omega \mathbb{I}_{(0,0.5]}(\omega)$ and take finally $\mathcal{G}_Y$ the $\sigma$-field generated by the rv $Y$.
Let's evaluate $E(X|\mathcal{G}_Y)$. I know by definition that it must satisfy $E(X|\mathcal{G}_Y)(\omega) = \dfrac{d\mathbb{Q}}{d\mathbb{P}}(\omega)$, but I'll go the other way around first.
As suggested in the comments, we can take a look at the elements of $Y^{-1}((-\infty,a])$ that generate the $\sigma$-algebra $\mathcal{G}_Y$. The random variable takes non-null values only in the set $(0,1/2]$ by construction, so:
$$ Y^{-1}(-\infty, a]) =\begin{cases} \emptyset & a<0 \\ (1/2, 1] & a =0, \\ \left(0,a\right] \cup (1/2, 1] & 0 < a \leq1/2 \\ \Omega & a >1/2 \end{cases} $$
This seems right to me because it sums up to one if I use the Lebesgue measure in this set and the resulting $F_Y$ would be an increasing function. So $\mathcal{G}_Y$ is the $\sigma$-algebra generated by these sets.
Let's go back to the problem. Because I conveniently defined my sub-sigmafield, I know that it's equivalent to evaluating $E(X|Y=y)$ so I'll study the probability density of $ X|Y=y$. Take for notation $Z=X|Y=y$ and consider the set of preimages:
$$ Z^{-1}\left((-\infty,a]\right) =\begin{cases} \emptyset & a<0 \\ (y, 1] & a =0 \\ (y, 1]\cup \left(0,a \right] & 0 < a \leq y \\ \Omega & a >y \end{cases} $$
Taking the Lebesgue measure on these sets, I'll have:
$$ F_{X|Y=y}(a) = (1-y)\mathbb{I}_{\{0\}}(a) + \left( (1-y) + a \right)\mathbb{I}_{(0,y]}(a), $$ which I can use as a fact to write the Lebesgue integral as a Lebesgue-Stieltjes integral.
Hence the conditional expectation is:
$$ E(X|\mathcal{G}_Y) := E(X|Y=y) = \int Z d\mathbb{P} = \int_{-\infty}^{+\infty} x dF_{X|Y=y} = y, $$ for values of $y \in (0,1/2]$, which is according to the intuition of the formulation of $Y(\omega)$.
Now let's try to assess it using the Radon-Nikodym theorem. By the definition:
$$ Q(A) = \int_A X d\mathbb{P}, A \in \mathcal{G}_Y $$
I need to verify that $Q(A) = \int_A X d\mathbb{P}$ for $A \in \mathcal{G}_Y$. So I'm talking about verifying that this holds for any set in the $\sigma$-field generated by the set of preimages of $Y(\omega$), that is: $$\sigma\left(\{\emptyset, \Omega, \{(0, a], \forall a \in (0,1/2]\}, (1/2, 1] \}\right),$$ where I denote here the $\sigma(\cdot)$ as the $\sigma$-algebra generated by the elements.
For the non-trivial case, it suffices considering only sets of the form $A=[0,y]$, with $y\in[0,1/2]$ to work with, as well as the set $(1/2,1]$, so I'll have:
$$ \mathbb{Q}(A) = \int_{A} Xd\mathbb{P} := \int_{A} x dF_x = \int_{0}^{y} x dx = \dfrac{y^2}{2} $$
Then again for the set $A=(1/2,1]$
$$ \mathbb{Q}(A) = \int_{A} Xd\mathbb{P} := \int_{A} x dF_x = \int_{1/2}^{1} x dx = 0.375 $$ which then leads to:
$$ \dfrac{d\mathbb{Q}}{d\mathbb{P}}(A) =\begin{cases} \omega & \omega \in (0,1/2] \\ 0 & \omega \in (1/2,1] \\ \end{cases}, $$ which is in fact what we intended to show.
Is my idea correct? I think my problem is more conceptual, like: when I take the derivative with respect to the Lebesgue measure, will it always be the "standard" derivative $\dfrac{d}{dx}$?