From 115cc22af2ba00e76f123f2a382afc44ff9710d4 Mon Sep 17 00:00:00 2001 From: jxu <7989982+jxu@users.noreply.github.com> Date: Fri, 18 Apr 2025 23:11:59 -0400 Subject: [PATCH 1/2] Fibonacci: restore matrix power form Maybe a dotted line would show the matrix [[F2, F1],[F1,F0]] can be viewed as two column vectors. Using only the matrix power saves one matrix-vector multiply. --- src/algebra/fibonacci-numbers.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/algebra/fibonacci-numbers.md b/src/algebra/fibonacci-numbers.md index e63e52081..e1acfdcb0 100644 --- a/src/algebra/fibonacci-numbers.md +++ b/src/algebra/fibonacci-numbers.md @@ -157,7 +157,19 @@ F_{n} \end{pmatrix} $$ -where $F_1 = 1, F_0 = 0$. +where $F_1 = 1, F_0 = 0$. +In fact, since +$$ +\begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix} += \begin{pmatrix} F_2 & F_1 \\ F_1 & F_0 \end{pmatrix} +$$ + +we can use the matrix directly: + +$$ +\begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix}^n += \begin{pmatrix} F_{n+1} & F_n \\ F_n & F_{n-1} \end{pmatrix} +$$ 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)) From 59c31747c57735cfe83639f9a1dac64bb800dd78 Mon Sep 17 00:00:00 2001 From: Oleksandr Kulkov Date: Sat, 19 Apr 2025 09:56:55 +0200 Subject: [PATCH 2/2] Update src/algebra/fibonacci-numbers.md --- src/algebra/fibonacci-numbers.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algebra/fibonacci-numbers.md b/src/algebra/fibonacci-numbers.md index e1acfdcb0..dd8e1bd1a 100644 --- a/src/algebra/fibonacci-numbers.md +++ b/src/algebra/fibonacci-numbers.md @@ -159,6 +159,7 @@ $$ where $F_1 = 1, F_0 = 0$. In fact, since + $$ \begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix} = \begin{pmatrix} F_2 & F_1 \\ F_1 & F_0 \end{pmatrix} 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