Find the solution for the problem:
$ \begin{equation} \frac{\partial^2 u}{\partial t^2} -c^2\frac{\partial^2u}{\partial x^2}=0\qquad \qquad x\in\mathbb{R}\;,t>0 \\ u(x,0)=e^{-x^2} \qquad \qquad \frac{\partial u}{\partial t}(x,0)=\cos x \end{equation} $
My attempt:
We know the general solution of wave equation is: $$u(x,t)=F(x-ct)+G(x+ct)\tag 1$$
We need find $F$ and $G$ such that $(1)$ satifies the initial condition of the problem.
Then,
$$\frac{\partial u}{\partial t}=-cF'(x-ct)+cG'(x+ct)$$
Moreover
$u(x,0)=e^{-x^2}\implies F(x)+G(x)=e^{-x^2} \tag 2$
$\frac{\partial u}{\partial t}(x,0)=\cos x \implies -cF'(x)+cG'(x)=\cos x\tag 3$
of $(2)$ and $(3)$ we can get the value of $G'(x)$
In other words,
$$G'(x)=-xe^{-x^2}+\frac{\cos x}{2c} \tag 4$$
Integrating $(4)$of $0$ to $x$ we have:
$$G(x)=\frac{1}{2}[e^{-x^2}-1+\frac{\sin x}{c}] + G(0)\tag 5$$
As $F(x)=e^{-x^2}-G(x)$ then:
$$F(x)=e^{-x^2}-\frac{1}{2}[e^{-x^2}-1+\frac{\sin x}{c}] - G(0) \tag 6$$
Replacing $(5)$, $(6)$ in $(1)$ we have:
$$u(x,t)=e^{-x^2}-\frac{1}{2}[e^{-x^2}-1+\frac{\sin x}{c}]+\frac{1}{2}[e^{-x^2}-1+\frac{\sin x}{c}] \tag 7$$
I think this last result is wrong because $(7)$ expression does not satisfy the principal PDE.
Can someone help me?