2.1101   ODE No. 1101

  1. Problem in Latex
  2. Mathematica input
  3. Maple input

\[ a x y(x)+x y''(x)+2 y'(x)=0 \] Mathematica : cpu = 0.0278023 (sec), leaf count = 51

\[\left \{\left \{y(x)\to \frac {c_1 e^{-\sqrt {-a} x}}{x}+\frac {c_2 e^{\sqrt {-a} x}}{2 \sqrt {-a} x}\right \}\right \}\]

Maple : cpu = 0.033 (sec), leaf count = 31

\[ \left \{ y \left ( x \right ) ={\frac {{\it \_C1}}{x}\sinh \left ( \sqrt {-a}x \right ) }+{\frac {{\it \_C2}}{x}\cosh \left ( \sqrt {-a}x \right ) } \right \} \]

Hand solution

\begin {equation} xy^{\prime \prime }+2y^{\prime }+axy=0 \tag {1} \end {equation}

First method much shorter, using transformation suggested by Kamke. Let \(y=\frac {u\left ( x\right ) }{x}\), hence

\begin {align*} y^{\prime } & =\frac {u^{\prime }}{x}-\frac {u}{x^{2}}\\ y^{\prime \prime } & =\frac {u^{\prime \prime }}{x}-\frac {u^{\prime }}{x^{2}}-\frac {u^{\prime }}{x^{2}}+2\frac {u}{x^{3}} \end {align*}

And (1) becomes

\begin {align*} x\left ( \frac {u^{\prime \prime }}{x}-\frac {u^{\prime }}{x^{2}}-\frac {u^{\prime }}{x^{2}}+2\frac {u}{x^{3}}\right ) +2\left ( \frac {u^{\prime }}{x}-\frac {u}{x^{2}}\right ) +ax\left ( \frac {u}{x}\right ) & =0\\ u^{\prime \prime }-2\frac {u^{\prime }}{x}+2\frac {u}{x^{2}}+\frac {2u^{\prime }}{x}-\frac {2u}{x^{2}}+au & =0\\ u^{\prime \prime }+au & =0 \end {align*}

Hence the roots of the characteristic equation are \(\pm \sqrt {-a}\) and the solution is

\[ u=A\cos \left ( \sqrt {a}x\right ) +B\sin \left ( \sqrt {a}x\right ) \]

Hence

\[ y=\frac {1}{x}\left ( A\cos \left ( \sqrt {a}x\right ) +B\sin \left ( \sqrt {a}x\right ) \right ) \]

Second method Using series method.

There is singularity at \(x=0\). We need to check if it regular or not. Writing in standard form \(y^{\prime \prime }+p\left ( x\right ) y^{\prime }+q\left ( x\right ) y=0\) gives (we are looking at the homogeneous part now only)\[ y^{\prime \prime }+\frac {2}{x}y^{\prime }+ay=0 \]

Hence \(\lim _{x\rightarrow 0}xp\left ( x\right ) =\lim _{x\rightarrow 0}x\frac {2}{x}=2\) which is analytic at \(x=0\). And \(\lim _{x\rightarrow 0}x^{2}q\left ( x\right ) =\lim _{x\rightarrow 0}-ax^{2}=0\) which is analytic. Hence the singularity is regular (removable). Using Frobenius series, assume that \[ y=\sum _{n=-\infty }^{\infty }c_{n}x^{n+r}\] Where \(c_{n}=0\) for \(n<0\). Hence\begin {align*} y^{\prime } & =\sum \left ( n+r\right ) c_{n}x^{n+r-1}\\ y^{\prime \prime } & =\sum \left ( n+r\right ) \left ( n+r-1\right ) c_{n}x^{n+r-2} \end {align*}

Substituting back in the original ODE gives\[ \sum \left ( n+r\right ) \left ( n+r-1\right ) c_{n}x^{n+r-1}+\sum 2\left ( n+r\right ) c_{n}x^{n+r-1}+\sum ac_{n}x^{n+r+1}=0 \] Adjusting so that all have same power \(x^{n+r}\) gives\[ \sum \left ( n+r+1\right ) \left ( n+r\right ) c_{n+1}x^{n+r}+\sum 2\left ( n+r+1\right ) c_{n+1}x^{n+r}+\sum ac_{n-1}x^{n+r}=0 \] Hence\begin {align} \left ( n+r+1\right ) \left ( n+r\right ) c_{n+1}+2\left ( n+r+1\right ) c_{n+1}+ac_{n-1} & =0\nonumber \\ \left ( n+r+1\right ) \left ( 2+\left ( n+r\right ) \right ) c_{n+1}+ac_{n-1} & =0\tag {2} \end {align}

We want equation with \(c_{0}\) in it. Hence let \(n=-1\)\[ \left ( -1+r+1\right ) \left ( 2+\left ( -1+r\right ) \right ) c_{0}+ac_{-2}=0 \] But \(c_{n}=0\) for all \(n<0\) hence\[ \left ( -1+r+1\right ) \left ( 2+\left ( -1+r\right ) \right ) c_{0}=0 \] But \(c_{0}\neq 0\), as this is the basis for this method. Therefore, we obtain the indicial equation for \(r\)\begin {align*} \left ( -1+r+1\right ) \left ( 2+\left ( -1+r\right ) \right ) & =0\\ r\left ( r+1\right ) & =0 \end {align*}

Hence \(r=0\) or \(r=-1\) are the roots. Now for each \(r\) we find a solution. Using \(r=0\), we go back the recurrence equation (2)\begin {align*} \left ( n+1\right ) \left ( 2+n\right ) c_{n+1}+ac_{n-1} & =0\\ c_{n+1} & =\frac {-ac_{n-1}}{\left ( n+1\right ) \left ( 2+n\right ) } \end {align*}

For \(n=0\)\[ c_{1}=\frac {-ac_{-1}}{\left ( n+1\right ) \left ( 2+n\right ) }=0 \] For \(n=1\)\[ c_{2}=\frac {-ac_{0}}{\left ( 2\right ) \left ( 3\right ) }\] For \(n=2\)\[ c_{3}=\frac {-ac_{1}}{\left ( n+1\right ) \left ( 2+n\right ) }=0 \] For \(n=3\)\[ c_{4}=\frac {-ac_{2}}{\left ( 4\right ) \left ( 5\right ) }=\frac {-a\left ( -ac_{0}\right ) }{\left ( 2\right ) \left ( 3\right ) \left ( 4\right ) \left ( 5\right ) }=\frac {a^{2}c_{0}}{\left ( 2\right ) \left ( 3\right ) \left ( 4\right ) \left ( 5\right ) }\] And so on. Hence, for \(r=0\) we have\begin {align} y_{r=0} & =\sum _{n=0}^{\infty }c_{n}x^{n}=c_{0}+c_{1}x^{1}+c_{2}x^{2}+c_{3}x^{3}+\cdots \nonumber \\ & =c_{0}-a\frac {c_{0}}{6}x^{2}+a^{2}\frac {c_{0}}{120}x^{4}+\cdots \nonumber \\ & =A\left ( 1-a\frac {1}{6}x^{2}+a^{2}\frac {1}{120}x^{4}+\cdots \right ) \tag {3} \end {align}

Where \(A\) is used as arbitrary constant instead of \(a_{0}\). Now we find the solution for \(r=-1.\) we go back the recurrence equation (2)\begin {align*} \left ( n-1+1\right ) \left ( 2+\left ( n-1\right ) \right ) c_{n+1}+ac_{n-1} & =0\\ n\left ( 1+n\right ) c_{n+1}+ac_{n-1} & =0\\ c_{n+1} & =\frac {-ac_{n-1}}{n\left ( 1+n\right ) } \end {align*}

For \(n=0\)\[ c_{1}=\frac {-ac_{-1}}{n\left ( 1+n\right ) }=0 \] For \(n=1\)\[ c_{2}=\frac {-ac_{0}}{2}\] For \(n=2\)\[ c_{3}=\frac {-ac_{1}}{n\left ( 1+n\right ) }=0 \] For \(n=3\)\[ c_{4}=\frac {-ac_{2}}{\left ( 3\right ) \left ( 4\right ) }=\frac {-a\left ( -ac_{0}\right ) }{\left ( 2\right ) \left ( 3\right ) \left ( 4\right ) }=\frac {a^{2}c_{0}}{\left ( 2\right ) \left ( 3\right ) \left ( 4\right ) }\] For \(n=4\)\[ c_{5}=\frac {-ac_{3}}{n\left ( 1+n\right ) }=0 \] For \(n=5\)\[ c_{6}=\frac {-ac_{4}}{\left ( 5\right ) \left ( 6\right ) }=\frac {-a\left ( a^{2}c_{0}\right ) }{\left ( 2\right ) \left ( 3\right ) \left ( 4\right ) \left ( 5\right ) \left ( 6\right ) }=\frac {-a^{3}c_{0}}{\left ( 2\right ) \left ( 3\right ) \left ( 4\right ) \left ( 5\right ) \left ( 6\right ) }\] And so on. Hence solution is\begin {align*} y_{r=-1} & =\frac {1}{x}\sum _{n=0}^{\infty }c_{n}x^{n}=\frac {1}{x}\left ( c_{0}-\frac {ac_{0}}{2}x^{2}+\frac {a^{2}c_{0}}{\left ( 2\right ) \left ( 3\right ) \left ( 4\right ) }x^{4}-\frac {a^{3}c_{0}}{\left ( 2\right ) \left ( 3\right ) \left ( 4\right ) \left ( 5\right ) \left ( 6\right ) }x^{6}+\cdots \right ) \\ & =\frac {B}{x}\left ( 1-\frac {a}{2}x^{2}+\frac {a^{2}}{24}x^{4}-\frac {a^{3}}{720}x^{6}+\cdots \right ) \end {align*}

Where \(B\) is used as arbitrary constant instead of \(a_{0}\). Therefore, the homogeneous solution found is\begin {align*} y_{h} & =y_{r=0}+y_{r=-1}\\ & =A\left ( 1-a\frac {1}{6}x^{2}+a^{2}\frac {1}{120}x^{4}+\cdots \right ) +\frac {B}{x}\left ( 1-\frac {a}{2}x^{2}+\frac {a^{2}}{24}x^{4}-\frac {a^{3}}{720}x^{6}+\cdots \right ) \\ & =A\left ( 1-\frac {1}{6}\left ( \sqrt {a}x\right ) ^{2}+\frac {1}{120}\left ( \sqrt {a}x\right ) ^{4}+\cdots \right ) +\frac {B}{x}\left ( 1-\frac {1}{2}\left ( \sqrt {a}x\right ) ^{2}+\frac {1}{24}\left ( \sqrt {a}x\right ) ^{4}-\frac {1}{720}\left ( \sqrt {a}x\right ) ^{6}+\cdots \right ) \end {align*}

But \begin {equation} \sin x=x-\frac {1}{6}x^{3}+\frac {1}{120}x^{5}-\cdots \tag {3} \end {equation} And \begin {equation} \cos x=1-\frac {1}{2}x^{2}+\frac {1}{24}x^{4}-\frac {1}{720}x^{6}+\cdots \tag {4} \end {equation} Therefore\begin {align*} \sin \left ( \sqrt {a}x\right ) & =\sqrt {a}x-\frac {1}{6}\left ( \sqrt {a}x\right ) ^{3}+\frac {1}{120}\left ( \sqrt {a}x\right ) ^{5}-\cdots \\ \cos \left ( \sqrt {a}x\right ) & =1-\frac {1}{2}\left ( \sqrt {a}x\right ) ^{2}+\frac {1}{24}\left ( \sqrt {a}x\right ) ^{4}-\frac {1}{720}\left ( \sqrt {a}x\right ) ^{6}+\cdots \end {align*}

Therefore, using the above, we can write \(y_{h}\) as\begin {align*} y_{h} & =\frac {A}{\sqrt {a}x}\sqrt {a}x\left ( 1-\frac {1}{6}\left ( \sqrt {a}x\right ) ^{2}+\frac {1}{120}\left ( \sqrt {a}x\right ) ^{4}+\cdots \right ) +\frac {B}{x}\cos \left ( \sqrt {a}x\right ) \\ & =\frac {A}{\sqrt {a}x}\left ( \sqrt {a}x-\frac {1}{6}\left ( \sqrt {a}x\right ) ^{3}+\frac {1}{120}\left ( \sqrt {a}x\right ) ^{5}+\cdots \right ) +\frac {B}{x}\cos \left ( \sqrt {a}x\right ) \\ & =\frac {A}{\sqrt {a}x}\sin \left ( \sqrt {a}x\right ) +\frac {B}{x}\cos \left ( \sqrt {a}x\right ) \end {align*}

Let \(A_{0}=\frac {A}{\sqrt {a}}\), hence the above becomes the same solution found using the transformation method\[ y\left ( x\right ) =\frac {1}{x}\left ( A_{0}\sin \left ( \sqrt {a}x\right ) +B\cos \left ( \sqrt {a}x\right ) \right ) \]

Clearly, the transformation method is much faster and better. But the trick is to see the correct transformation needed and this is not always easy.

Third method Using Laplace transform. Using property \(\mathcal {L}xf\left ( x\right ) =-\frac {d}{ds}F\left ( s\right ) \) then the Laplace transform of the ODE becomes\begin {align*} \mathcal {L}\left ( xy^{\prime \prime }+2y^{\prime }+axy\right ) & =0\\ -\frac {d}{ds}\left ( \mathcal {L}y^{\prime \prime }\right ) +2\left ( -\frac {d}{ds}\left ( \mathcal {L}y^{\prime }\right ) \right ) +a\left ( -\frac {d}{ds}Y\right ) & =0\\ -\frac {d}{ds}\left ( s^{2}Y-sA-B\right ) +2\left ( -\frac {d}{ds}\left ( sY-A\right ) \right ) +a\left ( -Y^{\prime }\right ) & =0 \end {align*}

Where \(A=y\left ( 0\right ) ,B=y^{\prime }\left ( 0\right ) \). Simplifying gives\begin {align*} -\left ( 2sY+s^{2}Y^{\prime }-A\right ) -2\left ( Y+sY^{\prime }\right ) -aY^{\prime } & =0\\ Y^{\prime }\left ( -s^{2}-2s-a\right ) +Y\left ( -2s-2\right ) +A & =0\\ Y^{\prime }+Y\frac {2s+2}{s^{2}+2s+a} & =\frac {A}{s^{2}+2s+a} \end {align*}

This is first order ODE, which is solved easily using an integrating factor. Solving for \(Y\left ( s\right ) \) gives\[ Y\left ( s\right ) =\frac {As+c_{1}}{s^{2}+a+2s}\] Where \(c_{1}\) is constant of integration. The inverse Laplace of the above is\[ y\left ( x\right ) =e^{-x}\left ( A\cos \left ( x\sqrt {1-a}\right ) +\frac {\left ( -A+c_{1}\right ) }{\sqrt {1-a}}\sinh \left ( x\sqrt {1-a}\right ) \right ) \]

I need to find why the above does not verify.  May be I made a mistake somewhere. Verification of the result of the first two methods is below.

restart; 
ode:=x*diff(diff(y(x),x),x)+2*diff(y(x),x)+a*x*y(x)=0; 
y0:=1/x*( _C1* cos(sqrt(a)*x)+ _C2*sin(sqrt(a)*x)); 
odetest(y(x)=y0,ode); 
0