Solving $v_{t}+v(x,t)v_{x}=0$ with initial condition This problem comes from an undergraduate course in PDE. 
The first question of the problem was to solve the following PDE: $v_{t}+v(x,t)v_{x}=0$ with the following initial condition: 
$v(x,0)=5x$ where $v(x,t)$ is an unknown function of the two independent variables: $x$, and $t$. $v_{t}$ and $v_{x}$ refer to the partial derivatives of $v(x,t)$ with respect to $t$ and $x$ respectively. 
The second question of the problem given the PDE above, but with the following initial condition: $$v(x,0)= 5\ \ if\ \ -3<x<3$$$$v(x,0)=0\  otherwise$$
The question was to find the time $S$ when the rarefaction wave catches up with the shock wave, and then to find $v(x,t)$ for the case:$0<t<S$ 
I solved the first question of the problem, and I found $v(x,t)=\frac{5x}{1+5t}$.
However, I am completely stuck when it comes to solving the second question. I have no idea how to find that time $S$, and this is the first I see a problem where the initial condition is defined piecewise. Any help is appreciated!
 A: You used Method of Characteristics for the first question to get $v = \phi(x-vt)$.
However, you can't use Method of Characteristics for the second question. For the characteristics will cross each other. Consider initially at $x=3^-$, the velocity of the wave is $v=5$, however at $x=3^+$, the velocity is $0$. Physically the wave front is propagating faster, thus creating a shock.
By talking rarefaction and shock wave, we are referring to the weak solution. Rewriting the equation as 
$$
v_t + f(v)_x = 0, \quad \text{where }f(v) = \frac{v^2}{2}.
$$
At $t=0^+$, any $x = x_0$, when 
$$v_l:= \lim\limits_{x\to x_0^-} v(x,0) > v_r:= \lim\limits_{x\to x_0^+} v(x,0),$$
we get a shock wave. This is happening on the right end of the interval $(-3,3)$. Using Rankine–Hugoniot formula, equation (10) on the Wikipedia entry, we have the shock wave is propagating at a constant speed of 
$$
v_s = \frac{v_l^2/2 - v_r^2/2}{v_l - v_r} = \frac{v_l+v_r}{2} = 5/2 
$$
moving to the right starting from $x=3$. And the weak solution is:
$$
v(x,t) = \begin{cases}
v_l = 5 & \text{when } x -3 < v_s t,
\\
v_r = 0 & \text{when } x -3 \geq  v_s t.
\end{cases}\tag{1}
$$
When $v_l<v_r$, you get a rarefaction wave (this is obtained by vanishing viscosity method). This is on the left end of the interval $(-3,3)$. Using the formula here (in the example of Korteweg-de Vries Equation, it starts from $x=0$, we modify $x=-3$ as the starting point), we have on the left end the rarefaction wave is :
$$
v(x,t) = \begin{cases}
0 & \text{when } x +3 <0,
\\
(x+3)/t & \text{when } 0\leq x +3 \leq 5t,
\\
5 & \text{when }   x +3 > 5t.
\end{cases}\tag{2}
$$
This is the vanishing viscosity solution, which is obtained by solving $v_t + vv_x = \epsilon v_{xx}$, then letting $\epsilon \to 0$, you will get a continuous solution. This tells us that the rarefaction wave is propagating to the right at a constant speed of $5$. 
Eventually, combining the shock wave (1) on the left end with the rarefaction wave (2) on the right end will give you the answer: before the rarefaction wave catches up the shock wave, $0<t<S$, the solution is:
$$
v(x,t) = \begin{cases}
0 & \text{when } x +3 <0,
\\
(x+3)/t & \text{when } 0\leq x +3 \leq 5t,
\\
5 & \text{when }   x +3 > 5t \;\text{ and }\; x-3 < 5t/2,
\\
0 & \text{when } x-3 \geq  5t/2.
\end{cases}
$$
So now computing when the rarefaction wave (propagating at a speed of $5$ from $x=-3$) will catch up with the shock wave (propagating at a speed of $5/2$ from $x=3$) is not a difficult task.

Some update: to answer doraemonpaul's concern, the solution above is more of a physical solution than mathematical, $v(x,t)$'s behavior when $t\to 0^+$ and $x\to -3^+$ can be viewed like a line with a slope $1/t$ approaching infinity to describe the discontinuity at $t=0, x=-3$. Notice on the left end, $x+3\to 5t$ from the right (spacial and temporal), we have:
$$
\lim_{\substack{x\to -3^+\\ t\to 0^+}} v(x,t) = 
\lim_{\substack{x\to -3^+\\ t\to 0^+}} \frac{x+3}{t} = \lim_{\substack{x\to -3^+\\ t\to 0^+}} \frac{5t}{t} = 5, \;\text{ and }\; \lim_{\substack{x\to -3^-\\ t\to 0^+}} v(x,t)  = 0.
$$
For reference, please view formula (22.31) and explanation here.
A: $\dfrac{dt}{ds}=1$ , letting $t(0)=0$ , we have $t=s$
$\dfrac{dv}{ds}=0$ , letting $v(0)=v_0$ , we have $v=v_0$
$\dfrac{dx}{ds}=v=v_0$ , letting $x(0)=f(v_0)$ , we have $x=v_0s+f(v_0)=vt+f(v)$ , i.e. $u=F(x-vt)$
$v(x,0)=\begin{cases}5&\text{when}-3<x<3\\0&\text{when}~x\leq-3~\text{or}~x\geq3\end{cases}$ :
$\therefore v=\begin{cases}5&\text{when}-3<x-vt<3\\0&\text{when}~x-vt\leq-3~\text{or}~x-vt\geq3\end{cases}=\begin{cases}5&\text{when}-3<x-5t<3\\0&\text{when}~x\leq-3~\text{or}~x\geq3\end{cases}=\begin{cases}5&\text{when}~5t-3<x<5t+3\\0&\text{when}~x\leq-3~\text{or}~x\geq3\end{cases}$
Hence $v(x,t)=\begin{cases}5&\text{when}~5t-3<x<5t+3\\0&\text{when}~x\leq-3~\text{or}~x\geq3\\c&\text{otherwise}\end{cases}$
