Conditional Expectation of X with respect to a $\sigma$-algebra $\mathcal{G}$ I read this definition from my lecture handout:

If X is a random variable on a countable probability space $(\Omega,\mathcal{F},\mathbb{P})$, then the conditional expectation $\mathbb{E}_\mathbb{P}(X|\mathcal{G})$ of X with respect to $\mathcal{G}$ is defined as a random variable which satisfies, for every $\omega\in A_i$,
$$\mathbb{E}_\mathbb{P}(X|\mathcal{G})(\omega)=\sum_{i\in I}\frac{\mathbb{E}_\mathbb{P}(X\mathbb{1}_{A_i})\mathbb{1}_{A_i}}{\mathbb{P}(A_i)}\quad\quad \forall A_i\in \mathcal{P}$$
$\mathcal{P}$ is a countable partition that generates $\mathcal{G}$.

And I have the following questions:

*

*Some of the other materials give this definition as a conditional expectation of X with respect to the whole $\sigma$-field $\mathcal{G}$, which without indicating the small omega, i.e.:$$\mathbb{E}_\mathbb{P}(X|\mathcal{G})=\sum_{i\in I}\frac{\mathbb{E}_\mathbb{P}(X\mathbb{1}_{A_i})\mathbb{1}_{A_i}}{\mathbb{P}(A_i)}.$$
I personally support this definition, because $\mathbb{E}_\mathbb{P}(X|\mathcal{G})(\omega)$ seems to be a partial condition and it should be equivalent to $\mathbb{E}_\mathbb{P}(X|\mathcal{G})\mathbb{1}_{A_i}=\mathbb{E}_\mathbb{P}(X|A_{i})$. So which one is the correct definition?

*Why we have two indicator functions over there? As per my logic, $\mathbb{E}_\mathbb{P}(X|\mathcal{G})=\sum_{i\in I}\mathbb{E}_\mathbb{P}(X|A_i)=\sum_{i\in I}\frac{\mathbb{E}_\mathbb{P}(X\mathbb{1}_{A_i})}{\mathbb{P}(A_i)}.$ I don't know where is the other $\mathbb{1}_{A_i}$ comes from.

 A: In what follows

*

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


*$X$ is a random variable defined on $\Omega $,


*$\mathcal G\subseteq \mathcal F$ is a sub-$\sigma $-algebra generated by a countable partition $\{A_i\}_{i\in I}$
of $\Omega $, formed  by $\mathcal F$-measurable sets.
The first thing to bear in mind is that
the  conditional expectation $\mathbb E_{\mathbb P}(X|\mathcal G)$ is another random
variable (rather than just a number).  Since random variables are nothing but  functions defined on $\Omega $,
the notation
$$
  \mathbb E_{\mathbb P}(X|\mathcal G)(\omega )
  $$
makes perfect sense as it indicates the value taken by the function
$\mathbb E_{\mathbb P}(X|\mathcal G)$ on a given point $\omega $ of $\Omega $.
The second important point is that   $\mathbb E_{\mathbb P}(X|\mathcal G)$ is constant on every set $A_i$
(although its constant value may change among the various  $A_i$).
By the definition of
conditional expectation, the constant value taken on $A_i$ by $\mathbb E_{\mathbb P}(X|\mathcal G)$  is
the expected value of $X$ on $A_i$,  namely
$$
  \mathbb E_{\mathbb P}(X|A_i ) := \frac {\mathbb E_{\mathbb P}(X1_{A_i} )}{\mathbb P(A_i)}.
  $$
Denoting the above expected value simply by $e_i$, the question is how should  we express the function which
is supposed to take on the value $e_i$ on $A_i$.    I guess the best way to do this is simply to write
$$
  \sum_{i\in I}e_i1_{A_i},
  \tag 1
  $$
observing that if $\omega $ lies in some $A_j$, then $1_{A_i}(\omega )$ vanishes for every $i$, except for $i=j$, in
which case $1_{A_i}(\omega )=1$,  so the above sum comes out as $e_j$, which is precisely what we expect.
Notice that there is no $\omega $ in  expression (1) for the same reason  many people consider it
incorrect to say

"consider the function $\sin(x)$"

In fact,   the  function is called simply "$\sin$", whereas  "$\sin(x)$" is meant to denote the value
of the function $\sin$ at the given real number $x$.
According to this we therefore have that
$$
  \mathbb E_{\mathbb P}(X|\mathcal G)=   \sum_{i\in I}e_i1_{A_i},
  \tag 2
  $$
which, upon substituting the appropriate value for $e_i$, is exactly what the OP writes in the first question.
If we want to explicitly indicate the dependency of these functions on a variable $\omega $,  I'd write
$$
  \mathbb E_{\mathbb P}(X|\mathcal G) (\omega ) =   \sum_{i\in I}e_i1_{A_i}(\omega ), \quad\forall \omega \in \Omega ,
  \tag 3
  $$
noticing that now $\omega $ shows up on both sides.
On the down side,   I believe mixing the LHS of (3) with the RHS of (2) is incorrect so I agree 100%
with the OP that their second formula is preferable over the first one.
Regarding the OP's second question, I see a problem in the sense that
$$
  \mathbb{E}_\mathbb{P}(X|\mathcal{G})
  $$
is supposed to be a random variable, as already discussed, while
$$
  \sum_{i\in I}\mathbb{E}_\mathbb{P}(X|A_i)
  $$
strikes me as a number.
Inserting the  missing  $1_{A_i}$ on the  last expression  would make it a function, which is more in line
with the functional nature of the conditional expectation.
