If $U$ is a closed subspace of a Hilbert space $X$, then we have the orthogonal decomposition $X=U\oplus U^\perp$. However, this orthogonal decomposition fails in general, if $X$ is only a pre-Hilbert space (i.e., if $X$ is a inner product space, but not necessarily complete w.r.t. the norm induced by the inner product). I came up with the following counter example:
Set $y= (\frac{1}{n})_n$. Take $X=\ell^1$ equipped with the $\ell^2$-inner product. Then $X$ is a pre-Hilbert space, but not a Hilbert space. Set $U:=$ {$x\in X\mid x\perp y$}. Then $U$ is a closed linear subspace of $X$ and it is quite straight forward to show that $U^\perp$ (the orthogonal complement of $U$ in $X$) is trivial. Thus $U\oplus U^\perp =U\neq X$, where the last inequality follows easily (e.g. consider the sequence $x=(\frac{1}{n^2})_n\in X\backslash U$).
I am curious to learn about different counterexamples! Thanks in advance.
Edit: I came up with a different example, where both $U$ and $U^\perp$ are non-trivial which I'll sketch in the following in case somebody stumbles up on the same question in the future.
Take $X=C([-\pi,\pi];\mathbb{C})$ with the $L^2([-1,1])-$inner product. Then $X$ is a pre-Hilbert space. Let $U\subseteq X$ denote the space of uneven continuous functions, i.e.,
$U:=\{f\in X\mid f(-x)=-f(x) \text{ for all }x\in [-\pi,\pi]\}$.
It is straightfoward to show that $U$ is closed (this essentially follows from Fischer-Riesz theorem). Moreover, it is easily veryfied that $U^\perp$ consists of all even continuous functions, i.e.,
$U^\perp=\{g\in X\mid g(-x)=g(x)\text{ for all } x\in [-1,1]\}$
and we clearly have $U\neq \{0\}$ and $U^\perp=\{0\}$. We know that the exponentials $\{e_k:=\frac{1}{\sqrt{2\pi}}e^{ikx}|k\in \mathbb{Z}\}$ is an orthonormal basis in $L^2([-1,1])$ and thus also in $X$. It is not hard to show that $U$ consists of all functions with vanishing even Fourier coefficients, i.e.,
$U=\{f\in X\mid \hat{f}(k):=(f,e_k)=0 \text{ for all even }k\in \mathbb{Z}\}$.
Similarly, we have
$U^\perp=\{g\in X\mid \hat{g}(k)=0 \text{ for all uneven }k\in \mathbb{Z}\}$.
Suppose now that $X= U\oplus U^\perp$. Consider $f$ defined by $f(x)=(1-e^{-ix})\mathrm{sgn}(x)$ for $x\in [-\pi,\pi]$. As $\lim_{x\to 0}\big(1-e^{-ix}\big)=0$, we find that $f$ is indeed continuous, thus $f\in X$. By assumption there are $u\in U$ and $v\in U^\perp$ such that $f=u+v$. Then a short computation yields that
$\widehat{u}(k)=\widehat{\text{sgn}}(k)$ for all $k\in \mathbb{Z}$.
Thus, we must have $u=\mathrm{sgn}$ in $L^2([-1,1])$, and thus $u(x)=\mathrm{sgn}(x)$ for a.e. $x\in [-1,1]$. But this implies that $u$ is not continuous and thus $u\notin X$. Thus we showed that $X\neq U \oplus U^\perp$.