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 (similarly as in the matrix multiplication calculator) 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 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:
Moreover, we say that a matrix has cells, or boxes, into which we write the elements of our array. For example, the above matrix, , has the value 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.
🔎 If you want to add or subtract several matrixes, our matrix addition calculator will come in handy!
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, we can easily do it, 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 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 from the above section. We can multiply it by a matrix of size , but not by a matrix of size (because has three rows).
Fortunately for us, the above matrix multiplication condition translates into something very simple in our case: the exponent (integer, at least ) of a matrix exists if and only if it is a square matrix. Observe that it indeed makes sense: if exists, then (the first factor) must have as many rows as (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 has entries , where denotes the number of the row, and denotes the column. This means that an entry of would refer to the number in the second row of the fourth column. Similarly, let have entries . If the product is a matrix with entries , then we have
In other words, to obtain the entry in row and column in the matrix product, we need to take the -th row of the first matrix and the -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 gives again an array of size .
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 array and check how to square such a matrix.
Let be given by:
and the cells of its second power are denoted by:
Then, according to the above matrix multiplication rule, we have:
But what if we increase the exponent? What comes with greater powers?
We could just repeat this multiplication as many times as we need. However, if the matrix power is, say, , 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, a way to bring their beauty to the surface involves eigenvalues and eigenvectors.
For more information about eigenvalues and eigenvectors, please check our eigenvalue and eigenvector calculator. Here, however, we'll focus on the usability of them.
Say that you have a matrix of size , and you want to find . 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 is diagonalizable. This means that it must have exactly eigenvalues (counted with their multiplicities) and eigenvectors.
If , , ,…, are the eigenvalues and , , ,…, are the eigenvectors, then:
and is the matrix whose first column consists of the coordinates of , the second consists of , and so on. Note also that the last factor on the right, i.e., the denotes the matrix inverse of . You can quickly evaluate the inverse of any matrix with our inverse matrix calculator.
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:
Let's analyze what happened here step by step.
We know that the matrix power is just a multiplication of two copies of , so that's what we wrote.
Using eigenvalues and eigenvectors, we can decompose:
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, and are not the same thing.
We rearrange the brackets so that we have next to . These are inverse elements (just like inverse fractions), so their product gives us the identity element - the matrix which has 's along the main diagonal and 's elsewhere. Think of it as a matrix equivalent to the number .
The identity element changes nothing in matrix multiplication (just like in regular number multiplication), so we can forget about it.
We get rid of the brackets, which gives two copies of next to each other. This is nothing else but the square of .
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 and leave the and on the sides. In our case, this means that:
"But what does it change? I had to get , and now I need ." Well, the thing is that diagonal matrices (such as ) 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.,
This way, instead of multiplying thirty matrices, we simply multiply three: , (which we get immediately from ), and . Pretty cool, isn't it? And it saves a lot of time and a lot of work!
🙋 Omni's diagonalize matrix calculator is a dedicated tool that helps you diagonalize any matrix in a second.
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 for the matrix:
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, . This will show us a symbolic image of such an array with its entries denoted , , , and so on. Before we move on to those, we input the matrix power that we'd like to calculate, which for us is .
The picture shows that the first row of has entries , , and . We look back at the task at hand and input the relevant numbers into the matrix power calculator:
- , , and .
Similarly, the two other rows give:
- , , ;
- , , .
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 matrices.) For our matrix , it will tell us that its eigenvalues are , , and , while the corresponding eigenvectors are , , . This means that:
Now, if we recall the previous section, then we can use this decomposition to write:
What is more, we have: