How to solve this recurrence $K(n)=2K(n-1)-K(n-2)+C$?

$$ \begin{bmatrix} K(n+1) \\ K(n) \end{bmatrix}=A \begin{bmatrix} K(n) \\ K(n-1) \end{bmatrix}+ \begin{bmatrix} C \\ 0 \end{bmatrix}, $$

where

$$A= \begin{bmatrix} 2 & -1 \\ 1 & 0 \end{bmatrix}. $$

Therefore,

$$ \begin{bmatrix} K(n+1) \\ K(n) \end{bmatrix}=A^n \begin{bmatrix} K(1) \\ K(0) \end{bmatrix}+ \left(\sum_{k=1}^{n-1}A^k+I\right) \begin{bmatrix} C \\ 0 \end{bmatrix} $$

and

$$ K(n)=nK(1)-(n-1)K(0)+\frac{1}{2}Cn(n-1) $$

by noticing that

$$ A^k= \begin{bmatrix} k+1 & -k \\ k & k-1 \end{bmatrix}. $$


The other answers are way too complicated for this particular problem.

They're useful in more general cases, but they're completely overkill here.

\begin{align*} K(n) &= 2 K(n - 1) - K(n - 2) + C \\ K(n) - K(n - 1) &= K(n - 1) - K(n - 2) + C \end{align*}

Just look at this equation for a few seconds.
It's literally telling you that the difference between successive elements increases by $C$ every step.
So... just go ahead and count how many times you add $C$ to the difference $K(1) - K(0)$:

$$K(n) = K(0) + \sum_{k=1}^{n} K(1) - K(0) + (k - 1) C$$

Notice you don't need any linear algebra, eigenvectors, or other higher-level math for this problem. It's just algebraic manipulation.

I'll leave the last step of simplifying the summation to you.

Edit:

or I'll just do it for you myself, since you seem to think it leads to another recurrence...

\begin{align*} K(n) &= K(0) + n(K(1) - K(0)) + C\sum_{k=1}^{n} (k-1) \\ &= K(0) + n(K(1) - K(0)) + C \frac{n(n-1)}{2} \end{align*}


To keep things general, suppose $k_0=A$ and $k_1=B$. Then the next few terms are: $$k_2=2A-B+C\\ k_3=4A-3B+3C\\ k_4=6A-5B+6C\\ k_5=8A-7B+10C\\ k_6=10A-9B+15C$$

The pattern seems to be (for $n\ge2$) that 2 more $A$'s are added, 2 more $B$'s are subtracted, and $n-1$ more $C$'s are added, $$k_n=(2n-2)A-(2n-3)B+\frac{(n-1)(n)}{2}C$$

A proof by strong induction along with some messy algebra will give you your answer