How to find the $n$-th term in a sequence with following recurrence relation for a given $n$?
$$F(n)=2b F(n-1)-F(n-2), \ F(0)=a,\ F(1)=b,$$ where $a$ and $b$ are constants.
The value of $n$ is quite large $(1 \leq n\leq 10^{12})$ and so matrix exponentiation is required.
However I am facing difficulties deducing its matrix from the relation which would give the required value.
Could anyone help me with this question and show how to convert as well so I can tackle these kind of problems myself afterward?
The value of n is quite large ... and so matrix exponentiation is requiredNot clear on how matrix exponentiation helps there. One way or another, you'll get the same $,F_n=c_1 u^n + c_2 v^n,$ where $,u, v,$ are the roots of $,x^2 - 2bx + 1 = 0,$. It's easy to see that both roots are real, and they multiply to $,1,$, so one of them will be larger than $,1,$ in absolute value. That term will grow pretty quickly for large $,n,$, no matter how you calculate it. – dxiv Feb 09 '18 at 23:53