# ODE Challenge

#### MarkFL

Staff member
Find the general solution for:

$$\displaystyle \left(\left(x^2+y^2 \right)x-y \right)\,dx+\left(\left(x^2+y^2 \right)y+x \right)\,dy=0$$

#### Jester

##### Well-known member
MHB Math Helper
My solution

If you switch to polar coords $x = r \cos \theta , \; y = r \sin \theta$ the ODE becomes

$r dr + dt = 0$.

At this point the ODE is trivial.

#### MarkFL

Staff member
My solution

If you switch to polar coords $x = r \cos \theta , \; y = r \sin \theta$ the ODE becomes

$r dr + dt = 0$.

At this point the ODE is trivial.
Brilliant! For those who may not follow the substitution and subsequent result, I will elaborate, and also give my method here:

Jester suggests switching to polar coordinates:

$$\displaystyle x=r\cos(\theta)$$

$$\displaystyle y=r\sin(\theta)$$

and so we find:

$$\displaystyle x^2+y^2=r^2$$

$$\displaystyle \theta=\tan^{-1}\left(\frac{y}{x} \right)$$

$$\displaystyle dx=-r\sin(\theta)\,d\theta+\cos(\theta)\,dr$$

$$\displaystyle dy=r\cos(\theta)\,d\theta+\sin(\theta)\,dr$$

Now, substituting into the ODE, we get:

$$\displaystyle \left(r^3\cos(\theta)- r\sin(\theta) \right)\left(\cos(\theta)\,dr- r\sin(\theta)\,d\theta \right)+ \left(r^3\sin(\theta)+ r\cos(\theta) \right)\left(\sin(\theta)\,dr+ r\cos(\theta)\,d\theta \right)=0$$

Dividing through by $r$ and expanding, we find the first term is:

$$\displaystyle r^2\cos^2(\theta)\,dr-r^3\sin(\theta)\cos(\theta)-\sin(\theta)\cos(\theta)\,dr+r\sin^2(\theta)\,dt$$

and the second term is:

$$\displaystyle r^2\sin^2(\theta)\,dr+r^3\sin(\theta)\cos(\theta)+\sin(\theta)\cos(\theta)\,dr+r\cos^2(\theta)\,dt$$

And so their sum is (and applying the Pythagorean identity):

$$\displaystyle r^2\,dr+r\,d\theta=0$$

Divide through by $r$ to obtain:

$$\displaystyle r\,dr+d\theta=0$$

Integrating, we find:

$$\displaystyle r^2+2\theta=C$$

And back-substituting, we get the general solution:

$$\displaystyle x^2+y^2+2\tan^{-1}\left(\frac{y}{x} \right)=C$$

This is the method I used:

Beginning with:

$$\displaystyle \left(\left(x^2+y^2 \right)x-y \right)\,dx+\left(\left(x^2+y^2 \right)y+x \right)\,dy=0$$

$$\displaystyle \left(x^2+y^2 \right)x-y+\left(\left(x^2+y^2 \right)y+x \right)y'=0$$

Divide through by $$\displaystyle x^2+y^2$$ to get:

$$\displaystyle x+yy'+\frac{xy'-y}{x^2+y^2}=0$$

$$\displaystyle 2x+2yy'+2\frac{1}{\left(\frac{y}{x} \right)^2+1}\cdot\frac{xy'-y}{x^2}=0$$

$$\displaystyle 2x+2y\frac{dy}{dx}+2\frac{1}{\left(\frac{y}{x} \right)^2+1}\frac{d}{dx}\left(\frac{y}{x} \right)=0$$

Integrating with respect to $x$, we obtain the general solution:

$$\displaystyle x^2+y^2+2\tan^{-1}\left(\frac{y}{x} \right)=C$$