Existence of a random variable $Y$ that minimizes $\lVert X-Y\rVert_2$. In here, stated as a theorem is:
Let $\mathcal{G}\subseteq\mathcal{F}$ be $\sigma$-algebras, $X\in L_2$ be a random variable on the probability space. Then, there exists a random variable $Y\in\mathcal{G}$ such that 
$E||X-Y||_2=\inf_{Z\in\mathcal{G}}E||X-Z||_2$
How do I prove such an element exists up to almost surely equivalence? Also, how can I show that this is $E[X|\mathcal{G}]$. In this appendix, $E[X|\mathcal{G}]$ is defined as this, but what if we start with the usual definition that this conditional expectation satisfies the properties that for all $G\in\mathcal{G}$, $\int_{G} E[X|\mathcal{G}]dP=\int_G XdP$ and $E[X|\mathcal{G}]$ is $\mathcal{G}$-measurable and integrable?
 A: If we assume that we are minimizing over all $\mathcal{G}$-measurable functions in $L^2$, we can proceed as follows:
First, we can use Jensen's inequality for conditional expectation to say that 
$$|E[X|\mathcal{G}]|^2 \leq E[|X|^2 |\mathcal{G}] = E[|X|^2 | \mathcal{G}] < \infty.$$
Then, since $\Omega \in \mathcal{G}$, if $Z$ is any $\mathcal{G}$-measurable function and $Y=E[X|\mathcal{G}]$, then 
$$E[(X-Y)Z] = E[XZ-YZ] = E[XZ] - E[YZ \chi_{\Omega}] = E[XZ] - E[XZ\chi_{\Omega}] = 0$$
Thus, $X-Y$ is orthogonal to any $\mathcal{G}$-measurable random variable $Z$, so $Y$ minimizes that $L^2$ norm over all possible random variables $Z$.  
Here $\chi_A$ is the indicator function of the set $A$, and I'm using the fact that
$E[Z E[X|\mathcal{G}]] = E[E[ZX|\mathcal{G}]] = E[ZX]$, since $Z$ is $\mathcal{G}$-measurable. 
This property that $E[(X-Y)Z] = 0$ for every $\mathcal{G}$-measurable $Z$ is sufficient because given any $Z \in \mathcal{G}$,
$$E[(X-Z)(X-Z)] = E[(X-(Y+Z-Y))(X-(Y+Z-Y))] $$
$$= E[(X-Y)(X-Y)] + 2 E[(X-Y)Z] + E[(Z-Y)(Z-Y)]$$
so we can see that this last expression is minimized when $Z \equiv Y$.
