# Completeness of a finite direct sum of closed subspaces of $L^2$

Let $X_1$ and $X_2$ be real-valued square-integrable random variables defined on a probability space $(\Omega, {\cal F},P)$. For $i=1,2$, set $$A_i := \{g(X_i)\in L^2 \mid g \text{ is some Borel measurable function with } \mathbb{E}g(X_i)=0 \} .$$
Note that $A_i$ forms a Hilbert subspace of $L^2(\Omega, {\cal F},P)$ for each $i$.

My question: does $$A_1 + A_2 := \{g_1(X_1) + g_2(X_2): g_i(X_i)\in A_i, \; i=1,2\}$$ equipped with the norm $||\cdot||_{L^2}$ also form a Hilbert subspace of $L^2(\Omega, {\cal F},P)$?

#### Solutions Collecting From Web of "Completeness of a finite direct sum of closed subspaces of $L^2$"

Building on my other answer, we can construct a counterexample to the original question.

Let $\{I_n \mid n\geq 3\}$, $\{I'_n \mid n\geq 3\}$, $\{J_n \mid n\geq 3\}$, and $\{J'_n\mid n\geq 3\}$ be mutually exclusive events satisfying
$$P(I_n) = P(I'_n) = \frac{1}{2n^2}\qquad\text{and}\qquad P(J_n) = P(J'_n)=\frac{1}{2n^4}.$$
Let $X_1$ and $X_2$ be the random variables
$$X_1(\omega) =\begin{cases}1/n & \text{if }\,\omega\in I_n \\ -1/n & \text{if }\,\omega\in I'_n, \\ 0 & \text{otherwise},\end{cases} \qquad\text{and}\qquad X_2(\omega) =\begin{cases}1/n & \text{if }\,\omega\in I_n\cup J_n, \\ -1/n & \text{if }\,\omega\in I'_n\cup J'_n, \\ 0 & \text{otherwise},\end{cases}$$
For each $n$, let $Y_n$ and $Z_n$ be the random variables
$$Y_n(\omega)=\begin{cases}n & \text{if }\,\omega\in I_n \\ -n & \text{if } \,\omega\in I'_n \\ 0 & \text{otherwise}\end{cases} \qquad\text{and}\qquad Z_n(\omega)=\begin{cases}n^2 & \text{if }\,\omega\in J_n \\ -n^2 & \text{if } \,\omega\in J'_n \\ 0 & \text{otherwise}\end{cases}$$
Then the functions $\{Y_n\mid n\geq 3\}$ and $\{Z_n \mid n\geq 3\}$ are orthonormal. Moreover, $Y_n \in A_1$ for each $n$, and $Y_n + \frac{1}{n} Z_n \in A_2$ for each $n$. It follows that $Z_n\in A_1+A_2$ for each $n$. However, the sum
$$\sum_{n=3}^\infty \frac{1}{n}Z_n$$
does not lie in $A_1+A_2$.

This is not intended as an answer. However, as Byron points out, the direct sum of two closed, non-orthogonal subspaces of a Hilbert space need not be closed. For others thinking about this question, here is an example of this phenomenon.

Let $\mathcal{H}$ be an infinite-dimensional Hilbert space, and let $\{\textbf{e}_1,\textbf{e}_2,\ldots\}$ and $\{\textbf{f}_1,\textbf{f}_2,\ldots\}$ be two mutually orthogonal sequences of orthonormal vectors in $\mathcal{H}$. Let
$$U \;=\; \text{closure}\bigl(\text{Span}\{\textbf{e}_n \mid n\in\mathbb{N}\}\bigr)$$
and let
$$V \;=\; \text{closure}\bigl(\text{Span}\bigl\{\textbf{e}_n+\tfrac{1}{n}\textbf{f}_n \mid n\in\mathbb{N}\bigr\}\bigr)$$
The subspaces $U$ and $V$ are closed by definition, and the intersection $U\cap V\;$ is trivial. However, the direct sum $U+V\;$ is not a closed subspace. In particular, observe that all of the vectors $\textbf{f}_n$ lie in $U+V$, but the sum
$$\sum_{n=1}^\infty \frac{1}{n}\textbf{f}_n$$
does not lie in $U+V$.  This gives a contradiction, since $\{1/n\}$ is an $\ell^2$ sequence.