Let $A: X\to X$ be a densely defined linear operator acting on Banach Space $X$. Is $A^2$ also dense?
Context: I was trying to think of an alternative proof for the Hille-Yosida theorem - specifically $$R(A, \lambda)\leq\frac{M}{\lambda-\omega} \text{ and } A \text{ dense}\Rightarrow e^{tA} \text{ exists and } e^{tA}\leq Me^{t\omega}$$ Similarly to Rudin's proof (Theorem 13.37 of Functional Analysis) I first define $S(\varepsilon)=(I-\varepsilon A)^{-1}$ and note $AS(\varepsilon)f=S(\varepsilon)Af$ for $f\in\mathcal{D}(A)$. I also show $\lim_{\varepsilon\to0}S(\varepsilon)f=f$ for all $f\in X$. I next consider $T(t,\varepsilon)=\exp(tAS(\varepsilon))$ and show
$$\|T(t,\varepsilon)\|\leq M\exp\left(\frac{t\omega}{1-\varepsilon A}\right)$$
My proof then diverges from Rudin's (I didn't really understand it). I wanted to show $T$ was differentiable and therefore continuous, and we could define $Q(t)=\lim_{\varepsilon\to 0}T(t,\varepsilon)$. Given $f\in\mathcal{D}(A^2)$ we have
$$\left\|\frac{\partial}{\partial \varepsilon}T(t,\varepsilon)f\right\|=\left\|-te^{tAS(\varepsilon)}S(\varepsilon)^2A^2f\right\|<\infty$$
then given $A^2$ is dense over $X$, we can show that $Q(t)$ is well-defined over all of $X$, is generated by $A$, and is bounded by $M\exp(\omega t)$ as desired. However, I can't figure out how to prove that $A^2$ must be dense, and I'm not sure if this is the case.
I've thought of a counterexample for this.
Let $X=\ell^p(\mathbb{R}),1<p\leq\infty$. Define
$$c_i=\sum_{k=i}^\infty x_k$$
Let $f:\mathbb{N}\to\mathbb{N}^2$ be a bijection, where $f(n)=(f_1(n),f_2(n))$. We define a operator $A$ where
$$(Ax)_n=\frac{1}{f_1(n)+1}c_{f_2(n)}$$
Now note that $$\|Ax\|_p^p=\sum_{i=0}^\infty\sum_{j=0}^\infty\frac{1}{(i+1)^p}|c_j|^p=\zeta(p)\sum^\infty_{j=0}|c_j|^p$$
Then we define the domain of $A$ as $$\mathcal{D}(A)=\left\{x\in \ell^p(\mathbb{R}):\sum^\infty_{k=0}|x_k|<\infty\text{ and }\sum_{n=0}^\infty\left|\sum^\infty_{k=n}x_k\right|^p<\infty\right\}$$
The function is dense: take $x_k'=\sum^k_{n=0}x_ne_n$. $$\|x'_k-x_k\|=\sum^\infty_{n=k+1}x_n^p\to0$$
Because $x_k’$ has support $[k]$, it clearly meets the first condition and $$\sum_{j=0}^\infty |c_j|^p=\sum^k_{j=0}|c_j|^p<\infty$$
Hence $x_k'\in\mathcal{D}(A)$ and $\mathcal{D}(A)$ is dense.
Next, consider the domain of $A^2$. Let $Ax=y$. Then,
$$\infty>\sum^\infty_{k=0}|y_k|\geq\sum^\infty_{f_2(k)=n}|y_k|=\sum^\infty_{f_2(k)=n}\frac{1}{f_1(k)+1}|c_{n}|=|c_n|\sum_{i=1}^\infty\frac{1}{i}$$
Since the harmonic series diverges, we need all $c_n=0$, which (after taking differences) implies all $x_n=0$. Hence $\mathcal{D}(A^2)=\{0\}$ and is not dense in $X$.
Now note that $A$ is not closed. That being said, I expect this not to be true in general. Essentially, let $\mathcal{B}$ be a ball around $x$. For $\mathcal{B}$ to contain a point in $\mathcal{D}(A^2)$, we want $A\mathcal{B}$ to contain a point in $\mathcal{D}(A)$. Since density is only a statement about open subsets of $X$ containing elements of $\mathcal{D}(A)$, we want $A\mathcal{B}$ to have nonempty interior. However this is generally not the case (especially if $A$ is not surjective).
That being said, I have thought of a way to sidestep this - using the derivative of $T(t,\varepsilon)$, we can use the mean value inequality to bound $\|[T(t,\varepsilon+\delta)-T(t,\varepsilon)]f\|$. Taking $\varepsilon\to0$, then $\delta\to0$ shows that the limit exists for $f\in\mathcal{D}(A)$, which is dense in $X$.