What is the Matrix Power Calculator?
This tool raises a square matrix A to an integer power n, written \(A^n\). It multiplies the matrix by itself n times and returns the resulting matrix. It works for 2x2, 3x3 and 4x4 matrices of real numbers. Matrix powers appear throughout linear algebra: Markov chains and transition matrices, graph adjacency powers (counting walks), discrete dynamical systems, and recurrence relations such as Fibonacci.
How to use it
Pick the matrix size, type each entry of A into the grid cell by cell (decimals and negatives are allowed), then enter the integer exponent n and calculate. Use n = 0 to get the identity matrix, n = 1 to return A unchanged, and any n ≥ 2 for repeated multiplication. If A is invertible you may also enter a negative n, which computes the inverse first and raises it to |n|.
The formula
A power is defined recursively: \(A^0 = I\) (the identity), \(A^1 = A\), and \(A^n = A \cdot A^{n-1}\). The product \(C = A \cdot B\) of two j×j matrices has entries \(C[i][k] = \sum A[i][m] \cdot B[m][k]\). This calculator uses exponentiation by squaring for efficiency, but the answer is identical to plain repeated multiplication: $$A^{\,n} = \underbrace{A \cdot A \cdots A}_{n\ \text{times}}$$ Matrix power is only defined when A is square (rows = columns).
Worked example
Let A = [[1, 2], [3, 4]] and n = 2. Then \(A^2 = A \cdot A\) gives $$c_{11} = 1 \cdot 1 + 2 \cdot 3 = 7,\quad c_{12} = 1 \cdot 2 + 2 \cdot 4 = 10,\quad c_{21} = 3 \cdot 1 + 4 \cdot 3 = 15,\quad c_{22} = 3 \cdot 2 + 4 \cdot 4 = 22,$$ so \(A^2 = [[7, 10], [15, 22]]\). Squaring once more (or computing \(A^3 = A^2 \cdot A\)) gives \(A^3 = [[37, 54], [81, 118]]\).
FAQ
What does n = 0 return? The identity matrix I of the same size, by convention.
Can I use a negative exponent? Yes, if A is invertible (determinant ≠ 0). \(A^{-k}\) equals \(\left(A^{-1}\right)^k\), that is $$A^{\,n} = \left(A^{-1}\right)^{\left|n\right|},\quad \det(A) \neq 0$$ If the determinant is 0 the result is undefined and the calculator warns you.
Why do some entries show tiny decimals? Floating-point rounding can accumulate for large powers or large entries; results are rounded to about 14 significant digits.