2.97 ODE No. 97
\[ a y(x)^2+b x^2+x y'(x)-y(x)=0 \]
✓ Mathematica : cpu = 0.085697 (sec), leaf count = 46
DSolve[b*x^2 - y[x] + a*y[x]^2 + x*Derivative[1][y][x] == 0,y[x],x]
\[\left \{\left \{y(x)\to -\frac {\sqrt {b} x \tan \left (\sqrt {a} \sqrt {b} x-\sqrt {a} \sqrt {b} c_1\right )}{\sqrt {a}}\right \}\right \}\]
✓ Maple : cpu = 0.056 (sec), leaf count = 25
dsolve(x*diff(y(x),x)+a*y(x)^2-y(x)+b*x^2 = 0,y(x))
\[y \left (x \right ) = -\frac {\tan \left (\sqrt {a b}\, \left (x +c_{1} \right )\right ) x \sqrt {a b}}{a}\]
Hand solution
\[ ay^{2}+bx^{2}+xy^{\prime }-y=0 \]
This is Riccati first order non-linear. Let \(y=ux\), hence the above becomes
\begin{align*} au^{2}x^{2}+bx^{2}+x\left ( u^{\prime }x+u\right ) -ux & =0\\ au^{2}x+bx+u^{\prime }x & =0\\ au^{2}+b+u^{\prime } & =0\\ u^{\prime } & =-au^{2}-b \end{align*}
Which is separable, Hence
\[ \frac {du}{au^{2}+b}=-dx \]
Integrating
\begin{align*} \frac {1}{\sqrt {ab}}\arctan \left ( \frac {au}{\sqrt {ab}}\right ) & =-x+C\\ \frac {au}{\sqrt {ab}} & =\tan \left ( \sqrt {ab}\left ( -x+C\right ) \right ) \\ u & =\frac {\sqrt {ab}}{a}\tan \left ( \sqrt {ab}\left ( -x+C\right ) \right ) \end{align*}
Therefore
\begin{align*} y & =ux\\ & =x\frac {\sqrt {ab}}{a}\tan \left ( \sqrt {ab}\left ( -x+C\right ) \right ) \end{align*}
Verification
restart;
ode:=a*y(x)^2+b*x^2+x*diff(y(x),x)-y(x)=0;
my_sol:=x*sqrt(a*b)/a*tan(sqrt(a*b)*(-x+_C1));
odetest(y(x)=my_sol,ode);
0