[Math] Solve $(x^2-y^2)dx+2xy\ dy=0$

integrating-factormultivariable-calculusordinary differential equations

I'm at the beggining of a differential equations course, and I'm stuck solving this equation:
$$(x^2-y^2)dx+2xy\ dy=0$$
I'm asked to solve it using 2 different methods. I proved I can find integrating factors of type $\mu_1(x)$ and $\mu_2(y/x)$. If I'm not wrong, these two integrating factors are:
$$\mu_1(x)=x^{-2} \ \ , \ \ \mu_2(y/x)=\left(1+\frac{y^2}{x^2}\right)^{-2}.$$
Then, I've used $\mu_1(x)$ to find the function $\psi(x,y)$ (I think it's called "potential function") so that
$$\frac{\partial \psi}{\partial x}=x^{-2}(x^2-y^2) \ \ , \ \ \frac{\partial \psi}{\partial y}=2xy.$$
Then, a solution to my equation is $\psi(x,y)=C$, being $C$ a constant.
I've got as solution:
$$\boxed{\psi(x,y)=x+\frac{y^2}{x}=C.}$$
I want to know first if this solution is correct. Then, I know that given two different integrating factors of different type, in my case $\mu_1(x)$ and $\mu_2(y/x)$, then
$$\frac{\mu_1(x)}{\mu_2(y/x)=K} \ \ , \ \ \text{$K$ constant}$$
defines also the solution to the equation. But what I get is
$$\boxed{\frac{x^{-2}}{\left(1+\frac{y^2}{x^2}\right)^{-2}}=K.}$$
I've graphed both solutions and they are not the same (correct me if I'm wrong). What of these is the right solution? Did I did something wrong along the way? Are both solutions the same? Any help will be appreciated.

PD: I know it can also be solved as an homogeneus one, but I'm interested in using these two methods and finding what I did wrong along the way.

EDIT: I realised I got wrong the integrating factor $\mu_2(y/x)$. Instead it it
$$\mu_2(y/x)=\left(1+\frac{y^2}{x^2}\right)^2.$$
Now, I can state as solution
$$\frac{\mu_2}{\mu_1}=K \ \implies \ \boxed{\left(x+\frac{y}{x}\right)^2=K}$$
which is equivalent to my first solution.

Best Answer

Here is another way where $x=0$ is not a problem, you have $$x^2-y^2+2xyy'= 0$$

Let set $\ u=x^2+y^2\ $ then $\ u'=2x+2yy'$

Giving $\require{cancel}\cancel{x^2}-(u-\cancel{x^2})+x(u'-\cancel{2x})=-u+xu'=0$

ODE $\ u=xu'\ $ has solutions $u=Cx$ therefore $$x^2+y^2=Cx$$


We can also solve it using polar coordinates:

$\begin{cases} x^2-y^2=r^2\cos(2\theta)\\ 2xy = r^2\sin(2\theta)\\ dx=\cos(\theta)dr-r\sin(\theta)d\theta\\ dy=\sin(\theta)dr+r\cos(\theta)d\theta\\ \end{cases}$

When you report in the ODE, you can cancel the factor $r^2$, also collecting $dr$ and $d\theta$ you'll find addition formulas for angle $(2\theta-\theta)$ and you will eventually get:

$$\cos(\theta)dr+r\sin(\theta)d\theta=0$$

This can also be writen $\frac {r'}r=-\tan(\theta)\ $ which solves to $$r=C\cos(\theta)$$

Which you can verify is a circle of diameter $C$ passing through origin and the same as above solution.

Related Question