Matrix Power Calculator
Raise a square matrix to any whole power using binary exponentiation, with the intermediate squarings shown and negative powers via the exact inverse.
A¹⁰
| 89 | 55 |
| 55 | 34 |
Repeated squarings (the working)
|n| = 10 is 1010 in binary, so A is squared once per binary digit and multiplied into the running answer wherever that digit is 1 — 5 multiplications instead of 9.
A²
| 2 | 1 |
| 1 | 1 |
A⁴
| 5 | 3 |
| 3 | 2 |
A⁸
| 34 | 21 |
| 21 | 13 |
What is the Matrix Power Calculator?
The ByteTools Matrix Power Calculator computes Aⁿ for any whole exponent from −64 to 64, using binary exponentiation — squaring and multiplying — so A¹⁶ takes four multiplications instead of fifteen.
- Binary exponentiation — A¹⁶ in four multiplications, not fifteen
- Intermediate squarings A², A⁴, A⁸ shown as working with the binary exponent
- A⁰ returns the identity matrix; negative powers use the exact Gauss-Jordan inverse
- Exact fraction arithmetic keeps long chains of multiplication precise
- Clear message when a singular matrix rules out negative powers
- Handles 1×1 to 5×5 matrices entirely in your browser
How to use the Matrix Power Calculator
- 1
Enter the square matrix A, one row per line, with values separated by spaces or commas.
- 2
Type the exponent, from −64 to 64. Use 0 for the identity or a negative value for the inverse.
- 3
Read the resulting matrix, and compare the multiplication count against the naive method.
- 4
Expand the repeated-squarings panel to see A², A⁴, A⁸ and the binary breakdown of the exponent.
- 5
Copy the result with the copy button.
About the Matrix Power Calculator
The ByteTools Matrix Power Calculator computes Aⁿ for any whole exponent from −64 to 64, using binary exponentiation — squaring and multiplying — so A¹⁶ takes four multiplications instead of fifteen. The intermediate squarings A², A⁴, A⁸ are all displayed as working, and the page tells you how many multiplications it used against how many the naive repeated-multiplication method would need.
Edge cases are handled properly rather than being errors. A⁰ is the identity matrix for any square A, just as x⁰ = 1 for numbers. Negative exponents are computed as powers of A⁻¹, with the inverse found by exact Gauss-Jordan elimination on [A | I]; if the matrix is singular the tool explains that no inverse exists instead of producing nonsense.
All arithmetic uses exact fractions, so entries stay precise no matter how many multiplications are chained together. Everything runs as JavaScript in your browser — nothing is uploaded, and the page works offline.
Frequently asked questions
How do you calculate a matrix to a power?
You multiply the matrix by itself repeatedly, but a much faster route is binary exponentiation: square the matrix and multiply together the squares matching the 1 bits of the exponent. A¹⁰ is A⁸ × A², which is four multiplications rather than nine.
What is a matrix to the power of 0?
It is the identity matrix of the same size, for any square matrix. That is the convention that makes the exponent rules work, exactly as x⁰ = 1 does for ordinary numbers.
Can you raise a matrix to a negative power?
Yes, if the matrix is invertible. A⁻ⁿ is defined as (A⁻¹)ⁿ. If the determinant is zero there is no inverse, so no negative power exists — this calculator checks the determinant and tells you rather than failing silently.
What is the Fibonacci matrix trick?
Raising [[1,1],[1,0]] to the power n gives [[F(n+1), F(n)], [F(n), F(n−1)]], so matrix powers compute Fibonacci numbers. With binary exponentiation that means around 20 multiplications reach the millionth term instead of a million additions.
Why does the exponent stop at 64?
Because exact fraction arithmetic grows the numerators and denominators quickly, and beyond that range the numbers exceed what JavaScript can represent precisely. Capping the exponent keeps every answer exact rather than quietly wrong.
Related tools
Matrix Calculator
Add, subtract and multiply matrices up to 6×6, transpose them or scale by a number. Type matrices as simple rows and get instant, copyable results.
Matrix Inverse Calculator
Invert any square matrix up to 6×6 using Gauss-Jordan elimination on [A|I]. Detects singular matrices and verifies the result with A × A⁻¹ = I.
Characteristic Polynomial Calculator
Compute det(λI − A) for matrices up to 6×6 with the Faddeev-LeVerrier recursion, plus trace and determinant cross-checks and a Cayley-Hamilton proof.
Eigenvalue and Eigenvector Calculator
Find eigenvalues and eigenvectors of 2×2 and 3×3 matrices from the characteristic polynomial, with algebraic and geometric multiplicity spelled out.
Determinant Calculator
Compute the determinant of any square matrix up to 6×6 instantly. See the full cofactor expansion for 2×2 and 3×3 matrices, worked step by step.