#### 2.110   ODE No. 110

$f(x) \left (y(x)^2-x^2\right )+x y'(x)=0$ Mathematica : cpu = 11.582 (sec), leaf count = 0 , could not solve

DSolve[f[x]*(-x^2 + y[x]^2) + x*Derivative[1][y][x] == 0, y[x], x]

Maple : cpu = 0. (sec), leaf count = 0 , could not solve

dsolve(x*diff(y(x),x)+f(x)*(y(x)^2-x^2) = 0,y(x))

Hand solution

$$xy^{\prime }+axy^{2}+2y+bx=0$$This is Riccati non-linear ﬁrst order. Converting it to standard form\begin {align} xy^{\prime }+f\left ( x\right ) \left ( y^{2}-x^{2}\right ) -y & =0\nonumber \\ xy^{\prime } & =-f\left ( y^{2}-x^{2}\right ) +y\nonumber \\ y^{\prime } & =-\frac {f}{x}y^{2}+fx+\frac {1}{x}y\tag {1} \end {align}

This is Riccati non-linear ﬁrst order oder. There are two particular solutions $$y_{p}=\pm x$$. Using $$y_{p}=x$$, then using the transformation $$y=y_{p}+\frac {1}{u}$$, gives $$y^{\prime }=1-\frac {u^{\prime }}{u^{2}}$$ and (1) becomes\begin {align*} 1-\frac {u^{\prime }}{u^{2}} & =-\frac {f}{x}\left ( x+\frac {1}{u}\right ) ^{2}+fx+\frac {1}{x}\left ( x+\frac {1}{u}\right ) \\ & =-\frac {f}{x}\left ( x^{2}+\frac {1}{u^{2}}+2\frac {x}{u}\right ) +fx+\left ( 1+\frac {1}{ux}\right ) \\ & =-fx-\frac {f}{x}\frac {1}{u^{2}}-2\frac {f}{u}+fx+1+\frac {1}{ux}\\ & =-\frac {f}{x}\frac {1}{u^{2}}-2\frac {f}{u}+1+\frac {1}{ux} \end {align*}

Hence\begin {align*} u^{2}-u^{\prime } & =-\frac {f}{x}-2fu+u^{2}+\frac {u}{x}\\ -u^{\prime } & =-\frac {f}{x}-2fu+\frac {u}{x}\\ -u^{\prime }-\frac {u}{x}+2fu & =\frac {-f}{x}\\ u^{\prime }+\frac {u}{x}-2fu & =\frac {-f}{x}\\ u^{\prime }+u\left ( \frac {1}{x}-2f\right ) & =\frac {-f}{x} \end {align*}

Integrating factor is $$\mu =e^{\int \frac {1}{x}-2f}=e^{\ln x}e^{-2\int fdx}=xe^{-2\int fdx}$$, hence\begin {align*} d\left ( \mu u\right ) & =-\mu \frac {f}{x}\\ d\left ( xe^{-2\int fdx}u\right ) & =-\left ( xe^{-2\int fdx}\right ) \frac {f}{x}\\ d\left ( xe^{-2\int fdx}u\right ) & =-f\left ( e^{-2\int fdx}\right ) \end {align*}

Integrating\begin {align*} xe^{-2\int fdx}u & =-\int f\left ( e^{-2\int fdx}\right ) +C\\ u & =-\frac {1}{x}e^{2\int fdx}\int f\left ( e^{-2\int fdx}\right ) +C\frac {1}{x}e^{2\int fdx} \end {align*}

Since $$u=\frac {1}{y}$$ then\begin {align*} y & =\frac {1}{-\frac {1}{x}e^{2\int fdx}\int f\left ( e^{-2\int fdx}\right ) +C\frac {1}{x}e^{2\int fdx}}\\ & =\frac {xe^{-2\int fdx}}{-\int fe^{-2\int fdx}dx+C} \end {align*}

Veriﬁcation (Maple does not verify it, need to look more into this)

ode:=x*diff(y(x),x)+f(x)*(y(x)^2-x^2) =0;
dsolve(ode,y(x));
fint:=Int(f(x),x);
my_solution:=x*exp(-2*fint)/(-Int(f*exp(-2*fint),x)+_C1);
odetest(y(x)=my_solution,ode);
not zero