# ODE power series solution $y'+xy=1+x$

So i have been told to find the power series solution to the following ode $$y'+yx=1-x$$ Using the substitution $y=\sum_{n=0}^{\infty}a_nx^n$, i can rewrite the equation as the following; $$\sum_{n=1}^{\infty}na_nx^{n-1}+\sum_{n=0}^{\infty}a_nx^{n+1}=1+x$$ That is $$\sum_{n=0}^{\infty}(n+1)a_{n+1}x^{n}+\sum_{n=1}^{\infty}a_{n-1}x^{n}=1+x$$ I then combined the series and the non homogeneous terms to obtain $$(a_1-1)+x(2a_2+a_0-1)+\sum_{n=2}^{\infty}[(n+1)a_{n+1}+a_{n-1}]x^n=0$$ Setting $a_1=1$ and $2a_2+a_0-1=0$, I can say that $(n+1)a_{n+1}+a_{n-1}=0$, meaning i can say $a_n=\frac{-a_{n-2}}{n}$ for $n=3,4,5...$

I began subbing in the values for n to try and get a relation, i got

$a_3=-\frac{1}{3}$, $a_4=\frac{a_0-1}{4\cdot2}$, $a_5=\frac{1}{5\cdot3}$, $a_6=-\frac{a_0-1}{6\cdot4\cdot2}$...

This is where I am stumped, I said that $$a_{2k}=\frac{(-1)^k(a_0-1)}{2k!!}, k=2,3,4...$$ And $$a_{2k+1}=\frac{(-1)^n}{(2k-1)!!},k=1,2,3..$$ Am i correct in saying this? And if so how to i get to an answer from these statements? Any help would be greatly appriciated.

• $2\cdot4\cdot6=2^33!$ May 19, 2018 at 19:33
• I tried to see if there's some other way to solve it besides using power series to no avail... any comments regarding that? May 19, 2018 at 22:38

$$2\cdot4\cdot6\cdots2k=2^kk!$$ $$1\cdot3\cdot5\cdots(2k-1)=\frac{(2k)!}{2^kk!}$$

As for your solution, you will have to separate into two series of the form $$y=a_0y_0+y_1$$

Note that your textbook did not bother to find the general terms for $3\cdot5\cdot7\cdot(2n+1)$. I worked it out using the general terms, but separated the odd and even terms in the sum.

Starting with $$\sum_{n=1}^{\infty}na_nx^{n-1}+\sum_{n=0}^{\infty}a_nx^{n+1}=1+x$$

we adjust the indices to coordinate the exponents, getting

$$\sum_{n=0}^{\infty}(n+1)a_{n+1}x^n+\sum_{n=1}^{\infty}a_{n-1}x^{n}=1+x$$ Next, we cast out the first term of the first sum to bring the two summations into alignment, and subtract the terms on the right to the left side. $$a_1-1-x+\sum_{n=1}^{\infty}(n+1)a_{n+1}x^n+\sum_{n=1}^{\infty}a_{n-1}x^{n}=0$$ We can now combine the summations. $$a_1-1-x+\sum_{n=1}^{\infty}\left[(n+1)a_{n+1}+a_{n-1}\right]x^{n}=0$$ Next we cast out the $x$ to the power $1$ term from the summation. $$a_1-1+(2a_2+a_0-1)x+\sum_{n=2}^{\infty}\left[(n+1)a_{n+1}+a_{n-1}\right]x^{n}=0$$ Setting all coefficients to $0$ gives \begin{eqnarray} a_1&=&1\\ a_2&=&\frac{1-a_0}{2}\\ a_{n+1}&=&-\frac{a_{n-1}}{n+1}\text{ for }n\ge2 \end{eqnarray} Clearly the even and odd coefficients beginning with the $x^2$ term should be separated, giving the relations

\begin{eqnarray} a_{2k}&=&-\frac{a_{2k-2}}{2k}\text{ for }k>1\\ a_{2k+1}&=&-\frac{a_{2k}}{2k+1}\text{ for }k\ge1 \end{eqnarray}

So

\begin{eqnarray} a_2&=&\frac{1-a_0}{2}\\ a_4&=&-\frac{a_2}{4}=(-1)\frac{1}{2\cdot4}\cdot(1-a_0)\\ a_6&=&-\frac{a_4}{6}=(-1)^2\frac{1}{2\cdot4\cdot6}\cdot(1-a_0)\\ &\vdots&\\ a_{2k}&=&\frac{(-1)^{k-1}}{2^kk!}\cdot(1-a_0)\text{ for }k\ge2 \end{eqnarray}

For the odd power terms we get

\begin{eqnarray} a_3&=&-\frac{a_1}{3}=-\frac{1}{3}\\ a_5&=&\frac{(-1)^2}{3\cdot5}\\ a_7&=&\frac{(-1)^3}{3\cdot5\cdot6}\\ &\vdots&\\ a_{2k+1}&=&(-1)^k\frac{2^kk!}{(2k+1)!}\text{ for }k\ge1 \end{eqnarray}

This gives a general solution of $$y=a_0+x+\sum_{k=1}^\infty(-1)^k\frac{2^kk!}{(2k+1)!}x^{2k+1}+(1-a_0)\sum_{k=1}^\infty\frac{(-1)^{k-1}}{2^kk!}x^{2k}$$

• Thank you, however im still confused as to how to obtain a final solution. My notes say the the general solution is $y(x)=a_0+x+\frac{1-a_0}{2}x^2-\frac{1}{3}x^3+\frac{a_0-1}{2^22!}x^4+\frac{1}{5\cdot3}x^5...$, but i just cant figure out how to get this, especially where the first three terms are from as i thought it would have to start with $-\frac{1}{3}x^3$ term. May 19, 2018 at 21:05
• OK, I will try to work out a complete solution. Check back later. May 19, 2018 at 21:21
• @JohnWaylandBales can it be done using a method other than power series? May 19, 2018 at 22:42
• @AmateurMathPirate : The integrating factor is $\exp(x^2/2)$, there remains a symbolically not solvabe integral. May 19, 2018 at 22:46
• I have not found another way to work it. May 19, 2018 at 22:53