Let $f\in\operatorname{C}^2(\mathbb{R})$ and $g\in\operatorname{C}^1(\mathbb{R})$ be function whose support are compact. By considering a solution $u$ of the problem $$ \begin{cases} u_{tt}(x,t) - u_{xx}(x,t) = 0,\text{ for } (x,t)\in\mathbb{R}^2\\ u(\cdot, 0) = f\\ u_{t}(\cdot,0) = g \end{cases}$$ How to show that $F(x,t) = |\nabla u(x,t)|^2$ has compact support and the energy function $$E(t) = \frac{1}{2}\int_{\mathbb{R}}F(x,t)dx$$ can be written as $$E(t) = \int_{\mathbb{R}} g(x)^2 + f'(x)^2 dx$$
By drawing the dependence domains, I can "show" the first part, but I'm having trouble in writing it down formally.
To write down something formally, you need some symbols as ingredients from which formulas will be cooked. Let's say the supports of $f$ and $g$ are contained in interval $[a,b]$. Using D'Alembert's formula you will see that $u(x,t)=0$ when $x>b+t$ or $x<a-t$. Hence, for each fixed $t$ the function $|\nabla u(x,t)|$ is compactly supported in $x$.
The part about $E$ actually asks you to show that $E$ is independent of $t$: this is why $E(t)=E(0)=\int g^2+(f')^2$. So, take the derivative $E'(t)$ and massage it into zero: $$ E'(t) = \int (u_tu_{tt}+u_xu_{xt}) = \int ( u_tu_{xx}+u_xu_{xt}) = \int (u_tu_x)_x =0 $$