2.2.23 Problem 25

2.2.23.1 Solved using first_order_ode_riccati
2.2.23.2 Solved using first_order_ode_riccati_by_guessing_particular_solution
2.2.23.3 Maple
2.2.23.4 Mathematica
2.2.23.5 Sympy

Internal problem ID [13229]
Book : Handbook of exact solutions for ordinary differential equations. By Polyanin and Zaitsev. Second edition
Section : Chapter 1, section 1.2. Riccati Equation. 1.2.2. Equations Containing Power Functions
Problem number : 25
Date solved : Sunday, January 18, 2026 at 06:49:18 PM
CAS classification : [_Riccati]

2.2.23.1 Solved using first_order_ode_riccati

0.542 (sec)

Entering first order ode riccati solver

\begin{align*} y^{\prime }&=y^{2}+a \,x^{n} y+a \,x^{n -1} \\ \end{align*}
In canonical form the ODE is
\begin{align*} y' &= F(x,y)\\ &= y^{2}+a \,x^{n} y+a \,x^{n -1} \end{align*}

This is a Riccati ODE. Comparing the ODE to solve

\[ y' = y^{2}+a \,x^{n} y+\frac {a \,x^{n}}{x} \]
With Riccati ODE standard form
\[ y' = f_0(x)+ f_1(x)y+f_2(x)y^{2} \]
Shows that \(f_0(x)=\frac {a \,x^{n}}{x}\), \(f_1(x)=x^{n} a\) and \(f_2(x)=1\). Let
\begin{align*} y &= \frac {-u'}{f_2 u} \\ &= \frac {-u'}{u} \tag {1} \end{align*}

Using the above substitution in the given ODE results (after some simplification) in a second order ODE to solve for \(u(x)\) which is

\begin{align*} f_2 u''(x) -\left ( f_2' + f_1 f_2 \right ) u'(x) + f_2^2 f_0 u(x) &= 0 \tag {2} \end{align*}

But

\begin{align*} f_2' &=0\\ f_1 f_2 &=x^{n} a\\ f_2^2 f_0 &=\frac {a \,x^{n}}{x} \end{align*}

Substituting the above terms back in equation (2) gives

\[ u^{\prime \prime }\left (x \right )-x^{n} a u^{\prime }\left (x \right )+\frac {a \,x^{n} u \left (x \right )}{x} = 0 \]
Entering second order change of variable on \(y\) method 2 solverIn normal form the ode
\begin{align*} \frac {d^{2}u}{d x^{2}}-x^{n} a \left (\frac {d u}{d x}\right )+\frac {a \,x^{n} u}{x} = 0\tag {1} \end{align*}

Becomes

\begin{align*} \frac {d^{2}u}{d x^{2}}+p \left (x \right ) \left (\frac {d u}{d x}\right )+q \left (x \right ) u&=0 \tag {2} \end{align*}

Where

\begin{align*} p \left (x \right )&=-x^{n} a\\ q \left (x \right )&=a \,x^{n -1} \end{align*}

Applying change of variables on the depndent variable \(u = v \left (x \right ) x^{n}\) to (2) gives the following ode where the dependent variables is \(v \left (x \right )\) and not \(u\).

\begin{align*} \frac {d^{2}}{d x^{2}}v \left (x \right )+\left (\frac {2 n}{x}+p \right ) \left (\frac {d}{d x}v \left (x \right )\right )+\left (\frac {n \left (n -1\right )}{x^{2}}+\frac {n p}{x}+q \right ) v \left (x \right )&=0 \tag {3} \end{align*}

Let the coefficient of \(v \left (x \right )\) above be zero. Hence

\begin{align*} \frac {n \left (n -1\right )}{x^{2}}+\frac {n p}{x}+q&=0 \tag {4} \end{align*}

Substituting the earlier values found for \(p \left (x \right )\) and \(q \left (x \right )\) into (4) gives

\begin{align*} \frac {n \left (n -1\right )}{x^{2}}-\frac {n \,x^{n} a}{x}+a \,x^{n -1}&=0 \tag {5} \end{align*}

Solving (5) for \(n\) gives

\begin{align*} n&=1 \tag {6} \end{align*}

Substituting this value in (3) gives

\begin{align*} \frac {d^{2}}{d x^{2}}v \left (x \right )+\left (\frac {2}{x}-x^{n} a \right ) \left (\frac {d}{d x}v \left (x \right )\right )&=0 \\ \frac {d^{2}}{d x^{2}}v \left (x \right )+\left (\frac {2}{x}-x^{n} a \right ) \left (\frac {d}{d x}v \left (x \right )\right )&=0 \tag {7} \\ \end{align*}

Using the substitution

\begin{align*} u \left (x \right ) = \frac {d}{d x}v \left (x \right ) \end{align*}

Then (7) becomes

\begin{align*} \frac {d}{d x}u \left (x \right )+\left (\frac {2}{x}-x^{n} a \right ) u \left (x \right ) = 0 \tag {8} \\ \end{align*}

The above is now solved for \(u \left (x \right )\). Entering first order ode linear solverIn canonical form a linear first order is

\begin{align*} \frac {d}{d x}u \left (x \right ) + q(x)u \left (x \right ) &= p(x) \end{align*}

Comparing the above to the given ode shows that

\begin{align*} q(x) &=-\frac {x^{n +1} a -2}{x}\\ p(x) &=0 \end{align*}

The integrating factor \(\mu \) is

\begin{align*} \mu &= e^{\int {q\,dx}}\\ &= {\mathrm e}^{\int -\frac {x^{n +1} a -2}{x}d x}\\ &= {\mathrm e}^{\frac {-x^{n +1} a +2 \ln \left (x^{n +1}\right )}{n +1}} \end{align*}

The ode becomes

\begin{align*} \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \mu u &= 0 \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left (u \,{\mathrm e}^{\frac {-x^{n +1} a +2 \ln \left (x^{n +1}\right )}{n +1}}\right ) &= 0 \end{align*}

Integrating gives

\begin{align*} u \,{\mathrm e}^{\frac {-x^{n +1} a +2 \ln \left (x^{n +1}\right )}{n +1}}&= \int {0 \,dx} + c_1 \\ &=c_1 \end{align*}

Dividing throughout by the integrating factor \({\mathrm e}^{\frac {-x^{n +1} a +2 \ln \left (x^{n +1}\right )}{n +1}}\) gives the final solution

\[ u \left (x \right ) = {\mathrm e}^{-\frac {-x^{n +1} a +2 \ln \left (x^{n +1}\right )}{n +1}} c_1 \]
Simplifying the above gives
\begin{align*} u \left (x \right ) &= {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}} c_1 \\ \end{align*}
Now that \(u \left (x \right )\) is known, then
\begin{align*} \frac {d}{d x}v \left (x \right )&= u \left (x \right )\\ v \left (x \right )&= \int u \left (x \right )d x +c_2\\ &= \int {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}} c_1 d x +c_2 \end{align*}

Hence

\begin{align*} u&= v \left (x \right ) x^{n}\\ &= \left (\int {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}} c_1 d x +c_2 \right ) x\\ &= \left (c_1 \int {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}}d x +c_2 \right ) x\\ \end{align*}

Taking derivative gives

\begin{equation} \tag{4} u^{\prime }\left (x \right ) = {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}} c_1 x +\int {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}} c_1 d x +c_2 \end{equation}
Substituting equations (3,4) into (1) results in
\begin{align*} y &= \frac {-u'}{f_2 u} \\ y &= \frac {-u'}{u} \\ y &= -\frac {{\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}} c_1 x +\int {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}} c_1 d x +c_2}{\left (\int {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}} c_1 d x +c_2 \right ) x} \\ \end{align*}
Doing change of constants, the above solution becomes
\[ y = -\frac {{\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}} x +\int {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}}d x +c_3}{\left (\int {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}}d x +c_3 \right ) x} \]

Summary of solutions found

\begin{align*} y &= -\frac {{\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}} x +\int {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}}d x +c_3}{\left (\int {\mathrm e}^{\frac {x^{n +1} a -2 \ln \left (x^{n +1}\right )}{n +1}}d x +c_3 \right ) x} \\ \end{align*}
2.2.23.2 Solved using first_order_ode_riccati_by_guessing_particular_solution

0.060 (sec)

Entering first order ode riccati guess solver

\begin{align*} y^{\prime }&=y^{2}+a \,x^{n} y+a \,x^{n -1} \\ \end{align*}
This is a Riccati ODE. Comparing the above ODE to solve with the Riccati standard form
\[ y' = f_0(x)+ f_1(x)y+f_2(x)y^{2} \]
Shows that
\begin{align*} f_0(x) & =\frac {a \,x^{n}}{x}\\ f_1(x) & =x^{n} a\\ f_2(x) &=1 \end{align*}

Using trial and error, the following particular solution was found

\[ y_p = -\frac {1}{x} \]
Since a particular solution is known, then the general solution is given by
\begin{align*} y &= y_p + \frac { \phi (x) }{ c_1 - \int { \phi (x) f_2 \,dx} } \end{align*}

Where

\begin{align*} \phi (x) &= e^{ \int 2 f_2 y_p + f_1 \,dx } \end{align*}

Evaluating the above gives the general solution as

\[ y = -\frac {1}{x}+\frac {{\mathrm e}^{\frac {a \,x^{n +1}}{n +1}-2 \ln \left (x \right )}}{c_1 -\int {\mathrm e}^{\frac {a \,x^{n +1}}{n +1}-2 \ln \left (x \right )}d x} \]

Summary of solutions found

\begin{align*} y &= -\frac {1}{x}+\frac {{\mathrm e}^{\frac {a \,x^{n +1}}{n +1}-2 \ln \left (x \right )}}{c_1 -\int {\mathrm e}^{\frac {a \,x^{n +1}}{n +1}-2 \ln \left (x \right )}d x} \\ \end{align*}
2.2.23.3 Maple. Time used: 0.005 (sec). Leaf size: 422
ode:=diff(y(x),x) = y(x)^2+a*x^n*y(x)+a*x^(n-1); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {-{\mathrm e}^{\frac {a \,x^{n +1}}{2 n +2}} \left (-\frac {a \,x^{n +1}}{n +1}\right )^{-\frac {n}{2 n +2}} \left (n +1\right )^{2} \left (-n \,x^{-n -1}+a \right ) \operatorname {WhittakerM}\left (\frac {-n -2}{2 n +2}, \frac {2 n +1}{2 n +2}, -\frac {a \,x^{n +1}}{n +1}\right )-2 n \left (-\frac {n \,x^{-n -1} {\mathrm e}^{\frac {a \,x^{n +1}}{2 n +2}} \left (-\frac {a \,x^{n +1}}{n +1}\right )^{-\frac {n}{2 n +2}} \left (n +1\right ) \operatorname {WhittakerM}\left (\frac {n}{2 n +2}, \frac {2 n +1}{2 n +2}, -\frac {a \,x^{n +1}}{n +1}\right )}{2}+\left (c_1 x -{\mathrm e}^{\frac {a \,x^{n +1}}{n +1}}\right ) \left (n +\frac {1}{2}\right ) a \right )}{\left ({\mathrm e}^{\frac {a \,x^{n +1}}{2 n +2}} \left (-\frac {a \,x^{n +1}}{n +1}\right )^{-\frac {n}{2 n +2}} \left (n +1\right )^{2} \left (-n \,x^{-n -1}+a \right ) \operatorname {WhittakerM}\left (\frac {-n -2}{2 n +2}, \frac {2 n +1}{2 n +2}, -\frac {a \,x^{n +1}}{n +1}\right )+2 n \left (-\frac {n \,x^{-n -1} {\mathrm e}^{\frac {a \,x^{n +1}}{2 n +2}} \left (-\frac {a \,x^{n +1}}{n +1}\right )^{-\frac {n}{2 n +2}} \left (n +1\right ) \operatorname {WhittakerM}\left (\frac {n}{2 n +2}, \frac {2 n +1}{2 n +2}, -\frac {a \,x^{n +1}}{n +1}\right )}{2}+a x c_1 \left (n +\frac {1}{2}\right )\right )\right ) x} \]

Maple trace

Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying 1st order linear 
trying Bernoulli 
trying separable 
trying inverse linear 
trying homogeneous types: 
trying Chini 
differential order: 1; looking for linear symmetries 
trying exact 
Looking for potential symmetries 
found: 2 potential symmetries. Proceeding with integration step
 

Maple step by step

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \frac {d}{d x}y \left (x \right )=y \left (x \right )^{2}+a \,x^{13229} y \left (x \right )+a \,x^{13228} \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 1 \\ {} & {} & \frac {d}{d x}y \left (x \right ) \\ \bullet & {} & \textrm {Solve for the highest derivative}\hspace {3pt} \\ {} & {} & \frac {d}{d x}y \left (x \right )=y \left (x \right )^{2}+a \,x^{13229} y \left (x \right )+a \,x^{13228} \end {array} \]
2.2.23.4 Mathematica. Time used: 0.489 (sec). Leaf size: 268
ode=D[y[x],x]==y[x]^2+a*x^n*y[x]+a*x^(n-1); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ \text {Solve}\left [\int _1^{y(x)}\left (\frac {e^{\frac {a x^{n+1}}{n+1}}}{(x K[2]+1)^2}-\int _1^x\left (\frac {a e^{\frac {a K[1]^{n+1}}{n+1}} K[1]^n}{K[1] K[2]+1}-\frac {a e^{\frac {a K[1]^{n+1}}{n+1}} K[2] K[1]^{n+1}}{(K[1] K[2]+1)^2}+\frac {2 e^{\frac {a K[1]^{n+1}}{n+1}} K[2]^2 K[1]}{(K[1] K[2]+1)^3}-\frac {2 e^{\frac {a K[1]^{n+1}}{n+1}} K[2]}{(K[1] K[2]+1)^2}\right )dK[1]\right )dK[2]+\int _1^x\left (-a e^{\frac {a K[1]^{n+1}}{n+1}} K[1]^{n-1}+\frac {a e^{\frac {a K[1]^{n+1}}{n+1}} y(x) K[1]^n}{K[1] y(x)+1}-\frac {e^{\frac {a K[1]^{n+1}}{n+1}} y(x)^2}{(K[1] y(x)+1)^2}\right )dK[1]=c_1,y(x)\right ] \]
2.2.23.5 Sympy
from sympy import * 
x = symbols("x") 
a = symbols("a") 
n = symbols("n") 
y = Function("y") 
ode = Eq(-a*x**n*y(x) - a*x**(n - 1) - y(x)**2 + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE -a*x**n*y(x) - a*x**(n - 1) - y(x)**2 + Derivative(y(x), x) cann
 
Python version: 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] 
Sympy version 1.14.0
 
classify_ode(ode,func=y(x)) 
 
('1st_power_series', 'lie_group')