how to prove $E(X|\mathcal G)(\omega)=n\int^{\frac{j}{n}}_{\frac{j-1}{n}}X(s)ds, \omega\in(\frac{j-1}{n},\frac{j}{n}].$ Suppose $\Omega=[0,1]$, and $\mathcal P=$lebesgue Measure , and $\mathcal F=\mathcal B([0,1])$
and also Suppose X is random variable and $\mathcal G$ is $\sigma-$algebra Produced With intervals $ (\frac{j-1}{n},\frac{j}{n}]$   $\forall j=1,2,...,n$      .
show that $E(X|\mathcal G)(\omega)=n\int^{\frac{j}{n}}_{\frac{j-1}{n}}X(s)ds, \omega\in(\frac{j-1}{n},\frac{j}{n}].$
thanks in advance
$\mathcal B$ means Borel $\sigma-$algebra.
 A: Minor technicality: We need $\{0\} $ in the collection of sets from which ${\cal G}$ is created, otherwise ${\cal G}$ would not be a sub-$\sigma$-field of ${ \cal F}$.
Let $I_0 = \{0\}$, and let $I_j$ be the intervals above. Then it is straightforward to show that ${\cal G} = \sigma \{I_j\} = \{ \cup_{j \in J} I_j  | J \text{ is finite }\}$ (the empty union being $\emptyset$).
Let $Y$ be the formula to the right of $E( X | {\cal G})$ above, and note that $Y$ is simple. It is straightforward to verify that $Y$ is ${\cal G}$ measurable and  $\int_{I_j} Y = \int_{I_j} X$ for all $I_j$. (Since $P\{0\} = 0$, we have $\int_{I_0} Y = \int_{I_0} X$.)
Let ${\cal C} = \{ C \in {\cal G} | \int_{C} Y = \int_{C} X \}$. Then we have $I_j \in {\cal C}$ for all  $I_j$, and since the $I_j$ are disjoint, it follows immediately that $\cup_{j \in J} I_j \in {\cal G}$ for any finite $J$. Hence ${\cal C} = {\cal G}$.
It follows that $Y$ is a version of $E( X | {\cal G})$.
(Since $\{0\}$ is the only null set other than $\emptyset$, we can see that all versions of $E( X | {\cal G})$ have the form $Y+c\cdot 1_{\{0\}}$, where $c$ is some constant.)
A: $\mathbb E\big(X\,|\,\mathcal G)$ can be defined as the unique $\mathcal G$-measurable function $Y$ s.t.
$$\tag{P}
\mathbb E \big( XZ \big) = \mathbb E \big( YZ \big)
$$
for any $\mathcal G$-measurable funcion $Z$ s.t. the expected value $\mathbb E \big( XZ \big)$ exists.
That said, basically we have to check 2 things:
1. if
$$
Y(\omega) = \sum_{j=1}^nn\int_{\frac{j-1}{n}}^{\frac jn} \!\!X(s){\rm d}s ~~\chi_{(\frac{j-1}{n},\frac jn]}(\omega)
$$
is $\mathcal G$-measurable (I compactly rewrote your function using the characteristic function $\chi$ notation)
2. and if the property (P) holds.
No. 1. is easy to check: to be more specific, note that since the intervals that generate the $\sigma$-algebra $\mathcal G$ make a finite partition of the whole set $[0,1]$, then any set of $\mathcal G$ is the union of some of those atoms, and viceversa any such set belongs to $\mathcal G$. Therefore any $\mathcal G$-measurable function is a (step) function which is constant over those intervals (otherwise the preimages wouldn't belong to $\mathcal G$, can you see it?)
As to point no. 2., by linearity (and by the fact that those intervals $\sigma$-generate $\mathcal G$), it suffices to show that the property (P) holds for the characteristic functions
$$
Z_j(\omega) = \chi_{(\frac{j-1}{n},\frac jn]}(\omega)~,\quad j=1\ldots n
$$
Try and check it...
Otherwise...
As to 2., instead of checking if that specific function works, you can directly find it yourself. As stated above, being $\mathcal G$-measurable, the expected value we are looking for is a step function
$$
\mathbb E\big( X\,|\,\mathcal G\big)(\omega) = \sum_{j=1}^n c_j\,\chi_{(\frac{j-1}{n},\frac jn]}(\omega) ~\quad\exists\,\, c_1\ldots c_n\in\mathbb R
$$
Therefore we just have to find those coefficients $c_1\ldots c_n$. As previously suggested, let us check what happens with the functions $Z_j$:
$$\tag{1}
\int_{[0,1]}\mathbb E\big( X\,|\,\mathcal G\big)(\omega)\,Z_j(\omega)\,{\rm d}\omega
~=~
\int_{[0,1]}
\underbrace{\sum_{i=1}^n c_i\,\chi_{(\frac{i-1}{n},\frac in]}(\omega)}_{\mathbb E\big( X\,|\,\mathcal G\big)(\omega)}\,
\underbrace{\chi_{(\frac{j-1}{n},\frac jn]}(\omega)}_{Z_j(\omega)}\,{\rm d}\omega
~=\\
c_j\int_{(\frac{j-1}{n},\frac jn]} {\rm d}\omega ~=~ \frac{c_j}{n}
$$
Now, for property (P) this has to be equal to
$$\tag{2}
\int_{[0,1]} X(\omega)\,Z_j(\omega)\,{\rm d}\omega
~=~
\int_{(\frac{j-1}{n},\frac jn]} X(\omega){\rm d}\omega
$$
Now compare (1) and (2)...
