Matrix Power Calculator
Welcome to the matrix power calculator, where we'll study the topic of taking an integer exponent of a matrix. In essence, taking the power of a matrix is the same thing as with regular numbers: you use multiplication several times.
Learning how to square a matrix is quite simple, but when the exponent increases, the task gets tiresome and tricky. That's why we also show how to calculate matrix powers using eigenvalues and eigenvectors — a route that makes A100 barely harder than A2.
Let's not waste a second longer and go straight into the nitty-gritty, shall we?
What is a matrix?
Say that you were sent to the supermarket to do some grocery shopping. Apparently, the fridge is half empty, and you have a BBQ party planned for tomorrow. Still, you don't want to be a hoarder and buy too much, so you decide to make a shopping list. You need a dozen eggs, four pounds of potatoes, a couple of large water bottles, a bar of chocolate…
When you write the items you need one after the other, together with how much you should buy, what you end up with is a table. If you want to keep your hand on your home budget, you might even want to add one more column with the prices. Or yet another one with a tax on the products. In the end, you get a table that is very concise but carries a lot of information. The idea behind a matrix is very similar.
A matrix is an array of elements (usually numbers) that has a set number of rows and columns. An example of a matrix would be:
A = ⎡ 3 −1 ⎤
⎢ 0 2 ⎥
⎣ 1 −1 ⎦
Moreover, we say that a matrix has cells, or boxes, into which we write the elements of our array. For example, the matrix A above has the value 2 in the cell that is in the second row and the second column. The starting point here are 1-cell matrices, which are, for all intents and purposes, the same thing as real numbers.
As you can see, matrices came to be when a scientist decided that they needed to write a few numbers concisely and operate with the whole lot as a single object. As such, they naturally appear when dealing with:
- Systems of equations, especially with Cramer's rule and the (reduced) row echelon form;
- Vectors and vector spaces;
- 3-dimensional geometry (e.g., the dot product and the cross product);
- Linear transformations (translation and rotation); and
- Graph theory and discrete mathematics.
We can look at matrices as an extension of the numbers as we know them, because they contain more information than a single value. As such, it makes sense to define some basic operations on them, like addition and subtraction. We, however, are more interested in taking an exponent of a matrix. Intuitively, it should be connected with matrix multiplication, and indeed it is. So let's start small and see first how to square a matrix.
Matrix multiplication: how to square a matrix?
The most important thing we need to know about matrix multiplication is that sometimes it can't be done. In fact, a product A · B of two matrices exists if and only if the first matrix has as many columns as the other has rows. For example, recall the 3 × 2 matrix A from the section above. We can multiply it by a matrix of size 2 × 3, but not by a matrix of size 3 × 2.
Fortunately for us, that condition translates into something very simple in our case: the exponent of a matrix exists if and only if the matrix is square. Observe that it indeed makes sense: if A² = A · A exists, then A (the first factor) must have as many columns as A (the second factor) has rows — which is only possible when A has the same number of rows and columns.
In general, if A has entries an,m and B has entries bn,m, then the product A · B is the matrix with entries:
cn,m = an,1·b1,m + an,2·b2,m + … + an,k·bk,m
In words: the entry in row n and column m of the product is the dot product of the n-th row of A with the m-th column of B. Squaring a matrix is just this rule with B = A:
⎡ 1 1 ⎤² ⎡ 1·1+1·1 1·1+1·0 ⎤ ⎡ 2 1 ⎤ ⎣ 1 0 ⎦ = ⎣ 1·1+0·1 1·1+0·0 ⎦ = ⎣ 1 1 ⎦
From there, A³ = A² · A, A⁴ = A³ · A, and so on. Two special cases are worth remembering:
- A⁰ = I, the identity matrix — no matter which square matrix A you started with.
- A−n = (A−1)n, which only exists when det(A) ≠ 0.
You don't have to do all n − 1 multiplications, though. To get A¹⁰, it's cheaper to square repeatedly: A² = A · A, A⁴ = A² · A², A⁸ = A⁴ · A⁴, and then A¹⁰ = A⁸ · A². That's 4 multiplications instead of 9, and the gap only widens: A⁴⁰ needs 6 instead of 39. This trick is called exponentiation by squaring, and our calculator shows you the full chain it used.
Calculating matrix power using eigenvalues and eigenvectors
Repeated squaring is fast, but there's an even slicker way. If A is diagonalizable, we can write:
A = P · D · P−1
where D is a diagonal matrix holding the eigenvalues of A, and P holds the corresponding eigenvectors as its columns. The magic happens when you raise this to a power. Watch the middle terms collapse:
A² = (P·D·P−1)(P·D·P−1) = P·D·(P−1·P)·D·P−1 = P·D²·P−1
The same cancellation repeats for every factor, which gives the key formula:
An = P · Dn · P−1
And here's why that's such a win: D is diagonal, so Dn is just each eigenvalue raised to the n-th power — no matrix multiplication at all. P and P−1 never change with n. So once you've diagonalized A, computing A¹⁰⁰ costs exactly the same as computing A². It also tells you what happens in the long run: the largest |λ| (the spectral radius) decides whether An shrinks to zero, stays bounded, or blows up.
Not every matrix is diagonalizable, mind you. If an eigenvalue repeats but doesn't supply enough independent eigenvectors, the matrix is defective and this route is closed — repeated squaring still works fine. And if the eigenvalues are complex, An rotates: writing λ = r(cos θ + i sin θ), De Moivre's formula gives λn = rn(cos nθ + i sin nθ), so the powers spiral with modulus rn and angle nθ.
Example: Using the matrix power calculator
Let's try the calculator's default: the Fibonacci matrix, raised to the 10th power.
- Choose the matrix size: 2 × 2.
- Enter the exponent: 10.
- Fill in the cells: first row 1, 1; second row 1, 0.
The calculator returns:
⎡ 1 1 ⎤¹⁰ ⎡ 89 55 ⎤ ⎣ 1 0 ⎦ = ⎣ 55 34 ⎦
Recognize those numbers? 34, 55, 89 are consecutive Fibonacci numbers. That's no coincidence — this matrix raised to the n-th power always produces F(n+1), F(n), F(n), F(n−1), which is exactly how you compute the billionth Fibonacci number quickly.
A few more things worth noticing in the results:
- Its eigenvalues are the golden ratio φ ≈ 1.618 and −1/φ ≈ −0.618. Since the spectral radius is φ > 1, the entries grow — by a factor of φ each step.
- det(A) = −1, so A is unimodular: its inverse is also a whole-number matrix, and negative powers stay exactly integer too. Try an exponent of −10.
- A is symmetric, so every power of it is symmetric as well — and indeed 55 appears in both off-diagonal cells.
Two identities are checked for you on every run, and they're a genuinely free way to catch a mistake: det(An) = det(A)n and tr(An) = Σ λin — the trace of the power equals the sum of the n-th powers of the eigenvalues. For our example, 89 + 34 = 123 = φ¹⁰ + (−1/φ)¹⁰. Try it yourself!