Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit115cc22

Browse files
authored
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.
1 parent8c5bc69 commit115cc22

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎src/algebra/fibonacci-numbers.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,19 @@ F_{n}
157157
\end{pmatrix}
158158
$$
159159
160-
where $F_1 = 1, F_0 = 0$.
160+
where $F_1 = 1, F_0 = 0$.
161+
In fact, since
162+
$$
163+
\begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix}
164+
= \begin{pmatrix} F_2 & F_1 \\ F_1 & F_0 \end{pmatrix}
165+
$$
166+
167+
we can use the matrix directly:
168+
169+
$$
170+
\begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix}^n
171+
= \begin{pmatrix} F_{n+1} & F_n \\ F_n & F_{n-1} \end{pmatrix}
172+
$$
161173
162174
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))
163175

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp