Suppose we have proved the equation $$u_{tt}-u_{xx}=0\quad\text{in}\quad(0,T)\times(0,\ell)$$ with some boundary and initial conditions has an unique solution $u\in C^2(0,T,H^2(0,\ell))$ and we need a $L^2$-estimate to $u_{tt}$.
Differentiating the equation with respect to $t$, multiplying by $u_{tt}$ and integrating with respect to $x$ we get
\begin{align*} \int_0^\ell u_{ttt}u_{tt}\;dx-\int_0^\ell u_{txx}u_{tt}\;dx&=0\\ \int_0^\ell u_{ttt}u_{tt}\;dx+\int_0^\ell u_{tx}u_{ttx}\;dx&=0\\ \frac{1}{2}\frac{d}{dt}\int_0^\ell \Big((u_{tt})^2 +(u_{tx})^2\Big)\;dx&=0\\ \|u_{tt}\|_{L^2}^2\leq \int_0^\ell \Big((u_{tt})^2 +(u_{tx})^2\Big)\;dx&=C \text{ (constant)} \end{align*}
Notice that only second order terms appear in the final estimate, so it makes sense. However, the calculation seems to make no sense because we have used third order terms that are not defined.
How can we justify calculations like that? I've seen the following comment: the differentiation with respect to $t$ is formally not allowed, but smoothing the initial data and going to the limit in the final estimates justifies the calculation. However I need some more details and references.
Thanks.