2.94   ODE No. 94

\[ a y(x)+b x^n+x y'(x)=0 \]

Mathematica : cpu = 0.0385486 (sec), leaf count = 25

DSolve[b*x^n + a*y[x] + x*Derivative[1][y][x] == 0,y[x],x]
 
\[\left \{\left \{y(x)\to -\frac {b x^n}{a+n}+c_1 x^{-a}\right \}\right \}\]

Maple : cpu = 0.019 (sec), leaf count = 23

dsolve(x*diff(y(x),x)+a*y(x)+b*x^n = 0,y(x))
 
\[y \left (x \right ) = -\frac {b \,x^{n}}{a +n}+x^{-a} c_{1}\]

Hand solution

\[ xy^{\prime }+ay+bx^{n}=0 \]

Linear first order, exact, separable. \(y^{\prime }+\frac {ay}{x}=-bx^{n-1}\), integrating factor \(\mu =e^{\int \frac {a}{x}dx}=e^{a\ln x}=x^{a}\), hence

\begin{align*} d\left ( \mu y\right ) & =-\mu bx^{n-1}\\ x^{a}y & =-\int bx^{a+n-1}+C \end{align*}

If \(a=-n\) then

\begin{align*} x^{a}y & =-\int bx^{-1}+C\\ y & =-x^{-a}b\ln \left ( x\right ) +x^{-a}C\\ & =x^{-a}\left ( C-b\ln x\right ) \end{align*}

If \(a\neq -n\) then

\begin{align*} x^{a}y & =-\frac {bx^{a+n}}{a+n}+C\\ y & =-b\frac {x^{n}}{a+n}+Cx^{-a}\end{align*}

Verification

restart; 
ode:=x*diff(y(x),x)+a*y(x)+b*x^n=0; 
s1:=x^(-a)*(_C1-b*ln(x)); 
s2:=-b*(x^n/(a+n))+_C1*x^(-a); 
odetest(y(x)=s2,ode); 
0