6.2 Example 2. \(xy^{\prime }+y=x\)
\begin{equation} xy^{\prime }+y=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}\) 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 \(x\) on RHS
\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\), EQ. (3A) gives
\begin{align*} rc_{0}x^{r}+c_{0}x^{r} & =x\\ \left ( rc_{0}+c_{0}\right ) x^{r} & =x \end{align*}
For balance we need \(r=1\). Hence \(rc_{0}+c_{0}=1\) or \(c_{0}=\frac {1}{2}\). EQ. (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}
For \(n>0\) we obtain recursive relation (since no balance now, as all \(x\) powers on left side do not match the right side)
\begin{align} \left ( n+1\right ) c_{n}+c_{n} & =0\nonumber \\ \left ( n+2\right ) c_{n} & =0 \tag {4}\end{align}
This show that \(c_{n}=0\) for \(n>0.\) Therefore
\begin{align*} y_{p} & =\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*}
Therefore
\begin{align*} y & =y_{h}+y_{p}\\ & =\frac {a_{0}}{x}+\frac {1}{2}x \end{align*}