# Solution for $\frac{dy}{dx}=\frac{1}{y^2}-\frac{1}{x^2}$, change of variables, integrating factor

I encountered the following nonlinear 1st order ODE as a simplified case of this question.

$$\frac{dy}{dx}=\frac{1}{y^2}-\frac{1}{x^2}$$

I didn't find it in the literature and Wolfram Alpha couldn't solve it either.

However, I believe it might have a solution,.

Replace:

$$y= r \sin t, \qquad x=r \cos t$$

After simplifications, this leads to the following ODE:

$$(r^2 \sin^3 t \cos^2 t+\sin^2 t \cos t- \cos^3 t) dr+\left(r^3 \sin^2 t \cos^3 t+r( \sin t \cos^2 t-\sin^3 t) \right)dt=0$$

$$P(r,t) dr+Q(r,t)dt=0$$

Checking if the new ODE is exact or not, we find that it's not, but the partial derivatives look promising:

$$P_t =r^2 (3 \sin^2 t \cos^3 t-2 \sin^4 t \cos t) +5 \sin t \cos^2 t-\sin^3 t$$

$$Q_r =r^2 (3 \sin^2 t \cos^3 t) +\sin t \cos^2 t-\sin^3 t$$

I feel like there's a simple integrating factor we can use here, but I have no idea what it is.

Can we find an integrating factor which makes the last ODE exact? If we can, what is it?

Is there another way to obtain an explicit or implicit solution for the titular ODE in terms of known functions?

What about the more general case ($$a,b$$ - constants)? $$\frac{dy}{dx}=\frac{a}{y^2}-\frac{b}{x^2}$$

Edit

Multiplying by $$\frac{1}{\cos^2 t}$$ we obtain:

$$\left(r^2 \sin^3 t +\frac{\sin^2 t }{\cos t}- \cos t\right) dr+\left(r^3 \sin^2 t \cos t+r\left( \sin t -\frac{\sin^3 t}{\cos^2 t}\right) \right)dt=0$$

Now we have:

$$P_t=3 r^2 \sin^2 t \cos t+ \sin t +\frac{\sin^3 t }{\cos^2 t}$$

$$Q_r=3 r^2 \sin^2 t \cos t+ \sin t -\frac{\sin^3 t }{\cos^2 t}$$

It's almost exact. Did I make a mistake somewhere? Or do we need a more elaborate integrating factor?

Edit 2

Hyperbolic substitution:

$$y= r \sinh t, \qquad x=r \cosh t$$

leads to a similar equation, which is still not exact:

$$\left(r^2 \sinh^3 t-\frac{1}{\cosh t} \right) dr+\left(r^3 \sinh^2 t \cosh t-r \frac{\sinh t}{\cosh^2 t} \right) dt=0$$

$$P_t=3 r^2 \sinh^2 t \cosh t +\frac{\sinh t }{\cosh^2 t}$$

$$Q_r=3 r^2 \sinh^2 t \cosh t -\frac{\sinh t }{\cosh^2 t}$$

• you can write $$y'(x)=\frac{(x-y(x))(y(x)+x)}{x^2y(x)^2}$$ Commented Apr 18, 2018 at 13:47
• @Dr.SonnhardGraubner, thank you, but what should I do then? Commented Apr 18, 2018 at 14:01
• One integrating factor that is surprisingly versatile is $\mu=x^ny^m$. You might try that. Commented Apr 18, 2018 at 14:14
• @AdrianKeister, thank you, but I tried and it doesn't work here Commented Apr 18, 2018 at 14:20
• Another option is to try $\mu=f(x^n,y^m)$, but that can sometimes lead to a pde that's no easier to solve than the original. Commented Apr 18, 2018 at 14:40

Hint:

Let $u=\dfrac{y}{x}$ ,

Then $y=xu$

$\dfrac{dy}{dx}=x\dfrac{du}{dx}+u$

$\therefore x\dfrac{du}{dx}+u=\dfrac{1}{x^2u^2}-\dfrac{1}{x^2}$

$x\dfrac{du}{dx}=\dfrac{1-u^2}{x^2u^2}-u$

$x\dfrac{du}{dx}=\dfrac{1-u^2-x^2u^3}{x^2u^2}$

Let $v=x^2$ ,

Then $\dfrac{du}{dx}=\dfrac{du}{dv}\dfrac{dv}{dx}=2x\dfrac{du}{dv}$

$\therefore2x^2\dfrac{du}{dv}=\dfrac{1-u^2-x^2u^3}{x^2u^2}$

$2v\dfrac{du}{dv}=\dfrac{1-u^2-u^3v}{u^2v}$

$(u^3v+u^2-1)\dfrac{dv}{du}=-2u^2v^2$

$\left(v+\dfrac{1}{u}-\dfrac{1}{u^3}\right)\dfrac{dv}{du}=-\dfrac{2v^2}{u}$

This belongs to an Abel equation of the second kind.