Is the subspace of odd functions of $L^2(-1,1)$ convex? I am trying to show that the Hilbert space $H =L^2(-1,1)$ can be decomposed into the direct orthogonal sum $O\oplus E$ where $O$ is the subspace of odd functions, and $E$ is the subspace of even functions.
I know that the subspace of odd functions of $H$ is closed, and I want to now use the closest point property of Hilbert spaces, which states that if a set $A$ is a non-empty closed convex subset of $H$, then for any $f \in H$ there is a unique point of $O$ which is closer to $f$ than any other point of $O$.
I am not familiar with using convexity when the sets are spaces of functions.
So I have that $O$ is closed, but I'm not sure if it is convex? If I can show that, the rest of the proof is straightforward.
 A: There are several ways to show $O\oplus E = H$.
The first is a direct proof I have provided in the comments:
We have shown that every $f \in H$ permits a decomposition $f = g + h$, where $g \in O$, $h \in E$. This showes that $O + V = H$. Secondly, we showed $O \perp E$, which means that the sum $O \oplus E$ is orthogonal. It is not necessary to show that any of the subspaces is closed.
The second proof is the one you attempted:
We will show $O^\perp = E$ and $E^\perp = O$. From this follows that $O$ (and $E$) is a closed subspace because orthogonal of a set is always a closed subspace.
Let's prove that $O^\perp = E$, as $E^\perp = O$ is similar. From $O \perp E$ we have $E \subseteq O^\perp$. To prove $O^\perp \subseteq E$, take $g \in O^\perp.$ For every $f \in O$ we have:
$\newcommand\diff{\mathop{}\!\mathrm{d}}$
$\newcommand\inner[2]{\langle #1, #2 \rangle}$
\begin{align}0 &= \inner{f}{g} \\ &= \int_{-1}^1 f(t)\overline{g(t)} \diff{t} \\
&= \int_{-1}^0 f(t)\overline{g(t)} \diff{t} + \int_{0}^1 f(t)\overline{g(t)} \diff{t} \\
&= -\int_{1}^0 f(-t)\overline{g(-t)} \diff{t} + \int_{0}^1 f(t)\overline{g(t)} \diff{t} \\
&= -\int_{0}^1 f(t)\overline{g(-t)} \diff{t} + \int_{0}^1 f(t)\overline{g(t)} \diff{t} \\
&= \int_{0}^1 f(t)\overline{\bigl( g(t) - g(-t)\bigr)} \diff{t} 
\end{align}
Since $t \mapsto g(t)-g(-t)$ is an odd function, by setting this for $f$ we have:
$$0 = \int_{0}^1 \bigl( g(t) - g(-t)\bigr)\overline{\bigl( g(t) - g(-t)\bigr)} = \int_{0}^1 \left|g(t) - g(-t) \right|^2 \diff{t}$$
If we define $h : (0, 1) \to \mathbb{C}$ as $h(t) = g(t) - g(-t), \forall t \in (0, 1)$, the previous equality states that $\lVert h \rVert_{L^2(0,1)}^2 = 0$ where $\lVert \cdot \rVert_{L^2(0,1)}$ denotes the norm on the space $L^2(0,1)$. This implies $h = 0$, that is $g(t) = g(-t), \forall t \in (0, 1)$, which implies that $g$ is an odd function. Thus, $O^\perp \subseteq E$, which completes the proof of $O^\perp = E$.
Now, back to your original question, $O$ is convex because it is a vector subspace of $H$:
Take $\lambda \in [0, 1]$ and $f, g \in O$:
$$\lambda f + (1-\lambda)g \in O$$
since $O$ is closed under linear combinations.
Now you can use the closest point property for $O$ and complete the proof.
Remark: Using the closest point property for a closed subspace of a Hilbert space to prove this kind of thing is essentially reproducing a proof of a result usually known as Riesz projection theorem:

Let $H$ be a Hilbert space, and $M$ a closed subspace of $H$. Then $H = M \oplus M^\perp$ holds.

