Solution (source code)

= Solution

Let $M$ be the <linear subspace> of $L^2(P)$ consisting of classes admitting $\mathcal G$-measurable representatives. It is closed. Indeed, if $Y_n\in M$ converges in $L^2$ to $Y$, choose a <subsequence> converging almost surely: take $\|Y_{n_j}-Y\|_2^2\le2^{-3j}$ and apply <Markov inequality> and the <Borel-Cantelli lemma> to errors exceeding $2^{-j}$. The pointwise limit of its $\mathcal G$-measurable representatives, set to zero wherever the finite limit does not exist, is $\mathcal G$-measurable and equals $Y$ almost surely. This also works when $\mathcal G$ is not complete.

Here is a proof of the <orthogonal projection> construction using only completeness. Put $d=\inf_{W\in M}\|X-W\|_2$ and take $W_n$ approaching this infimum. The <parallelogram law> gives
$$
\|W_n-W_m\|_2^2=2\|X-W_n\|_2^2+2\|X-W_m\|_2^2-4\left\|X-\frac{W_n+W_m}{2}\right\|_2^2\longrightarrow0.
$$
Completeness and closedness give a minimizer $Y\in M$. For every $Z\in M$, expand $\|X-Y-tZ\|_2^2$ for real $t$. Its minimum at zero implies
$$
\boxed{E((X-Y)Z)=0\quad\text{for every }Z\in M.}
$$
This $Y$ is unique almost surely, because the difference of two possible choices belongs to $M$ and is orthogonal to itself. It is the <conditional expectation> $E(X\mid\mathcal G)$, as also follows by testing indicators of events in $\mathcal G$.

For the jointly Gaussian pair, if $u>0$, set
$$
\boxed{Y=\nu+\frac vu(G-\mu).}
$$
The residual $R=X-Y$ has mean zero and <covariance> $\operatorname{Cov}(R,G)=v-(v/u)u=0$. Since $(R,G)$ is jointly Gaussian, its characteristic function factors when this <covariance> is zero, so $R$ and $G$ are independent. Hence $E(RZ)=E(R)E(Z)=0$ for every square-integrable function $Z$ of $G$; <independence> first proves this for bounded functions, and truncation plus <Cauchy-Schwarz inequality> gives the general case. This proves the <Gaussian conditional expectation> formula, including a zero residual <variance>. If $u=0$, $G=\mu$ almost surely and the <covariance> inequality gives $v=0$; \b[$Y=\nu$] is the answer.