Project DelphiTensors Workshop

Fibonacci as a matrix state

The rule f(n) = f(n-1) + f(n-2) is one matrix applied repeatedly:

F = np.array([[1, 1], [1, 0]]) v = np.array([1, 0]) for _ in range(10): v = F @ v print(v[1]) # 55 print(np.linalg.matrix_power(F, 10)[0, 1]) # 55 — same answer, one step

The state is the pair of the last two numbers. Once the recurrence is a matrix, matrix_power collapses ten steps into one.