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

$\boldsymbol{\cdot1}$ | $\boldsymbol{\cdot2}$ | $\boldsymbol{\cdot3}$ | $\boldsymbol{\cdot4}$ | $\boldsymbol{\cdot5}$ | $\boldsymbol{\cdot6}$ | $\boldsymbol{\cdot7}$ | $\boldsymbol{\cdot8}$ | $\boldsymbol{\cdot9}$ | $\boldsymbol{\cdot10}$ | |
---|---|---|---|---|---|---|---|---|---|---|

$\boldsymbol{1\cdot}$ | $1$ | $2$ | $3$ | $4$ | $5$ | $6$ | $7$ | $8$ | $9$ | $10$ |

$\boldsymbol{2\cdot}$ | $2$ | $4$ | $6$ | $8$ | $10$ | $12$ | $14$ | $16$ | $18$ | $20$ |

$\boldsymbol{3\cdot}$ | $3$ | $6$ | $9$ | $12$ | $15$ | $18$ | $21$ | $24$ | $27$ | $30$ |

$\boldsymbol{4\cdot}$ | $4$ | $8$ | $12$ | $16$ | $20$ | $24$ | $28$ | $32$ | $36$ | $40$ |

$\boldsymbol{5\cdot}$ | $5$ | $10$ | $15$ | $20$ | $25$ | $30$ | $35$ | $40$ | $45$ | $50$ |

$\boldsymbol{6\cdot}$ | $6$ | $12$ | $18$ | $24$ | $30$ | $36$ | $42$ | $48$ | $54$ | $60$ |

$\boldsymbol{7\cdot}$ | $7$ | $14$ | $21$ | $28$ | $35$ | $42$ | $49$ | $56$ | $63$ | $70$ |

$\boldsymbol{8\cdot}$ | $8$ | $16$ | $24$ | $32$ | $40$ | $48$ | $56$ | $64$ | $72$ | $80$ |

$\boldsymbol{9\cdot}$ | $9$ | $18$ | $27$ | $36$ | $45$ | $54$ | $63$ | $72$ | $81$ | $90$ |

$\boldsymbol{10\cdot}$ | $10$ | $20$ | $30$ | $40$ | $50$ | $60$ | $70$ | $80$ | $90$ | $100$ |

**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 $A$ above 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:

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

And:

In a more concise notation, we can write them as $(3, 0, 1)$ and $(-1, 2, -1)$. 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** $A$ is, as we already mentioned, **the span of the column vectors** $\vec{v}_1$, $\vec{v}_2$, $\vec{v}_3$, ..., $\vec{v}_n$ (where $n$ is the number of columns in $A$), i.e., it is the space of all **linear combinations** of $\vec{v}_1$, $\vec{v}_2$, $\vec{v}_3$, ..., $\vec{v}_n$, which is the set of all vectors $w$ of the form:

Where $\alpha_1$, $\alpha_2$, $\alpha_3$, ...$\alpha_n$ are any numbers. In our case, this means the space of all vectors:

With $\alpha$ and $\beta$ 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 $4$ columns is defined by $4$ 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 $\vec{v}_1$, $\vec{v}_2$, $\vec{v}_3$, ..., $\vec{v}_n$ are linearly independent vectors if the equation:

(here $0$ is the vector with zeros in all coordinates) holds if and only if $\alpha_1=\alpha_2=\alpha_3=...=\alpha_n$. 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 $0$) 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 $3\times 2$:

If the first cell in the first row (in our case, $a_1$) 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 $s_2$ 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 $1$'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**.

**Ready?**

## 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: $(1, 3, -2)$, $(4, 7, 1)$, and $(3, -1, 12)$. 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 $3$. 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 $a_1$, $b_1$, and $c_1$. Looking back at our values, we input

Similarly, for the other two columns we have

And:

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**!