How do I solve following recursion

121 Views Asked by At

I have been trying to solve this

$f(n) = 2 \cdot f(n-1) - f(n-2) + 2 \cdot k$

and failed , can anybody help ? $n>4$

The values of $ f(1) = a,\,f(2) = b,\, f(3) = c$ and $f(4) =d $

where $ a,b,c,d,k $ are constants

EDIT:

This is an example $ a=1/6 ,b =1/3 ,c =1/3 ,d = 1/2 $

$f(5)$ should be $1$

but by constant difference method I am not getting it

and sorry about this .. there is another piece of information $k = f(2) - f(1)$ (always)

P.S $ a,b,c,d $ can have different values than above .. i.e i need a general solution

3

There are 3 best solutions below

0
On

Let $f(n)-f(n-1)=g(n)$. Then, we have $$g(n)-g(n-1)=2k.$$ Hence, we have $$g(n)=g(2)+2k(n-2),$$ i.e. $$f(n)-f(n-1)=f(2)-f(1)+2k(n-2).$$ Hence, for $n\ge 2$, we have $$\begin{align}f(n)&=f(1)+\sum_{i=2}^n\left(f(2)-f(1)+2k(i-2)\right)\\&=f(1)+(n-1)(f(2)-f(1))+2k\cdot\frac{(n-2)(n-1)}{2}\\&=\color{red}{kn^2+(f(2)-f(1)-3k)n+2f(1)-f(2)+2k}\end{align}$$ Note that this holds for $n=1$.

0
On

$$f(n+1)-2f(n)+f(n-1)=2k$$ This is a finite difference version of $f''(x)=\text{const}$ which has quadratic solutions. In this case, just write $$f(n)=an^2+bn+c$$ and determine the unknown $a$ coefficient ($b$ and $c$ are determined by the initial conditions).

4
On

From the equation it follows that we have,

$$f(n+1)-3f(n)+3f(n-1)-f(n-2)=0$$

The characteristic equation of the above recurrence is given by, $$x^3-3x^2+3x-1=0$$Therefore, $$f(n)=\alpha+n\beta+n^2\gamma$$

By the problem we have (putting successively $n=1,2,3$),

$$a=\alpha+\beta+\gamma$$$$b=\alpha+2\beta+4\gamma$$$$c=\alpha+3\beta+9\gamma$$ which you can easily solve. For the value of $d$ you just need to check whether the solutions of the above three equations are consistent with $$d=\alpha+4\beta+16\gamma$$