Equipartition of energy 
Let $u$ solve the initial-value problem or the wave equation in one dimension: $$\begin{cases}u_{tt}-u_{xx}=0 & \text{in } \mathbb{R} \times (0,\infty) \\ u = g, u_t = h & \text{on } \mathbb{R} \times \{t=0\}. \end{cases}$$ Suppose $g,h$ have compact support. The kinetic energy is $k(t) := \frac 12 \int_{-\infty}^\infty u_t^2(x,t) \, dx$ and the potential energy is $p(t) := \frac 12 \int_{-\infty}^\infty u_x^2(x,t) \, dx$. Prove
(a) $k(t)+p(t)$ is constant in $t$,
(b) $k(t)=p(t)$ for all large enough times $t$.

This is Chapter 2, Exercise 24 of PDE Evans, 2nd edition.
I am only doing part (a) right now; my work is shown below:
Define $$e(t):=k(t)+p(t)=\int_{-\infty}^\infty u_t^2+u_x^2 \, dx.$$ Then $$e'(t)=\frac 12 \int_{-\infty}^\infty 2u_tu_{tt}+2u_{x}u_{xt} \, dx= \int_{-\infty}^\infty u_tu_{tt}+u_{x}u_{xt} \, dx.$$
Now, I want to get $e'(t)=0$ so that $e(t)$ is constant. How can I go about doing this? I do know that I can use $u_{tt}-u_{xx}=0$, if $t > 0$.
With $t>0$ into mind, do I have to consider the $t=0$ case separately? Or can I treat both cases together as $t \ge 0$, since $g$ and $h$ have compact support?

(a) We define$$
e(t)\equiv k(t)+p(t)=\frac12\int_{-\infty}^\infty \left( u_t^2+u_x^2\right)\,dx.
$$
Since $g,h$ have compact supports, we have that\begin{align*}
\frac{d}{dt}e(t)&=\frac12\int_{-\infty}^\infty 2u_tu_{tt}+2u_xu_{xt}\,dx\\
&=\int_{-\infty}^\infty u_tu_{tt}\,dx-\int_{-\infty}^\infty u_{xx}u_t\,dx\\
&=\int_{-\infty}^\infty u_t(u_{tt}-u_{xx})\,dx=0.
\end{align*}
Hence, $e(t)\equiv e(0)$ and so $k(t)+p(t)$ is constant in $t$.
(b) By d'Alembert's formula, we have$$
u(x,t)\frac12 (g(x+t)+g(x-t))+\frac12 \int_{x-t}^{x+t} h(y)\,dy.
$$
Thus\begin{align*}
u_t&=\frac12 (g'(x+t)-g'(x-t))+\frac12(h(x+t)+h(x-t)),\\
u_x&=\frac12 (g'(x+t)+g'(x-t))+\frac12(h(x+t)-h(x-t))
\end{align*}
We assume that there exists a positive constant $M$ so that $[-M,M]\supseteq supp(g')$ and $[-M,M]\supseteq supp(h)$. Note that for a fixed $t>M$,$$
-M\leq x-t\leq M\Leftrightarrow 0<t-M\leq x\leq t+M$$and $$-M\leq x+t \leq M\Leftrightarrow -t-M\leq x\leq -t+M<0.$$
Thus, when $t>M$,
$\,\,\,\,\,$(i) $0<t-M\leq x\leq t+M$. Then,$$
h(x+t)=g(x+t)=0
$$and so$$
u_t^2=\frac14 g'(x-t)^2+\frac14 h(x-t)^2-\frac12 g'(x-t)h(x-t)=u_x^2.
$$
$\,\,\,\,\,$(ii) $-t-M\leq x\leq -t+M<0$. Then,$$
u_t^2=\frac14 g'(x+t)^2+\frac14 h(x+t)^2+\frac12 g'(x+t)h(x+t)=u_x^2.
$$
$\,\,\,\,\,$(iii) Otherwise,$$
g'(x+t)=g'(x-t)=h(x+t)=h(x-t)=0.
$$
Hence, combining all the cases, it follows that, when $t>M$, $k(t)=p(t)$.
