# Does orthogonal decomposition characterize direct sums in Hilbert space?

Let $H$ be a Hilbert space with inner product $(\cdot, \cdot)$.

I know that if $M$ is a closed subspace of $H$, then $H$ can be written as the direct sum $M \oplus M^\perp$, where $M^\perp$ stands for the orthogonal complement of $M$.

I would like to know if this decomposition above essentially describes all direct sums in Hilbert spaces:

If $M,N$ are closed subspaces of $H$ with $H$ being the direct sum $M \oplus N$, then is it true that $N = M^\perp$.

So far I've tried using a direct proof that's not really getting me anywhere: take $n \in N$ and show that $(n,m) = 0$ for $m \in M$ arbitrary. Without knowing any specific about $M$ and $N$, I am not able to move any further. Is there some basic fact about the inner product that makes this all work? Or is the question deeper?

Hints or solutions are greatly appreciated.

Not necessarily; this fails even in $\mathbb{R}^2$ with the usual inner product. Take $U$ to be the $x$-axis, and $V = \{(x,y):x=y\}$, the diagonal. Then $\mathbb{R}^2 = U\oplus V$, but nothing other than $0$ in $V$ is orthogonal to anything in $U$ other than $0$.
For orthogonal decompositions: $$\mathcal{H}=U\oplus V:\quad U\perp V\implies U=V^\perp,V=U^\perp$$ Note it wasn't assumed closedness.