2.19.8 Problem 8

2.19.8.1 Solved using first_order_ode_riccati
2.19.8.2 Solved using first_order_ode_riccati_by_guessing_particular_solution
2.19.8.3 Maple
2.19.8.4 Mathematica
2.19.8.5 Sympy

Internal problem ID [13456]
Book : Handbook of exact solutions for ordinary differential equations. By Polyanin and Zaitsev. Second edition
Section : Chapter 1, section 1.2. Riccati Equation. subsection 1.2.8-1. Equations containing arbitrary functions (but not containing their derivatives).
Problem number : 8
Date solved : Sunday, January 18, 2026 at 08:20:45 PM
CAS classification : [_Riccati]

2.19.8.1 Solved using first_order_ode_riccati

2.664 (sec)

Entering first order ode riccati solver

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

This is a Riccati ODE. Comparing the ODE to solve

\[ y' = \frac {x^{2 n} f \left (x \right ) y^{2}}{x}+\frac {a \,x^{n} f \left (x \right ) y}{x}+\frac {f \left (x \right ) b}{x}-\frac {n y}{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 {f \left (x \right ) b}{x}\), \(f_1(x)=\frac {a \,x^{n} f \left (x \right )}{x}-\frac {n}{x}\) and \(f_2(x)=\frac {x^{2 n} f \left (x \right )}{x}\). Let
\begin{align*} y &= \frac {-u'}{f_2 u} \\ &= \frac {-u'}{\frac {u \,x^{2 n} f \left (x \right )}{x}} \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' &=-\frac {f \left (x \right ) x^{2 n}}{x^{2}}+\frac {2 x^{2 n} f \left (x \right ) n}{x^{2}}+\frac {x^{2 n} f^{\prime }\left (x \right )}{x}\\ f_1 f_2 &=\frac {\left (\frac {a \,x^{n} f \left (x \right )}{x}-\frac {n}{x}\right ) x^{2 n} f \left (x \right )}{x}\\ f_2^2 f_0 &=\frac {x^{4 n} f \left (x \right )^{3} b}{x^{3}} \end{align*}

Substituting the above terms back in equation (2) gives

\[ \frac {x^{2 n} f \left (x \right ) u^{\prime \prime }\left (x \right )}{x}-\left (-\frac {f \left (x \right ) x^{2 n}}{x^{2}}+\frac {2 x^{2 n} f \left (x \right ) n}{x^{2}}+\frac {x^{2 n} f^{\prime }\left (x \right )}{x}+\frac {\left (\frac {a \,x^{n} f \left (x \right )}{x}-\frac {n}{x}\right ) x^{2 n} f \left (x \right )}{x}\right ) u^{\prime }\left (x \right )+\frac {x^{4 n} f \left (x \right )^{3} b u \left (x \right )}{x^{3}} = 0 \]
Unable to solve. Will ask Maple to solve this ode now.

The solution for \(u \left (x \right )\) is

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

Summary of solutions found

\begin{align*} y &= -\frac {\left (\frac {a \,x^{n -1} f \left (x \right ) {\mathrm e}^{\frac {a \int f \left (x \right ) x^{n -1}d x}{2}} \cosh \left (\frac {\sqrt {a^{4}-4 a^{2} b}\, \left (a \int f \left (x \right ) x^{n -1}d x +1\right )}{2 a^{2}}\right ) c_3}{2}+\frac {{\mathrm e}^{\frac {a \int f \left (x \right ) x^{n -1}d x}{2}} \sqrt {a^{4}-4 a^{2} b}\, x^{n -1} f \left (x \right ) \sinh \left (\frac {\sqrt {a^{4}-4 a^{2} b}\, \left (a \int f \left (x \right ) x^{n -1}d x +1\right )}{2 a^{2}}\right ) c_3}{2 a}\right ) x \,x^{-2 n} {\mathrm e}^{\int -\frac {a \,x^{n -1} f \left (x \right )}{2}d x}}{f \left (x \right ) \cosh \left (\frac {\sqrt {a^{4}-4 a^{2} b}\, \left (a \int f \left (x \right ) x^{n -1}d x +1\right )}{2 a^{2}}\right ) c_3} \\ \end{align*}
2.19.8.2 Solved using first_order_ode_riccati_by_guessing_particular_solution

0.397 (sec)

Entering first order ode riccati guess solver

\begin{align*} y^{\prime } x&=x^{2 n} f \left (x \right ) y^{2}+\left (a \,x^{n} f \left (x \right )-n \right ) y+f \left (x \right ) b \\ \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 {f \left (x \right ) b}{x}\\ f_1(x) & =\frac {a \,x^{n} f \left (x \right )}{x}-\frac {n}{x}\\ f_2(x) &=\frac {x^{2 n} f \left (x \right )}{x} \end{align*}

Using trial and error, the following particular solution was found

\[ y_p = \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) x^{-n} \]
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 = \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) x^{-n}+\frac {{\mathrm e}^{\int \left (\frac {2 \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) x^{-n} x^{2 n} f \left (x \right )}{x}+\frac {a \,x^{n} f \left (x \right )}{x}-\frac {n}{x}\right )d x}}{c_1 -\int \frac {{\mathrm e}^{\int \left (\frac {2 \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) x^{-n} x^{2 n} f \left (x \right )}{x}+\frac {a \,x^{n} f \left (x \right )}{x}-\frac {n}{x}\right )d x} x^{2 n} f \left (x \right )}{x}d x} \]

Summary of solutions found

\begin{align*} y &= \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) x^{-n}+\frac {{\mathrm e}^{\int \left (\frac {2 \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) x^{-n} x^{2 n} f \left (x \right )}{x}+\frac {a \,x^{n} f \left (x \right )}{x}-\frac {n}{x}\right )d x}}{c_1 -\int \frac {{\mathrm e}^{\int \left (\frac {2 \left (-\frac {a}{2}+\frac {\sqrt {a^{2}-4 b}}{2}\right ) x^{-n} x^{2 n} f \left (x \right )}{x}+\frac {a \,x^{n} f \left (x \right )}{x}-\frac {n}{x}\right )d x} x^{2 n} f \left (x \right )}{x}d x} \\ \end{align*}
2.19.8.3 Maple. Time used: 0.017 (sec). Leaf size: 65
ode:=x*diff(y(x),x) = x^(2*n)*f(x)*y(x)^2+(a*x^n*f(x)-n)*y(x)+f(x)*b; 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {x^{-n} \left (\tanh \left (\frac {\sqrt {a^{2} \left (a^{2}-4 b \right )}\, \left (a \int x^{-1+n} f \left (x \right )d x +c_1 \right )}{2 a^{2}}\right ) \sqrt {a^{2} \left (a^{2}-4 b \right )}+a^{2}\right )}{2 a} \]

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 
<- Chini successful
 

Maple step by step

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & x \left (\frac {d}{d x}y \left (x \right )\right )=x^{26912} f \left (x \right ) y \left (x \right )^{2}+\left (a \,x^{13456} f \left (x \right )-13456\right ) y \left (x \right )+b f \left (x \right ) \\ \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 )=\frac {x^{26912} f \left (x \right ) y \left (x \right )^{2}+\left (a \,x^{13456} f \left (x \right )-13456\right ) y \left (x \right )+b f \left (x \right )}{x} \end {array} \]
2.19.8.4 Mathematica. Time used: 0.694 (sec). Leaf size: 82
ode=x*D[y[x],x]==x^(2*n)*f[x]*y[x]^2+(a*x^n*f[x]-n)*y[x]+b*f[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ \text {Solve}\left [\int _1^{\sqrt {\frac {x^{2 n}}{b}} y(x)}\frac {1}{K[1]^2-\sqrt {\frac {a^2}{b}} K[1]+1}dK[1]=\int _1^x\frac {b f(K[2]) \sqrt {\frac {K[2]^{2 n}}{b}}}{K[2]}dK[2]+c_1,y(x)\right ] \]
2.19.8.5 Sympy
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
n = symbols("n") 
y = Function("y") 
f = Function("f") 
ode = Eq(-b*f(x) + x*Derivative(y(x), x) - x**(2*n)*f(x)*y(x)**2 - (a*x**n*f(x) - n)*y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
Timed Out
 
Python version: 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] 
Sympy version 1.14.0