I'm trying to solve this problem from Haberman's book.

I solved the PDE and got $$ u(x,t) = \sum_{n=1}^{\infty} A_n \sin{\frac{n\pi}{L}x} \cos{\frac{n\pi c}{L}t} $$
I used the trigonometric identity and got
$$ u(x,t) = \sum_{n=1}^{\infty} \frac{1}{2}A_n \left[\sin \left(\frac{n\pi}{L}(x+ct)\right)+\sin \left(\frac{n\pi}{L}(x-ct)\right)\right] \\ u(x,t) = \frac{1}{2} \left[F(x+ct)+F(x-ct)\right] $$
My question is, is this correct? I didn't use the fact that $u(x,0)=f(x)$ anywhere, so I don't know if I solved this properly.