2.31.5 Problem 153

2.31.5.1 Maple
2.31.5.2 Mathematica
2.31.5.3 Sympy

Internal problem ID [13814]
Book : Handbook of exact solutions for ordinary differential equations. By Polyanin and Zaitsev. Second edition
Section : Chapter 2, Second-Order Differential Equations. section 2.1.2-5
Problem number : 153
Date solved : Friday, December 19, 2025 at 01:08:51 PM
CAS classification : [_Gegenbauer]

\begin{align*} \left (-x^{2}+1\right ) y^{\prime \prime }-2 y^{\prime } x +n \left (n +1\right ) y&=0 \\ \end{align*}
2.31.5.1 Maple. Time used: 0.010 (sec). Leaf size: 15
ode:=n*(n+1)*y(x)-2*x*diff(y(x),x)+(-x^2+1)*diff(diff(y(x),x),x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = c_1 \operatorname {LegendreP}\left (n , x\right )+c_2 \operatorname {LegendreQ}\left (n , x\right ) \]

Maple trace

Methods for second order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
checking if the LODE has constant coefficients 
checking if the LODE is of Euler type 
trying a symmetry of the form [xi=0, eta=F(x)] 
checking if the LODE is missing y 
-> Trying a Liouvillian solution using Kovacics algorithm 
<- No Liouvillian solutions exists 
-> Trying a solution in terms of special functions: 
   -> Bessel 
   -> elliptic 
   -> Legendre 
   <- Legendre successful 
<- special function solution successful
 
2.31.5.2 Mathematica. Time used: 0.018 (sec). Leaf size: 18
ode=(1-x^2)*D[y[x],{x,2}]-2*x*D[y[x],x]+n*(n+1)*y[x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to c_1 \operatorname {LegendreP}(n,x)+c_2 \operatorname {LegendreQ}(n,x) \end{align*}
2.31.5.3 Sympy
from sympy import * 
x = symbols("x") 
n = symbols("n") 
y = Function("y") 
ode = Eq(n*(n + 1)*y(x) - 2*x*Derivative(y(x), x) + (1 - x**2)*Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
False