Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 37s1 days 16 hours 1 minutes 37 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 37s1 days 16 hours 1 minutes 37 seconds.

Sign in to watch this lesson
Advanced - Number Theory · 4:31
Multiplying the pair (F_n, F_n-1) by the matrix [[1,1],[1,0]] moves it one step along the Fibonacci sequence, so the n-th power of that matrix holds F_n, and binary exponentiation computes it with about log n matrix products. We cover fast doubling, the identities the matrix explains (Cassini and gcd(F_m, F_n) = F_gcd(m,n)), and the same technique for any linear recurrence and for counting walks in a graph.