Consider the variable coefficient, real valued wave equation
$$ u_{tt} - \nabla \cdot (c^2 \nabla u) + qu = 0, \quad u(x,0) = \phi(x), \quad u_t(x, 0) = \phi(x), $$ where $c, q \geq 0$ depend only on $x$. Then we define the total energy at time $f$ of a $C^2$ solution $u$ as
$$ E(t) = \frac{1}{2}\int_\Omega (u_t^2 + c(x)^2|\nabla u|^2 + q(x)u^2) \, dx. $$
The goal is to show that the total energy is constant given some boundary conditions. To do this, we differentiate $E$ with respect to $t$, but I have some questions about the presented derivation. The notes I'm following claim that
$$ \frac{dE}{dt}(t) = \frac{1}{2}\int_\Omega (u_tu_{tt} + c(x)^2 \nabla u \cdot \nabla u_t + q(x)uu_t)\, dx. $$
However, my calculations have that, e.g.:
$$ \frac{d}{dt} u_t^2 = 2\left(\frac{d}{dt}u_t\right)\left(\frac{d}{dt}u\right) = 2u_{tt}u_t.$$
Where does the extra factor of $2$ appear in my derivation?
With the $\nabla$ term, I'm having even more trouble recovering the solution's expression. I expand as:
$ \begin{align*} \frac{\partial}{\partial t}|\nabla u|^2 &= \frac{\partial}{\partial t}\left(\sum_{i=1}^n\left(\frac{\partial u}{\partial x_i}\right)^2 + \left(\frac{\partial u}{\partial t}\right)^2\right)\\ &= \sum_{i=1}^n 2\frac{\partial^2 u}{\partial t \partial x_i} \frac{\partial u}{\partial t} + 2 \frac{\partial^2 u}{\partial^2 t}\frac{\partial u}{\partial t} \\ \end{align*} $
which isn't the form in the notes. Any guidance in how the notes get their final expression would be much appreciated.
The notes that you are following should be corrected by erasing the initial fraction: $$ \frac{dE}{dt}(t) = \int_\Omega (u_tu_{tt} + c(x)^2 \nabla u \cdot \nabla u_t + q(x)uu_t)\, dx. $$ In particular, the derivative of $(u_t)^2$ is obtained exactly as you wrote. As for the middle term, you have instead $$ \frac{\partial}{\partial t}|\nabla u|^2 = \frac{\partial}{\partial t}\sum_{i=1}^n\left(\frac{\partial u}{\partial x_i}\right)^2= \sum_{i=1}^n 2\frac{\partial^2 u}{\partial t \partial x_i} \frac{\partial u}{\partial x_i}= \sum_{i=1}^n 2\frac{\partial u_t}{\partial x_i} \frac{\partial u}{\partial x_i}=2\nabla u \cdot \nabla u_t. $$