Understanding the measurability of conditional expectations My question is about the conditional expectation of random variables with respect to a $\sigma$-algebra. I am having trouble getting an intuition behind the definitions among other things.
I know that if $X$ is $\mathcal{G}$-measurable then $\mathbb{E} [X| \mathcal{G}]  = X$, but what if $X$ is not $\mathcal{G}$-measurable? Is this expression just not defined?
Furthermore, in the following definition:
Let $(\Omega, \mathcal{F}, \mathbb{P})$ be a probability space, $\mathcal{G}$ a sub $\sigma$-field of $\mathcal{F}$ and $X$ be a random variable with $\mathbb{E}|X| < \infty$.
Definition (Conditional Expectation):
The conditional expectation of $X$ given $G$, denoted by $\mathbb{E}[X|\mathcal{G}]$, is defined as any random variable Y which satisfies


*

*$Y$ is $\mathcal{G}$-measurable

*$\int_A X d\mathbb{P} = \int_A Y d\mathbb{P}$ for all $A \in \mathcal{G}$


Remark:


*

*Any random variable $Y$ satisfying $(1)$ and $(2)$ in the definition is called a version of $\mathbb{E}[X|\mathcal{G}]$.


I don't know why the 2nd condition is defined this way. Can someone bring an argument where if the second condition is not defined in the way it is then something undesirable results? Or an argument where this 2nd condition brings desirable results.
 A: Let $(\Omega,\mathcal F,\mu)$ be a probability space. The idea of condition expectation is the following: we have an integrable random variable $X$ and a sub-$\sigma$-algebra $\mathcal G$ of $\mathcal F$. The random variable $X$ is not necessarily measurable with respect to this smaller $\sigma$-algebra. We would like to consider a random variable which is $\mathcal G$-measurable, and close in some sense to $X$. 
Assume that $Y$ satisfies conditions 1. and 2. Then 
$$X=\color{red}{Y}+\color{blue}{X-Y}.$$
The red random variable is $\mathcal G$-measurable and if $\varphi$ is a bounded $\mathcal G$-measurable function, then $\mathbb E[(\color{blue}{X-Y})\phi]=0$, hence we wrote $X$ as a sum of a $\mathcal G$-measurable random variable plus an other one whose integral over the $\mathcal G$-measurable sets vanish. There is an idea of projection, which can be made more concrete when $X$ belongs to $\mathbb L^2$.
A: I would like to answer the specific questions in this post.

*

*When we talk about measurability we need to recall the definition of a measurable function. Let ($\Omega, \mathcal{F}, P$) be probability space, let $X$ be a function $X:\Omega \rightarrow \mathbb{R}(\mathcal{B})$. $X$ is a measurable function if:
$$X^{-1}(A) \in \mathcal{F}, \quad \forall A \in \mathbb{R}(\mathcal{B})$$
Here (ommitted) it is implicity that we are talking about $\mathcal{F}$-measurability because all the pre-images of $X$ lies on $\mathcal{F}$. If $X$ is $\mathcal{G}$-measurable, where $\mathcal{G} \subset \mathcal{F}$,then we can affirm that all the pre-images of $X$ lies on $\mathcal{G}$ because we are notified that $X$ is $\mathcal{G}$-measurable. So, $X$ is not always $\mathcal{H}$-measurable, where $\mathcal{H}$ is any $\sigma$-algebra. We need information to say something about measurability. But, there is a $\sigma$-algebra that always exists and any $X$ is measurable and that it is $\sigma(X)$. It's obvious that any $X$ is $\sigma(X)$-measurable (its own $\sigma$-algebra).

So, if X is $\mathcal{G}$-measurable, it means that all the pre-images of $X$ lies in $\mathcal{G}$ and by definition $\mathbb{E}(X|\mathcal{G})$ is $\mathcal{G}$-measurable so $\mathbb{E}(X|\mathcal{G})=X$, in words: if all the information of $X$ (given by its $\sigma$-algebra) is in $\mathcal{G}$ and we are conditioning over the same information $\mathcal{G}$ there is no need to take expectation. What is the expectation that tomorrow will rain given that it will rain tomorrow?
If $X$ is not $\mathcal{G}$-measurable it means that the pre-images of $X$ doesn't lie in $\mathcal{G}$ (mathematically $\sigma(X) \not \subset \mathcal{G}$). That fact, doesn't affect the existence of $\mathbb{E}(X|\mathcal{G})$ at all. Imagine that $X$ is the random variable 1 (tomorrow will rain) or 0 (tomorrow will not rain) and $\mathcal{G}$ is the $\sigma$-algebra generated by $Y$ (it means that $\mathcal{G}=\sigma(Y)$) where $Y$ is a random variable about the exchange rate dollar/euro. It is obvious that $X$ is not $\mathcal{G}$-measurable (the pre-images of $X$ = {rain, not rain} are not in the pre-images of $Y$={$\mathbb{R}$}) but you can calculate $\mathbb{E}(X|\mathcal{G})$, ask yourself what is the expectation for the weather tomorrow (rain or not) given the exchange rate. It sounds a crazy question but it is possible.
