Skip to content

Commit 546ce11

Browse files
authored
Merge pull request #1455 from cp-algorithms/fibmatrix
Fibonacci: restore matrix power form
2 parents 51d3953 + 59c3174 commit 546ce11

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/algebra/fibonacci-numbers.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,20 @@ F_{n}
159159
\end{pmatrix}
160160
$$
161161
162-
where $F_1 = 1, F_0 = 0$.
162+
where $F_1 = 1, F_0 = 0$.
163+
In fact, since
164+
165+
$$
166+
\begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix}
167+
= \begin{pmatrix} F_2 & F_1 \\ F_1 & F_0 \end{pmatrix}
168+
$$
169+
170+
we can use the matrix directly:
171+
172+
$$
173+
\begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix}^n
174+
= \begin{pmatrix} F_{n+1} & F_n \\ F_n & F_{n-1} \end{pmatrix}
175+
$$
163176
164177
Thus, in order to find $F_n$ in $O(\log n)$ time, we must raise the matrix to n. (See [Binary exponentiation](binary-exp.md))
165178

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy