2.4.1.7 Example 7. \(xy^{\prime \prime }-2y^{\prime }+y=\cos x\)
\begin{equation} xy^{\prime \prime }-2y^{\prime }+y=\cos x \tag {1}\end{equation}
Let solution be \(y=y_{h}+y_{p}\). We always start by finding \(y_{h}\) then find \(y_{p}\) using balance method. \(x=0\) is regular singular point. Hence Frobenius series gives
\[ y\left ( x\right ) =\sum _{n=0}^{\infty }a_{n}x^{n+r}\]
Where \(r\) is to be determined. It is the root of the indicial equation. Therefore
\begin{align*} y^{\prime }\left ( x\right ) & =\sum _{n=0}^{\infty }\left ( n+r\right ) a_{n}x^{n+r-1}\\ y^{\prime \prime }\left ( x\right ) & =\sum _{n=0}^{\infty }\left ( n+r\right ) \left ( n+r-1\right ) a_{n}x^{n+r-2}\end{align*}
Substituting the above in (1) gives
\begin{align} x\sum _{n=0}^{\infty }\left ( n+r\right ) \left ( n+r-1\right ) a_{n}x^{n+r-2}-2\sum _{n=0}^{\infty }\left ( n+r\right ) a_{n}x^{n+r-1}+\sum _{n=0}^{\infty }a_{n}x^{n+r} & =\cos x\nonumber \\ \sum _{n=0}^{\infty }\left ( n+r\right ) \left ( n+r-1\right ) a_{n}x^{n+r-1}+\sum _{n=0}^{\infty }-2\left ( n+r\right ) a_{n}x^{n+r-1}+\sum _{n=0}^{\infty }a_{n}x^{n+r} & =\cos x \tag {1A}\end{align}
Adjusting indices to all powers of \(x\) are the same gives
\begin{equation} \sum _{n=0}^{\infty }\left ( n+r\right ) \left ( n+r-1\right ) a_{n}x^{n+r-1}+\sum _{n=0}^{\infty }-2\left ( n+r\right ) a_{n}x^{n+r-1}+\sum _{n=1}^{\infty }a_{n-1}x^{n+r-1}=\cos x \tag {1B}\end{equation}
The indicial equation is found from only the terms with the expansion of the dependent variable \(y\). This means by making the LHS of (3) vanish. We only consider
\begin{equation} \sum _{n=0}^{\infty }\left ( n+r\right ) \left ( n+r-1\right ) a_{n}x^{n+r-1}+\sum _{n=0}^{\infty }-2\left ( n+r\right ) a_{n}x^{n+r-1}+\sum _{n=1}^{\infty }a_{n-1}x^{n+r-1}=0 \tag {1C}\end{equation}
For \(n=0\)
\begin{align*} \left ( r\right ) \left ( r-1\right ) a_{0}x^{r-1}-2ra_{0}x^{r-1} & =0\\ \left ( r\left ( r-1\right ) -2r\right ) a_{0} & =0 \end{align*}
Since \(a_{0}\neq 0\) then the above gives
\begin{align*} r\left ( r-1\right ) -2r & =0\\ r^{2}-3r & =0\\ r\left ( r-3\right ) & =0 \end{align*}
Hence roots are \(r_{1}=3,r_{2}=0\). Since the difference is integer, the two basis solution for \(y_{h}\) are
\begin{align*} y_{1} & =x^{r_{1}}\sum _{n=0}^{\infty }a_{n}x^{n}\\ & =\sum _{n=0}^{\infty }a_{n}x^{n+3}\\ y_{2} & =C_{1}y_{1}\ln x+x^{r_{2}}\sum _{n=0}^{\infty }b_{n}x^{n}\\ & =C_{1}y_{1}\ln x+\sum _{n=0}^{\infty }b_{n}x^{n}\end{align*}
To find \(y_{1},\) we can find the recursive equation to be for \(n>0\). From (1C) and for \(n>0\)
\begin{align*} \left ( n+r\right ) \left ( n+r-1\right ) a_{n}x^{n+r-1}-2\left ( n+r\right ) a_{n}x^{n+r-1}+a_{n-1}x^{n+r-1} & =0\\ \left ( n+r\right ) \left ( n+r-1\right ) a_{n}-2\left ( n+r\right ) a_{n}+a_{n-1} & =0 \end{align*}
But for \(r=3\) the above becomes
\begin{align*} \left ( n+3\right ) \left ( n+2\right ) a_{n}-2\left ( n+3\right ) a_{n}+a_{n-1} & =0\\ a_{n} & =-\frac {a_{n-1}}{\left ( n+3\right ) \left ( n+2\right ) -2\left ( n+3\right ) }\\ & =\frac {a_{n-1}}{n\left ( n+3\right ) }\end{align*}
Iterating over few values of \(n\) gives this table (where we always use \(a_{0}=1\) by default)
| | |
| \(n\) |
\(a_{n}\left ( r\right ) \) |
\(a_{n}\left ( r_{1}=3\right ) \) |
| | |
| \(a_{0}\) |
\(1\) |
\(1\) |
| | |
| \(a_{1}\) |
\(-\frac {1}{r^{2}-r-2}\) |
\(-\frac {1}{4}\) |
| | |
| \(a_{2}\) |
\(\frac {1}{r^{4}-5r^{2}+4}\) | \(\frac {1}{40}\) |
| | |
| \(a_{3}\) | \(-\frac {1}{\left ( r^{4}-5r^{2}+4\right ) r\left ( r+3\right ) }\) | \(\frac {-1}{720}\) |
| | |
| \(a_{4}\) |
\(-\frac {1}{\left ( r^{4}-5r^{2}+4\right ) r\left ( r+3\right ) \left ( r^{2}+5r+4\right ) }\) |
\(\frac {1}{20160}\) |
| | |
Hence
\begin{align*} y_{1} & =\sum _{n=0}^{\infty }a_{n}x^{n+r_{1}}\\ & =\sum _{n=0}^{\infty }a_{n}x^{n+3}\\ & =x^{3}\sum _{n=0}^{\infty }a_{n}x^{n}\\ & =x^{3}\left ( a_{0}-a_{1}x+a_{2}x^{2}+a_{3}x^{3}+\cdots \right ) \\ & =x^{3}\left ( 1-\frac {x}{4}+\frac {1}{40}x^{2}-\frac {1}{720}x^{3}+\frac {1}{20160}x^{4}+\cdots \right ) \end{align*}
Finding \(y_{2}=Cy_{1}\ln x+\sum _{n=0}^{\infty }b_{n}x^{n}\) is a little more involved because we need to determine \(C\) first. This decided if \(\ln \) term is needed or not. Let \(r_{1}-r_{2}=N\,\) where we always use \(r_{1}\) as the larger root. Hence \(N=3-0=3.\) To find if \(C\) is zero or not, we take \(\lim _{r\rightarrow r_{2}}a_{3}\). If this limit exists then \(C=0\) else we need to keep \(\ln \) and \(C\neq 0\). From the table above, we see \(a_{3}=-\frac {1}{\left ( r^{4}-5r^{2}+4\right ) r\left ( r+3\right ) }\). Since \(r_{2}=0\) (the smaller root), then \(\lim _{r\rightarrow 0}a_{3}\) is not defined. Hence we need to keep the \(\ln \) term. This means
\begin{align*} y_{2} & =Cy_{1}\ln x+\sum _{n=0}^{\infty }b_{n}x^{n}\\ y_{2}^{\prime } & =Cy_{1}^{\prime }\ln x+\frac {Cy_{1}}{x}+\sum _{n=0}^{\infty }nb_{n}x^{n-1}\\ y_{2}^{\prime \prime } & =Cy_{1}^{\prime \prime }\ln x+\frac {Cy_{1}^{\prime }}{x}+\frac {Cy_{1}^{\prime }}{x}-\frac {Cy_{1}}{x^{2}}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-2}\\ & =Cy_{1}^{\prime \prime }\ln x+\frac {2Cy_{1}^{\prime }}{x}-\frac {Cy_{1}}{x^{2}}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-2}\end{align*}
Substituting the above into the given ode (with zero on RHS) \(xy^{\prime \prime }-2y^{\prime }+y=0\) gives
\begin{align*} x\left ( Cy_{1}^{\prime \prime }\ln x+\frac {2Cy_{1}^{\prime }}{x}-\frac {Cy_{1}}{x^{2}}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-2}\right ) -2\left ( Cy_{1}^{\prime }\ln x+\frac {Cy_{1}}{x}+\sum _{n=0}^{\infty }nb_{n}x^{n-1}\right ) +Cy_{1}\ln x+\sum _{n=0}^{\infty }b_{n}x^{n} & =0\\ xCy_{1}^{\prime \prime }\ln x+2Cy_{1}^{\prime }-\frac {Cy_{1}}{x}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-1}-2Cy_{1}^{\prime }\ln x-2\frac {Cy_{1}}{x}+\sum _{n=0}^{\infty }-2nb_{n}x^{n-1}+Cy_{1}\ln x+\sum _{n=0}^{\infty }b_{n}x^{n} & =0\\ C\ln x\left ( xy_{1}^{\prime \prime }-2y_{1}^{\prime }+y_{1}\right ) +2Cy_{1}^{\prime }-\frac {Cy_{1}}{x}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-1}-2\frac {Cy_{1}}{x}+\sum _{n=0}^{\infty }-2nb_{n}x^{n-1}+\sum _{n=0}^{\infty }b_{n}x^{n} & =0 \end{align*}
But \(xy_{1}^{\prime \prime }-2y_{1}^{\prime }+y_{1}=0\) since \(y_{1}\) is solution. The above simplifies to
\[ 2Cy_{1}^{\prime }-\frac {Cy_{1}}{x}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-1}-2\frac {Cy_{1}}{x}+\sum _{n=0}^{\infty }-2nb_{n}x^{n-1}+\sum _{n=0}^{\infty }b_{n}x^{n}=0 \]
But \(y_{1}=\sum _{n=0}^{\infty }a_{n}x^{n+3}\). Hence \(y_{1}^{\prime }=\sum _{n=0}^{\infty }\left ( n+3\right ) a_{n}x^{n+2}\) and the above now becomes
\begin{align*} 2C\sum _{n=0}^{\infty }\left ( n+3\right ) a_{n}x^{n+2}-\frac {C}{x}\sum _{n=0}^{\infty }a_{n}x^{n+3}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-1}-2\frac {C}{x}\sum _{n=0}^{\infty }a_{n}x^{n+3}+\sum _{n=0}^{\infty }-2nb_{n}x^{n-1}+\sum _{n=0}^{\infty }b_{n}x^{n} & =0\\ 2C\sum _{n=0}^{\infty }\left ( n+3\right ) a_{n}x^{n+2}-C\sum _{n=0}^{\infty }a_{n}x^{n+2}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-1}-2C\sum _{n=0}^{\infty }a_{n}x^{n+2}+\sum _{n=0}^{\infty }-2nb_{n}x^{n-1}+\sum _{n=0}^{\infty }b_{n}x^{n} & =0\\ \sum _{n=0}^{\infty }2C\left ( n+3\right ) a_{n}x^{n+2}+\sum _{n=0}^{\infty }-3Ca_{n}x^{n+2}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-1}+\sum _{n=0}^{\infty }-2nb_{n}x^{n-1}+\sum _{n=0}^{\infty }b_{n}x^{n} & =0 \end{align*}
Making all sums the same with powers on \(x\) being \(n-1\) gives
\begin{equation} \sum _{n=3}^{\infty }2Cna_{n-3}x^{n-1}+\sum _{n=3}^{\infty }-3Ca_{n-3}x^{n-1}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-1}+\sum _{n=0}^{\infty }-2nb_{n}x^{n-1}+\sum _{n=1}^{\infty }b_{n-1}x^{n-1}=0 \tag {2}\end{equation}
For \(n=0\) we choose \(b_{0}=1\) as we did for \(a_{0}\). For \(n=1\) the above gives
\begin{align*} -2b_{1}+b_{0} & =0\\ -2b_{1}+b_{0} & =0\\ b_{1} & =\frac {b_{0}}{2}\\ & =\frac {1}{2}\end{align*}
For \(n=2\), EQ. (2) gives
\begin{align*} 2\left ( 1\right ) b_{2}x-4b_{2}x+b_{1}x & =0\\ -2b_{2}+b_{1} & =0\\ b_{2} & =\frac {b_{1}}{2}\\ & =\frac {1}{4}\end{align*}
For \(n=3\) and since this is where \(N=3\), then this is special case. It becomes
\begin{align*} 2Cna_{n-3}-3Ca_{n-3}+n\left ( n-1\right ) b_{n}-2nb_{n}+b_{n-1} & =0\\ 6Ca_{0}-3Ca_{0}+6b_{3}-6b_{n}+b_{2} & =0\\ 3Ca_{0}+b_{2} & =0\\ C & =\frac {-b_{2}}{3a_{0}}\\ & =-\frac {\frac {1}{4}}{3}\\ & =-\frac {1}{12}\end{align*}
Where we used \(a_{0}=1\) in the above. Notice that for \(n=3\), \(b_{3}\) is not used since it does not show up. We are free to choose \(b_{N}=0\) or \(b_{3}=0\). Now that we found \(C\) then we update EQ. (2) and it becomes
\begin{equation} \sum _{n=3}^{\infty }-\frac {1}{6}na_{n-3}x^{n-1}+\sum _{n=3}^{\infty }\frac {1}{4}a_{n-3}x^{n-1}+\sum _{n=0}^{\infty }n\left ( n-1\right ) b_{n}x^{n-1}+\sum _{n=0}^{\infty }-2nb_{n}x^{n-1}+\sum _{n=1}^{\infty }b_{n-1}x^{n-1}=0 \tag {3}\end{equation}
The recursive relation now for \(n>3\) is
\begin{align*} -\frac {1}{6}na_{n-3}+\frac {1}{4}a_{n-3}+n\left ( n-1\right ) b_{n}-2nb_{n}+b_{n-1} & =0\\ b_{n} & =\frac {\frac {1}{6}na_{n-3}-\frac {1}{4}a_{n-3}-b_{n-1}}{n\left ( n-1\right ) -2n}\end{align*}
For \(b_{4}\) the above gives
\[ b_{4}=\frac {\frac {4}{6}a_{1}-\frac {1}{4}a_{1}-b_{3}}{4\left ( 3\right ) -8}\]
But \(a_{1}\) from the earlier table is \(-\frac {1}{4}\) and \(b_{3}=0\). Hence
\begin{align*} b_{4} & =\frac {\frac {4}{6}\left ( -\frac {1}{4}\right ) -\frac {1}{4}\left ( -\frac {1}{4}\right ) }{4\left ( 3\right ) -8}\\ & =-\frac {5}{192}\end{align*}
And for \(n=5\) the recursion relation gives
\begin{align*} b_{5} & =\frac {\frac {1}{6}na_{n-3}-\frac {1}{4}a_{n-3}-b_{n-1}}{n\left ( n-1\right ) -2n}\\ & =\frac {\frac {5}{6}a_{2}-\frac {1}{4}a_{2}-b_{4}}{5\left ( 4\right ) -10}\end{align*}
But \(a_{2}=\frac {1}{40},b_{4}=-\frac {5}{192}\) and the above becomes
\begin{align*} b_{5} & =\frac {\frac {5}{6}\left ( \frac {1}{40}\right ) -\frac {1}{4}\left ( \frac {1}{40}\right ) +\frac {5}{192}}{10}\\ & =\frac {13}{3200}\end{align*}
And so on. Now that we found all \(b_{n}\) and found \(C\) then we know \(y_{2}\)
\begin{align*} y_{2} & =Cy_{1}\ln x+\sum _{n=0}^{\infty }b_{n}x^{n}\\ & =-\frac {1}{12}\ln \left ( x\right ) y_{1}+\left ( b_{0}+b_{1}x+b_{2}x^{2}+\cdots \right ) \\ & =-\frac {1}{12}\ln \left ( x\right ) \left ( x^{3}\left ( 1-\frac {x}{4}+\frac {1}{40}x^{2}-\frac {1}{720}x^{3}+\frac {1}{20160}x^{4}+\cdots \right ) \right ) +\left ( 1+\frac {1}{2}x+\frac {1}{4}x^{2}+0x^{3}-\frac {5}{192}x^{4}+\frac {13}{3200}x^{5}+\cdots \right ) \\ & =-\frac {1}{12}\ln \left ( x\right ) \left ( x^{3}-\frac {x^{4}}{4}+\frac {1}{40}x^{5}-\frac {1}{720}x^{6}+\frac {1}{20160}x^{6}+\cdots \right ) +\left ( 1+\frac {1}{2}x+\frac {1}{4}x^{2}-\frac {5}{192}x^{4}+\frac {13}{3200}x^{5}+\cdots \right ) \end{align*}
Hence
\[ y_{h}=c_{1}y_{1}+c_{2}y_{2}\]
Or
\begin{multline*} y_{h}=c_{1}\left ( x^{3}-\frac {x^{4}}{4}+\frac {1}{40}x^{5}-\frac {1}{720}x^{6}+\frac {1}{20160}x^{6}+\cdots \right ) \\ +c_{2}\left ( -\frac {1}{12}\ln \left ( x\right ) \left ( x^{3}-\frac {x^{4}}{4}+\frac {1}{40}x^{5}-\frac {1}{720}x^{6}+\frac {1}{20160}x^{6}+\cdots \right ) +\left ( 1+\frac {1}{2}x+\frac {1}{4}x^{2}-\frac {5}{192}x^{4}+\frac {13}{3200}x^{5}+\cdots \right ) \right ) \end{multline*}
The above was the easy part. Now we need to find the particular solution. Since right side is not a single term of a polynomial, we expand \(\cos x\) and add all the particular solutions from each term in the series expansion of \(\cos x\). Now we have
\[ xy^{\prime \prime }-2y^{\prime }+y=1-\frac {1}{2}x^{2}+\frac {1}{24}x^{4}-\cdots \]
Starting with the first term \(1\). We have
\begin{equation} xy^{\prime \prime }-2y^{\prime }+y=1 \tag {4}\end{equation}
Let the particular solution associated with \(1\) on the right side be
\[ y_{p}=\sum _{n=0}^{\infty }c_{n}x^{n+r}\]
Just be careful here, the \(r\) used above has nothing to do with the \(r\) that was used in finding \(y_{h}\). Substituting this into the ode (4) gives (1C) but with \(a_{n}\) now being \(c_{n}\)
\begin{equation} \sum _{n=0}^{\infty }\left ( n+r\right ) \left ( n+r-1\right ) c_{n}x^{n+r-1}+\sum _{n=0}^{\infty }-2\left ( n+r\right ) c_{n}x^{n+r-1}+\sum _{n=1}^{\infty }c_{n-1}x^{n+r-1}=1 \tag {5}\end{equation}
For \(n=0\)
\begin{align*} \left ( r\right ) \left ( r-1\right ) c_{0}x^{r-1}-2\left ( r\right ) c_{0}x^{r-1} & =1\\ \left ( r\left ( r-1\right ) -2r\right ) c_{0}x^{r-1} & =1 \end{align*}
For balance we must have \(r-1=0\) since there is no \(x\) on the right side. This means \(r=1\). Which implies that
\begin{align*} \left ( r\left ( r-1\right ) -2r\right ) c_{0} & =1\\ -2c_{0} & =1\\ c_{0} & =-\frac {1}{2}\end{align*}
Now that we found \(r,c_{0}\) then \(y_{p}\) becomes
\begin{align*} y_{p} & =\sum _{n=0}^{\infty }c_{n}x^{n+r}\\ & =\sum _{n=0}^{\infty }c_{n}x^{n+1}\end{align*}
And (5) becomes
\begin{equation} \sum _{n=0}^{\infty }\left ( n+1\right ) \left ( n\right ) c_{n}x^{n}+\sum _{n=0}^{\infty }-2\left ( n+1\right ) c_{n}x^{n}+\sum _{n=1}^{\infty }c_{n-1}x^{n}=1 \tag {6}\end{equation}
Recursion relation for \(n>0\) is the following. Important note here, when finding Recursion we set right side back to zero since we can no longer have a match for any \(x\). So the recursive relation is from (6) but with zero on right side.
\begin{align} \left ( n+1\right ) \left ( n\right ) c_{n}-2\left ( n+1\right ) c_{n}+c_{n-1} & =0\nonumber \\ c_{n} & =\frac {-c_{n-1}}{\left ( n+1\right ) \left ( n\right ) -2\left ( n+1\right ) } \tag {7}\end{align}
For \(n=1\) the above gives
\begin{align*} c_{1} & =\frac {-c_{0}}{2-4}\\ & =\frac {-\left ( -\frac {1}{2}\right ) }{-2}\\ & =-\frac {1}{4}\end{align*}
For \(n=2\) then (7) gives
\begin{align*} c_{2} & =\frac {-c_{1}}{\left ( 2+1\right ) \left ( 2\right ) -2\left ( 2+1\right ) }\\ & =\frac {-\frac {1}{4}}{6-6}\\ & =\infty \end{align*}
This indicates the series solution for this particular solution does not converge. When this happens we throw the white towel and give up and say that no particular solution exist. No need to try other terms in expansion of \(\cos x\). If one particular solution to any term does this, then this means the problem can not be solved using series method. Maple also fail to solve this using series method. Mathematica solves it, but using asymptotic
expansion.
Hence No solution exist.