# Conditional expectation is square-integrable

I am given the following definition:

Let $(G_i:i\in I )$ be a countable family of disjoint events, whose union is the probability space $\Omega$. Let the $\sigma$-algebra generated by these events be $\mathcal{G}$. Let $X$ be an integrable random variable, that is $E|X|<\infty$. The conditional expectation of X given $\mathcal{G}$ is given by $Y=\sum_iE(X1_{G_i})1_{G_i}/P(G_i)$.

I am told that $Y$ is square integrable, that is $E(Y^2)<\infty$. $1_A$ denotes the indicator function for the event $A$.

But I could not prove that $Y$ is square integrable. Can anyone offer a proof? Thanks.

If $X$ is $\mathcal G$-measurable, then $Y=X$. Thus, with the only assumption that $X$ is integrable, there is no way to deduce that $Y$ is square integrable.
Counterexample: $X=\sum\limits_ix_i\mathbf 1_{G_i}$ with $\sum\limits_ix_iP[G_i]$ finite and $\sum\limits_ix_i^2P[G_i]$ infinite.
On the other hand, in the general case, if $X$ is square integrable then $E[Y^2]\leqslant E[X^2]$ hence $Y$ is square integrable.