# Find the solution of the differential equation $xdx+ydy+\frac{xdy-ydx}{x^2+y^2}=0.$

Find the solution of the differential equation $$xdx+ydy+\frac{xdy-ydx}{x^2+y^2}=0.$$

My solution goes like this:

Given, $$xdx+ydy+\frac{xdy-ydx}{x^2+y^2}=0.$$ We assume $$M=x$$ and $$N=y.$$ Now, $$\frac{\partial M}{\partial y}=0=\frac{\partial N}{\partial x}=0,$$ and hence,$$xdx+ydy=0$$ is an exact differential equation.the . So, the solution of the differential equation $$xdx+ydy=0$$ is (evaluated according to the rule for evaluating an exact differential equation) is :

$$\int (x)dx+\int (y)dy= \frac{x^2}{2}+\frac{y^2}{2}=c$$ , where $$c$$ is an arbitary constant.

We now proceed to calculate the solution of the differential equation $$\frac{xdy-ydx}{x^2+y^2}=0.$$

Given, $$\frac{xdy-ydx}{x^2+y^2}=0.$$ We can write this as, $$\frac{xdy}{x^2+y^2}=\frac{ydx}{x^2+y^2}=0\implies xdy=ydx\implies \frac{dy}{y}=\frac{dx}{x}.$$ On integrating, we have, $$\log x=\log y+c_1\implies \log(\frac xy)=c_1\implies \frac xy=e^{c_1}.$$ So, the solution of this differential equation is $$\frac xy=e^{c_1},$$ where $$c_1$$ is a constant of integration.

So, we can say, the solution of given differential equation is:

$$\frac{x^2}{2}+\frac{y^2}{2}+\frac xy=c+e^{c_1}=c_2,$$ where $$c_2$$ is an arbitary constant of integration.

Now, the way I did the above solution is following just an idea of mine. Let me elaborate. While solving, exact differential equations, I studied the way to check, whether a given differential equation is exact or not. Then, I learnt the way to solve the exact differential equation of first degree and first order by the usual rule:

If the differential equation $$Mdx+Ndy=0$$ is an exact differential equation, then it's solution is given by $$\int Mdx+\int Ndx=c$$ , where, while solving $$\int Mdx$$ we integrate only with respect to $$x$$ treating the $$y$$ variables( if there is any) as constants. Next, while solving $$\int Ndy$$ we integrate only thise terms in $$N$$ that are free from the variable $$x,$$ and then we equate the found values and add them to equate those integrals to an arbitary constant.

This is the general way to solve exact differetial equations (this is what I learnt). But, when I encountered a differential equation say, of the sort (above) i.e $$xdx+ydy+\frac{xdy-ydx}{x^2+y^2}=0,$$ I just noticed that the terms $$xdx$$ and $$ydy$$ when added and equated to zero, i.e $$xdx+ydy=0$$ forms an exact differential equation, I thought about first solving this differential equation $$xdx+ydy=0$$, just like the way we solve, exact differential equations (like I did in my solution). Then, I solved the remaining part of the given differential equation $$xdx+ydy+\frac{xdy-ydx}{x^2+y^2}=0$$ i.e $$\frac{xdy-ydx}{x^2+y^2}=0,$$ separately and found the solution of the differential equation $$\frac{xdy-ydx}{x^2+y^2}=0.$$ I added both the found solutions of the two differential equations:

$$xdx+ydy=0,$$ and

$$\frac{xdy-ydx}{x^2+y^2}=0,$$ and then,

equated them to an arbitary constant and claimed it to be a solution of the given differential equation $$xdx+ydy+\frac{xdy-ydx}{x^2+y^2}=0.$$ I want to know, whether, the solution I found is a valid or not? Is my approach a legit one? The way I went on to evaluate the solution of the given differential equation, as I feel, is not a much known method (if it's at all one) and neither it's discussed (whether it's valid or not?) often. So, I am perplexed about this way of solving differential equations.

EDIT:

As I am given to understand from the answers that the solution I found, is not quite a correct solution. The correct solution is $$\frac{x^2+y^2}{2}+\arctan\frac yx=c.$$ But I posted a question on this site. The link is :

Find the solution of the differential equation $\frac{xdy-ydx}{x^2+y^2}=0.$

In this link, I did the same thing, while solving the differential equation, $$\frac{xdy-ydx}{x^2+y^2}=0$$ i.e I multiplied both sides of this eqquation, by the homogeneous function, $$x^2+y^2$$ in order to simplify the equation. In that thread, it seemed that this was a perfectly valid thing. But , when I try to do the same thing here, the answers hint that, this is not valid here.

Now, I have two questions:

Now,I dont quite understand why this simplification, in this case results in an erroneous solution?

The next thing I want to know, that what are some steps that I have to take so that while trying to solve a given differential equation using the approach described previously i.e

Segregating the given differential equation into two parts such that each part, forms a differential equation. Further, one of the newly formed differential equations is exact and the other one is not, and then solving each of those newly formed differential equations and then adding in order to equate them to an arbitrary constant and claiming that to be the required solution of the given differential equation.

to avoid such erroneous results/solutions. I am quite confused about this uncanny bug in my approach.

We can rewrite the differential equation as $$xdx+ydy+\frac{d}{d\theta}(\arctan(\frac{y}{x}))d\theta=0,$$ where we have used the substitution $$x=r\cos\theta$$ and $$y=r\sin\theta$$ and the fact that $$\frac{xdy-ydx}{x^2+y^2}=d\theta.$$ Integrating both sides, we get the solution $$\frac{1}{2}x^2+\frac{1}{2}y^2+\arctan(\frac{y}{x})=C.$$ You can verify the above solution by taking differentiation, and the above solution is correct.

• @FdstZfsy your method is correct because by linearity, the sum of two exact equations is exact. However your answer failed to produce the arctangent in the correct answer. May 1 at 7:11
• @NinadMunshi Why did that happen ? May 1 at 7:11
• @HeroZhang001 Thank you for your answer! I want to know whether my solution is a legit one or not? May 1 at 7:13
• @FdstZfsy because all you really know is that the second equation is a function of $x/y$ not that it is exactly $x/y$ - in solving that second part you multiplied by a multivariate homogeneous factor of $x^2+y^2$, which invalidates the solution of the first part and forbids you from adding the two equations and using linearity. A way to phrase this intuitively is that you have the wrong relative ratio between the two solutions. Anyway the point is the integrate and differentiate (hailstone) method will always work for a combined exact equation such as this. May 1 at 7:15
• @NinadMunshi I think I understand where I went wrong partially. The point is, while solving for the equation $\frac {xdy-ydx}{x^2+y^2}=0$, I multiplied this with $x^2+y^2$ but this won't be valid here. This is because, if we multiply it by $x^2+y^2$ then, we also, need, to multiply the first differential eqution (considered) i.e $xdx+ydy=0$ by $x^2+y^2$, because then the given differential equation becomes $(x^2+y^2)(xdx+ydy)+xdy-ydx=0$ .The method I used, actually, calculates the solution of the differential equation, $xdx+ydy+xdx-ydy=0$ instead of the equation $(x^2+y^2)(xdx+ydy)+xdy-ydx=0$ May 1 at 7:50

The procedure for exact differential is correctly followed.

Referring to your question before this and using polar coordinates again

$$d\frac{r^2}{2} + d \theta =0$$ $$\frac{r^2}{2} + \theta =\frac{c}{2}$$ and when we get back to cartesian coordinates $$x^2+y^2 + 2 \tan^{-1}\frac{y}{x}=c.$$