# Why unable to verify solution to first order PDE?

This is using V12 on windows.

I solved this PDE by hand and wanted to ask Mathematica to verify my solution. But Mathematica solution does not look like mine. And when I tried to verify Mathematica own solution I get False.

Is it possible Mathematica solution is not correct? Could some expert help shed some light on what is the issue here? The PDE is

Solve for $$u(x,y)$$ in $$y u_x - x u_y = e^u$$

Here is Mathematica code

ClearAll[x,y,u]
pde=y*D[u[x,y],x]-x*D[u[x,y],y]==Exp[u[x,y]]
sol=DSolve[pde,u,{x,y}]


Assuming[y>0,Simplify[pde/.sol]]


Here is the solution obtained by hand (derivation below), which Mathemaica verifies ok.

mySol = u -> Function[{x, y}, -Log[C[1][(x^2 + y^2)] - ArcTan[x/y]]]
Simplify[pde /. mySol]


Note on Mathematica solution: Using $$\frac{1}{2}$$ or not does not matter. Since this is absorbed by the constant of integration.

The question is: Why Mathematica does not verify its own solution? Is the solution given by Mathematica not correct? The difference between my solution and Mathematica solution seems to be a sign difference only! i.e. if I swap the terms inside Mathematica own solution, it becomes same as my solution and now Mathematica verifies it. So it looks like a sign problem somewhere?

## Appendix

FYI, here is my hand solution

Solve $$yu_{x}-xu_{y}=e^{u}$$ Since no initial conditions are given, I find using Lagrange-charpit method is better here than using characteristic equations with parameter $$s$$. The Lagrange-charpit equations for the above PDE are

$$\frac{dx}{y}=\frac{-dy}{x}=\frac{du}{e^{u}}$$

The first two equations gives

\begin{align} xdx & =-ydy\nonumber\\ \frac{x^{2}}{2} & =-\frac{y^{2}}{2}+C_{1}\nonumber\\ C_{1} & =\frac{1}{2}\left( x^{2}+y^{2}\right) \nonumber\\ C_{1} & =\left( x^{2}+y^{2}\right) \tag{1} \end{align}

Where the $$\frac{1}{2}$$ is absorbed by the constant. We now need to decide to either solve $$\frac{-dy}{x}=\frac{du}{e^{u}}$$ together or $$\frac{dx}{y}=\frac {du}{e^{u}}$$. It does not matter which pair to pick. Using the second pair gives

$$\frac{dx}{y}=\frac{du}{e^{u}}$$

But from (1), $$y=\sqrt{C_{1}-x^{2}}$$ (taking only the positive root) and the above equation now becomes

$$\frac{dx}{\sqrt{C_{1}-x^{2}}}=\frac{du}{e^{u}}$$

Integrating gives

\begin{align*} \arctan\left( \frac{x}{\sqrt{C_{1}-x^{2}}}\right) & =-e^{-u}+C_{2}\\ \arctan\left( \frac{x}{y}\right) & =-e^{-u}+C_{2}\\ C_{2} & =\arctan\left( \frac{x}{y}\right) +e^{-u} \end{align*}

In this method, the constants $$C_{1},C_{2}$$ are always related by $$C_{2}=F\left( C_{1}\right)$$ where $$F$$ is an arbitrary function. Hence we obtain

\begin{align*} \arctan\left( \frac{x}{y}\right) +e^{-u} & =F\left( x^{2}+y^{2}\right) \\ e^{-u} & =F\left( x^{2}+y^{2}\right) -\arctan\left( \frac{x}{y}\right) \end{align*}

For positive $$u$$ the above simplifies to

\begin{align*} -u & =\ln\left( F\left( x^{2}+y^{2}\right) -\arctan\left( \frac{x} {y}\right) \right) \\ u\left( x,y\right) & =-\ln\left( F\left( x^{2}+y^{2}\right) -\arctan\left( \frac{x}{y}\right) \right) \end{align*}

I get a Solve::ifun error (inverse functions being used) from DSolve that indicates only some branches of the solution might have been used. You have to search around for the one that was chosen, I guess.
Assuming[y < 0, Simplify[pde /. sol]]

• Thanks. The problem is then documentations. When I followed the help page at DSolveSolutionVerification.html and did ClearAll[x, y, u]; pde = y*D[u[x, y], x] - x*D[u[x, y], y] == Exp[u[x, y]]; sol = DSolve[pde, u, {x, y}]; Simplify[pde /. sol] I do not get True. The help page should really tell users about such possibilities of different branch cuts and what to do in that case. The examples shown do not give such cases. But now I'll keep this in mind next time. Commented May 22, 2019 at 1:03