Wave equation, initial conditions The displacement of an infinite string obeys the wave equation:
$$ \frac{\partial ^2 u}{\partial t^2} = c^2 \frac{\partial^2 u}{\partial x^2}$$
Find the solution in the form:
$$u(x,t) = f(x-ct) + g(x+ct) $$
where $g=-f$ and the initial conditions are given by:
$$u(x,0)=0$$
$$\frac{\partial}{\partial t} u(x,0) = \frac{x}{(1+x^2)^2}$$

The second condition leads to:
$$\frac{\partial u}{\partial t}=-cf'(x,0)+cg'(x,0)=-2cf'(x,0)=\frac{x}{(1+x^2)^2}$$
$$f(x,0) = - \frac{1}{2c} \left( \frac{x}{(1+x^2)^2} \right) t + h(x)$$
Now, this is the solution for $t=0$. Is it mathematically correct to simply substitute $x$ back with $x \pm ct$? i.e.:
$$u(x,t) = - \frac{1}{2c} \left( \frac{(x-ct)}{(1+(x-ct)^2)^2} \right) t +\frac{1}{2c} \left( \frac{(x+ct)}{(1+(x+ct)^2)^2} \right)t$$
In principle the initial conditions would be satisfied for any function of $t$ that yields $h(0)=0$, but since I am supposed to find a solution of that particular form ($f(x\pm ct)$), I suppose it is a correct solution?

Let's be careful:
The second condition leads to:
$$\left.\frac{\partial u}{\partial t}\right|_{t=0}=-cf'(x)+cg'(x)=-2cf'(x)=\frac{x}{(1+x^2)^2}$$
Thus
$$f(x) = \frac{1}{4c} \cdot\frac{1}{1+x^2}+c_1,$$
where $c_1$ is a constant, as
$$
f'(x)=-\frac{1}{2c}\cdot\frac{x}{(1+x^2)^2}.
$$
