6.6 Example 6. \(xy^{\prime }+y=x+x^{3}+2x^{4}\)

\begin{equation} xy^{\prime }+y=x+x^{3}+2x^{4}\tag {1}\end{equation}

This is same as example 1, but with nonzero on RHS. The solution is \(y=y_{h}+y_{p}\). Where \(y_{h}\) was found above as

\[ y_{h}=\frac {a_{0}}{x}\]

To find \(y_{p}\) we assume it has power series

\[ y_{p}=\sum _{n=0}^{\infty }c_{n}x^{n+r}\]

Substituting the above into the ode and simplifying as we did in first example gives EQ. (3) in the first example, but now with \(\sin x\) on RHS

\[ \sum _{n=0}^{\infty }\left ( n+r\right ) c_{n}x^{n+r}+\sum _{n=0}^{\infty }c_{n}x^{n+r}=x+x^{3}+2x^{4}\]

We have to find \(y_{p}\) for each term at a time. Starting with \(x\)

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

For \(n=0\) the above becomes

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

Balance gives \(r=1\) and \(\left ( r+1\right ) c_{0}=1\) or \(c_{0}=\frac {1}{2}\). Hence (3A) becomes

\begin{equation} \sum _{n=0}^{\infty }\left ( n+1\right ) c_{n}x^{n+1}+\sum _{n=0}^{\infty }c_{n}x^{n+1}=x\tag {3B}\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 (3B) 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. Hence (3B) becomes for \(n>0\)

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

We see that for all \(n>0\) then \(\left ( n+2\right ) c_{n}=0\) or \(c_{n}=0\) for all \(n>0\). Hence \(y_{p_{1}}\) that corresponds to \(x\) is

\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\\ & =\frac {1}{2}x \end{align*}

Now we repeat the above for the second term \(x^{3}\). Starting with (3A) again

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

For \(n=0\)

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

Hence \(r=3\) and \(\left ( r+1\right ) c_{0}=1\) or \(c_{0}=\frac {1}{4}\). Then (3A) becomes

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

Now that we used \(n=0\) to find \(r\) by matching against the RHS which is \(x^{3}\), from now on, for all \(n>0\) we will use (3B) 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. Hence (3B) becomes for \(n>0\)

\begin{equation} \left ( n+4\right ) c_{n}x^{n+3}=0\tag {3C}\end{equation}

We see that for all \(n>0\) then \(\left ( n+4\right ) c_{n}=0\) or \(c_{n}=0\) for all \(n>0\). Hence \(y_{p_{2}}\) that corresponds to \(x^{3}\) is

\begin{align*} y_{p_{1}} & =\sum _{n=0}^{\infty }c_{n}x^{n+r}=\sum _{n=0}^{\infty }c_{n}x^{n+3}\\ & =c_{0}x^{3}\\ & =\frac {1}{4}x^{3}\end{align*}

Now we repeat the above for the third and final term \(2x^{4}\). Starting with (3A) again

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

For \(n=0\)

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

Hence \(r=4\) and \(\left ( r+1\right ) c_{0}=2\) or \(c_{0}=\frac {2}{5}\). Then (3A) becomes

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

Now that we used \(n=0\) to find \(r\) by matching against the RHS which is \(2x^{4}\), from now on, for all \(n>0\) we will use (3B) 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^{4}\) on the right. Hence (3B) becomes for \(n>0\)

\begin{equation} \left ( n+5\right ) c_{n}x^{n+4}=0\tag {3C}\end{equation}

We see that for all \(n>0\) then \(\left ( n+5\right ) c_{n}=0\) or \(c_{n}=0\) for all \(n>0\). Hence \(y_{p_{3}}\) that corresponds to \(2x^{4}\) is

\begin{align*} y_{p_{3}} & =\sum _{n=0}^{\infty }c_{n}x^{n+r}=\sum _{n=0}^{\infty }c_{n}x^{n+4}\\ & =c_{0}x^{4}\\ & =\frac {2}{5}x^{4}\end{align*}

Therefore

\begin{align*} y_{p} & =y_{p_{1}}+y_{p_{2}}+y_{p_{3}}\\ & =\frac {1}{2}x+\frac {1}{4}x^{3}+\frac {2}{5}x^{5}\end{align*}

We found \(y_{p}\). Hence the solution is

\begin{align*} y & =y_{h}+y_{p}\\ & =\frac {a_{0}}{x}+\frac {1}{2}x+\frac {1}{4}x^{3}+\frac {2}{5}x^{4}\end{align*}