Welcome to the matrix rank calculator, where you'll have the opportunity to learn how to find the rank of a matrix and what that number means. In short, it is one of the basic values that we assign to any matrix, but, as opposed to the determinant, the array doesn't have to be square. The idea of matrix rank in linear algebra is connected with linear independence of vectors. In particular, a full rank matrix is an array whose rows are all linearly independent, and such objects are of particular interest to mathematicians.
What is a matrix?
You know how, when you get bored, you stare at the paint patterns on the ceiling and your mind begins to wonder and, before you know it, you've come up with a whole new system of categorizing the style of paint chips? Mathematicians are no different. Maths all started when one of them was sent (by their spouse, no doubt) to fetch some turkey for dinner and a couple of apples for the kids. One turkey, two apples. Easy enough, those are simple numbers. They come quite naturally, so we call them just that - natural numbers.
But groceries cost money, so buying all of that made a small dent in the household budget: . This new negative number lumped in with the natural numbers to make up the so-called integers. But that's not all! The kids are fussy enough, so the apples had to be cut into halves and then into quarters. Those new values were called fractions and we grouped with what we had so far to form the rational numbers.
And then there came that Pythagoras guy from across the yard with his theorem which introduced some ugly new numbers that he called square roots. What is more, he declared that , used in circle calculations, is also one and called the whole lot the real numbers. But that must have been the end of it, right? Surely there can't be anything more, can there?
Well, oddly enough, mathematics didn't end there. While Isaac Newton was bored enough to invent calculus, some other mathematicians figured out even more numbers and called them complex numbers. Although both are quite interesting and extremely useful, that's not why we're here.
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, matrix above has the value in the cell that is in the second row and the second column. The starting point here is 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 he needed to write a few numbers concisely and operate with the whole lot as a single object. As such, they are extremely useful when dealing with:
- Systems of equations, as you can discover at Omni's Cramer's rule calculator;
- Vectors and vector spaces;
- 3-dimensional geometry (e.g., the dot product and the cross product);
- Eigenvalues and eigenvectors; and
- Graph theory and discrete mathematics.
When we operate with regular numbers, we usually want to add them, take their fractions, and so on. More or less, the same is possible with matrices, but it tends to get messy. Adding and subtracting arrays is simple enough, we taught you to do it in the blink of an eye at our matrix addition calculator, but when we move on to multiplication, it gets tricky, trust us. Not to mention division, which here is not an operation in itself, but rather a multiplication by the inverse, which sometimes doesn't even exist. And let's not forget about the cofactor matrix and adjoint matrix...
Fortunately, all of the above is a matter for a different time and a different calculator. We're here to see how to find the rank of a matrix, and that's what we'll focus on now.
Definition: the rank of a matrix
Rank in linear algebra is a number that we assign to any matrix. It is the maximal number of linearly independent rows of the matrix. Equivalently, though it's not at all obvious at first glance, it is also the maximal number of linearly independent columns. But what does all this fancy language really mean?
The definition comes from looking at a matrix row by row (or column by column). As such, we can think of our array with rows as separate lines of numbers. Such objects, i.e., matrices with one row, are called vectors, and they are elements of so-called vector spaces. For example, the numerical axis, the Cartesian plane, and 3-dimensional space are all examples of vector spaces.
We say that vectors , , , ..., are linearly independent if the equation
where , , , ..., are some real numbers, is true if and only if . Equivalently, at least one of the vectors is the sum of the other ones (with some multiplicities).
🔎 For an in-depth analysis of linear dependence and independence, we invite you to visit the linear independence calculator!
Just to paint a picture, when we are on the real plane (vectors are just pairs of real numbers), then two linearly independent vectors will span the whole plane (we say that we have a full rank matrix in this case). This means that any point, i.e., any pair of real numbers, can be represented as a linear sum of the two vectors (sum of the two with some multiplicities). However, if they are linearly dependent, then this will not be possible, and the pair will only span a line instead. Since, in this case, we only have two objects, it will mean that one is a multiple of the other.
Rank in linear algebra is a tool that keeps track of linear independence, what vector space we're in, and the vector space's dimension. So, now that we know what to use it for, let's see how to find the rank of a matrix.
How to find the rank of a matrix?
There are several ways to figure out the rank of a given matrix. Arguably, the simplest one is Gaussian elimination, or its slightly modified version, Gauss-Jordan elimination. They rely on so-called elementary row operations to modify the matrix into its (reduced) row echelon form — the form you can discover at Omni's (reduced) row echelon form calculator). From there, we can easily read out the rank of the matrix.
The operations are:
- Exchanging two rows of the matrix;
- Multiplying a row by a non-zero constant; and
- Adding to a row a non-zero multiple of a different row.
The key property here is that, although the above operations change our matrix, they don't change its rank. In other words, learning how to find the rank of a matrix boils down to learning the Gauss (or Gauss-Jordan) algorithm.
Say that your matrix is:
Then, provided that is not zero, the first step of the Gaussian elimination will transform the matrix into something in the form
with some real numbers and . Then, as long as is not zero, the second step will give the matrix
Now we need to observe that the bottom row represents the zero vector (it has 's in every cell), which is linearly dependent with any vector. Therefore, the rank of our matrix will simply be the number of non-zero rows of the array we obtained, which in this case is .
In particular, observe that, whatever we'd done, we couldn't have obtained the third row non-zero since every consecutive number in that row was eliminated by one of the rows above. This means that a can never be a full rank matrix, and further translates to the following general rule: if is a matrix of size , then
Phew, that was quite some time pondering over theory. How about we move onto a numerical example and see the matrix rank calculator in action?
Example: using the matrix rank calculator
Suppose that you're on a date in a fancy restaurant, and your partner challenges you into a matrix rank calculating competition. Apparently, it's a new viral TikTok challenge, so what can you do?
You ask a gentleman struggling with a steak on the table next to you for an example of a matrix. Obviously, he happily obliges.
Ready? Set? Go!
Luckily enough, you know the Omni Calculator website inside out and visit the matrix rank calculator straight away. To make it work in your favor, we first need to tell the calculator what we're dealing with. It's a matrix of size , so we input under the number of rows, and under the number of columns. This will show us a symbolic example of a matrix similar to ours. We just need to give it the correct numbers.
According to the picture, the first row has elements , , and , so we look back at our array and put its first row under these symbols:
Similarly, we input the other three rows:
Once we input the last number, the matrix rank calculator will spit out the rank of our matrix. Unfortunately, just as it was about to do so, your date makes you put the phone down and points out that it'll be more fun to see how much time it takes to do it without any fancy tools. Oh well, it looks like we'll have to calculate it by hand, after all.
First of all, we see that the first element of the first row is . We don't like zeros - we can't use them in Gauss-Jordan elimination to get rid of the other numbers in that column. So why don't we exchange the first row with the second?
Now that's more like it! With this, we can take care of the and the in the bottom two rows. To do this, we add a suitable multiple of the first one to these rows, so that we'll obtain zeros in the whole of the first column, apart from the first row. Since we have to work with and and , we add a multiple of the first row to the third one, and a multiple to the fourth. Observe that we don't have to do anything with the second row since we already have there.
Alright, we've lost quite some time trying to use the matrix rank calculator before, so we need to speed up a little.
We move on to the second column. We'd like to use the in the second row to eliminate the and the from the two bottom rows. Just as before, we add a suitable multiple of the second row: this time, it'll be for the third row, and for the last.
You see your partner nervously scribbling on her piece of paper, and the gentleman on the table next to you is cheering you on. Time for the last step.
Now we'd like to get rid of the in the fourth row using the from the third one. We add a multiple of to obtain:
The matrix has three non-zero rows, which means that . You look triumphantly at your date and declare yourself the winner. The gentleman next to you is clapping, and you decide to celebrate it with a slice of chocolate cake. That much fun deserves a nice dessert and a good tip, don't you think?