(From an exercise in Pinchover's Introduction to Partial Differential Equations).
$u(x,t)=\frac{A_0 + B_0 t}{2}+\sum_{n=1}^{\infty} \left(A_n\cos{\frac{c\pi nt}{L}}+ B_n\sin{\frac{c\pi nt}{L}}\right)\cos{\frac{n\pi x}{L}}$
is a general (and formal, at least) solution to the vibrating string with fixed ends. How to write this as a superposition of a forward and a backward wave? That is, as $f(x+ct)+f(x-ct)$ for some $f$. (No need to worry about rigour here, an heuristic will do.)
I know, by elementary trigonometry, that $\left(A_n\cos{\frac{c\pi nt}{L}}+ B_n\sin{\frac{c\pi nt}{L}}\right)\cos{\frac{n\pi x}{L}} =\\= (1/2)(A_n\cos +B_n\sin)\left(\frac{c\pi nt}{L} + \frac{n\pi x}{L}\right)+(1/2)(A_n\cos +B_n\sin)\left(\frac{c\pi nt}{L} - \frac{n\pi x}{L}\right), $ but this doesn't seem to work because the variable $x$ is the one that changes sign, so apparently this cannot be interpreted as a sum of forward and backward waves.
Is there a workaround to this?
EDIT. The second wave is from another function $g$. The answer is then straightforward after oen's comment.