Method of characteristics PDE $u_t +uu_x = x$ In this question you are asked to solve the initial value problem
\begin{aligned}
u_t +uu_x &= x,\\
u(x, 0) &= f(x)
\end{aligned}
using the method of characteristics. Using the parameters $s$ and $τ$, show that the solution can be expressed as
$$u(s, τ ) = \frac{1}{2}(f(s) + s) e^τ +\frac{1}{2}
(f(s) − s) e
^{−τ}$$
I tried using Method of characteristics but cannot get the answer. 
$\frac{dt}{ds} = 1$, $ \frac{dx}{ds} =u$ and $\frac{du}{ds} =x$. 
This gives $\frac{dx}{du} =x/u
$ which does not give the solution as above. How do i get the above solution. Thanks.
 A: Let us apply the method of characteristics.


*

*$\frac{\text d t}{\text d \tau} = 1$, letting $t(0)=0$, we know $t=\tau$.

*$\frac{\text d x}{\text d \tau} = u$ and $\frac{\text d u}{\text d \tau} = x$, so that $\frac{\text d^2 x}{\text d \tau^2} = \frac{\text d}{\text d \tau}\frac{\text d x}{\text d \tau} = \frac{\text d u}{\text d \tau}$, i.e., $\frac{\text d^2 x}{\text d \tau^2} = x$. Letting $(x(0),u(0)) = (s,f(s))$, we know
\begin{aligned} x(\tau) &=
   \frac{1}{2}(f(s)+s) e^\tau - \frac{1}{2}(f(s)-s) e^{-\tau}\\
      &= f(s) \sinh\tau + s\cosh\tau \, ,
\end{aligned}
and
\begin{aligned}
   u(x(\tau),\tau) &= \frac{1}{2}(f(s)+s) e^\tau + \frac{1}{2}(f(s) - s)
   e^{-\tau} \\
     &= f(s) \cosh\tau + s\sinh\tau \, .
\end{aligned}
To obtain $u(x, t)$, one eliminates $s$ by using the expression of $x(\tau)$. Here, it is hard to express $s$ in terms of $x(\tau)$ and $\tau$ for general initial data $f$, but it is possible in some particular cases. For instance, if $f(s) = a s$, then
$$
u(x,t)= x \frac{a+\tanh t}{1 + a\tanh t}
$$
as long as $t \neq \text{argtanh}(-1/a)$.
