1. ## Difference equations

Hi!

We just started on this new topic, and I don´t understand how to solve even the first problems.

If someone could walk me through how to solve the following, I would be immensly grateful!

$y_{n+1} - 2y_{n} = n \; \; \; \; n\geq 0 \; \; \; y_{0} = 2$

Thanks!

2. What is the question?

3. ## Hi!

The question was 'How do I solve this equation' basically.
I did however do some research on the web, and ask around a bit, and
I think I got at least a bit hang of it.

If any of the following is incorrect, let me know.

Equation (1):
$y_{n+1} - 2y_{n} = n \; \; \; \; n\geq 0 \; \; \; y_{0} = 0
$

The characteristic equation is: $r - 2 = 0 \Rightarrow \, r = 2$
Meaning that the homogenous part of the solution to $y_{n}$
is $y_{h} = A\cdot 2^n$
Now we need to find the particular solution to the equation (1).
Since the right side is a polynomial of degree q = 1, we will look for a
polynomial of the same degree.
$P(n) = C*n + D \; \mbox{where C and D are constants}$

Now we take this polynomial $P(n)$ and put it
into equation (1). Giving us:
$C*n + C + D - 2*C*n - 2*D = n$
Now we have a equation system which can be solved:
$n(-C) = n \; \; \mbox{and} \; \; C-D = 0$
This gives us $C = -1 \; and D=C=-1$
So we get:
$y_{n} = A*2^n -n -1$
And with $y_{0}=0 \; \mbox{we get} \; y_{n} = 2^n - n - 1$

4. Hello, Twig!

Ugh! This is a messy one!

I'll show you a method that I was taught . . .

$y_{n+1} \:=\:2y_n + n \qquad n\geq 0 \qquad y_0 = 2$
Crank out the first few terms . . .

$\begin{array}{ccccccc}& y_0 &=& 2 \\
n=0\!: & y_1 &=& 2(2) + 0 &=& 4\\
n = 1\!: & y_2 &=& 2(4) + 1 &=& 9 \\
n=2\!: & y_3 &=& 2(9) + 2 &=& 20
\end{array}$

We have been given: . . $y_{n+1} \:=\:2y_n + n$. . . . . .[1]

Write the "next" term: . $y_{n+2} \:=\:2y_{n+1} + (n+1)$ .[2]

Subtract [1] from [2]: . $y_{n+2} -y_{n+1} \:=\:2y_{n+1} - 2y_n + 1 \quad \Rightarrow \quad y_{n+2} -3y_{n+1} + 2y_n \:=\:1$

Let $y_n = X^n$
. .
We assume that the general term is an exponential.

Then we have: . . . $X^{n+2} - 3X^{n+1} + 2X^n \:=\:1$ .[3]

"Next" equaton: . $X^{n+3} - 3X^{n+2} + 2X^{n+1} \:=\:1$ .[4]

Subtract [3] from [4]: . $X^{n+3} - 4X^{n+2} + 5X^{n+1} - 2X^n \:=\:0$

Divide by $X^n\!:\;\;X^3 - 4X^2 + 5X - 2 \:=\:0$

This factors: . $(X - 1)(X - 1)(X - 2) \:=\:0$

. . and has roots: . $X \;=\;1,\:1,\:2$

The general form is: . $y(n) \;=\;A + Bn + C\cdot2^n$

Plug in the first three terms:

. . $\begin{array}{ccccc}y(0) = 2\!: & A + C &=& 2 & {\color{blue}[5]}\\
y(1) = 4\!: & A + B + 2C &=& 4 & {\color{blue}[6]}\\
y(2) = 9\!: & A + 2B + 4C &=& 9 & {\color{blue}[7]} \end{array}$

$\begin{array}{cccccc}\text{Subtract {\color{blue}[6] - [5]}:} & B + C &=& 2 & {\color{blue}[8]}\\

\text{Subtract {\color{blue}[7] - [6]}:} & B + 2C &=& 5 & {\color{blue}[9]}\end{array}$

Subtract [9] - [8]: . $C \:=\:3 \quad\Rightarrow\quad B \:=\:-1 \quad\Rightarrow\quad A \:=\:-1$

Therefore: . $\boxed{ y(n) \;=\;-1 - n + 3\!\cdot\!2^n}$

Is there a better way? . . . I hope so!
.

5. ## Hi soroban

Hi!

Yes, this can get quite messy.
I read through your solution and then tried to compare it to mine.
$y'' + y' + y = f(x)$
$y_{n} = y_{h} + y_{p}$