ZestCalc

Matrix Power Calculator

Raise a square matrix to any whole power, exactly, up to 8×8. See how repeated squaring saves work, and where applying a matrix again and again leads.

Matrix and power

Enter a square matrix and a whole-number exponent, or start from an example.

Up to 8 rows and 8 columns.

Use integers, decimals, or fractions such as 1/3. Paste rows from a spreadsheet or a Python list into any cell.

Input

A=[1110]A = \begin{bmatrix} 1 & 1 \\ 1 & 0 \end{bmatrix}

Power

Updates as you type.

Repeated squaring

The current power of two AA

11
10

The running product II

10
01

In binary, 13 is 1101, so A13A^{13} splits into A8⋅A4⋅AA^{8} \cdot A^{4} \cdot A. Keep squaring, and multiply in each square whose digit is 1.

Step 0 of 6

What a matrix power means

For a square matrix AA and a whole number nn, AnA^n means multiplying AA by itself nn times:

An=A⋅A⋯A⏟n factorsA^n = \underbrace{A \cdot A \cdots A}_{n \text{ factors}}

Only a square matrix has powers, because the sizes have to match at every product. You can check any single product with the Matrix Multiplication Calculator. By convention, A0=IA^0 = I. A negative power means a power of the inverse, A−n=(A−1)nA^{-n} = (A^{-1})^n, so it exists only when AA is invertible. The Matrix Inverse Calculator shows that inverse being built.

Repeated squaring

Multiplying one at a time takes n−1n - 1 products. Squaring gets there much faster, because A2A^2, A4A^4, A8A^8, and so on each take just one product. Any exponent is a sum of powers of two, which its binary digits spell out. For example, 13 is 1101 in binary, so:

A13=A8⋅A4⋅AA^{13} = A^{8} \cdot A^{4} \cdot A

That's 5 products rather than 12. At n=1000n = 1000, it's 15 rather than 999.

Why powers are useful

Applying a matrix over and over models anything that updates in fixed steps. Three classic cases:

  • Fibonacci numbers. The entries of [1110]n\begin{bmatrix} 1 & 1 \\ 1 & 0 \end{bmatrix}^n are Fibonacci numbers, so squaring finds a far-off one in a few products.
  • Markov chains. If a matrix holds the probabilities of moving between states, its nnth power holds the probabilities after nn steps, and they often settle to a steady pattern.
  • Long-run behavior. The eigenvalues decide what happens. Powers shrink to zero if every eigenvalue is smaller than 1 in size, and grow if any is larger. The Linear Transformation Visualizer shows the directions those eigenvalues belong to.