1.2 Example 2. inhomogeneous ode example \(x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +x^{2}y\left ( x\right ) =\sin \left ( x\right ) \)

Solve

\begin{equation} x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +x^{2}y\left ( x\right ) =\sin \left ( x\right ) \tag {1}\end{equation}

This is the same example as example 1, but with non-zero on RHS. Expanding \(\sin \left ( x\right ) \) gives

\begin{equation} x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +x^{2}y\left ( x\right ) =x-\frac {1}{6}x^{3}+\frac {1}{120}x^{5}-\frac {1}{5040}x^{7}+\cdots \tag {1A}\end{equation}

The solution is

\[ y=y_{h}+y_{p}\]

Where we found \(y_{h}\) above. We just need to find \(y_{p}\) now. This is done by finding \(y_{p}\) that corresponds to each separate term on the RHS at a time. i.e. we need to find \(y_{p}\) for each of the following problems

\begin{align} x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +x^{2}y\left ( x\right ) & =x\tag {2A}\\ x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +x^{2}y\left ( x\right ) & =-\frac {1}{6}x^{3}\tag {2B}\\ x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +x^{2}y\left ( x\right ) & =\frac {1}{120}x^{5}\tag {2C}\\ & \vdots \nonumber \end{align}

Then add all the \(y_{p}\) found from each solution.  

Starting with (2A). Let \(y_{p_{1}}=\sum _{n=0}^{\infty }c_{n}x^{n+r}\). Substituting in (2A) and simplifying, we get as was done in EQ (3) in the first problem, which is the following (with now \(a_{n}\) changed to \(c_{n}\) and with the RHS not zero anymore)

\begin{equation} \sum _{n=0}^{\infty }\left ( n+r\right ) \left ( n+r-1\right ) c_{n}x^{n+r}+\sum _{n=0}^{\infty }\left ( n+r\right ) c_{n}x^{n+r}+\sum _{n=2}^{\infty }c_{n-2}x^{n+r}=x\tag {*}\end{equation}

For \(n=0\)

\begin{align*} \left ( r\right ) \left ( r-1\right ) c_{0}x^{r}+rc_{0}x^{r} & =x\\ \left ( r\left ( r-1\right ) +r\right ) c_{0}x^{r} & =x \end{align*}

Balance gives \(r=1\).  And \(\left ( r\left ( r-1\right ) +r\right ) c_{0}=1\) or \(c_{0}=1\). Since we found \(r=1\) then (*) becomes

\begin{equation} \sum _{n=0}^{\infty }n\left ( n+1\right ) c_{n}x^{n+1}+\sum _{n=0}^{\infty }\left ( n+1\right ) c_{n}x^{n+1}+\sum _{n=2}^{\infty }c_{n-2}x^{n+1}=x\tag {3}\end{equation}

Now that we used \(n=0\) to find \(r\) by matching against the RHS which is \(x\), from now on, for all \(n>0\) we will use (3) to solve for all other \(c_{n}\). From now on, we just need to solve with RHS zero, since there can be no more matches for any \(x\) on the right. For \(n=1\) then (3) gives

\begin{align*} 2c_{1}x^{2}+2c_{1}x^{2} & =0\\ 4c_{1}x^{2} & =0 \end{align*}

Hence \(c_{1}=0\). For \(n=2\) EQ (3) gives

\begin{align*} 2\left ( 3\right ) c_{3}x^{3}+3c_{3}x^{3}+c_{0}x^{3} & =0\\ x^{3}\left ( 9c_{3}+c_{0}\right ) & =0 \end{align*}

Hence \(9c_{3}+c_{0}=0\) or \(c_{3}=-\frac {1}{9}\) since we found \(c_{1}=1\). We continue this way and find that \(c_{3}=0,c_{4}=\frac {1}{225},c_{5}=0,c_{6}=-\frac {1}{11\,025}\) and so on. Hence

\begin{align*} y_{p_{1}} & =\sum _{n=0}^{\infty }c_{n}x^{n+r}\\ & =\sum _{n=0}^{\infty }c_{n}x^{n+1}\\ & =c_{0}x+c_{1}x^{2}+c_{2}x^{3}+c_{3}x^{4}+c_{4}x^{5}+c_{5}x^{6}+c_{6}x^{7}+\cdots \\ & =x-\frac {1}{9}x^{3}+\frac {1}{225}x^{5}-\frac {1}{11\,025}x^{7}+\cdots \end{align*}

Now we repeat the above for the second problem (2B)

\[ x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +x^{2}y\left ( x\right ) =-\frac {1}{6}x^{3}\]

Let \(y_{p_{2}}=\sum _{n=0}^{\infty }c_{n}x^{n+r}\). Substituting in above and simplifying, we get as was done in Eq (3) in the first problem, the following (with now \(a_{n}\) changed to \(c_{n}\) and with the RHS not zero anymore)

\begin{equation} \sum _{n=0}^{\infty }\left ( n+r\right ) \left ( n+r-1\right ) c_{n}x^{n+r}+\sum _{n=0}^{\infty }\left ( n+r\right ) c_{n}x^{n+r}+\sum _{n=2}^{\infty }c_{n-2}x^{n+r}=-\frac {1}{6}x^{3}\tag {*}\end{equation}

For \(n=0\)

\begin{align*} \left ( r\right ) \left ( r-1\right ) c_{0}x^{r}+rc_{0}x^{r} & =-\frac {1}{6}x^{3}\\ \left ( r\left ( r-1\right ) +r\right ) c_{0}x^{r} & =-\frac {1}{6}x^{3}\end{align*}

Balance gives \(r=3\) and \(\left ( r\left ( r-1\right ) +r\right ) c_{0}=-\frac {1}{6}\) or \(\left ( 6+3\right ) c_{0}=-\frac {1}{6}\) or \(c_{0}=-\frac {1}{54}\). Since we found \(r=3\) then (*) becomes

\begin{equation} \sum _{n=0}^{\infty }\left ( n+3\right ) \left ( n+2\right ) c_{n}x^{n+3}+\sum _{n=0}^{\infty }\left ( n+3\right ) c_{n}x^{n+3}+\sum _{n=2}^{\infty }c_{n-2}x^{n+3}=-\frac {1}{6}x^{3}\tag {4}\end{equation}

Now that we used \(n=0\) to find \(r\) by matching against the RHS which is \(x\), from now on, for all \(n>0\) we will use (4) to solve for all other \(c_{n}\). From now on, we just need to solve with RHS zero, since there can be no more matches for any \(x^{3}\) on the right. For \(n=1\) the above gives

\begin{align*} \left ( 4\right ) \left ( 3\right ) c_{1}x^{4}+4c_{1}x^{4} & =0\\ 16c_{1}x^{4} & =0 \end{align*}

Hence \(c_{1}=0\). For \(n=2\) EQ (4) gives

\begin{align*} \left ( 5\right ) \left ( 4\right ) c_{2}x^{5}+5c_{2}x^{5}+c_{0}x^{5} & =0\\ x^{5}\left ( 25c_{2}+c_{0}\right ) & =0 \end{align*}

Hence \(25c_{2}+c_{0}=0\) or \(c_{2}=-\frac {c_{0}}{25}=-\frac {-\frac {1}{54}}{25}=\frac {1}{1350}\). For \(n=3\) then (4) gives

\[ \left ( 6\right ) \left ( 5\right ) c_{3}x^{6}+6c_{3}x^{6}+c_{1}x^{6}=0 \]

Which gives \(c_{3}=0\) since \(c_{1}=0\). For \(n=4\) then (4) gives

\begin{align*} \left ( 7\right ) \left ( 6\right ) c_{4}x^{7}+7c_{4}x^{7}+c_{2}x^{7} & =0\\ x^{7}\left ( 49c_{4}+c_{2}\right ) & =0 \end{align*}

Hence \(49c_{4}+c_{2}=0\) or \(c_{4}=-\frac {c_{2}}{49}=-\frac {\frac {1}{1350}}{49}=-\frac {1}{66\,150}\). We continue this way. Hence

\begin{align*} y_{p_{2}} & =\sum _{n=0}^{\infty }c_{n}x^{n+r}\\ & =\sum _{n=0}^{\infty }c_{n}x^{n+3}\\ & =c_{0}x^{3}+c_{1}x^{4}+c_{2}x^{5}+c_{3}x^{6}+c_{4}x^{7}+\cdots \\ & =-\frac {1}{54}x^{3}+\frac {1}{1350}x^{5}-\frac {1}{66\,150}x^{7}+\cdots \end{align*}

Now we repeat the above for the next problem (2C)

\[ x^{2}y^{\prime \prime }\left ( x\right ) +xy^{\prime }\left ( x\right ) +x^{2}y\left ( x\right ) =\frac {1}{120}x^{5}\]

And if we carry the same steps as above we will find that

\begin{align*} y_{p_{3}} & =\sum _{n=0}^{\infty }c_{n}x^{n+r}\\ & =\sum _{n=0}^{\infty }c_{n}x^{n+5}\\ & =c_{0}x^{5}+c_{1}x^{6}+c_{2}x^{7}+c_{3}x^{8}+c_{4}x^{9}+\cdots \\ & =\frac {1}{3000}x^{5}-\frac {1}{147\,000}x^{7}+\frac {1}{11\,907\,000}x^{9}+\cdots \end{align*}

We keep doing this for as many terms as we have on the right side. At the end, all \(y_{p_{i}}\) are added. This gives the final \(y_{p}\)

\begin{align*} y_{p} & =y_{p_{1}}+y_{p2}+y_{p3}+\cdots \\ & =x-\frac {1}{9}x^{3}+\frac {1}{225}x^{5}-\frac {1}{11\,025}x^{7}+\cdots \\ & -\frac {1}{54}x^{3}+\frac {1}{1350}x^{5}-\frac {1}{66\,150}x^{7}+\cdots \\ & +\frac {1}{3000}x^{5}-\frac {1}{147\,000}x^{7}+\frac {1}{11\,907\,000}x^{9}+\cdots \\ & -\frac {1}{246960}x^{7}+\frac {1}{20003760}x^{9}+\cdots \end{align*}

Which results in

\begin{align*} y_{p} & =x+x^{3}\left ( -\frac {1}{9}-\frac {1}{54}\right ) +x^{5}\left ( \frac {1}{225}+\frac {1}{1350}+\frac {1}{3000}\right ) +x^{7}\left ( -\frac {1}{11\,025}-\frac {1}{66\,150}-\frac {1}{147\,000}-\frac {1}{246960}\right ) +\cdots \\ & =x+x^{3}\left ( -\frac {7}{54}\right ) +x^{5}\left ( \frac {149}{27\,000}\right ) +x^{7}\left ( -\frac {2161}{18\,522\,000}\right ) +\cdots \end{align*}

Hence the solution is

\[ y=y_{h}+y_{p}\]

Using \(y_{h}\) from the above problem gives the total solution as

\begin{align*} y & =c_{1}\left ( 1-\frac {1}{4}x^{2}+\frac {1}{64}x^{4}-\frac {1}{2304}x^{6}+O\left ( x^{8}\right ) \right ) \\ & +c_{2}\left ( \left ( 1-\frac {1}{4}x^{2}+\frac {1}{64}x^{4}-\frac {1}{2304}x^{6}+O\left ( x^{8}\right ) \right ) \ln \left ( x\right ) +\left ( \frac {1}{4}x^{2}-\frac {3}{128}x^{4}+\frac {11}{13824}x^{6}+O\left ( x^{8}\right ) \right ) \right ) \\ & +\left ( x-\frac {7}{54}x^{3}+\frac {149}{27000}x^{5}-\frac {2161}{18522000}x^{7}+\cdots \right ) \end{align*}