How to understand conditional expectation w.r.t sigma-algebra: is the conditional expectation unique in this example? This board has many questions on how to understand conditional expectations w.r.t a $\sigma$-algebra; it's clearly a topic that confuses many. I am one of them. I read all the other questions and answers and I still don't understand the intuition behind it.
I have an example here that leads to the wrong answer, and I hope that by figuring out where I'm going wrong I can figure out more about how these conditional expectations work, and also why $E(\xi \mid \mathcal{H}) = \xi (\omega)$ when $\xi$ is $\mathcal{H}$-measurable.

Here I will follow the definition on wikipedia. Say we have:

*

*a probability space $(\Omega, \mathcal{F}, \mathbb{P})$

*a random variable $\xi : (\Omega, \mathcal{F}) \mapsto (X, \mathcal{B})$

*a sub-$\sigma$-algebra $\mathcal{H} \subseteq \mathcal{F}$, where $\xi$ is not necessarily $\mathcal{H}$-measurable (i.e. we cannot say that $\sigma (\xi) \subseteq \mathcal{H}$, where $\sigma(\xi)$ is the $\sigma$-algebra generated by $\xi$).

The conditional expectation of $\xi$ w.r.t $\mathcal{H}$, or $E(\xi \mid \mathcal{H})$, is not a constant number but a function $E(\xi \mid \mathcal{H}) : \Omega \mapsto X$. It is defined as any $\mathcal{H}$-measurable function $E(\xi \mid \mathcal{H}) : \Omega \mapsto X$ that satisfies:
\begin{equation}
\int _H E(\xi \mid \mathcal{H}) (\omega) d\mathbb{P} (\omega) = \int _H \xi (\omega) d\mathbb{P} (\omega)
\tag{1}\label{1}
\end{equation}
for any $H \in \mathcal{H}$.
It can then be shown that it is unique and equal to what I think is a Radon-Nikodyn derivative.
Finally, if $\xi$ is $\mathcal{H}$-measurable, we have that $E(\xi \mid \mathcal{H}) = \xi (\omega)$.

Now, if we then consider the following example: $\Omega = \mathbb{R}$, $X = \mathbb{R}$, $\mathcal{B} = \{\emptyset, X\}$, $\mathcal{H} = \{ \emptyset, \Omega\}$, and $\xi$ being any nice continuous function from the reals to the reals.
In this example, it seems obvious to me that $\sigma(\xi) = \{ \emptyset, \Omega\}$ and thus that $\xi$ is $\mathcal{H}$-measurable. Therefore $E(\xi \mid \mathcal{H}) = \xi (\omega)$.
But could I not also satisfy Equation \ref{1} by letting the conditional expectation be a constant? Something like:
\begin{eqnarray}
E(\xi \mid \mathcal{H})(\omega) & = \begin{cases}
\frac{\int _\Omega \xi (\omega') d\mathbb{P} (\omega')} {\int _\Omega d\mathbb{P} (\omega')} & \omega \in \Omega \tag{2}\label{2} \\
\text{anything} & \omega \in \emptyset
\end{cases}
\end{eqnarray}
So does this not mean that $E(\xi \mid \mathcal{H})(\omega)$ is not unique? Equation \ref{2} seems to be at odds with $E(\xi \mid \mathcal{H}) = \xi (\omega)$. So what did I do wrong here?
For example: does the standard definition for conditional expectations assume that the $\sigma$-algebra of the random variable is a Borel $\sigma$-algebra? I can see why the above would then be wrong.
 A: You're not doing anything wrong in your example. However, you're operating outside of the 'usual' framework of conditions: most of the theory of expectations and conditional expectations assumes (not always explicitly) that the 'output' $\sigma$-algebra is the Borel one. (Incidentally, the notation $\mathcal{B}$ in your example is a bit confusing, as $\mathcal{B}$ is usually reserved for the Borel $\sigma$-algebra on the reals.)
In the context of your example, one problem is that any indicator function $1_A$ is measurable regardless of $A$, while normally when defining Lebesgue integrals we have $1_A$ being measurable iff $A\in\mathcal{F}$, which comes from assuming that the 'output' $\sigma$-algebra is the Borel one. That is to say, the definition of the integral assumes that the 'output' $\sigma$-algebra is the Borel one. So, I guess you can still define the expectation $\int _\Omega \xi (\omega) d\mathbb{P} (\omega)$ but be aware that this is implicitly assuming that the 'output' $\sigma$-algebra is Borel.
You can then define the conditional expectation, but the proof of uniqueness of the conditional expectation (up to sets of measure zero) assumes that the 'output' $\sigma$-algebra is Borel e.g. if you look at Section 9.5 in the book by Williams, Probability with Martingales, the uniqueness proof starts by considering two 'versions' of the conditional expectation $Y$ and $\tilde{Y}$ before considering the set $\{Y-\tilde{Y}>n^{-1}\}$ which is a member of the sub-$\sigma$-algebra in the context of the book, but does not necessarily belong to your $\mathcal{H}$. In your example, the conditional expectation is not unique: it can be any random variable that integrates to the same as $\xi$.
To get more intuition I'd suggest looking at the case where a random variable takes only finitely many values, which is covered in Section 9.1 of the same book.
