#### 2.104   ODE No. 104

$a x y(x)^2+b x+x y'(x)+2 y(x)=0$ Mathematica : cpu = 0.111434 (sec), leaf count = 43

$\left \{\left \{y(x)\to -\frac {1}{a x}-\sqrt {\frac {b}{a}} \tan \left (a x \sqrt {\frac {b}{a}}-c_1\right )\right \}\right \}$ Maple : cpu = 0.046 (sec), leaf count = 63

$\left \{ y \left ( x \right ) =-{\frac {1}{a} \left ( -{\frac {1}{x} \left ( i\sqrt {a}\sqrt {b}x-1 \right ) }+{{{\rm e}^{-2\,i\sqrt {a}\sqrt {b}x}} \left ( {\it \_C1}-{{\frac {i}{2}}{{\rm e}^{-2\,i\sqrt {a}\sqrt {b}x}}{\frac {1}{\sqrt {a}}}{\frac {1}{\sqrt {b}}}} \right ) ^{-1}} \right ) } \right \}$

Hand solution

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

Using transformation suggested by Kamke $$y=u\left ( x\right ) -\frac {1}{ax}$$ then $$y^{\prime }=u^{\prime }+\frac {1}{ax^{2}}$$. Equating this to RHS of (1) gives\begin {align*} u^{\prime }+\frac {1}{ax^{2}} & =-b-\frac {2}{x}\left ( u-\frac {1}{ax}\right ) -a\left ( u-\frac {1}{ax}\right ) ^{2}\\ & =-b-\frac {2}{x}u+\frac {2}{ax^{2}}-a\left ( u^{2}+\frac {1}{a^{2}x^{2}}-\frac {2u}{ax}\right ) \\ & =-b-\frac {2}{x}u+\frac {2}{ax^{2}}-au^{2}-\frac {1}{ax^{2}}+\frac {2u}{x} \end {align*}

Hence

\begin {align*} u^{\prime } & =-b-au^{2}\\ \frac {du}{dx} & =-b-au^{2} \end {align*}

This is separable

$\frac {du}{b+au^{2}}=-dx$

Integrating

\begin {align*} \int \frac {du}{b+au^{2}} & =-x+C\\ \frac {1}{\sqrt {ba}}\arctan \left ( \frac {au}{\sqrt {ba}}\right ) & =-x+C\\ \arctan \left ( \frac {au}{\sqrt {ba}}\right ) & =-\sqrt {ba}x+C\\ u & =\frac {\sqrt {ba}}{a}\tan \left ( -\sqrt {ba}x+C\right ) \end {align*}

Hence

\begin {align*} y & =u-\frac {1}{ax}\\ & =\frac {\sqrt {ba}}{a}\tan \left ( -\sqrt {ba}x+C\right ) -\frac {1}{ax} \end {align*}

Veriﬁcation

restart;
ode:=x*diff(y(x),x)+a*x*y(x)^2+2*y(x)+b*x = 0;
my_solution:=sqrt(b*a)/a*tan(-sqrt(b*a)*x+_C1)-1/(a*x);
odetest(y(x)=my_solution,ode);
0