I have problem with first order quasi-linear PDE. I used Mathematica to solve the equation but it doesn't work. Would appreciate for some tips. Here is what I have done.

Solve equation:


Now in Mathematica define p and q:

p = D[u[x, y], x]
q = D[u[x, y], y]

Now I'm trying to use Dsolve function.

eqn = 2*p + u[x, y]*q == (u[x, y])^2/y

sol = u[x, y] /. DSolve[eqn, u[x, y], {x, y}]

what I get is

ReplaceAll::reps: {DSolve[u[x, y] Derivative[0, 1][u][x, y] + 2 Derivative[1, 0][u][x, y] == u[x, y]^2/y, u[x, y], {x, y}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing.

  • 2
    $\begingroup$ I generally prefer Maple for solving PDEs, I can never get Mathematica to solve PDEs. Very user-friendly as well in Maple, just type out the PDE then ask it to solve it. $\endgroup$
    – Tom
    Commented Mar 31, 2020 at 5:40

4 Answers 4


Mathematica can't solve this pde, so the error is from the /. command and not from the DSovle command. You should always check that the last command worked before using its result to avoid hard to detect errors.

On V 12.1 this gives

ClearAll[u, x, y];
pde = 2 D[u[x, y], x] + u[x, y] D[u[x, y], y] == u[x, y]^2/y;
DSolve[pde, u[x, y], {x, y}]

Mathematica graphics

Maple 2020 solves this giving

pde := 2*diff(u(x,y),x) + u(x, y)*diff(u(x,y),y) = u(x, y)^2/y;
DEtools:-remove_RootOf( sol );

Mathematica graphics

Where F1 above is an arbitrary function.


One possibility is, do it mumerically with given initial conditions, for example:

usol[x0_, y0_] := 
   u /. First@
  NDSolve[{2* Derivative[1, 0][u][x, y] + 
   u[x, y]* Derivative[0, 1][u][x, y] == u[x, y]^2/y, 
 u[0, y] == y0, u[x, 4] == x0}, u, {x, 0, 3}, {y, 1, 4}]

Plot3D[Evaluate[usol[-1, -1][x, y]], {x, 0, 3}, {y, 1, 4}]

Making the change of variable $u(x,y) = y\sqrt{v(x,y)}$ as follows

op[u_, x_ , y_] := 2 D[u, x] + u D[u, y] - u^2/y
pde = op[y Sqrt[v[x, y]], x, y] // Together // Numerator

and now an implicit solution

DSolve[pde == 0, v, {x, y}]
(*Solve[C[1][v[x, y], E^(-(1/2) x Sqrt[v[x, y]]) y] == 0, v[x, y]]*)

First of all it is important to accept the categorization of the Mathematica documentation for partial differential equations:

Solve equation:


  1. This is a nonlinear partial differential equation. The term u u' does matter on the left-hand side.

  2. The right-hand side is completely different and the classification into the given categories of the partial differential equations fails.

  3. The right-hand side is u^2/y. That is crucial. So no example for DSolve nonlinear pde fits this question.

  4. The chapter first-order partial differential equations applies. The second example is close to this type of pde. So what is missing is evidently the initial condition to make Mathematica solve it. Form the Mathematica documentation page for DSolve:

    DSolve[{x D[u[x, y], y] + y D[u[x, y], x] == -4 x y u[x, y], u[x, 0] == E^(-x^2)}, u, {x, y}]

for the right-hand side.

  1. The next Example matched the left-hand of this one

    DSolve[{D[u[x, y], x] + u[x, y] D[u[x, y], y] == 0, u[x, 0] == 1/(x + 1)}, u, {x, y}]

So we are in need of initial conditions to solve this pde. But we need the correct ones. So far from Mathematica documentation, we have the homogeneous solution of the given pde and the categorization

Initial value problem for a scalar conservation law:

  1. Method of characteristics The neat qualification is, this is hyperbolic pde for which the method of characteristics applies. Online is this very page available: Scott Sara, The Method of Characteristics with applications to Conservation Laws*. From this it is an inhomogeneous inviscid Burger equation.

The methods of characteristics fails because of the right-hand side of this pde.

  1. Burgers equation This is inhomogeneous, but our right-hand side is different. This appears in the documentation page for DSolveValue in the chapter General partial differential equations. under Applications.

Nice examples can be found on Partial Differential Equations First-Order PDE: The method of characteristics.

From that the u^2/y is really exceptional! pde methods of characterictis


so Maple can not solve this either.

  1. Trivial dependence of u from x

u(x,y)=u(y)=y is definitely a correct solution. This can be proved by the separation of constants.

  1. This solution sheets some light on the Maple solution given in another answer: methods of characteristics.

  2. Another introductory text using Mathematica and the methods of characteristics from Branko Ćurgus

  3. Solution

    1/(Log[c1 + Log[x - 2 Log[y/a]]])

This is similar to the numerical solution from another answer for larger c1 and a. It is indeed singular.

enter image description here

  1. The solution must be added together for the general solution.
  • 2
    $\begingroup$ "Maple can not solve this either. " Well, but as shown in Nasser's answer, Maple manages to find an implicit solution expressed as an algebraic equation. (Whether it's correct or not is another story, though. ) $\endgroup$
    – xzczd
    Commented Mar 31, 2020 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.