I'm trying to solve the following transport equation
$$\frac{\partial\phi}{\partial t}+\phi\frac{\partial\phi}{\partial x}=0$$
subject to the initial condition $$\phi(x,0)=f(x)=\left\{ \begin{array}{l l} 1,\quad x<0 \\ 0, \quad x\geq0 \end{array} \right. $$
This is my solution:
$\frac{dx}{dt}=\phi \Rightarrow x=\phi t+C$. At $t=0$ let $x=s$. Therefore $x=\phi t+s$. So along a characteristic we have $s=x-\phi t$.
For $s<0$, $\phi=1$ so $s=x-t$.
For $s\geq0$, $\phi=0$ so $s=x$.
$\frac{d\phi}{dt}=0 \Rightarrow \phi(x,t)=f(x)$ and given $\phi=f(s)$ at $x=s,t=0$ we find that $$u(x,t)=f(s)=\left\{\begin{array}{l l} 1,\quad s<0 \\ 0, \quad s\geq0 \end{array} \right.$$
$$\Rightarrow \phi(x,t)=\left\{\begin{array}{l l} 1,\quad x-t<0 \\ 0, \quad x\geq0 \end{array} \right.$$
Apparently the answer is $$ \phi(x,t)=\left\{\begin{array}{l l} 1,\quad t>2x \\ 0, \quad t<2x \end{array} \right.$$
I'm not sure where I went wrong. Can someone please tell me where my working is wrong?