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...?

• Your question doesn't make much sense? every euclidean space is a Hilbert space – JustDroppedIn May 12 at 11:33
• The definition of a Euclidean space used in my course is that it is an inner product space - not necessarily complete. – Baran Karakus May 14 at 8:17
• Yes but you can prove its completeness easily, you only need that $\mathbb{R}$ is complete (and this is the so called "least upper bound axiom") – JustDroppedIn May 14 at 21:03
• This is not true. Take the space C[0, 1] of continuous functions onto the reals from [0, 1], equipped with the L2 norm, which is induced from an inner product. This space is incomplete but is a Euclidean space (i.e. an inner product space). – Baran Karakus May 18 at 17:34
• This is not a Euclidean space, since it is not finite dimensional; the definition of a Euclidean space specifically refers to a finite dimensional space. – JustDroppedIn May 19 at 12:11

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\}$$.
• I don't see that $S$ is closed in $X$. Let $x^{(k)}$ be the vector whose first component is $1$, whose next $k$ components are $-\frac1k$, and whose remaining components are all $0$. Let $y$ be the vector whose first component is $1$ and whose other components are all $0$. All these vectors are in $X$. The difference $y-x^{(k)}$ has $k$ non-zero components, all equal to $-\frac1k$, so its $\ell^2$ norm is $1/\sqrt k$, which approaches $0$ as $k\to\infty$. So $x^{(k)}\to y$. But all of the $x^{(k)}$ are in $S$ and $y$ isn't. – Andreas Blass May 23 at 1:35
• @AndreasBlass Shoot, thank you for pointing this out. I was quite tired and apparently very very careless when writing this. Of course, the idea of your example can easily be used to show that that $S$ was dense in the corresponding $X$. I've now updated the answer to contain the example I was really hoping to avoid when writing my previous answer. Hopefully this time I'm not missing something stupid. – Rhys Steele May 23 at 8:11