Added May 23, 2019.
From Math 5587 midterm I, Fall 2016, practice exam, problem 3.
Solve for \(u(x,t)\) \begin {align*} u_t + x u_x = 0 \end {align*}
With with \(u(x,0)=x^2\)
Mathematica ✓
ClearAll["Global`*"]; pde = D[u[x, t], t] + x*D[u[x, t], x] == 0; ic = u[x,0]==x^2; sol = AbsoluteTiming[TimeConstrained[DSolve[{pde,ic}, u[x, t], {x, t}], 60*10]];
\[\left \{\left \{u(x,t)\to e^{-2 t} x^2\right \}\right \}\]
Maple ✓
restart; pde := diff(u(x,t),t)+x*diff(u(x,t),x)=0; ic :=u(x,0)=x^2; cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic],u(x,t))),output='realtime'));
\[u \left (x , t\right ) = x^{2} {\mathrm e}^{-2 t}\]
Hand solution
Solve \(u_{t}+xu_{x}=0\) with \(u\left ( x,0\right ) =x^{2}\). Using the method of characteristics, the systems of characteristic lines are (from the PDE itself)\begin {align} \frac {dt}{ds} & =1\tag {1}\\ \frac {dx}{ds} & =x\tag {2}\\ \frac {du}{ds} & =0\tag {3} \end {align}
With initial conditions at \(s=0\)\[ t\left ( 0\right ) =0,x\left ( 0\right ) =\xi ,u\left ( 0\right ) =\xi ^{2}\] Equation (1) gives\begin {align} t & =s+t\left ( 0\right ) \nonumber \\ & =s\tag {5} \end {align}
Equation (2) gives\begin {align} \ln x & =s+x\left ( 0\right ) \nonumber \\ x & =\xi e^{s}\tag {6} \end {align}
From (5,6) solving for \(\xi \) gives\begin {align} \xi & =xe^{-s}\nonumber \\ & =xe^{-t}\tag {7} \end {align}
Equation (3) gives\begin {align*} u & =u\left ( 0\right ) \\ & =\xi ^{2}\\ & =x^{2}e^{-2t} \end {align*}
____________________________________________________________________________________