Matrix Power Calculator

Created by Maciej Kowalski, PhD candidate
Reviewed by Dominik Czernia, PhD and Jack Bowater
Last updated: Apr 06, 2022

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 (in this case, matrix 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.

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 the tax on the products. In the end, you get an 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 above matrix, A, 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:

We can look at matrices as an extension of the numbers as we know them (real or complex) because they contain more information than a single value (i.e., it contains many of them). As such, it would make sense to define some basic operations on them, like, for example, addition and subtraction. And indeed, it can be easily done, but the truth is that their structure is much richer. To illustrate that, let us mention that to every matrix we can associate several important values, such as their rank or determinant, which allow us to do many interesting useful things with them.

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 rows as the other has columns. For example, recall the matrix A from the above section. We can multiply it by a matrix of size 3×3, but not by a matrix of size 3×2 (because A has three rows).

Fortunately for us, the above matrix multiplication condition translates into something very simple in our case: the exponent (integer, at least 2) of a matrix exists if and only if it is a square matrix. Observe that it indeed makes sense: if A² = A * A exists, then A (the first factor) must have as many rows, as A (the second factor) has columns.

However, before we get to our very special case, let's see how matrix multiplication works in general.

Say that A has entries an,m, where n denotes the number of the row, and m denotes the column. This means that an entry of a2,4 would refer to the number in the second row of the fourth column. Similarly, let B have entries bn,m. If the product A * B is a matrix with entries cn,m, then we have

cn,m = an,1 * b1,m + an,2 * b2,m + an,3 * b3,m + ...

In other words, to obtain the entry in row n and column m in the matrix product, we need to take the n-th row of the first matrix and the m-th column of the second matrix and multiply their elements in pairs one by one, and then add it all up. Note, that in particular, this means that multiplying two square matrices of size n×n gives again an array of size n×n.

Well, that sure looks more complicated than regular number multiplication, doesn't it? To get a firmer grasp of the topic, let's look at an example of a 2×2 array and check how to square such a matrix.

Let A be given by

A =
a₁ a₂
b₁ b₂

and the cells its second power are denoted by

x₁ x₂
y₁ y₂

Then, according to the above matrix multiplication rule, we have

x₁ = a₁ * a₁ + a₂ * b₁,

x₂ = a₁ * a₂ + a₂ * b₂,

y₁ = b₁ * a₁ + b₂ * b₁,

y₂ = b₁ * a₂ + b₂ * b₂.

But what if we increase the exponent? What comes with greater powers?

Higher matrix powers can be costly.

We could just repeat this multiplication as many times as we need. However, if the matrix power is, say, 50, it may take us a whole day to get it. Lucky for us, there is a trick to save us from such tedious calculations. Do you want to see it?

Calculating matrix power using eigenvalues and eigenvectors

In general, matrices can be difficult to work with. Their entries can be some large numbers or ugly fractions (who even remembers how to multiply those?). Fortunately, there is a way to bring their beauty to the surface: it involves eigenvalues and eigenvectors.

For more information about eigenvalues and eigenvectors, please check our dedicated calculator. Here, however, we'll focus on the usability of them.

Say that you have a matrix A of size n×n, and you want to find A³⁰. If you choose to do regular matrix multiplication that many times, then we wish you good luck and suggest that you might need to find a hobby.

For those of us who care about our mental health, we'll now show how to finish this task quicker, more efficiently, and in general, in a way that could impress that pretty girl in your class. Note, however, that in order for this to work, we need to know that A is diagonalizable. This means that it must have exactly n eigenvalues (counted with their multiplicities) and n eigenvectors.

If λ₁, λ₂, λ₃,..., λₙ are the eigenvalues and v₁, v₂, v₃,..., vₙ are the eigenvectors, then

A = S * D * S⁻¹,


D =
λ₁ 0 0
| 0 λ₂ 0
0 0 λₙ

and S is the matrix whose first column consists of the coordinates of v₁, the second consists of v₂, and so on. Note also that the last factor on the right, i.e., the S⁻¹ denotes the matrix inverse of S.

Well, fair enough, we have some new matrices that don't give much at first glance. However, you'll find they help us a lot. To see this, let's check how to square such a matrix decomposition:

A² = A * A = (S * D * S⁻¹) * (S * D * S⁻¹) =

= (S * D) * (S⁻¹ * S) * (D * S⁻¹) =

= (S * D) * I * (D * S⁻¹) =

= (S * D) * (D * S⁻¹) =

= S * D² * S⁻¹

Let's analyze what happened here step by step.

  1. We know that the matrix power is just a multiplication of two copies of A, so that's what we wrote.
  2. Using eigenvalues and eigenvectors, we can decompose:

A = S * D * S⁻¹.

  1. Matrix multiplication is associative. This means that we can arbitrarily change the order of multiplication. Or, in other words, we can put the brackets wherever we like. Note, however, that in general, matrix multiplication is not commutative, so we can't have the factors change places. For instance, S * D and D * S are not the same thing.
  2. We rearrange the brackets so that we have S⁻¹ next to S. These are inverse elements (just like inverse fractions), so their product give us the identity element - the matrix I which has 1's along the main diagonal and 0's elsewhere. Think of it as a matrix equivalent to the number 1.
  3. The identity element I changes nothing in matrix multiplication (just like 1 in regular number multiplication), so we can forget about it.
  4. We get rid of the brackets, which gives two copies of D next to each other. This is nothing else but the square of D.

You can see that once we know how to square such a matrix, we can do the same thing to higher powers, i.e., the diagonalization will move the exponent to the diagonal matrix D and leave the S and S⁻¹ on the sides. In our case, this means that

A³⁰ = (S * D * S⁻¹)³⁰ = S * D³⁰ * S⁻¹.

"But what does it change? I had to get A³⁰, and now I need D³⁰." Well, the thing is that diagonal matrices (such as D) are very simple to raise to some power. In fact, we just need to transfer the exponent to each of the values on the diagonal, i.e.,

D³⁰ =
λ₁³⁰ 0 0
| 0 λ₂³⁰ 0
0 0 λₙ³⁰

This way, instead of multiplying thirty matrices, we simply multiply three: S, D³⁰ (which we get immediately from D), and S⁻¹. Pretty cool, isn't it? And it saves a lot of time and a lot of work!

Why don't we leave all those mathematical symbols aside and finally see an example? After all, the theory is useful to start with, but it's numbers that will appear on the test.

Example: Using the matrix power calculator

Say that your teacher decides to test how much you've learned about matrix multiplication and divides the class into groups. Your task is to find A¹³ for the matrix

A =
1 0 0
| 2 1 -1
0 -1 1

Well, the entries aren't too large, so regular matrix multiplication applied several times shouldn't be too bad. However, you can already see that the other members of your group don't feel like helping. Do they even know how to square a matrix? Eh, how is it that it's always you that does all the dirty work? Never mind, today we've learned a trick or two, so let's get to work.

First of all, let's see how the matrix power calculator can give us an answer in a few simple clicks. To begin with, we need to tell it the size of the matrix we have by choosing the right option under "Matrix size" - in our case, 3×3. This will show us a symbolic image of such an array with its entries denoted a₁, a₂, b₁, and so on. Before we move on to those, we input the matrix power that we'd like to calculate, which for us is 13.

We see in the picture that the first row of A has entries a₁, a₂, and a₃. We look back at the task at hand and input the relevant numbers into the matrix power calculator

a₁ = 1, a₂ = 0, and a₃ = 0.

Similarly, the two other rows give

b₁ = 2, b₂ = 1, b₃ = -1,

c₁ = 0, c₂ = -1, c₃ = 1.

Once we input the last entry, the matrix power calculator will give us the answer at the bottom of the calculator.

However, we won't spoil the answer and we'll calculate the matrix power ourselves first. So, grab a piece of paper, and let's get to it.

We might just use regular matrix multiplication several times, but where's the fun in that? Now that we know about eigenvalues and eigenvectors, let's use them to speed things up!

Note that the matrix power calculator can give us all the tools we need - we only need to ask it nicely. Just go to the advanced mode and choose "Yes" under "Show diagonalization?". (Note, however, that this option is not available for 4×4 matrices.) For our matrix A, it will tell us that its eigenvalues are λ₁ = 2, λ₂ = 0, and λ₃ = 1, while the corresponding eigenvectors are v₁ = (0,-1,1), v₂ = (0,1,1), v₃ = (0.5,0,1). This means that

A = S * D * S⁻¹,


D =
2 0 0
| 0 0 0
0 0 1


S =
0 0 0.5
| -1 1 0
1 1 1

Now, if we recall the previous section, then we can use this decomposition to write

A¹³ = (S * D * S⁻¹)¹³ = S * D¹³ * S⁻¹.

What is more, we have

D¹³ =
2 0 0 ⌉¹³
| 0 0 0
0 0 1
2¹³ 0 0
| 0 0¹³ 0
0 0 1¹³
8192 0 0
| 0 0 0
0 0 1

Now it's just a matter of multiplying that matrix by S from the left and S⁻¹ from the right. As extra motivation, let us mention that matrix multiplication is a piece of cake when one of them is diagonal (like D¹³) because of all the zeros outside of the diagonal. Let's see this in practice and calculate S * D¹³:

S * D¹³ =

0 0 0.5
| -1 1 0
1 1 1
8192 0 0
| 0 0 0
0 0 1
0 0 0.5*1
| -1*8192 0 0
1*8192 0 1*1
0 0 0.5
| -8192 0 0
8192 0 1

Lastly, we need to find the inverse of S and multiply the above matrix by it from the right. By the way the other group members are on their phones, so you don't expect any help there. Luckily, if you don't feel like doing that, or just want to check your solution, all the tools you may need are easily available on the Omni Calculator website. We always have your back!

Maciej Kowalski, PhD candidate
Matrix size
Power (k)
First row
Second row
Check out 34 similar linear algebra calculators 🔢
Adjoint matrixCharacteristic polynomialCholesky decomposition… 31 more
People also viewed…

Dividing radicals

The dividing radicals calculator is here to help you find the quotient of two roots of arbitrary order.

Length of a rectangle

The length of a rectangle calculator can take two dimensions of your rectangle (width, area, diagonal, or perimeter) and work out the length of your rectangle.


Do you feel like you could be doing something more productive or educational while on a bus? Or while cleaning the house? Well, why don't you dive into the rich world of podcasts! With this podcast calculator, we'll work out just how many great interviews or fascinating stories you can go through by reclaiming your 'dead time'!


Use our titration calculator to determine the molarity of your solution.
Copyright by Omni Calculator sp. z o.o.
Privacy policy & cookies
main background