Matrix Power Calculator

Enter a square matrix and an exponent to compute its power.

Result

89 55 55 34

How it is calculated

Enter the square matrix with one row per line and the entries separated by spaces, commas or semicolons. The tool checks that every row has as many numbers as there are rows; otherwise it returns nothing, and so does a matrix larger than 20 × 20. The power is rounded to the nearest whole number, and a negative power is refused, since that would need the inverse.

An = A × A × … × A (n factors)

It starts from the identity matrix and uses square and multiply (about log2 n matrix products), so even a very large power is instant; each product uses Cij = Σk Aik·Bkj (row times column). Power 0 therefore returns the identity matrix. Whole numbers are printed without decimals; other entries are shown with four decimals, and the columns are separated by two spaces. Very large entries are shown rounded to about 16 significant digits.

Worked example

The matrix is 1 1 on the first row and 1 0 on the second, raised to the power 10. This is the Fibonacci matrix: each multiplication shifts the pair of consecutive Fibonacci numbers one step forward. The powers run 2: (2, 1; 1, 1), 3: (3, 2; 2, 1), and so on. For the power 10 the tool prints 89 55 55 34, which means the matrix 89, 55 on the first row and 55, 34 on the second. The entries are the Fibonacci numbers F11 = 89, F10 = 55 and F9 = 34.

Try this example →

Common mistakes

  • Entering a non-square matrix, such as 2 rows of 3 numbers. A matrix power is only defined for square matrices, so the tool returns nothing.
  • Writing decimals with a comma, like 1,5. The comma separates cells, so "1,5 2" is read as three numbers in one row and the matrix is no longer square. Use a decimal point.
  • Confusing An with raising each entry to the power n. A matrix power is repeated matrix multiplication; squaring the entries one by one gives a different matrix.
  • Expecting a negative or fractional power. A negative exponent is rejected, and a decimal exponent such as 2.6 is silently rounded to 3.
  • Forgetting the order of rows and columns when entering numbers. Each line is one row, so typing the matrix column by column gives the transpose, whose power is the transpose of the answer.

About this calculator

Raising a square matrix to a power means multiplying the matrix by itself n times: Aⁿ = A × A × ... × A. Unlike scalar exponentiation, matrix multiplication isn't commutative in general, so the operation must preserve the exact left-to-right order of multiplication, and the matrix must be square (same number of rows and columns) for the result to remain a valid matrix of the same size.

Matrix powers come up constantly in linear algebra, computer graphics, and applied mathematics — repeatedly applying a transformation matrix, computing terms of a linear recurrence like the Fibonacci sequence via matrix exponentiation, or analyzing multi-step transitions in a Markov chain, where the entries of the transition matrix raised to the nth power give the probabilities of moving between states after n steps. Students use it to verify hand calculations, while programmers and data scientists use it to check results from linear algebra libraries.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    Beyond Fibonacci numbers, powers of a matrix count routes: if the entries of A show direct links between points, with 1 for a link and 0 for none, then entry (i, j) of A to the power n counts the walks of length n from i to j. Entries are held as ordinary floating-point numbers, so exact integers are only dependable to about 16 digits. What are you using matrix powers for, graphs, recurrences or transitions?

Popular calculators

All Calculators