Column Space Calculator
Welcome to Omni's column space calculator, where we'll study how to determine the column space of a matrix. The whole process is quite similar to how we calculate the rank of a matrix (we did it at our matrix rank calculator), but, if you're new to the topic, don't worry! We'll slowly go through all the theory and provide you with some examples. And we will not only find the column space, we'll give you the basis for the column space as well!
So sit back, pour yourself a nice cup of tea, and let's get to it!
What is a matrix?
The first time we learned about matrices was way back in primary school. Yes, that's right! You've known them all this time without even realizing it.
At first, we counted apples and bananas using our fingers. Then they taught us to add and subtract the numbers, and still fingers proved the superior tool for the task. If nothing else, they're very handy wink wink.
But then multiplication barged its way into the picture, and everything got a little more complicated. Even if we took off our shoes and started using our toes as well, it was often not enough. Those big-headed scientists... why did they invent so many numbers?
Still, there is this simple tool that came to the rescue - the multiplication table. And that was the first matrix of our lives! (Unless you'd already seen the movie by that time, which we don't recommend at that age.)
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 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, as we've seen at the Cramer's rule calculator;
- 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. After all, the multiplication table above is just a simple example, but, in general, we can have any numbers we like in the cells: positive, negative, fractions, decimals. If you're feeling especially brainy, you can even have some complex numbers in there too.
The usefulness of matrices comes from the fact that they contain more information than a single value (i.e., they contain many of them). Arguably, it makes them fairly complicated objects, but it's still possible to define some basic operations on them, like, for example, addition and subtraction
However, the possibilities don't end there! Matrices have an extremely rich structure. To illustrate this with an example, let us mention that to each such matrix, we can associate several important values, such as the determinant.
🙋 Our matrix determinant calculator teaches you all you need to know to calculate the most fundamental quantity in linear algebra!
But let's not dilly-dally too much. After all, we're here for the column space of a matrix, and the column space we will see! We have the basic object well-defined and understood, so it's no use wasting another minute - we're ready to go further!
Column space of a matrix
Believe it or not, the column space has little to do with the distance between columns supporting a building. Rather than that, we will look at the columns of a matrix and understand them as vectors. As such, they will be elements of Euclidean space, and the column space of a matrix will be the subspace spanned by these vectors.
To have something to hold on to, recall the matrix from the above section:
It has two columns:
In a more concise notation, we can write them as and . Note how a single column is also a matrix (as are all vectors, in fact). In this case, the array has three rows, which translates to the columns having three elements. As such, they are elements of three-dimensional Euclidean space.
The column space of a matrix is, as we already mentioned, the span of the column vectors , , , ..., (where is the number of columns in ), i.e., it is the space of all linear combinations of , , , ..., , which is the set of all vectors of the form:
Where , , , ... are any numbers. In our case, this means the space of all vectors:
With and set arbitrarily.
In fact, we can also define the row space of a matrix: we simply repeat all of the above, but exchange column for row everywhere. However, we'll not do that, and it's not because we're lazy. No, really, it's not that. Seriously.
In mathematics, the column space of a matrix is more useful than the row space. This is because when we look at an array as a linear transformation in a multidimensional space (a combination of a translation and rotation), then its column space is the image (or range) of that transformation, i.e., the space of all vectors that we can get by multiplying by the array.
If the above paragraph made no sense whatsoever, don't fret. We can leave it at "It's useful to know the column space of a matrix." The rest is in the details.
So why do we need the column space calculator? After all, the space is defined by its columns. Why use some fancy tool for that?
It may happen that, although the column space of a matrix with columns is defined by column vectors, some of them are redundant. Here's where the definition of the basis for the column space comes into play.
Basis for the column space
As we've mentioned at the end of the previous section, it may happen that we don't need all of the matrix' columns to find the column space. What we mean by this is that we can obtain all the linear combinations of the vectors by using only a few of the columns.
We call this notion linear dependence. We say that , , , ..., are linearly independent vectors if the equation:
(here is the vector with zeros in all coordinates) holds if and only if . Otherwise, we say that the vectors are linearly dependent.
In essence, linear dependence means that you can construct (at least) one of the vectors from the others. If that's the case, then it's redundant in defining the span, so why bother with it at all? We can just forget about it.
The basis of the space is the minimal set of vectors that span the space. With what we've seen above, this means that out of all the vectors at our disposal, we throw away all which we don't need so that we end up with a linearly independent set. This will be the basis.
"Alright, I get the idea, but how do I find the basis for the column space?" Well, how nice of you to ask! We were just about to answer that!
To find the basis for the column space of a matrix, we use so-called Gaussian elimination (or rather its improvement: the Gauss-Jordan elimination). This algorithm tries to eliminate (i.e., make ) as many entries of the matrix as possible using elementary row operations. They are:
- Exchange two rows of the matrix.
- Multiply a row by a non-zero constant.
- Add to a row a non-zero multiple of a different row.
For instance, say that you have a matrix of size :
If the first cell in the first row (in our case, ) is non-zero, then we add a suitable multiple of the top row to the other two rows, so that we obtain a matrix of the form:
Next, provided that is non-zero, we do something similar using the second row to transform the bottom one:
Lastly (and this is the extra step that differentiates the Gauss-Jordan elimination from the Gaussian one), we divide each row by the first non-zero number in that row. This gives an array in its so-called reduced row echelon form:
🙋 The name may sound daunting, but we promise is nothing too hard. Visit our reduced row echelon form calculator to learn more!
Also, note how you don't have to do the Gauss-Jordan elimination yourself - the column space calculator can do that for you! Just open up the
advanced mode and choose "Yes" under "Show the reduced matrix?".
We call the first 's in each row the leading ones. The last thing to do here is read off the columns which contain the leading ones. These are the ones that form the basis for the column space.
Phew, that was a lot of time spent on theory, wouldn't you say? It's high time we leave the letters and see some example which actually have numbers in them.
Example: using the column space calculator
Your dream has finally come true - you've bought yourself a drone! You can't wait to turn it on and fly around for hours (how many? find it out with our drone flight time calculator). However, apparently, before you start playing around, you have to input three vectors that will define the drone's movements.
It will only be able to fly along these vectors, so it's better to do it well. The worst-case scenario is that they will define a low-dimensional space, which won't allow us to move freely. After all, the world we live in is three-dimensional, so restricting ourselves to 2 is like only being able to turn left.
You close your eyes, flip a coin, and choose three vectors at random: , , and . Note that each has three coordinates because that is the dimension of the world around us. Now, we'd better check if our choice was a good one, i.e., if their span is of dimension . Oh, how fortunate that we have the column space calculator for just this task!
Let's take a look at our tool. At the top, we have to choose the size of the matrix we're dealing with. We have three vectors (so we need three columns) with three coordinates each (so we need three rows). We choose these values under "Number of columns" and "Number of rows". This will trigger a symbolic picture of our chosen matrix to appear, with the notation that the column space calculator uses.
We need to input our three vectors as columns of the matrix. We see that the first one has cells denoted by , , and . Looking back at our values, we input
Similarly, for the other two columns we have
Once we input the last number, the column space calculator will spit out the answer: it will give us the dimension and the basis for the column space. But we're too ambitious to just take this spoiler of an answer for granted, aren't we? Let's grab a piece of paper and calculate the whole thing ourselves!