How are these results obtained in d'Alembert's Solution to the $1+1$ wave equation?
After getting, $\frac{1}{c}\psi(c)=f'(x)-g'(x)$ we integrate from $a$ to $x$ and we get
$$f(x)-g(x)=\frac{1}{c}\int_{a}^{x}\psi(s)\,ds.$$ My question is: Why do we integrate it from $a$ to $x$?
I think we require answer in variable $x$, that's why we integrate..
The parameter $a$ is arbitrary. However, the author was a bit careless with an intermediate step.
Note that from $f'(x)-g'(x)=\frac1c\psi(x)$ we have for any constant $a$
$$f(x)-g(x) -(f(a)-g(a))=\frac1c \int_a^x \psi(x')\,dx'\tag1$$
Then, since $f(x)+g(x)=\phi(x)$ we see that
$$f(x)=\frac12\phi(x)+\frac1{2c}\int_a^x \psi(x')\,dx'+f(a)-g(a)\tag 2$$
and
$$g(x)=\frac12 \phi(x)-\frac1{2c}\int_a^x \psi(x')\,dx'-(f(a)-g(a))\tag 3$$
Finally, from $u(x,t)=f(x+ct)+g(x-ct)$ we find that
$$u(x,t)=\frac12\left(\phi(x+ct)+\phi(x-ct)\right)+\frac1{2c}\int_{x-ct}^{x+ct}\psi(x')\,dx'$$
and the term $f(a)-g(a)$ is absent as expected.