Find wave equation initial condition such that solution consists of right-going waves only Let $u(x,t)$ solve the wave equation $u_{tt}=c^2u_{xx}$ and let $u(x,0)=A(x)$ for some function $A(x)$. Find the function $B(x)=u_t(x,0)$ such that the solution consists of right going waves only.
My attempt:
By d'Alembert's formula, the general solution is given by 
$u(x,t) = \frac{1}{2}[A(x+ct)+A(x-ct)]+\frac{1}{2c}\int_{x-ct}^{x+ct}B(s)ds$
Since the solution should consist of right-going waves only, we want a solution of the form 
$u(x,t)=A(x-ct)$
which implies the sum of the remaining terms in d'Alembert's formula should equal $0$.
\begin{equation}
\frac{1}{2}A(x+ct)+ \frac{1}{2c}\int_{x-ct}^{x+ct}B(s)ds=0\\
\frac{1}{2c}\int_{x-ct}^{x+ct}B(s)ds = -\frac{1}{2}A(x+ct)\\
\int_{x-ct}^{x+ct}B(s)ds = -cA(x+ct)\\
\end{equation}
And then taking the derivative of both sides,
\begin{equation}
B(x) = -cA'(x+ct)
\end{equation}
Is this the correct way to do this?

The general solution to the homogeneous wave function $u_{tt}-c^2u_{xx}=0$ is 
$$u(x,t)=f(x-ct)+g(x+ct)$$
Applying the initial condition $u(x,0)=A(x)$ reveals that 
$$f(x)+g(x)=A(x) \tag 1$$
Applying the initial condition $u_t(x,0)=B(x)$ reveals that 
$$-cf'(x)+cg'(x)=B(x) \tag 2$$
Now, we differentiate $(1)$ to obtain
$$f'(x)+g'(x)=A'(x) \tag 3$$
Solving $(2)$ and $(3)$ simultaneously for $f'$ and $g'$ yields
$$f'(x)=\frac{cA'(x)-B(x)}{2c}$$
$$g'(x)=\frac{cA'(x)+B(x)}{2c}$$
If we impose that $g=0$, then we must have $B(x)=-cA'(x)$.  Then, 
$$f(x)=A(x)$$
and 
$$u(x,t)=A(x-ct)$$
where the initial conditions are $u(x,0)=A(x)$ and $u_t(x,0)=B(x) = -cA'(x)$.

Approaching the problem using D'Alembert's equation, we have
$$u(x,t)=\frac12 (A(x-ct)+A(x+ct))+\frac{1}{2c}\int_{x-ct}^{0}B(u)du+\frac{1}{2c}\int_{0}^{x+ct}B(u)du$$
Then, for a solution with right-going waves only, we must enforce
$$\frac12 A(x+ct)+\frac{1}{2c}\int_{0}^{x+ct}B(u)du=0 \tag 4$$
Differentiating $(4)$ yields
$$\frac{c}{2} A'(x+ct)+\frac12 B(x+ct)=0 \Rightarrow B(x+ct)=-cA'(x+ct)$$
Finally, 
$$u(x,t)=\frac12 A(x-ct)-\frac{1}{2}\int_{x-ct}^{0}A'(u)du=A(x-ct)$$
where we tacitly assume that $A(0)=0$.
