Solution (source code)

= Solution

Use <separation of variables>, $f=X(x)T(t)$, and set
$$
\frac{X''}{X}=\frac{T''}{c^2T}=\kappa.
$$
For $\kappa=-\lambda^2$, with $\lambda>0$, the separated solutions are
$$
\boxed{f=(A\cos\lambda x+B\sin\lambda x)
(C\cos c\lambda t+D\sin c\lambda t)}.
$$
For $\kappa=0$, they are
$$
\boxed{f=(Ax+B)(Ct+D)}.
$$
For $\kappa=+\lambda^2$, they are
$$
\boxed{f=(A\cosh\lambda x+B\sinh\lambda x)
(C\cosh c\lambda t+D\sinh c\lambda t)}.
$$
Arbitrary admissible superpositions of separated solutions are again solutions. An individual product is only a separated family, not the entire <general solution>. Without prescribed boundaries, the general twice-differentiable solution is equivalently <D'Alembert's formula>,
$$
\boxed{f(x,t)=F(x-ct)+G(x+ct)}.
$$
For example, changing to $\xi=x-ct$, $\eta=x+ct$ makes the differential equation $f_{\xi\eta}=0$, whose two integrations give this form.