Using Fourier transform to solve for pde 
Consider the initial value problem for the wave equation $\frac{\partial^2}{\partial t^2}u(x,t) = c^2 \frac{\partial^2}{\partial x^2}u(x,t)$
, $-\infty < x < \infty$, $t > 0$
with initial conditions $u(x,0) = f(x)$ and $\frac{\partial}{\partial t} u(x,0) = g(x)$
for $-\infty<x<\infty$.


Using a Fourier transform in $x$, show that the solution is
$u(x,t) = \frac{1}{2}(f(x-ct)+f(x+ct)) + \frac{1}{2c}\int_{x - ct}^{x+ct}g(x')dx'$.
Hint. you will need to consider the result of $\int_{x - ct}^{x+ct}e^{-iku}du$.

I tried to do this question by first taking the fourier transform w.r.t. $x$ and then arrived at solution for pde (let $F(u)$ be fourier transform of solution $u$)$F(u) = A\cos(ckt)+B\sin(ckt)$. By applying the initial conditions, my solution then becomes $F(u) = F(f)\cos(ckt)+\frac{F(g)}{ck}\sin(ckt)$. I'm not sure what to do next to arrive to the answer above. Thanks
 A: The function $u(x,t)$ is derived from solving the two conditions separately. 
$$ u(x,t) = u_{1}(x,t) +u_{2}(x,t) \tag{1} $$
if you take the pde as follows
$$ \begin{align}\begin{cases} \frac{\partial^{2}  }{\partial t^{2}}u(x,t) = c^{2} \frac{\partial^{2} }{\partial x^{2}}u(x,t) \\  - \infty  < x < \infty , t > 0 \\  u(x,0) = f(x)  \\ \frac{\partial}{\partial x}u(x,0) = g(x)    \end{cases} \end{align} \tag{2}$$
First part
$$ \begin{align}\begin{cases} \frac{\partial^{2}  }{\partial t^{2}}u_{1}(x,t) = c^{2} \frac{\partial^{2} }{\partial x^{2}}u_{1}(x,t) \\  - \infty  < x < \infty , t > 0 \\  u_{1}(x,0) = f(x)  \\ \frac{\partial}{\partial x}u_{1}(x,0) = 0    \end{cases} \end{align} \tag{3}$$
and we solve the first part
$$\hat{U}_{1}(\omega,t) = \frac{1}{2\pi} \int_{-\infty}^{\infty} u_{1}(x,t) e^{i \omega x}  dx \tag{4}  $$
$$  u_{1}(x,t)  = \int_{-\infty}^{\infty} \hat{U}_{1}(\omega, t)  e^{-i \omega x}  d \omega \tag{5}  $$
If you take the fourier transform you get
$$ \frac{\partial \hat{U}_{1}}{\partial t^{2}} =-c^{2} \omega^{2} \hat{U}_{1} \tag{6} $$
when you apply the initial conditions you get
$$ \hat{U}_{1}(\omega, 0) = \frac{1}{2\pi}  \int_{-\infty}^{\infty} f(x) e^{i \omega x} \tag{7}$$
$$ \frac{\partial }{\partial t}\hat{U}_{1}(\omega, 0) = 0 \tag{8}$$
$$  \hat{U}_{1}(\omega,t) = A(\omega) \cos( c\omega t) + B(\omega)\sin(c \omega t) \tag{9} $$
$$B(\omega) = 0 \\ A(\omega) = \hat{U}_{1}(\omega, 0) = \frac{1}{2\pi} \int_{-\infty}^{\infty} f(x) e^{i \omega x}  dx \tag{10}  $$
now if you use the inverse fourier transform you get
$$ u_{1}(x,t) = \int_{-\infty}^{\infty} \hat{U}_{1}(\omega, 0) \cos( c\omega t) e^{- i \omega x} d \omega  \tag{11} $$
$$ u_{1}(x,t) = \frac{1}{2} \int_{-\infty}^{\infty} \hat{U}_{1}(\omega, 0) \bigg[ e^{- i \omega (x-ct)} + e^{-i \omega (x+ct)}  \bigg]d \omega \tag{12}$$
$$ u_{1}(x,t) = \frac{1}{2}\big[f(x-ct) +f(x+ct) \big] \tag{13} $$
Second part
$$ \begin{align}\begin{cases} \frac{\partial^{2}  }{\partial t^{2}}u_{2}(x,t) = c^{2} \frac{\partial^{2} }{\partial x^{2}}u_{2}(x,t) \\  - \infty  < x < \infty , t > 0 \\  u_{2}(x,0) = 0  \\ \frac{\partial}{\partial x}u_{2}(x,0) = g(x)    \end{cases} \end{align} \tag{14}$$
you get 
$$\hat{U}_{2}(\omega, t) = A(\omega) \cos( c\omega t) + B(\omega) \sin(c\omega t) \tag{15} $$
$$ \hat{U}_{2}(\omega,0) = 0  \\ \frac{\partial }{\partial t}\hat{U}_{2}(\omega, 0) = G(\omega) \tag{16}$$
$$ \hat{U}_{2}(\omega,t) = G(\omega) \frac{\sin(c \omega t}{c\omega } = \frac{\pi}{c}G(\omega)F(\omega) \tag{17}$$
then you get 
$$ f(x) = \begin{align}\begin{cases} 0  & |x|  > ct \\  1 & |x|  <ct     \end{cases} \end{align} \tag{18}$$
there's an exercise earlier in the book. This is Haberman. It is actually the $f(x)$ function above nearly
$$ f(x) = \begin{align}\begin{cases} 0  & |x|  > a \\  1 & |x|  <a     \end{cases} \end{align} \tag{19}$$
determine the Fourier transform
$$ F(\omega) = \frac{1}{2\pi} \int_{-\infty}^{\infty} f(x)e^{i \omega x} dx = \frac{1}{2\pi} \int_{-a}^{a} e^{i \omega x} dx = \frac{e^{i\omega x}}{2\pi i\omega}\Big|_{-a}^{a} \tag{20}$$
this gives
$$ F(\omega) = \frac{1}{2\pi i\omega} (e^{i \omega a} - e^{-i \omega a}) = \frac{1}{\pi \omega}\sin(\omega a) \tag{21} $$
$$u_{2}(x,t) = \frac{\pi}{c}\big[ \frac{1}{2\pi} \int_{-\infty}^{\infty} g(\hat{x}) f(x-\hat{x}) d\hat{x}  \big]  \tag{22}$$
$$ f(x-\hat{x}) = \begin{align}\begin{cases} 0  & |x-\hat{x}|  > ct \\  1 & |x-\hat{x}|  <ct     \end{cases} \end{align} \tag{23}$$
$$ u_{2}(x,t) = \frac{1}{2c} \int_{x-ct}^{x+ct} g(\hat{x}) d\hat{x} \tag{24} $$
$$ u(x,t) = \frac{1}{2}\big[f(x-ct) +f(x+ct) \big] +\frac{1}{2c} \int_{x-ct}^{x+ct} g(\hat{x}) d\hat{x} \tag{25} $$
