Number of rows
3
Number of columns
2
A=
a1a2
|b1b2
c1c2
First row
a₁
a₂
Second row
b₁
b₂
Third row
c₁
c₂
Result
rank|=0

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.

So make yourself a nice cup of coffee, and let's begin!

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: -$10. 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

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, matrix A above has the value 2 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 needs 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:

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, 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.

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 n rows as n 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 v₁, v₂, v₃,..., vₙ are linearly independent if the equation

a₁*v₁ + a₂*v₂ + a₃*v₃ + ... + aₙ*vₙ = 0,

where a₁, a₂, a₃,..., aₙ are some real numbers, is true if and only if a₁ = a₂ = a₃ = ... = aₙ = 0. Equivalently, at least one of the vectors is the sum of the other ones (with some multiplicities).

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. 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

A =
a₁ a₂
| b₁ b₂
c₁ c₂

Then, provided that a₁ is not zero, the first step of the Gaussian elimination will transform the matrix into something in the form

a₁ a₂
| 0 s₂
0 t₂

with some real numbers s₂ and t₂. Then, as long as s₂ is not zero, the second step will give the matrix

a₁ a₂
| 0 s₂
0 0

Now we need to observe that the bottom row represents the zero vector (it has 0'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 2.

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 3 × 2 can never be a full rank matrix, and further translates to the following general rule: if A is a matrix of size n × m, then

rank(A) ≤ min(n,m).

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.

A =
0 2 -1
| 1 0 1
| 2 -1 3
1 1 4

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 4 × 3, so we input 4 under the number of rows, and 3 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 a₁, a₂, and a₃, so we look back at our array and put its first row under these symbols:

a₁ = 0, a₂ = 2, a₃ = -1.

Similarly, we input the other three rows:

b₁ = 1, b₂ = 0, b₃ = 1,

c₁ = 2, c₂ = -1, c₃ = 3,

d₁ = 1, d₂ = 1, d₃ = 4.

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 0. 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?

1 0 1
| 0 2 -1
| 2 -1 3
1 1 4

Now that's more like it! With this, we can take care of the 2 and the 1 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 1 to work with and 2 + (-2)*1 = 0 and 1 + (-1)*1 = 0, we add a (-2) multiple of the first row to the third one, and a (-1) multiple to the fourth. Observe that we don't have to do anything with the second row since we already have 0 there.

1 0 1
| 0 2 -1
| 2 + (-2)*1 -1 + (-2)*0 3 + (-2)*1
1 + (-1)*1 1 + (-1)*0 4 + (-1)*1
=
=
1 0 1
| 0 2 -1
| 0 -1 1
0 1 3

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 2 in the second row to eliminate the -1 and the 1 from the two bottom rows. Just as before, we add a suitable multiple of the second row: this time, it'll be 0.5 for the third row, and -0.5 for the last.

1 0 1
| 0 2 -1
| 0 -1 + 0.5*2 1 + 0.5*(-1)
0 1 + (-0.5)*2 3 + (0.5)*(-1)
=
=
1 0 1
| 0 2 -1
| 0 0 0.5
0 0 2.5

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 2.5 in the fourth row using the 0.5 from the third one. We add a multiple of (-5) to obtain

1 0 1
| 0 2 -1
| 0 0 0.5
0 0 2.5 + (-5)*0.5
=
=
1 0 1
| 0 2 -1
| 0 0 0.5
0 0 0

The matrix has three non-zero rows, which means that rank(A) = 3. 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?

Maciej Kowalski, PhD candidate

Get the widget!

Matrix Rank Calculator can be embedded on your website to enrich the content you wrote and make it easier for your visitors to understand your message.

It is free, awesome and will keep people coming back!

Matrix Rank Calculator