How to solve this recurrence relation? $f(1) = a; f(2) = b; f(x) = 2f(x-1)-f(x-2)+2;$

72 Views Asked by At

How to solve this recurrence relation?

  • $f(1) = a;$
  • $f(2) = b;$
  • $f(x) = 2f(x-1)-f(x-2)+2;$

Where $a$ and $b$ are positive integers

I want to find $f(x)$ representation with $a$ and $b$ only

Also I am sorry, I really not familiar with it, I got into this as part of my development project

3

There are 3 best solutions below

0
On

This is a linear recurrence relation. Look it up.

First, find the solutions to $f(n)=2f(n-1)+f(n-2) $.

Then find the solution to the whole equation. Hint: Try constant, $n, n^2,$ ... until you find something that works.

Add these to get the general solution.

0
On

By combining all the above clues, we have \begin{equation} f(n) = (n-1)b - (n-2)a + (n-1)(n-2) \end{equation} To verify this, it is clear that $f(1) = a$ and $f(2) = b$. Also the simple calculation reveals that \begin{align} 2f(x-1) - f(x-2) +2 &= 2[(x-2)b - (x-3)a + (x-2)(x-3)] \\ &\hspace{0.2cm} ...- [(x-3)b - (x-4)a + (x-3)(x-4)] + 2 \\ &= (x-1)b - (x-2)a + (x-1)(x-2) = f(x). \end{align}

2
On

$$ f(x)-2 f(x-1)+f(x-2) = 2 \tag{A}$$ sum both sides over $x\in[3,X]$ to get: $$ f(X)-f(X-1)-f(2)+f(1) = 2(X-2) $$ $$ f(X)-f(X-1) = 2X-4+b-a \tag{B} $$ the sum both sides over $X\in[3,M]$ to get: $$ f(M)-b = M^2+M-6+(b-a-4)(M-2). \tag{C}$$ Rearrange and simplify to get that $f(M)$ is a monic, quadratic polynomial in $M$.