6.5 Example 5. \(xy^{\prime }+y=\sin x\)
\begin{equation} xy^{\prime }+y=\sin x\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
\begin{align*} \sum _{n=0}^{\infty }\left ( n+r\right ) c_{n}x^{n+r}+\sum _{n=0}^{\infty }c_{n}x^{n+r} & =\sin x\\ \sum _{n=0}^{\infty }\left ( n+r\right ) c_{n}x^{n+r}+\sum _{n=0}^{\infty }c_{n}x^{n+r} & =x-\frac {1}{6}x^{3}+\frac {1}{120}x^{5}-\frac {1}{5040}x^{7}+\cdots \end{align*}
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}\).
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 (3A) 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 (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}
The recursive relation for \(n>0\) is
\begin{equation} \left ( n+2\right ) c_{n}x^{n+1}=0\tag {3C}\end{equation}
We see from (3C) for all \(n>0\), that \(\left ( n+2\right ) c_{n}=0\) which implies \(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 in the \(\sin \) expansion. (3A) now becomes the following, with \(x\) replace by \(-\frac {1}{6}x^{3}\) on the right side
\begin{equation} \sum _{n=0}^{\infty }\left ( n+r\right ) c_{n}x^{n+r}+\sum _{n=0}^{\infty }c_{n}x^{n+r}=-\frac {1}{6}x^{3}\tag {3A}\end{equation}
For \(n=0\)
\begin{align*} rc_{0}x^{r}+c_{0}x^{r} & =-\frac {1}{6}x^{3}\\ \left ( r+1\right ) c_{0}x^{r} & =-\frac {1}{6}x^{3}\end{align*}
Balance gives \(r=3\) and \(\left ( r+1\right ) c_{0}=-\frac {1}{6}\), hence \(c_{0}=\frac {-1}{6\left ( 4\right ) }=-\frac {1}{24}\). (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}=-\frac {1}{6}x^{3}\tag {3B}\end{equation}
Now that we used \(n=0\) to find \(r\) by matching against the RHS which is \(-\frac {1}{6}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\) that \(\left ( n+4\right ) c_{n}=0\) or \(c_{n}=0\) for all \(n>0\). Hence \(y_{p_{2}}\) that corresponds to \(-\frac {1}{6}x^{3}\) is
\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}\\ & =-\frac {1}{24}x^{3}\end{align*}
Now we repeat the above for the third term in the \(\sin \) expansion. (3A) becomes
\begin{equation} \sum _{n=0}^{\infty }\left ( n+r\right ) c_{n}x^{n+r}+\sum _{n=0}^{\infty }c_{n}x^{n+r}=\frac {1}{120}x^{5}\tag {3A}\end{equation}
For \(n=0\)
\begin{align*} rc_{0}x^{r}+c_{0}x^{r} & =\frac {1}{120}x^{5}\\ \left ( r+1\right ) c_{0}x^{r} & =\frac {1}{120}x^{5}\end{align*}
Balance gives \(r=5\) and \(\left ( r+1\right ) c_{0}=\frac {1}{120}\), hence \(c_{0}=\frac {1}{120\left ( 6\right ) }=\allowbreak \frac {1}{720}\). (3A) becomes
\begin{equation} \sum _{n=0}^{\infty }\left ( n+5\right ) c_{n}x^{n+5}+\sum _{n=0}^{\infty }c_{n}x^{n+5}=\frac {1}{120}x^{5}\tag {3B}\end{equation}
Now that we used \(n=0\) to find \(r\) by matching against the RHS which is \(\frac {1}{120}x^{5}\), 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^{5}\) on the right. Hence (3B) becomes for \(n>0\)
\begin{equation} \left ( n+6\right ) c_{n}x^{n+5}=0\tag {3C}\end{equation}
We see that for all \(n>0\) that \(\left ( n+6\right ) c_{n}=0\) or \(c_{n}=0\) for all \(n>0\). Hence \(y_{p_{2}}\) that corresponds to \(\frac {1}{120}x^{5}\) is
\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}\\ & =\frac {1}{720}x^{5}\end{align*}
And so on. Now we add all the \(y_{p}\) found above, which gives
\begin{align*} y_{p} & =y_{p_{1}+}y_{p_{2}+}y_{p_{3}}+\cdots \\ & =\frac {1}{2}x-\frac {1}{24}x^{3}+\frac {1}{720}x^{5}-\cdots \end{align*}
We found \(y_{p}\). The solution is
\begin{align*} y & =y_{h}+y_{p}\\ & =\frac {a_{0}}{x}+\left ( \frac {1}{2}x-\frac {1}{24}x^{3}+\frac {1}{720}x^{5}+\cdots \right ) \end{align*}