Piecewise initial-value problem for Burgers' equation 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.
 A: $$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}$$
A: Alternatively, let's apply the method of characteristics in parameter-dependent form:

*

*$\frac{d u}{d s} = 0$, letting $u(0)=g(x_0)$ we know $u=g(x_0)$;

*$\frac{d t}{d s} = 0$, letting $t(0)=0$ we know $t=s$;

*$\frac{d x}{d s} = u$, letting $x(0)=x_0$ we know $x=x_0+ut$;

This solution can be rewritten in implicit form:
$$
u = g(x-ut) .
$$
The expression of $g$ gives the piecewise solution

*

*$u=1$ if $x-ut \leq 0,\quad$ i.e. $\quad u=1$ if $x\leq t$;

*$u=1-x+ut$ if $0\leq x-ut \leq 1,\quad$ i.e. $\quad u=\frac{1-x}{1-t}$ if $t\leq x \leq 1$;

*$u=0$ if $x-ut \geq 1,\quad$ i.e. $\quad u=0$ if $x\geq 1$.

Hence the proposed solution for small times $t<1$ is retrieved. See also this post for an illustration.
