For a densely defined symmetric operator $A$, is $A^2$ also densely defined? Let $A : D(A) \to H$ be a possibly unbounded, densely defined symmetric operator on a Hilbert space $H$ ($A$ being symmetric means that $(\varphi, A\psi) = (A\varphi, \psi)$ for all $\varphi, \psi \in D(A)$). Consider the operator $A^2$ with domain $D(A^2) := \{ \psi \in D(A) | A\psi \in D(A) \}$.

I would like to determine whether $D(A^2)$ is dense in $H$.

The usual way to prove something like this is to assume that we have $\varphi \in H$ such that 
$$(\psi, \varphi) = 0$$
for all $\psi \in D(A^2)$. Then we want to show that this implies $\varphi = 0$. But I have not really been able to make any progress from this point. 
Hints or solutions are greatly appreciated. 
 A: Let $H=L^2[0,\pi]$ and let $Af=if'$ on the domain $\mathcal{D}(A)$ consisting of all finite linear combinations of $\{ \sin(nx) \}_{n=1}^{\infty}$. The domain is dense because every $f\in H$ has an odd extension $f_o$ to $L^2[-\pi,\pi]$, and the Fourier series of $f_o$ is a sin series that converges in $L^2[-\pi,\pi]$ to $f_o$ and, hence, also converges to $f$ in $L^2[0,\pi]$.
The operator $A : \mathcal{D}(A)\subset H\rightarrow H$ is symmetric because $f \in \mathcal{D}(A)$ satisfies $f(0)=f(\pi)=0$, which gives
$$
         (Af,g)-(f,Ag) = \left.\int_{0}^{\pi}i\{f'\overline{g}+f\overline{g}'\}dx = if\,\overline{g}\right|_{x=0}^{\pi} = 0,\;\;\;f,g\in\mathcal{D}(A).
$$
The range $\mathcal{R}(A)$ of $A$ consists of finite linear combinations of $\{\cos(nx)\}_{n=1}^{\infty}$. In order for $f=\sum_{n=1}^{N}a_n\sin(nx)$ to be in the domain of $\mathcal{D}(A^2)$ it is necessary and sufficient for there to exist constants $b_k$ such that
$$
              \sum_{n=1}^{N}a_nn\cos(nx) = \sum_{k=1}^{K}b_k\sin(kx),\;\;\; 0 \le x \le \pi.
$$
It is easy to construct differential operators that will annihilate all but $\sin(lx),\cos(lx)$ in the above sums, which leads to $A_l\sin(lx)=B_l\cos(lx)$ on $[0,\pi]$ and forces $a_l=b_l=0$ for all $l$. So it appears to me that $\mathcal{D}(A^2)=\{0\}$, which is not dense.
A: On $L^2([0,1])$, let $A$ be the orthogonal projection onto (one-dimensional) linear span of some discontinuous function $f$. This is a self-adjoint operator. Restrict the domain of $A$ to   $C([0,1])$; this is a symmetric  operator. The domain of $A^2$ is $\{f\}^\perp$, which is not dense.
