# Thread: Solve the initial-value proble. X[n+2]- x[n+1]-2x[n] = 0, for x[1]= 0, x[2]= 1?

1. ## Solve the initial-value proble. X[n+2]- x[n+1]-2x[n] = 0, for x[1]= 0, x[2]= 1?

can you help with that, step by step

2. Hello, saihat!

Solve the initial value problem: .$\displaystyle X(n\!+\!2) -X(n\!+\!1)-2X(n)\:=\:0,\;\;X(1) = 0,\;X(2) = 1$

We conjecture that: .$\displaystyle X(n) \,=\,x^n$

The equation becomes: .$\displaystyle x^{n+2} -x^{n+1} - 2x^n\:=\:0$

Divide by $\displaystyle x^n\!:\;\;x^2 - x - 2 \:=\:0 \quad\Rightarrow\quad (x + 1)(x-2) \:=\:0 \quad\Rightarrow\quad x \:=\:-1,2$

So we have two solutions: .$\displaystyle \begin{array}{ccc}f(n) &=& (\text{-}1)^n \\ f(n) &=& 2^n \end{array}$

Form a linear combination of the two solutions: .$\displaystyle f(n) \:=\:A(\text{-}1)^n + B(2^n)$

We know the first two values of the sequence:

. . $\displaystyle \begin{array}{ccccccc}f(1) = 0\!: & \text{-}A + 2B &=& 0 & {\color{blue}[1]} \\ f(2) = 1\!: & A + 4B &=& 1 & {\color{blue}[2]} \end{array}$

Add [1] and [2]: .$\displaystyle 6B \:=\:1 \quad\Rightarrow\quad B \,=\,\tfrac{1}{6}$

Substitute into [2]: .$\displaystyle A + 4\left(\tfrac{1}{6}\right) \:=\:1 \quad\Rightarrow\quad A \,=\,\tfrac{1}{3}$

Hence: .$\displaystyle f(n) \;=\;\frac{1}{3}(\text{-}1)^n + \frac{1}{6}(2^n) \;=\;\frac{(\text{-}1)^n}{3} + \frac{2^n}{6} \;=\;\frac{(\text{-}1)^n}{3} + \frac{2^{n-1}}{3}$

Therefore: .$\displaystyle f(n) \;=\;\frac{2^{n-1} + (\text{-}1)^n}{3}$