Direct sum of a closed linear subspace of a Hilbert space I am currently reading a proof that involves some result from functional analysis which I would like to understand a little better - 
Suppose we have a Hilbert space $\mathcal{H}$ and a closed linear subspace $\mathcal{L}$ in $\mathcal{H}$. Suppose further that we are given that $\mathcal{L}$ contains the span of two sets $P_1$ and $P_2$ which are orthogonal, and conversely the span of these sets contains $\mathcal{L}$. The orthogonality statement means that if $(\cdot,\cdot)$ denotes the inner product in $\mathcal{H}$ then
\begin{equation}
(f,g) = 0 \quad \forall f \in P_1 \text{ and }  g \in P_2
\end{equation}
Then it follows that both Span$(P_1)$ and Span($P_2$) are closed, and we have an orthogonal sum
\begin{equation}
\mathcal{L} = \text{Span}(P_1) \oplus \text{Span}(P_2)
\end{equation}
My background in functional analysis is very sketchy unfortunately, I would like to understand what are the general results that I need to know about in order to see this conclusion as being trivial? 
In particular, why do I need closure of $\mathcal{L}$ to deduce that it has this direct sum decomposition ? Does this not follow directly from the fact that  Span$(P_1)$ and Span$(P_2)$ are orthognal ?  Also, how do I deduce these two spaces are closed from the fact that $\mathcal{L}$ is closed ?
Many thanks !
 A: Being closed in $\mathcal{H}$, $\mathcal{L}$ is itself a Hilbert space. By construction, you have that $\text{Span}(P_1)$ is the orthogonal complement of $\text{Span}(P_2)$, hence it is closed. 
A: Based on my understanding of the complete inner product spaces, the following facts are assumed to be known by the reader:

*

*A closed subspace of a complete space is complete. Hence $\mathcal{L}$ is complete, and the inner product can be restricted on $\mathcal{L}$ and makes $\mathcal{L}$ a Hilbert space.


*There exists an orthonormal basis for any Hilbert space. This tells us that the span of $P_1$ and $P_2$ is the span of the orthonormal bases residing in these two sets respectively.
Now that if
$$
(f,g) = 0 \quad \forall f \in P_1 \text{ and }  g \in P_2
$$
by contradiction we could see that $P_1$ and $P_2$ do not share any common basis, otherwise choose $f$ and $g$ be that common basis would make above inner product be 1.
By the orthogonality of the orthonormal basis we could see:
$$
\text{Span}_{\alpha\in A, \beta\in B}\{e_{\alpha},e_{\beta} \}  = \text{Span}_{\alpha\in A}\{e_{\alpha}\} \oplus \text{Span}_{\beta\in B}\{e_{\beta}\}
$$
if $A$ and $B$ share no common index for the basis. And this is where the direct sum comes from. For more read about the decomposition of Hilbert space like this, please refer to this link.
