Must a subspace of a Euclidean space with zero orthogonal complement be dense? Let $X$ be a Euclidean space (i.e. a vector space over $\mathbb{R}$ or $\mathbb{C}$ with an inner product, $\textbf{not necessarily complete}$). Let $S$ be a subspace of $X$ with its orthogonal complement $S^\perp$ equal to $\{0\}$. Must we have $\overline{S} = X?$
This is certainly true whenever $\overline{S}$ is complete in $X$, since we can write $X = \overline{S} \oplus S^\perp$. In particular it is true whenever $X$ is a Hilbert space. 
But in the general case that $X$ is Euclidean...?
 A: Equip the space $X = C_c^\infty(\mathbb{R})$ of smooth compactly supported test functions with the inner product arising from $L^2(\mathbb{R})$.
Let $S = \{f \in X: \int_0^1 f(s) ds = 0\}$. I claim that $S^\perp = \{0\}$ and that $S$ is not dense.
Firstly, if $g \in S^\perp$ then $\operatorname{supp}(g) \subseteq [0,1]$. Indeed, otherwise there is some interval $[a,b]$ disjoint from $[0,1]$ such that either $g>\varepsilon$ or $g < -\varepsilon$ on $[a,b]$ for some $\varepsilon > 0$. Then, a smooth probability density function $f$ with support in $[a,b]$ lies in $S$ and has either $\int_{\mathbb{R}} fg > \varepsilon > 0$ or $\int_{\mathbb{R}} fg < - \varepsilon <0$.
As a result, if $g \neq 0$ then $g$ is not constant on $[0,1]$ so that there exist $x,y \in [0,1]$ such that $g(x) \neq g(y)$. To see that this cannot happen, let $f$ be a smooth probability density function with support in $[0,1]$ and define $f_x^\lambda(y) = \lambda^{-1}f(\lambda^{-1}(x-y))$. For $\lambda$ sufficiently small $f_x^\lambda$ and $f_y^\lambda$ have disjoint support so that $f_x^\lambda - f_y^\lambda \in S$. Hence $0 = \int_0^1 (f_x^\lambda - f_y^\lambda) g$. However, $f_x^\lambda$ is a mollifier centered at $x$ and so by standard properties of mollification $\int_0^1 f_x^\lambda g \to g(x)$ as $\lambda \to 0$ which implies that $g(x) - g(y) = 0$, a contradiction. Hence $g = 0$ and so $S^\perp = 0$.
Next I show that $S$ is not dense in $X$. Note that if $f_n \in S$ and $f_n \to f$ in $L^2(\mathbb{R})$-norm then $\int_0^1 f = \int_0^1 (f-f_n) = \int_{\mathbb{R}} 1_{[0,1]} (f-f_n) \to 0$ as $n \to \infty$ by Cauchy-Schwarz and so $\int_0^1 f = 0$. Hence, $S$ is a proper closed subset of $X$ with $S^\perp = \{0\}$.
