# Thread: Solve ODE by power series

1. ## Solve ODE by power series

Hi everyone,
I faced a problem in solve a second order ODE by power series. Hope someone help me out there:
Here is the question:
$\displaystyle y'' - 2y' + y = 0$

This is my solution (I have checked many times, probably nothing wrong):
Let
$\displaystyle y = \sum\limits_{n = 0}^\infty {{c_n}{x^n}}$
$\displaystyle y' = \sum\limits_{n = 1}^\infty {n{c_n}{x^{n - 1}}}$
$\displaystyle y'' = \sum\limits_{n = 2}^\infty {n(n - 1){c_n}{x^{n - 2}}}$

Then,
$\displaystyle \sum\limits_{n = 2}^\infty {n(n - 1){c_n}{x^{n - 2}}} - 2\sum\limits_{n = 1}^\infty {n{c_n}{x^{n - 1}}} + \sum\limits_{n = 0}^\infty {{c_n}{x^n}} = 0$

After shift the index,
$\displaystyle \sum\limits_{n = 0}^\infty {(n + 2)(n + 1){c_{n + 2}}{x^n}} + \sum\limits_{n = 0}^\infty { - 2(n + 1){c_{n + 1}}{x^n}} + \sum\limits_{n = 0}^\infty {{c_n}{x^n}} = 0$
$\displaystyle \sum\limits_{n = 0}^\infty {(n + 2)(n + 1){c_{n + 2}}{x^n} - 2(n + 1){c_{n + 1}}{x^n} + {c_n}{x^n}} = 0$
$\displaystyle \sum\limits_{n = 0}^\infty {[(n + 2)(n + 1){c_{n + 2}} - 2(n + 1){c_{n + 1}} + {c_n}]{x^n}} = 0$

Therefore a recurrence relation, for all n > 0:
$\displaystyle (n + 2)(n + 1){c_{n + 2}} - 2(n + 1){c_{n + 1}} + {c_n} = 0$
$\displaystyle {c_{n + 2}} = \frac{2}{{(n + 2)}}{c_{n + 1}} - \frac{1}{{(n + 2)(n + 1)}}{c_n}$

To find $\displaystyle {c_n}$ terms in only $\displaystyle {c_0}$ & $\displaystyle {c_1}$,
For n = 0,
$\displaystyle {c_2} = \frac{2}{2}{c_1} - \frac{1}{{2 \cdot 1}}{c_0}$
$\displaystyle {c_2} = \frac{2}{{2!}}{c_1} - \frac{1}{{2!}}{c_0}$
$\displaystyle {c_2} = \frac{1}{{1!}}{c_1} - \frac{1}{{2!}}{c_0}$

For n = 1,
$\displaystyle {c_3} = \frac{2}{3}{c_2} - \frac{1}{{3 \cdot 2}}{c_1}$
$\displaystyle {c_3} = \frac{2}{3}\left[ {\frac{2}{{2!}}{c_1} - \frac{1}{{2!}}{c_0}} \right] - \frac{1}{{3!}}{c_1}$
$\displaystyle {c_3} = \left[ {\frac{{2 \cdot 2}}{{3!}} - \frac{1}{{3!}}} \right]{c_1} - \frac{2}{{3!}}{c_0}$
$\displaystyle {c_3} = \frac{3}{{3!}}{c_1} - \frac{2}{{3!}}{c_0}$
$\displaystyle {c_3} = \frac{1}{{2!}}{c_1} - \frac{2}{{3!}}{c_0}$

For n = 2,
$\displaystyle {c_4} = \frac{2}{4}{c_3} - \frac{1}{{4 \cdot 3}}{c_2}$
$\displaystyle {c_4} = \frac{2}{4}\left[ {\frac{3}{{3!}}{c_1} - \frac{2}{{3!}}{c_0}} \right] - \frac{1}{{4 \cdot 3}}\left[ {\frac{2}{{2!}}{c_1} - \frac{1}{{2!}}{c_0}} \right]$
$\displaystyle {c_4} = \left[ {\frac{{3 \cdot 2}}{{4!}}{c_1} - \frac{{2 \cdot 2}}{{4!}}{c_0}} \right] - \left[ {\frac{2}{{4!}}{c_1} - \frac{1}{{4!}}{c_0}} \right]$
$\displaystyle {c_4} = \left[ {\frac{{3 \cdot 2}}{{4!}} - \frac{2}{{4!}}} \right]{c_1} - \left[ {\frac{{2 \cdot 2}}{{4!}} - \frac{1}{{4!}}} \right]{c_0}$
$\displaystyle {c_4} = \frac{4}{{4!}}{c_1} - \frac{3}{{4!}}{c_0}$
$\displaystyle {c_4} = \frac{1}{{3!}}{c_1} - \frac{3}{{4!}}{c_0}$

For n = 3,
$\displaystyle {c_5} = \frac{2}{5}{c_4} - \frac{1}{{5 \cdot 4}}{c_3}$
$\displaystyle {c_5} = \frac{2}{5}\left[ {\frac{4}{{4!}}{c_1} - \frac{3}{{4!}}{c_0}} \right] - \frac{1}{{5 \cdot 4}}\left[ {\frac{3}{{3!}}{c_1} - \frac{2}{{3!}}{c_0}} \right]$
$\displaystyle {c_5} = \left[ {\frac{{2 \cdot 4}}{{5!}}{c_1} - \frac{{2 \cdot 3}}{{5!}}{c_0}} \right] - \left[ {\frac{3}{{5!}}{c_1} - \frac{2}{{5!}}{c_0}} \right]$
$\displaystyle {c_5} = \left[ {\frac{{2 \cdot 4}}{{5!}} - \frac{3}{{5!}}} \right]{c_1} - \left[ {\frac{{2 \cdot 3}}{{5!}} - \frac{2}{{5!}}} \right]{c_0}$
$\displaystyle {c_5} = \frac{5}{{5!}}{c_1} - \frac{4}{{5!}}{c_0}$
$\displaystyle {c_5} = \frac{1}{{4!}}{c_1} - \frac{4}{{5!}}{c_0}$

.....

Since
$\displaystyle y = \sum\limits_{n = 0}^\infty {{c_n}{x^n}}$
$\displaystyle y = {c_0} + {c_1}x + {c_2}{x^2} + {c_3}{x^3} + {c_4}{x^4} + {c_5}{x^5} + ...$
$\displaystyle y = {c_0} + {c_1}x + \left[ {\frac{1}{{1!}}{c_1} - \frac{1}{{2!}}{c_0}} \right]{x^2} + \left[ {\frac{1}{{2!}}{c_1} - \frac{2}{{3!}}{c_0}} \right]{x^3} + \left[ {\frac{1}{{3!}}{c_1} - \frac{3}{{4!}}{c_0}} \right]{x^4} + \left[ {\frac{1}{{4!}}{c_1} - \frac{4}{{5!}}{c_0}} \right]{x^5} + ...$
$\displaystyle y = {c_0}\left[ {1 - \frac{1}{{2!}}{x^2} - \frac{2}{{3!}}{x^3} - \frac{3}{{4!}}{x^4} - \frac{4}{{5!}}{x^5} - ...} \right] + {c_1}x\left[ {1 + \frac{1}{{1!}}x + \frac{1}{{2!}}{x^2} + \frac{1}{{3!}}{x^3} + \frac{1}{{4!}}{x^4} + ...} \right]$
$\displaystyle y = {c_0}\left[ {1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} } \right] + {c_1}x\left[ {\sum\limits_{n = 0}^\infty {\frac{1}{{n!}}{x^n}} } \right]$

As far as I know,
$\displaystyle \sum\limits_{n = 0}^\infty {\frac{1}{{n!}}{x^n}} = {e^x}$

In fact, when I solve $\displaystyle y'' - 2y' + y = 0$ using charactheristic equation,
$\displaystyle {r^2} - 2r + 1 = 0$
$\displaystyle {(r - 1)^2} = 0$
$\displaystyle r = 1$

And the solution is
$\displaystyle y = ({c_0} + {c_1}x){e^x}$

Now, here my question:
Is $\displaystyle 1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} = {e^x}$?
If yes, please can you help me proof it?
If not, could you point out where my mistake?

2. ## Re: Solve ODE by power series

Why do you want a power series solution when it is incredibly easy to solve exactly?

3. ## Solve ODE by power series

Hi Prove It,
This is the exercise from my lecturer told us to do

The proving part is actually that I'm exploring my own

4. ## Re: Solve ODE by power series

The solution to $y^{\prime\prime}-2y^\prime + y=0$ is not just $y=c e^t$

The characteristic polynomial has a repeated root at $s=1$ and thus the full solution is

$y(t) = c_1 e^t + c_2 t e^t$

see if your series solution, replicates this.

5. ## Re: Solve ODE by power series

Hi Romsek, thanks for reminding me,
However, after cooperating with a Dr., we had figured out the possible way to explain my question:
At first, I will say
$\displaystyle 1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} \ne {e^x}$
And there is no fault in my solution above,

The continuation is like this,
$\displaystyle 1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} = 1 - \sum\limits_{n = 2}^\infty {\left( {\frac{n}{{n!}} - \frac{1}{{n!}}} \right)} {x^n}$
$\displaystyle 1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} = 1 - \left( {\sum\limits_{n = 2}^\infty {\left( {\frac{n}{{n!}}} \right)} {x^n} - \sum\limits_{n = 2}^\infty {\left( {\frac{1}{{n!}}} \right)} {x^n}} \right)$
$\displaystyle 1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} = 1 - \sum\limits_{n = 2}^\infty {\left( {\frac{n}{{n!}}} \right)} {x^n} + \sum\limits_{n = 2}^\infty {\left( {\frac{1}{{n!}}} \right)} {x^n} + x - x$
$\displaystyle 1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} = \left( {1 + x + \sum\limits_{n = 2}^\infty {\left( {\frac{1}{{n!}}} \right)} {x^n}} \right) - \left( {x + \sum\limits_{n = 2}^\infty {\left( {\frac{1}{{(n - 1)!}}} \right)} {x^n}} \right)$
$\displaystyle 1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} = {e^x} - \sum\limits_{n = 1}^\infty {\left( {\frac{1}{{(n - 1)!}}} \right)} {x^n}$
$\displaystyle 1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} = {e^x} - \sum\limits_{n = 0}^\infty {\left( {\frac{1}{{(n + 1 - 1)!}}} \right)} {x^{n + 1}}$
$\displaystyle 1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} = {e^x} - x\sum\limits_{n = 0}^\infty {\left( {\frac{1}{{n!}}} \right)} {x^n}$
$\displaystyle 1 - \sum\limits_{n = 2}^\infty {\frac{{n - 1}}{{n!}}{x^n}} = {e^x} - x{e^x}$

Therefore for this case,
$\displaystyle y = {c_0}({e^x} - x{e^x}) + {c_1}x{e^x}$
$\displaystyle y = {c_0}{e^x} - {c_0}x{e^x} + {c_1}x{e^x}$
$\displaystyle y = {c_0}{e^x} + ({c_1} - {c_0})x{e^x}$

Now, the solutions from 2 methods (Charactheristics Equation & Power Series) has finally equated:
Charactheristics Equation Method:
(Let me use $\displaystyle {a_0}$ and $\displaystyle {a_1}$ for the 2 constant for Charactheristics Equation Method, so that it’s don’t get confusing)
$\displaystyle y = {a_0}{e^x} + {a_1}x{e^x}$

And Power Series Method:
$\displaystyle y = {c_0}{e^x} + ({c_1} - {c_0})x{e^x}$

Where the second constant from power series is dependent from the first constant.