2.13.5 Problem 53

2.13.5.1 Solved using first_order_ode_riccati
2.13.5.2 Maple
2.13.5.3 Mathematica
2.13.5.4 Sympy

Internal problem ID [13413]
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.6-5. Equations containing combinations of trigonometric functions.
Problem number : 53
Date solved : Sunday, January 18, 2026 at 08:02:06 PM
CAS classification : [_Riccati]

2.13.5.1 Solved using first_order_ode_riccati

0.862 (sec)

Entering first order ode riccati solver

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

This is a Riccati ODE. Comparing the ODE to solve

\[ y' = -a^{2} \cot \left (x \right )^{2}+a \cot \left (x \right )^{2}-y \tan \left (x \right )+y^{2} \]
With Riccati ODE standard form
\[ y' = f_0(x)+ f_1(x)y+f_2(x)y^{2} \]
Shows that \(f_0(x)=-a^{2} \cot \left (x \right )^{2}+a \cot \left (x \right )^{2}\), \(f_1(x)=-\tan \left (x \right )\) 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 &=-\tan \left (x \right )\\ f_2^2 f_0 &=-a^{2} \cot \left (x \right )^{2}+a \cot \left (x \right )^{2} \end{align*}

Substituting the above terms back in equation (2) gives

\[ u^{\prime \prime }\left (x \right )+\tan \left (x \right ) u^{\prime }\left (x \right )+\left (-a^{2} \cot \left (x \right )^{2}+a \cot \left (x \right )^{2}\right ) u \left (x \right ) = 0 \]
Entering second order change of variable on \(x\) method 2 solverIn normal form the ode
\begin{align*} \frac {d^{2}u}{d x^{2}}+\tan \left (x \right ) \left (\frac {d u}{d x}\right )+\left (-a^{2} \cot \left (x \right )^{2}+a \cot \left (x \right )^{2}\right ) u = 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 )&=\tan \left (x \right )\\ q \left (x \right )&=-\cot \left (x \right )^{2} a \left (a -1\right ) \end{align*}

Applying change of variables \(\tau = g \left (x \right )\) to (2) gives

\begin{align*} \frac {d^{2}}{d \tau ^{2}}u \left (\tau \right )+p_{1} \left (\frac {d}{d \tau }u \left (\tau \right )\right )+q_{1} u \left (\tau \right )&=0 \tag {3} \end{align*}

Where \(\tau \) is the new independent variable, and

\begin{align*} p_{1} \left (\tau \right ) &=\frac {\frac {d^{2}}{d x^{2}}\tau \left (x \right )+p \left (x \right ) \left (\frac {d}{d x}\tau \left (x \right )\right )}{\left (\frac {d}{d x}\tau \left (x \right )\right )^{2}}\tag {4} \\ q_{1} \left (\tau \right ) &=\frac {q \left (x \right )}{\left (\frac {d}{d x}\tau \left (x \right )\right )^{2}}\tag {5} \end{align*}

Let \(p_{1} = 0\). Eq (4) simplifies to

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

This ode is solved resulting in

\begin{align*} \tau &= \int {\mathrm e}^{-\int p \left (x \right )d x}d x\\ &= \int {\mathrm e}^{-\int \tan \left (x \right )d x}d x\\ &= \int e^{\ln \left (\cos \left (x \right )\right )} \,dx\\ &= \int \cos \left (x \right )d x\\ &= \sin \left (x \right )\tag {6} \end{align*}

Using (6) to evaluate \(q_{1}\) from (5) gives

\begin{align*} q_{1} \left (\tau \right ) &= \frac {q \left (x \right )}{\left (\frac {d}{d x}\tau \left (x \right )\right )^{2}}\\ &= \frac {-\cot \left (x \right )^{2} a \left (a -1\right )}{\cos \left (x \right )^{2}}\\ &= -a \left (a -1\right ) \csc \left (x \right )^{2}\tag {7} \end{align*}

Substituting the above in (3) and noting that now \(p_{1} = 0\) results in

\begin{align*} \frac {d^{2}}{d \tau ^{2}}u \left (\tau \right )+q_{1} u \left (\tau \right )&=0 \\ \frac {d^{2}}{d \tau ^{2}}u \left (\tau \right )-a \left (a -1\right ) \csc \left (x \right )^{2} u \left (\tau \right )&=0 \\ \end{align*}

But in terms of \(\tau \)

\begin{align*} -a \left (a -1\right ) \csc \left (x \right )^{2}&=-\frac {a \left (a -1\right )}{\tau ^{2}} \end{align*}

Hence the above ode becomes

\begin{align*} \frac {d^{2}}{d \tau ^{2}}u \left (\tau \right )-\frac {a \left (a -1\right ) u \left (\tau \right )}{\tau ^{2}}&=0 \end{align*}

The above ode is now solved for \(u \left (\tau \right )\). Entering second order euler ode solverThis is Euler second order ODE. Let the solution be \(u \left (\tau \right ) = \tau ^r\), then \(u'=r \tau ^{r-1}\) and \(u''=r(r-1) \tau ^{r-2}\). Substituting these back into the given ODE gives

\[ \tau ^{2}(r(r-1))\tau ^{r-2}+0 r \tau ^{r-1}-a \left (a -1\right ) \tau ^{r} = 0 \]
Simplifying gives
\[ r \left (r -1\right )\tau ^{r}+0\,\tau ^{r}-a \left (a -1\right ) \tau ^{r} = 0 \]
Since \(\tau ^{r}\neq 0\) then dividing throughout by \(\tau ^{r}\) gives
\[ r \left (r -1\right )+0-a \left (a -1\right ) = 0 \]
Or
\[ -a^{2}+r^{2}+a -r = 0 \tag {1} \]
Equation (1) is the characteristic equation. Its roots determine the form of the general solution. Using the quadratic equation the roots are
\begin{align*} r_1 &= a\\ r_2 &= -a +1 \end{align*}

Since the roots are real and distinct, then the general solution is

\[ u \left (\tau \right )= c_1 u_1 + c_2 u_2 \]
Where \(u_1 = \tau ^{r_1}\) and \(u_2 = \tau ^{r_2} \). Hence
\[ u \left (\tau \right ) = c_1 \,\tau ^{a}+c_2 \,\tau ^{-a +1} \]
The above solution is now transformed back to \(u\) using (6) which results in
\[ u = c_1 \sin \left (x \right )^{a}+c_2 \sin \left (x \right )^{-a +1} \]
Taking derivative gives
\begin{equation} \tag{4} u^{\prime }\left (x \right ) = \frac {c_1 \sin \left (x \right )^{a} a \cos \left (x \right )}{\sin \left (x \right )}+\frac {c_2 \sin \left (x \right )^{-a +1} \left (-a +1\right ) \cos \left (x \right )}{\sin \left (x \right )} \end{equation}
Substituting equations (3,4) into (1) results in
\begin{align*} y &= \frac {-u'}{f_2 u} \\ y &= \frac {-u'}{u} \\ y &= -\frac {\frac {c_1 \sin \left (x \right )^{a} a \cos \left (x \right )}{\sin \left (x \right )}+\frac {c_2 \sin \left (x \right )^{-a +1} \left (-a +1\right ) \cos \left (x \right )}{\sin \left (x \right )}}{c_1 \sin \left (x \right )^{a}+c_2 \sin \left (x \right )^{-a +1}} \\ \end{align*}
Doing change of constants, the above solution becomes
\[ y = -\frac {\frac {\sin \left (x \right )^{a} a \cos \left (x \right )}{\sin \left (x \right )}+\frac {c_3 \sin \left (x \right )^{-a +1} \left (-a +1\right ) \cos \left (x \right )}{\sin \left (x \right )}}{\sin \left (x \right )^{a}+c_3 \sin \left (x \right )^{-a +1}} \]
Simplifying the above gives
\begin{align*} y &= \frac {-a \sin \left (x \right )^{2 a} \cot \left (x \right )+c_3 \cos \left (x \right ) \left (a -1\right )}{\sin \left (x \right )^{2 a}+\sin \left (x \right ) c_3} \\ \end{align*}

Summary of solutions found

\begin{align*} y &= \frac {-a \sin \left (x \right )^{2 a} \cot \left (x \right )+c_3 \cos \left (x \right ) \left (a -1\right )}{\sin \left (x \right )^{2 a}+\sin \left (x \right ) c_3} \\ \end{align*}
2.13.5.2 Maple. Time used: 0.004 (sec). Leaf size: 37
ode:=diff(y(x),x) = y(x)^2-y(x)*tan(x)+a*(1-a)*cot(x)^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {-\sin \left (x \right )^{2 a} a \cot \left (x \right )+c_1 \cos \left (x \right ) \left (a -1\right )}{c_1 \sin \left (x \right )+\sin \left (x \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 
differential order: 1; looking for linear symmetries 
trying exact 
Looking for potential symmetries 
trying Riccati 
trying Riccati sub-methods: 
   trying Riccati_symmetries 
   trying Riccati to 2nd Order 
   -> Calling odsolve with the ODE, diff(diff(y(x),x),x) = -tan(x)*diff(y(x),x) 
+(a^2*cot(x)^2-a*cot(x)^2)*y(x), y(x) 
      *** Sublevel 2 *** 
      Methods for second order ODEs: 
      --- Trying classification methods --- 
      trying a symmetry of the form [xi=0, eta=F(x)] 
      checking if the LODE is missing y 
      -> Heun: Equivalence to the GHE or one of its 4 confluent cases under a \ 
power @ Moebius 
      -> trying a solution of the form r0(x) * Y + r1(x) * Y where Y = exp(int\ 
(r(x), dx)) * 2F1([a1, a2], [b1], f) 
      -> Trying changes of variables to rationalize or make the ODE simpler 
         trying a quadrature 
         checking if the LODE has constant coefficients 
         checking if the LODE is of Euler type 
         <- LODE of Euler type successful 
         Change of variables used: 
            [x = arcsin(t)] 
         Linear ODE actually solved: 
            (a^2-a)*u(t)-t^2*diff(diff(u(t),t),t) = 0 
      <- change of variables successful 
   <- Riccati to 2nd Order successful
 

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}-y \left (x \right ) \tan \left (x \right )+a \left (1-a \right ) \cot \left (x \right )^{2} \\ \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}-y \left (x \right ) \tan \left (x \right )+a \left (1-a \right ) \cot \left (x \right )^{2} \end {array} \]
2.13.5.3 Mathematica. Time used: 4.635 (sec). Leaf size: 274
ode=D[y[x],x]==y[x]^2-y[x]*Tan[x]+a*(1-a)*Cot[x]^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\frac {i \cot (x) \left (\left (\sqrt {a-1} \sqrt {a} \sqrt {-\frac {(2 a-1)^2}{(a-1) a}}-i\right ) \left (-\sin ^2(x)\right )^{\frac {1}{2} i \sqrt {a-1} \sqrt {a} \sqrt {-\frac {(2 a-1)^2}{(a-1) a}}}-\left (\sqrt {a-1} \sqrt {a} \sqrt {-\frac {(2 a-1)^2}{(a-1) a}}+i\right ) c_1\right )}{2 \left (\left (-\sin ^2(x)\right )^{\frac {1}{2} i \sqrt {a-1} \sqrt {a} \sqrt {\frac {1}{a-a^2}-4}}+c_1\right )}\\ y(x)&\to \frac {1}{2} i \left (\sqrt {a-1} \sqrt {a} \sqrt {\frac {1}{a-a^2}-4}+i\right ) \cot (x)\\ y(x)&\to \frac {1}{2} i \left (\sqrt {a-1} \sqrt {a} \sqrt {\frac {1}{a-a^2}-4}+i\right ) \cot (x) \end{align*}
2.13.5.4 Sympy
from sympy import * 
x = symbols("x") 
a = symbols("a") 
y = Function("y") 
ode = Eq(-a*(1 - a)/tan(x)**2 - y(x)**2 + y(x)*tan(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE -(-a**2 + a + (y(x) - tan(x))*y(x)*tan(x)**2)/tan(x)**2 + Deriva
 
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)) 
 
('factorable', 'lie_group')