Method of Characteristics for $u_t + uu_x = -2u$ 
Consider the following quasi-linear PDE : $u_t + uu_x = -2u$, with the boundary condition $u(0,t) = e^{-t}$. 
  Show, using the method of characteristics, that the solution to this boundary value problem is $u(x,t) = e^{-2t} / ( x + \sqrt{x^2 + e^{-2t}} )$.

So far I've followed the usual method when solving this and I've obtained that $t = r + s$, 
$u = e^{-s-2r}$
$x = e^{-s}(1-e^{-2r})$ / 2, 
but I'm not sure where to go from here to find my solution $u(x,t)$. Any help?
 A: Forming the characteristics :
$$\frac{\mathrm{d}t}{1} = \frac{\mathrm{d}x}{u} = \frac{\mathrm{d}u}{-2u}$$
Taking the last two :
$$\frac{\mathrm{d}x}{u} = \frac{\mathrm{d}u}{-2u} \Leftrightarrow -2\mathrm{d}x = \frac{\mathrm{d}u}{u} \implies -2x =  u + u_1 \implies u_1 \equiv  u + 2x$$
Now, taking the first and the last : 
$$\frac{\mathrm{d}t}{1} = \frac{\mathrm{d}u}{-2u} \implies t = -\frac{1}{2} \ln u + u_2\implies u_2 \equiv t + \frac{1}{2}\ln u  $$
We have finally yield our two integral curves $u_1$ and $u_2$, but we see that none of them can have clear expressions of $u(x,t)$.
The solution to the PDE will be given as a smooth function $F$, such that :
$$F(u_1,u_2) = 0 \implies F\left( u(x,t) + 2x, \frac{1}{2} \ln u(x,t) + t \right)=0$$
Now, let's take account of the boundary condition $u(0,t) = e^{-t}$. It will then be :
$$F\bigg|_{x=0} = F\left( u(0,t) , \frac{1}{2} \ln u(0,t) + t \right)= F \left(e^{-t}, \frac{t}{2} \right) \equiv 0$$
But, since $F$ is a smooth function giving an arbitrary curve $(=0)$ then, can take :
$$\begin{cases} u(x,t) + 2x = e^{-t} \\ \frac{1}{2}\ln u(x,t) + t = \frac{t}{2}\end{cases}$$ 
I'll leave it up to you to finish it now.
A: What you need to finish the solution is to eliminate $s$ and $r$, writing them in terms of $t$ and $x$.
Thus \begin{align*}x^2+e^{-2t}&=\frac{1}{4}e^{-2s}(1+e^{-4r}-2e^{-2r})+e^{-2t}\\
&=\frac{1}{4}(e^{-2s}+e^{-2s-4r}-2e^{-2s-2r})+e^{-2t}\\
&=\frac{1}{4}(e^{-2s}+u^2+2e^{-2t}\\
&=\frac{1}{4}e^{-2s}(1+e^{-2r})^2\end{align*}
Hence $\sqrt{x^2+e^{-2t}}=\frac{1}{2}(e^{-s}+u)$. Also $2x=e^{-s}-u$, so eliminating the $s$ variable gives $$u=\sqrt{x^2+e^{-2t}}-x$$ (This is equal to the given solution.)
A: $$u_t+uu_x=-2u$$
Charpit-Lagrange system of characteristic ODEs :
$$\frac{dt}{1}=\frac{dx}{u}=\frac{du}{-2u}$$
First characteristic equation from $\frac{dt}{1}=\frac{du}{-2u}$ :
$$ue^{2t}=c_1$$
Second characteristic equation from $\frac{dx}{u}=\frac{du}{-2u}$
$$u+2x=c_2$$
General solution of the PDE on the form of implicit equation :
$$ue^{2t}=F(u+2x)$$
$F$ is an arbitrary function, to be determined according to the specified condition.
Condition : $u(0,t)=e^{-t}$
$(e^{-t})e^{2t}=F(e^{-t}+0)$
Let $X=e^{-t}$
$$e^t=\frac{1}{X}=F(X)$$
So, the function $F(X)$ is determined. We put it into the above general solution where $X=u+2x$
$$ue^{2t}=\frac{1}{u+2x}$$
$$u^2+2xu-e^{-2t}=0$$
Solving for $u$ :
$$u=-x\pm\sqrt{x^2+e^{-2t}}$$
The sign is determined according to the condition $u(0,t)=e^{-t}$ :
$$u(x,t)=-x+\sqrt{x^2+e^{-2t}}$$
Note :
$-x+\sqrt{x^2+e^{-2t}}= e^{-2t} / ( x + \sqrt{x^2 + e^{-2t}} )$
