Raising a matrix to a power means multiplying the matrix by itself a certain number of times, just like raising a regular number to a power. If you want A³, you compute A × A × A. The key requirement: only square matrices (same number of rows and columns) can be raised to a power, because matrix multiplication requires the inner dimensions to match. A 2×3 matrix multiplied by itself is simply undefined.
The Basic Rules
Matrix exponentiation follows a few foundational conventions that mirror ordinary exponents. A square matrix raised to the power of 1 is just the matrix itself. A square matrix raised to the power of 0 is defined as the identity matrix (the matrix equivalent of the number 1, with ones on the diagonal and zeros everywhere else). And A² means A × A, A³ means A × A × A, and so on.
For negative powers, A⁻¹ is the inverse of A, and A⁻² equals (A⁻¹)². This only works if the matrix is invertible, meaning its determinant is not zero. A matrix with a zero determinant has no inverse, so negative powers don’t exist for it.
How to Multiply Step by Step
For small matrices and low powers, direct multiplication is the most straightforward approach. To compute A², you multiply A by itself using standard matrix multiplication: each entry in the result is the dot product of a row from the first copy of A and a column from the second copy. For a 2×2 matrix, this means four entries, each computed from two multiplications and an addition.
Say you have:
A = [[2, 1], [0, 3]]
To find A², multiply A × A. The top-left entry is (2)(2) + (1)(0) = 4. The top-right entry is (2)(1) + (1)(3) = 5. The bottom-left is (0)(2) + (3)(0) = 0. The bottom-right is (0)(1) + (3)(3) = 9. So A² = [[4, 5], [0, 9]].
For A³, you’d then multiply that result by A again. This gets tedious quickly as either the matrix size or the exponent grows, which is why shortcuts exist.
The Diagonal Matrix Shortcut
If your matrix happens to be diagonal (nonzero entries only along the main diagonal), raising it to a power is trivial. You just raise each diagonal entry to that power individually. A diagonal matrix with entries 0.5 and 0.1 raised to the kth power gives you 0.5^k and 0.1^k on the diagonal, with zeros everywhere else.
This is fast and requires no matrix multiplication at all. It also explains why the next method, diagonalization, is so useful.
Using Diagonalization for Higher Powers
Many matrices can be decomposed into the form A = PDP⁻¹, where D is a diagonal matrix of the eigenvalues of A, and P is a matrix whose columns are the corresponding eigenvectors. This is called diagonalization, and it transforms the problem of raising A to a power into the much simpler problem of raising a diagonal matrix to a power.
The formula is: A^n = P D^n P⁻¹.
Since D is diagonal, D^n is computed by raising each eigenvalue to the nth power. Then you just perform two matrix multiplications (P times D^n, then the result times P⁻¹) to get A^n. This works for any positive integer n, no matter how large.
Here’s the practical process for a 2×2 matrix:
- Find the eigenvalues by solving the characteristic equation det(A – λI) = 0.
- Find the eigenvectors for each eigenvalue by solving (A – λI)v = 0.
- Build P using the eigenvectors as columns, and build D with the eigenvalues on the diagonal.
- Compute P⁻¹, then calculate P D^n P⁻¹.
Not every matrix can be diagonalized this way. A matrix is diagonalizable only if you can find a full set of linearly independent eigenvectors (one for each dimension). If you can’t, you’ll need a different approach, such as Jordan normal form, which handles repeated eigenvalues that don’t produce enough eigenvectors.
Exponentiation by Squaring
When you need to compute a matrix to a large power programmatically, the naive approach of multiplying n-1 times is slow. Exponentiation by squaring (also called binary exponentiation) reduces the number of multiplications from n down to roughly log₂(n). For n = 1,000,000, that’s about 20 multiplications instead of 999,999.
The idea exploits the fact that:
- If n is even: A^n = (A^(n/2))²
- If n is odd: A^n = A × A^(n-1)
You break the exponent down into powers of 2, compute A¹, A², A⁴, A⁸, and so on by repeatedly squaring, then multiply together only the powers you need. For example, A¹³ = A⁸ × A⁴ × A¹, because 13 = 8 + 4 + 1 in binary. This technique is standard in competitive programming and numerical computing libraries.
Reducing High Powers With Cayley-Hamilton
The Cayley-Hamilton theorem offers another path for simplifying high powers of a matrix. It states that every square matrix satisfies its own characteristic equation. For a 2×2 matrix, the characteristic polynomial is degree 2, and this means any power of A can be rewritten as a linear combination of A and the identity matrix I.
For an n×n matrix, any power of A (no matter how large) can be reduced to a polynomial in A of degree n-1 or less. To do this, you divide the polynomial representing your desired power by the characteristic polynomial using long division. The remainder is your simplified expression.
As an example from MIT course materials: for A = [[3, 1], [1, 2]], the polynomial A⁴ + 3A³ + 2A² + A + I reduces to simply 146A – 184I. Instead of computing four separate matrix powers and adding them, you compute one scalar multiplication of A and subtract a scaled identity matrix. For large polynomial expressions involving a matrix, this can save enormous amounts of computation.
Tools for Computing Matrix Powers
In practice, most people use software rather than computing by hand. In Python with NumPy, numpy.linalg.matrix_power(A, n) handles the computation directly. MATLAB uses the syntax A^n for matrix powers, though you need to be careful: A.^n (with the dot) raises each element individually, which is a completely different operation. In Wolfram Alpha, you can type something like {{2,1},{0,3}}^5 and get the result immediately.
One common pitfall in MATLAB and similar tools: if your matrix isn’t square, you’ll get an error telling you to check that the matrix is square and the power is a scalar. This is the software enforcing the fundamental rule that only square matrices can be raised to a power. If you intended element-wise exponentiation (raising each number in the matrix to a power independently), use the dot-caret operator instead.

