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.
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).
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.