Burgers equation with method of characteristic [duplicate]
Consider the initial-value problem for Burgers' Equation $$\left\{ \begin{array}{ll} u_{t} + (\frac{u^{2}}{2})_{x}=0 & \mathbb{R} \times (0, \infty) \\ u=g & \text{on } \mathbb{R} \times {t=0} \end{array} \right.$$
with initial data $$g(x)= \begin{cases} 1, & x\leq 0 ,\\ 1-x, & 0\leq x \leq 1 ,\\ 0, & x \geq 1.\end{cases}$$
This is an example out of Evans PDE Text (Ex. 1 p. 139) and I am trying to understand how we can find $u(x,t)$ from here, it just says in the book and thus $$u(x,t) = \begin{cases} 1, & x\leq t ,\\ \tfrac{1-x}{1-t}, & t \leq x \leq 1,\\ 0, & x \geq 1.\end{cases} \quad (0 \leq t \leq 1)$$
What is the general way to write down this form for $u(x,t)$? How does the author find $u(x,t)$ for this problem? The book omits any details.
Solution 1:
$$u_t+u\:u_x=0$$ Characteristic system of DEs : $\frac{dt}{1}=\frac{dx}{u}=\frac{du}{0}$
First characteristic curve : $du=0 \quad\to\quad u=c_1$
Second characteristic curve : $\frac{dt}{1}=\frac{dx}{c_1}\quad\to\quad x-c_1 t=c_2$
Equation of general solution : $\Phi\left( u\;,\:x-u\:t \right)=0$ for any differentiable function $\Phi$.
Equivalent expression of the general solution expressed on implicit form : $$u=F(x-ut)\qquad \text{any differentiable function }F.$$
Initial conditions : $u(x,0)=F(x-0\:u)=F(x)\qquad$ $\begin{cases} u(x,0)=1 & x \leq 0 \\ u(x,0)=1-x & 0\leq x\leq 1 \\ u(x,0)=0 & 1\leq x \end{cases}$
This determines the function $F(X)$ , any dummy variable $X$ : $\quad\begin{cases} F(X)=1 & X \leq 0 \\ F(X)=1-X & 0\leq X\leq 1 \\ F(X)=0 & 1\leq X \end{cases}$
With $X=x-u\:t \qquad \begin{cases} u=1 & x-u\:t \leq 0 \\ u=1-(x-u\:t) & 0\leq x-u\:t\leq 1 \\ u=0 & 1\leq x-u\:t \end{cases}$
Case $u=1-(x-u\:t) \quad\to\quad u=\frac{1-x}{1-t}\quad$ if $\quad 0\leq x-\frac{1-x}{1-t}\:t\leq 1 \qquad 0\leq \frac{x-t}{1-t}\leq 1$
$$ \begin{cases} u(x,t)=1 & x \leq t \\ u(x,t)=\frac{x-t}{1-t} & 0\leq \frac{x-t}{1-t}\leq 1 \\ u(x,t)=0 & 1\leq x \end{cases}$$