2.1.12 \(x u_y + y u_x = -4 x y u\) and \(u(x,0)=e^{-x^2}\)

problem number 12

Taken from Mathematica help pages

Solve for \(u(x,y)\) \[ x u_y + y u_x = -4 x y u \] with initial value \(u(x,0)=e^{-x^2}\)

Mathematica

ClearAll["Global`*"]; 
pde = x*D[u[x, y], y] + y*D[u[x, y], x] == -4*x*y*u[x, y]; 
ic  = u[x, 0] == Exp[-x^2]; 
sol =  AbsoluteTiming[TimeConstrained[DSolve[{pde, ic}, u[x, y], {x, y}], 60*10]];
 

\[\left \{\left \{u(x,y)\to e^{-x^2-y^2}\right \}\right \}\]

Maple

restart; 
pde := x*diff(u(x, y), y) + y*diff(u(x, y), x) = -4*x*y*u(x, y); 
ic  := u(x, 0) = exp(-x^2); 
cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde, ic], u(x, y))),output='realtime'));
 

\[u \left ( x,y \right ) ={{\rm e}^{-{x}^{2}-{y}^{2}}}\]

Hand solution

Solve \[ xu_{y}+yu_{x}=-4xyu \] with \(u\left ( x,0\right ) =e^{-x^{2}}\).

Solution

Let \(u\equiv u\left ( x\left ( y\right ) ,y\right ) \). We’ve taken \(y\) as the independent variable for \(x\left ( y\right ) \) here, since the initial conditions has \(y\left ( 0\right ) \) in it. The PDE can be written as\begin {equation} u_{y}+\frac {y}{x}u_{x}=-4yu\tag {1} \end {equation} Then\begin {equation} \frac {du}{dy}=\frac {\partial u}{\partial x}\frac {dx}{dy}+\frac {\partial u}{\partial y}\tag {2} \end {equation} Comparing (1),(2) shows that \begin {align} \frac {du}{dy} & =-4yu\tag {3}\\ \frac {dx}{dy} & =\frac {y}{x}\tag {4} \end {align}

Solving (3) gives\begin {align} \ln \left \vert u\right \vert & =-\frac {4y^{2}}{2}+C_{1}\nonumber \\ u & =C_{1}e^{-2y^{2}}\tag {5} \end {align}

At \(y=0\), using initial conditions the above becomes\[ e^{-x\left ( 0\right ) ^{2}}=C_{1}\] (5) becomes\begin {align} u & =e^{-x\left ( 0\right ) ^{2}}e^{-2y^{2}}\nonumber \\ & =e^{-x\left ( 0\right ) ^{2}-2y^{2}}\tag {5A} \end {align}

All what is left is to find \(x\left ( 0\right ) \) to finish the solution. From (4)\begin {equation} \frac {x^{2}}{2}=\frac {y^{2}}{2}+C_{2}\tag {6} \end {equation} At \(y=0\)\[ \frac {x\left ( 0\right ) ^{2}}{2}=C_{2}\] Hence (6) becomes\begin {align*} \frac {x^{2}}{2} & =\frac {y^{2}}{2}+\frac {x\left ( 0\right ) ^{2}}{2}\\ x\left ( 0\right ) ^{2} & =x^{2}-y^{2} \end {align*}

Substituting the above in (5A) gives\begin {align*} u\left ( x\left ( y\right ) ,x\right ) & =e^{-\left ( x^{2}-y^{2}\right ) -2y^{2}}\\ & =e^{-x^{2}-y^{2}} \end {align*}

The following is a plot of the above solution showing the initial conditions are red line

____________________________________________________________________________________