Non-linear transport equation with shock and rarefaction. This is an old PDE qual problem and I seem to be lacking proper background to solve. 
Solve $u_t+uu_x = 0$, where the initial data is given by $$f(x) = \begin{cases}2, &0<x<1\\ 0, & \text{otherwise} \end{cases}.$$ 
Moreover, show that the solution has both rarefaction and shock wave, and decide whether the rarefaction wave catches the shock. Characterize the location and velocity of the waves.
What I am able to do is to use the method of characteristics to start as: 
$$u(t,x) = \begin{cases}2,&ut<x<ut+1\\0,&x\leq ut \,\,\,\vee \,\,x\geq ut+1 \end{cases}.$$
After this, how does one find the shock and rarefaction waves? I am following Introduction to Partial Differential equations by Peter Olver and the text says rarefaction and shock occurs when $f'(x)>0$ and $f'(x)<0$, respectively. But this does not help at all in this problem.
 A: The present PDE is the inviscid Burgers' equation. A sketch of the characteristic curves in the $x$-$t$ plane is

Along these curves, $u$ is constant and equal to its value at $t=0$, deduced from the initial data $f(x)$ (similar to a rectangular function).


*

*One can observe that the characteristic curves separate at $x=0$: the edges are the lines $x=0$ on the left, and $x=2t$ on the right. According to the Lax entropy condition, a rarefaction wave occurs. Such a wave is a self-similar continuous solution, i.e. $u(x,t) = v(x/t)$. In the case of Burgers' equation, one shows that $v(x/t) = x/t$ (cf. e.g. this post).

*At $x=1$, characteristics cross: a shock wave occurs. Starting from the intersection of characteristics, the method of characteristics is not valid anymore. The speed of shock $s$ is given by the Rankine-Hugoniot condition $s = \frac{1}{2}(2 + 0) = 1$. The shock wave is located on the line $\frac{x-1}{t} = s$, i.e. $x = 1+t$.


Therefore, as long as both waves do not interact, the solution is
$$
u(x,t) =
\left\lbrace
\begin{aligned}
&0 & &\text{if}\quad x\leq 0\\
&x/t & &\text{if}\quad 0\leq x \leq 2t\\
&2 & &\text{if}\quad 2t\leq x<1+t\\
&0 & &\text{if}\quad 1+t<x \, .
\end{aligned}
\right.
$$
Both waves will interact at some time $t^*$ such that $2t^* = 1+t^*$, i.e. $t^* = 1$. The rarefaction wave catches the shock.
