Find solution of this equation $$u_{t}+u u_{x}=0$$
$$u(x,0)= \begin{cases} 1 & \text{if}\quad x<0 \
0 & \text{if}\quad 0<x<1 \
1 & \text{if}\quad x<1
\end
 A: It is the opposite Cauchy problem as in this post. Here we have a shock with speed 1/2 starting at $x=0$ and a rarefaction starting at $x=1$. Therefore,
$$
u(x,t) =\left\lbrace
\begin{aligned}
&1 &&\text{if}\quad x<t/2\\
&0 &&\text{if}\quad t/2<x\le 1\\
&\tfrac{x-1}{t} &&\text{if}\quad 1\le x\le 1+t\\
&1 &&\text{if}\quad x\ge 1+t
\end{aligned}\right.
$$
for small times $t<t^*$.
The shock wave catches the rarefaction at $t^* = 2$. From this moment, the speed $s'(t)$ of the shock is modified due to the modification of data on the right. Following the Rankine-Hugoniot condition, we have
$$
s'(t) = \tfrac{1}{2}\left(1 + \tfrac{s(t)-1}{t}\right)
$$
with the initial condition $s(2) = 1$. The shock trajectory satisfies $s(t) = 1+t-\sqrt{2t}$, so that
$$
u(x,t) =\left\lbrace
\begin{aligned}
&1 &&\text{if}\quad x<s(t)\\
&\tfrac{x-1}{t} &&\text{if}\quad s(t)< x\le 1+t\\
&1 &&\text{if}\quad x\ge 1+t
\end{aligned}\right.
$$
for small times $t>t^*$. One notes that the shock slows down and never overtakes the rarefaction.
