<s>[INST] Modify the Fibonacci series We know that Fibonacci Numbers start with 0 and next element is 1 and F(n)=F(n-1)+F(n-2) to find nth term where n>=2 and F(0)=0 F(1)=1 .
But what if we suppose the first 2 terms of fibonacci series be a and b then what will be its nth term?
Like if a=1 b=2 then if we want to find 4th term then it will be 5.
 [/INST] $$F(n) = F(n - 1) + F(n - 2)$$
$$F(n - 1) = F(n - 1)$$

$$
\begin{bmatrix} F(n) \\ F(n - 1) \end{bmatrix} =
\begin{bmatrix} 1 & 1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} F(n - 1) \\ F(n - 2)\end{bmatrix}$$
$$
\begin{bmatrix} F(n + 1) \\ F(n) \end{bmatrix} =
\begin{bmatrix} 1 & 1 \\ 1 & 0 \end{bmatrix}^n \begin{bmatrix} b \\ a
\end{bmatrix}$$
Now if you want a more closed form than that you can do eigen value decomp on the matrix:
$$
\begin{bmatrix} F(n + 1) \\ F(n) \end{bmatrix} =
\begin{bmatrix} 1 & 1 \\ -\frac 2 {\sqrt{5} - 1} & \frac 2 {\sqrt{5} + 1} \end{bmatrix}
\begin{bmatrix} -\frac{\sqrt{5} - 1} 2 & 0 \\ 0 & \frac{\sqrt{5} + 1} 2 \end{bmatrix} ^n
\begin{bmatrix} 1 & 1 \\ -\frac 2 {\sqrt{5} - 1} & \frac 2 {\sqrt{5} + 1} \end{bmatrix}^{-1}
$$
$$F(n) = \frac {b} {\sqrt{5}} \left(\phi^n - \omega^n\right) + \frac {a} {\sqrt{5}} \left(\phi^{n-1} - \omega^{n - 1}\right)$$
using:
$$\phi = \frac{1 + \sqrt 5} 2$$
$$\omega = \frac{1 - \sqrt 5 } 2$$
</s>