Solution (source code)

= Solution

With $\eta=x-t$ and $\xi=x+t$, the <chain rule> gives
$$
\partial_x=\partial_\eta+\partial_\xi,
\qquad
\partial_t=-\partial_\eta+\partial_\xi.
$$
Hence
$$
u_{xx}-u_{tt}=4U_{\eta\xi},
$$
so the <wave equation> is equivalent to $U_{\eta\xi}=0$. Integrating in each variable gives
$$
u(x,t)=F(x-t)+G(x+t).
$$
The initial conditions imply
$$
F(x)+G(x)=f(x),
\qquad
-F'(x)+G'(x)=g(x).
$$
Solving and integrating yields the <D'Alembert formula with initial velocity>
$$
\boxed{
u(x,t)=\frac12[f(x-t)+f(x+t)]
+\frac12\int_{x-t}^{x+t}g(y)\,dy}.
$$

If $|x-x_0|>r+t$, then both $x-t$ and $x+t$ lie outside the support interval $[x_0-r,x_0+r]$, and every point between them does as well. All three terms therefore vanish. Thus
$$
\boxed{u(x,t)=0\quad\text{when }|x-x_0|>r+t},
$$
which is finite propagation speed.

For the finite string, differentiate its energy and use $y_{tt}=y_{xx}$:
$$
\begin{aligned}
\frac{dE}{dt}
&=\int_0^L(y_xy_{xt}+y_ty_{tt})\,dx\\
&=\int_0^L(y_xy_{xt}+y_ty_{xx})\,dx\\
&=[y_ty_x]_0^L.
\end{aligned}
$$
The fixed-end conditions hold for every $t$, so differentiation gives $y_t(0,t)=y_t(L,t)=0$. The boundary term vanishes and
$$
\boxed{E(t)=E(0)}.
$$