2.2.45 Problem 45

Solved as second order Bessel ode
Solved as second order ode adjoint method
Maple
Mathematica
Sympy

Internal problem ID [9168]
Book : Second order enumerated odes
Section : section 2
Problem number : 45
Date solved : Wednesday, March 05, 2025 at 07:37:15 AM
CAS classification : [_Bessel]

Solve

\begin{align*} x^{2} y^{\prime \prime }+x y^{\prime }+\left (x^{2}-5\right ) y&=0 \end{align*}

Solved as second order Bessel ode

Time used: 0.057 (sec)

Writing the ode as

\begin{align*} x^{2} y^{\prime \prime }+x y^{\prime }+\left (x^{2}-5\right ) y = 0\tag {1} \end{align*}

Bessel ode has the form

\begin{align*} x^{2} y^{\prime \prime }+x y^{\prime }+\left (-n^{2}+x^{2}\right ) y = 0\tag {2} \end{align*}

The generalized form of Bessel ode is given by Bowman (1958) as the following

\begin{align*} x^{2} y^{\prime \prime }+\left (1-2 \alpha \right ) x y^{\prime }+\left (\beta ^{2} \gamma ^{2} x^{2 \gamma }-n^{2} \gamma ^{2}+\alpha ^{2}\right ) y = 0\tag {3} \end{align*}

With the standard solution

\begin{align*} y&=x^{\alpha } \left (c_1 \operatorname {BesselJ}\left (n , \beta \,x^{\gamma }\right )+c_2 \operatorname {BesselY}\left (n , \beta \,x^{\gamma }\right )\right )\tag {4} \end{align*}

Comparing (3) to (1) and solving for \(\alpha ,\beta ,n,\gamma \) gives

\begin{align*} \alpha &= 0\\ \beta &= 1\\ n &= -\sqrt {5}\\ \gamma &= 1 \end{align*}

Substituting all the above into (4) gives the solution as

\begin{align*} y = c_1 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_2 \operatorname {BesselY}\left (-\sqrt {5}, x\right ) \end{align*}

Will add steps showing solving for IC soon.

Summary of solutions found

\begin{align*} y &= c_1 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_2 \operatorname {BesselY}\left (-\sqrt {5}, x\right ) \\ \end{align*}

Solved as second order ode adjoint method

Time used: 0.514 (sec)

In normal form the ode

\begin{align*} x^{2} y^{\prime \prime }+x y^{\prime }+\left (x^{2}-5\right ) y = 0 \tag {1} \end{align*}

Becomes

\begin{align*} y^{\prime \prime }+p \left (x \right ) y^{\prime }+q \left (x \right ) y&=r \left (x \right ) \tag {2} \end{align*}

Where

\begin{align*} p \left (x \right )&=\frac {1}{x}\\ q \left (x \right )&=\frac {x^{2}-5}{x^{2}}\\ r \left (x \right )&=0 \end{align*}

The Lagrange adjoint ode is given by

\begin{align*} \xi ^{''}-(\xi \, p)'+\xi q &= 0\\ \xi ^{''}-\left (\frac {\xi \left (x \right )}{x}\right )' + \left (\frac {\left (x^{2}-5\right ) \xi \left (x \right )}{x^{2}}\right ) &= 0\\ \frac {\xi ^{\prime \prime }\left (x \right ) x^{2}+\xi \left (x \right ) x^{2}-\xi ^{\prime }\left (x \right ) x -4 \xi \left (x \right )}{x^{2}}&= 0 \end{align*}

Which is solved for \(\xi (x)\). Writing the ode as

\begin{align*} \xi ^{\prime \prime } x^{2}-\xi ^{\prime } x +\left (x^{2}-4\right ) \xi = 0\tag {1} \end{align*}

Bessel ode has the form

\begin{align*} \xi ^{\prime \prime } x^{2}+\xi ^{\prime } x +\left (-n^{2}+x^{2}\right ) \xi = 0\tag {2} \end{align*}

The generalized form of Bessel ode is given by Bowman (1958) as the following

\begin{align*} \xi ^{\prime \prime } x^{2}+\left (1-2 \alpha \right ) x \xi ^{\prime }+\left (\beta ^{2} \gamma ^{2} x^{2 \gamma }-n^{2} \gamma ^{2}+\alpha ^{2}\right ) \xi = 0\tag {3} \end{align*}

With the standard solution

\begin{align*} \xi &=x^{\alpha } \left (c_3 \operatorname {BesselJ}\left (n , \beta \,x^{\gamma }\right )+c_4 \operatorname {BesselY}\left (n , \beta \,x^{\gamma }\right )\right )\tag {4} \end{align*}

Comparing (3) to (1) and solving for \(\alpha ,\beta ,n,\gamma \) gives

\begin{align*} \alpha &= 1\\ \beta &= 1\\ n &= -\sqrt {5}\\ \gamma &= 1 \end{align*}

Substituting all the above into (4) gives the solution as

\begin{align*} \xi = c_3 x \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 x \operatorname {BesselY}\left (-\sqrt {5}, x\right ) \end{align*}

Will add steps showing solving for IC soon.

The original ode now reduces to first order ode

\begin{align*} \xi \left (x \right ) y^{\prime }-y \xi ^{\prime }\left (x \right )+\xi \left (x \right ) p \left (x \right ) y&=\int \xi \left (x \right ) r \left (x \right )d x\\ y^{\prime }+y \left (p \left (x \right )-\frac {\xi ^{\prime }\left (x \right )}{\xi \left (x \right )}\right )&=\frac {\int \xi \left (x \right ) r \left (x \right )d x}{\xi \left (x \right )} \end{align*}

Or

\begin{align*} y^{\prime }+y \left (\frac {1}{x}-\frac {c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_3 x \left (-\operatorname {BesselJ}\left (-\sqrt {5}+1, x\right )-\frac {\sqrt {5}\, \operatorname {BesselJ}\left (-\sqrt {5}, x\right )}{x}\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )+c_4 x \left (-\operatorname {BesselY}\left (-\sqrt {5}+1, x\right )-\frac {\sqrt {5}\, \operatorname {BesselY}\left (-\sqrt {5}, x\right )}{x}\right )}{c_3 x \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 x \operatorname {BesselY}\left (-\sqrt {5}, x\right )}\right )&=0 \end{align*}

Which is now a first order ode. This is now solved for \(y\). In canonical form a linear first order is

\begin{align*} y^{\prime } + q(x)y &= p(x) \end{align*}

Comparing the above to the given ode shows that

\begin{align*} q(x) &=-\frac {-c_3 x \operatorname {BesselJ}\left (-\sqrt {5}+1, x\right )-c_4 x \operatorname {BesselY}\left (-\sqrt {5}+1, x\right )-\sqrt {5}\, \left (c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )\right )}{x \left (c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )\right )}\\ p(x) &=0 \end{align*}

The integrating factor \(\mu \) is

\begin{align*} \mu &= e^{\int {q\,dx}}\\ &= {\mathrm e}^{\int -\frac {-c_3 x \operatorname {BesselJ}\left (-\sqrt {5}+1, x\right )-c_4 x \operatorname {BesselY}\left (-\sqrt {5}+1, x\right )-\sqrt {5}\, \left (c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )\right )}{x \left (c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )\right )}d x}\\ &= \frac {1}{c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )} \end{align*}

The ode becomes

\begin{align*} \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \mu y &= 0 \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left (\frac {y}{c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )}\right ) &= 0 \end{align*}

Integrating gives

\begin{align*} \frac {y}{c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )}&= \int {0 \,dx} + c_5 \\ &=c_5 \end{align*}

Dividing throughout by the integrating factor \(\frac {1}{c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )}\) gives the final solution

\[ y = \left (c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )\right ) c_5 \]

Hence, the solution found using Lagrange adjoint equation method is

\begin{align*} y &= \left (c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right )\right ) c_5 \\ \end{align*}

The constants can be merged to give

\[ y = c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right ) \]

Will add steps showing solving for IC soon.

Summary of solutions found

\begin{align*} y &= c_3 \operatorname {BesselJ}\left (-\sqrt {5}, x\right )+c_4 \operatorname {BesselY}\left (-\sqrt {5}, x\right ) \\ \end{align*}

Maple. Time used: 0.003 (sec). Leaf size: 19
ode:=x^2*diff(diff(y(x),x),x)+x*diff(y(x),x)+(x^2-5)*y(x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = c_{1} \operatorname {BesselJ}\left (\sqrt {5}, x\right )+c_{2} \operatorname {BesselY}\left (\sqrt {5}, 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 
   <- Bessel successful 
<- special function solution successful`
 

Maple step by step

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & x^{2} \left (\frac {d^{2}}{d x^{2}}y \left (x \right )\right )+x \left (\frac {d}{d x}y \left (x \right )\right )+\left (x^{2}-5\right ) y \left (x \right )=0 \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 2 \\ {} & {} & \frac {d^{2}}{d x^{2}}y \left (x \right ) \\ \bullet & {} & \textrm {Isolate 2nd derivative}\hspace {3pt} \\ {} & {} & \frac {d^{2}}{d x^{2}}y \left (x \right )=-\frac {\left (x^{2}-5\right ) y \left (x \right )}{x^{2}}-\frac {\frac {d}{d x}y \left (x \right )}{x} \\ \bullet & {} & \textrm {Group terms with}\hspace {3pt} y \left (x \right )\hspace {3pt}\textrm {on the lhs of the ODE and the rest on the rhs of the ODE; ODE is linear}\hspace {3pt} \\ {} & {} & \frac {d^{2}}{d x^{2}}y \left (x \right )+\frac {\frac {d}{d x}y \left (x \right )}{x}+\frac {\left (x^{2}-5\right ) y \left (x \right )}{x^{2}}=0 \\ \square & {} & \textrm {Check to see if}\hspace {3pt} x_{0}=0\hspace {3pt}\textrm {is a regular singular point}\hspace {3pt} \\ {} & \circ & \textrm {Define functions}\hspace {3pt} \\ {} & {} & \left [P_{2}\left (x \right )=\frac {1}{x}, P_{3}\left (x \right )=\frac {x^{2}-5}{x^{2}}\right ] \\ {} & \circ & x \cdot P_{2}\left (x \right )\textrm {is analytic at}\hspace {3pt} x =0 \\ {} & {} & \left (x \cdot P_{2}\left (x \right )\right )\bigg | {\mstack {}{_{x \hiderel {=}0}}}=1 \\ {} & \circ & x^{2}\cdot P_{3}\left (x \right )\textrm {is analytic at}\hspace {3pt} x =0 \\ {} & {} & \left (x^{2}\cdot P_{3}\left (x \right )\right )\bigg | {\mstack {}{_{x \hiderel {=}0}}}=-5 \\ {} & \circ & x =0\textrm {is a regular singular point}\hspace {3pt} \\ & {} & \textrm {Check to see if}\hspace {3pt} x_{0}=0\hspace {3pt}\textrm {is a regular singular point}\hspace {3pt} \\ {} & {} & x_{0}=0 \\ \bullet & {} & \textrm {Multiply by denominators}\hspace {3pt} \\ {} & {} & x^{2} \left (\frac {d^{2}}{d x^{2}}y \left (x \right )\right )+x \left (\frac {d}{d x}y \left (x \right )\right )+\left (x^{2}-5\right ) y \left (x \right )=0 \\ \bullet & {} & \textrm {Assume series solution for}\hspace {3pt} y \left (x \right ) \\ {} & {} & y \left (x \right )=\moverset {\infty }{\munderset {k =0}{\sum }}a_{k} x^{k +r} \\ \square & {} & \textrm {Rewrite ODE with series expansions}\hspace {3pt} \\ {} & \circ & \textrm {Convert}\hspace {3pt} x^{m}\cdot y \left (x \right )\hspace {3pt}\textrm {to series expansion for}\hspace {3pt} m =0..2 \\ {} & {} & x^{m}\cdot y \left (x \right )=\moverset {\infty }{\munderset {k =0}{\sum }}a_{k} x^{k +r +m} \\ {} & \circ & \textrm {Shift index using}\hspace {3pt} k \mathrm {->}k -m \\ {} & {} & x^{m}\cdot y \left (x \right )=\moverset {\infty }{\munderset {k =m}{\sum }}a_{k -m} x^{k +r} \\ {} & \circ & \textrm {Convert}\hspace {3pt} x \cdot \left (\frac {d}{d x}y \left (x \right )\right )\hspace {3pt}\textrm {to series expansion}\hspace {3pt} \\ {} & {} & x \cdot \left (\frac {d}{d x}y \left (x \right )\right )=\moverset {\infty }{\munderset {k =0}{\sum }}a_{k} \left (k +r \right ) x^{k +r} \\ {} & \circ & \textrm {Convert}\hspace {3pt} x^{2}\cdot \left (\frac {d^{2}}{d x^{2}}y \left (x \right )\right )\hspace {3pt}\textrm {to series expansion}\hspace {3pt} \\ {} & {} & x^{2}\cdot \left (\frac {d^{2}}{d x^{2}}y \left (x \right )\right )=\moverset {\infty }{\munderset {k =0}{\sum }}a_{k} \left (k +r \right ) \left (k +r -1\right ) x^{k +r} \\ & {} & \textrm {Rewrite ODE with series expansions}\hspace {3pt} \\ {} & {} & a_{0} \left (r^{2}-5\right ) x^{r}+a_{1} \left (r^{2}+2 r -4\right ) x^{1+r}+\left (\moverset {\infty }{\munderset {k =2}{\sum }}\left (a_{k} \left (k^{2}+2 k r +r^{2}-5\right )+a_{k -2}\right ) x^{k +r}\right )=0 \\ \bullet & {} & a_{0}\textrm {cannot be 0 by assumption, giving the indicial equation}\hspace {3pt} \\ {} & {} & r^{2}-5=0 \\ \bullet & {} & \textrm {Values of r that satisfy the indicial equation}\hspace {3pt} \\ {} & {} & r \in \left \{\sqrt {5}, -\sqrt {5}\right \} \\ \bullet & {} & \textrm {Each term must be 0}\hspace {3pt} \\ {} & {} & a_{1} \left (r^{2}+2 r -4\right )=0 \\ \bullet & {} & \textrm {Solve for the dependent coefficient(s)}\hspace {3pt} \\ {} & {} & a_{1}=0 \\ \bullet & {} & \textrm {Each term in the series must be 0, giving the recursion relation}\hspace {3pt} \\ {} & {} & a_{k} \left (k^{2}+2 k r +r^{2}-5\right )+a_{k -2}=0 \\ \bullet & {} & \textrm {Shift index using}\hspace {3pt} k \mathrm {->}k +2 \\ {} & {} & a_{k +2} \left (\left (k +2\right )^{2}+2 \left (k +2\right ) r +r^{2}-5\right )+a_{k}=0 \\ \bullet & {} & \textrm {Recursion relation that defines series solution to ODE}\hspace {3pt} \\ {} & {} & a_{k +2}=-\frac {a_{k}}{k^{2}+2 k r +r^{2}+4 k +4 r -1} \\ \bullet & {} & \textrm {Recursion relation for}\hspace {3pt} r =\sqrt {5} \\ {} & {} & a_{k +2}=-\frac {a_{k}}{k^{2}+2 k \sqrt {5}+4+4 k +4 \sqrt {5}} \\ \bullet & {} & \textrm {Solution for}\hspace {3pt} r =\sqrt {5} \\ {} & {} & \left [y \left (x \right )=\moverset {\infty }{\munderset {k =0}{\sum }}a_{k} x^{k +\sqrt {5}}, a_{k +2}=-\frac {a_{k}}{k^{2}+2 k \sqrt {5}+4+4 k +4 \sqrt {5}}, a_{1}=0\right ] \\ \bullet & {} & \textrm {Recursion relation for}\hspace {3pt} r =-\sqrt {5} \\ {} & {} & a_{k +2}=-\frac {a_{k}}{k^{2}-2 k \sqrt {5}+4+4 k -4 \sqrt {5}} \\ \bullet & {} & \textrm {Solution for}\hspace {3pt} r =-\sqrt {5} \\ {} & {} & \left [y \left (x \right )=\moverset {\infty }{\munderset {k =0}{\sum }}a_{k} x^{k -\sqrt {5}}, a_{k +2}=-\frac {a_{k}}{k^{2}-2 k \sqrt {5}+4+4 k -4 \sqrt {5}}, a_{1}=0\right ] \\ \bullet & {} & \textrm {Combine solutions and rename parameters}\hspace {3pt} \\ {} & {} & \left [y \left (x \right )=\left (\moverset {\infty }{\munderset {k =0}{\sum }}a_{k} x^{k +\sqrt {5}}\right )+\left (\moverset {\infty }{\munderset {k =0}{\sum }}b_{k} x^{k -\sqrt {5}}\right ), a_{k +2}=-\frac {a_{k}}{k^{2}+2 k \sqrt {5}+4+4 k +4 \sqrt {5}}, a_{1}=0, b_{k +2}=-\frac {b_{k}}{k^{2}-2 k \sqrt {5}+4+4 k -4 \sqrt {5}}, b_{1}=0\right ] \end {array} \]
Mathematica. Time used: 0.079 (sec). Leaf size: 26
ode=x^2*D[y[x],{x,2}]+x*D[y[x],x]+(x^2-5)*y[x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to c_1 \operatorname {BesselJ}\left (\sqrt {5},x\right )+c_2 \operatorname {BesselY}\left (\sqrt {5},x\right ) \]
Sympy. Time used: 0.199 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2*Derivative(y(x), (x, 2)) + x*Derivative(y(x), x) + (x**2 - 5)*y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} J_{\sqrt {5}}\left (x\right ) + C_{2} Y_{\sqrt {5}}\left (x\right ) \]