Understanding the proof that a trivial orthogonal complement does not imply density of a subspace In this post: Trivial Orthogonal Complement $\implies$ Denseness! the relationship between trivial orthogonal complement and density of a subspace is investigated. The accepted answer:  https://math.stackexchange.com/a/831907/877219 shows that trivial orthogonal complement does not imply density of the subspace. Namely, we take $X = C_0^\infty(\mathbb{R}), \hat{X} = L^2(\mathbb{R}), A = \{f\in X\mid \int_a^bf(x)dx = 0\}$. Then the accepted answer states that:

$A^\perp = \{0\}$ since $1_{[a,b]}\not\in X$, but $A$ is clearly not dense.

I don't quite understand why this shows that $A^\perp = \{0\}$. Could you explain to me in detail the gist of this proof?
 A: The idea is that $A$ is the orthogonal complement of the indicator function ${\bf 1}_{[a,b]}$ of $[a,b]$, so $A^\perp$ is the span of ${\bf 1}_{[a,b]}$. But the latter intersects $X$ only in the zero function because ${\bf 1}_{[a,b]}$ is not smooth (continuous).
The details read as follows: Let $X:=(C_0^\infty(\mathbb R),\langle\cdot,\cdot\rangle_{L^2})$ and $A:=\{g\in X:\int_a^bg(x)dx=0\}$. Note that $A$ can be re-written as
\begin{align*}
A&=\Big\{g\in X:\int_{\mathbb R}{\bf 1}_{[a,b]}g(x)dx=0\Big\}\\
&=\{g\in X:\langle{\bf 1}_{[a,b]},g\rangle_{L^2}=0\}\\
&=\{g\in L^2(\mathbb R):\langle{\bf 1}_{[a,b]},g\rangle_{L^2}=0\}\cap X=\{{\bf 1}_{[a,b]}\}^{\perp,L^2}\cap X\,.
\end{align*}
where $(\cdot)^{\perp,L^2}$ is the orthogonal complement in $\bf L^2$.
Now we want to show that the orthogonal complement of $A$ in $\bf X$ (i.e. $A^\perp=A^{\perp,L^2}\cap X$) is just the zero function.
For this we need the following facts (in this order):

*

*The orthogonal complement of any non-trivial set $A$ equals the orthogonal complement of $\overline{A}$ (follows from Cauchy-Schwarz)

*Using that $X$ is dense in $L^2(\mathbb R)$ one readily verifies that $\{{\bf 1}_{[a,b]}\}^{\perp,L^2}\cap X$ is dense in $\{{\bf 1}_{[a,b]}\}^{\perp,L^2}$.

*Given any non-empty subset $A$ of a Hilbert space one has $(A^\perp)^\perp=\overline{\operatorname{span}(A)}$
With these tools at hand we compute
\begin{align*}
A^\perp=A^{\perp,L^2}\cap X&=(\{{\bf 1}_{[a,b]}\}^{\perp,L^2}\cap X)^{\perp,L^2}\cap X\\
&=\big(\overline{\{{\bf 1}_{[a,b]}\}^{\perp,L^2}\cap X}\big)^{\perp,L^2}\cap X\\
&=(\{{\bf 1}_{[a,b]}\}^{\perp,L^2})^{\perp,L^2}\cap X\\
&=\operatorname{span}({\bf 1}_{[a,b]})\cap X=\{0\}
\end{align*}
so altogether $A^\perp=\{0\}$. The last step is where we used that ${\bf 1}_{[a,b]}\not\in X$.
