Welcome to Omni's null space calculator, where we'll study the topic of how to find the null space of a matrix. In essence, it means finding all the vectors that are mapped to zero by the given array
A. This notion comes from treating
A as a linear map, and as such, the null space of a matrix is also often called the kernel of that matrix. In general, it will have infinitely many elements, so "finding all the vectors" basically means determining the basis for the null space (whose dimension we call the nullity of the matrix).
So sit back, bring along a cup of coffee, and let's get to it!
What is a matrix?
A long time ago in a galaxy far, far away... No, wait! This doesn't seem right for us talking about what a matrix is. Let's try again.
Several years ago, in the virtual world that we call reality, we used to go to primary school. And it was then when we first saw what a matrix is. That's right; they had taught us about these high-school-algebra objects long before we learned the most memorable information from our teenage education - that mitochondria are the powerhouses of cells.
We begin our mathematical education with learning numbers by counting dogs and kitties. Soon enough, the thing gets more complicated, and they tell us to add and subtract those numbers. But it's not that bad; we have our fingers to help us with that.
However, to our wonder, it appears that mathematics doesn't end there. The next topic they introduce is multiplication, and that one is trickier. Don't get us wrong; the operation makes sense. After all, if there are five trees and each has seven apples, then it's useful to know that in total, we have thirty-five apples. The problem is that we don't have that many fingers! How do we grasp this if our most reliable tool failed us?
That's where matrices come in! Well, in a sense, at least.
To help us with our multiplication (and division), we are shown what is called a multiplication table - some rows and columns with numbers in it. Precisely like a matrix.
A matrix is an array of elements (usually numbers) with a set number of rows and columns. It is the main object of studies in. 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 the same thing as real numbers for all intents and purposes.
As you can see, matrices came to be when scientists 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;
- 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.
But it's just the beginning of our journey! We're here to learn how to find the null space of a matrix, and the word "null" hasn't even appeared yet. So let's not waste another minute and jump to to learn what it is that we're trying to calculate.
Null space/kernel of a matrix
As mentioned in the three-dimensional space, or the four-dimensional hyperspace (the list goes on, but we're focusing here on arrays of size up to
4×4). In other words, the elements of that space are vectors with one, two, three, or four coordinates, respectively.
The null space or the kernel of a matrix is the subspace consisting of all the vectors mapped to the zero vector of that space. In mathematical notation, for an array
n columns, this means all the vectors
v = (v₁, v₂,..., vₙ) for which
A·v = 0,
· here denotes matrix multiplication, and
0 is the zero vector, i.e.,
0 = (0,0,...,0) with
- The zero vector is always in the null space. After all, whatever matrix we have, we'll get zero if we multiply it by zero.
- In general, the kernel of a matrix can have infinitely many elements. In fact, if
(v₁, v₂,..., vₙ)is in the null space, then so is
(av₁, av₂,..., avₙ)for any real number
- You can extend Point 2. above further: if
xₖall belong to the null space, then so does every linear combination of these vectors.
- The above points boil down to the fact that the null space of a matrix is a vector subspace of the big Euclidean space. Therefore, if we want to study it in-depth, it'd be best to be able to describe what its elements look like in general. That's where the notion of a basis for the null space comes into play - more on that in .
Alright, so the null space of a matrix is just a subspace of elements that satisfy some formula. Fair enough. But how is it useful? What does it tell us about the matrix itself? Well, how fortunate of you to ask, we were just getting to that!
Nullity of a matrix
The nullity of a matrix is the dimension of its null space. Simple as that, no strings attached. But although the nullity definition takes one line, let's try to go one step further and actually try to understand it.
Generally, the dimension of a space is equal to the size of its basis. Yup, yet another definition that uses words and notions that are not too easy themselves. Well, it looks like we'll have to go deeper than that.
xₖ be a collection of vectors from the same space. Then any vector
w of the form:
w = 𝛼₁*x₁ + 𝛼₂*x₂ + 𝛼₃*x₃ + ... + 𝛼ₖ*xₖ,
𝛼₁, 𝛼₂, 𝛼₃,..., 𝛼ₙ are arbitrary real numbers is called a linear combination of the vectors
xₖ. The space of all such vectors
w is called the span of
At times, it may happen that among
xₖ, some of the vectors are redundant. This means that you can construct all elements of the space from only a part of the
k vectors given. In that case, we say that
xₖ are linearly dependent. Otherwise, we call them linearly independent. (Please note that here, we mention all these notions briefly. For more in-depth study, be sure to check out the calculator dedicated to linear dependence.)
Any linearly independent set of vectors that generate a space is called its basis. In particular, the basis for the null space of a matrix is a collection of vectors that generate that matrix's kernel. Therefore, coming back to the nullity definition at the beginning of, we can reformulate it as follows:
|💡 The nullity of a matrix is the number of linearly independent vectors that generate the null space of that matrix.|
All in all, given a matrix (i.e., a linear map)
A that has
n columns (i.e., acts on elements of an
n-dimensional space), it is beneficial to know which elements are vanishing (that is, are mapped to zero) under
A. In other words, to know the null space of
A. For instance, if
A has, say,
4 columns and the nullity of that matrix is
3, then we know that
A "kills" three dimensions along the way, and the fewer dimensions there are, the easier the calculations.
A matrix's nullity is connected to its rank by the following theorem, called simply the rank-nullity theorem.
|💡 For a matrix |
In other words, if you know a matrix' nullity, then you know its rank and vice versa. For more information on that topic, be sure to check out Omni's calculator dedicated to the rank of a matrix.
Phew, it's been quite a few definitions, don't you think? Fortunately, the nullity definition was the last one for today, and it made us more than ready to finally learn how to find the null space of a matrix. Let's waste not a second longer, and see what we came here for!
How to find the null space of a matrix?
When we're trying to determine the kernel and nullity of a matrix, the primary tool to use is the Gauss-Jordan elimination. It is a handy algorithm that transforms a given matrix into its reduced row echelon form, which is so much easier to work with.
The idea is to "kill" (i.e., make zero) as many entries of the matrix as possible using the so-called elementary row operations. These 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 crucial property here is that the initial matrix, and its reduced row echelon form have the same rank and null space. Note that our null space calculator can show you how the input array looks after the Gauss-Jordan elimination due to its usefulness. It's enough to go into the advanced mode and choose the right option under "Show the reduced matrix?".
For example, suppose that we have a matrix that has three rows and four columns.
Then, the first step in the Gauss-Jordan elimination is to take the first cell in the first row, i.e.,
a₁ (provided that it is non-zero), and use the elementary row operations to kill the entries below it. This means that we add a suitable multiple of the top row to the other two so that we obtain a matrix of the form:
Next, we do something similar with the middle row. We take
s₂ (as long as it is non-zero) and use it to kill the entries below it. As a result, we get an array of the form:
Now comes the distinction between the Gauss-Jordan elimination and its simplified form, the Gaussian elimination: we divide each row by the first non-zero entry in that row. This gives:
And that's where we often end the algorithm, like, for instance, when we're looking for the column space of a matrix. In fact, for our purposes, we can already read off some useful information from the array we have.
The ones that appear as the first non-zero elements in each row are called the leading ones. In our example, we have them in the first, second, and third columns out of four. The number of columns that do not contain a leading one is equal to the nullity of that matrix. As a bonus, if we recalland the nullity definition, we get that the number of columns with a leading one is the rank of our matrix.
However, to find the basis for the null space, we'll modify the array some more. Again, we use elementary row operations, but this time we go from the bottom upwards. Firstly, we use the
1 in the third row to kill the entries above it.
Next, we do the same with the
1 in the middle row to kill the cell above it.
This, finally, is the matrix which will give us the basis for the null space. To determine it in detail, we follow a few simple rules.
- If the matrix has no columns without a leading one, the null space is trivial, i.e., it is of dimension
0and contains only the zero vector.
- If the array contains a column with nothing but zeros, say, the
k-th one, then the elementary vector
eₖis an element of the basis, i.e., the vector with
k-th coordinate and zeros otherwise.
- If a column, say, the
k-th one, doesn't have a leading one and has at least one non-zero entry, then we construct a vector
vof the basis by taking all the non-zero cells of that column and putting their opposites (i.e., the value times
-1) in the corresponding coordinates of
v. Moreover, we put
k-th coordinate and zeros in the remaining ones. Observe that this is what happens in the example above: from the matrix that we've obtained, we know that the vector
(u₄, m₄, r₄, 1)is in the basis for the null space.
- No other vectors belong to the basis.
Alright, we admit that although informative, this section was no walk in the park. But no worries - we hereby declare the end of theory! (For the rest of this article, of course, not forever.) We've spent so much time on it that we deserve an excellent example that actually has numbers in it rather than letters, don't you think?
Example: using the null space calculator
Say that you're sitting through the very last class before the winter break, and it just so happens that it's the linear algebra class. You can already see yourself running home to start packing for the mountain trip you have organized for the weekend. Oh, you just can't wait to go skiing, but first, you have to endure this last half an hour of mathematics.
You can see the teacher at the edge of dozing off. Apparently, not only you could use the break from school. However, they can't just end the class there and then, so they decide to give you one last task and whoever finishes it is free to leave. So the only thing separating you from the winter break is finding the null space of the following matrix:
Oh, how lucky we are that Omni is here with the null space calculator! Let's see how fast it will give us the answer to our problem.
The array we have at hand has two rows and four columns, so we begin by choosing the correct options under "Number of rows" and "Number of columns". This will trigger a symbolic matrix to appear with its cells denoted with symbols used under it. We see that the first row has entries
a₄, so looking back at the array
A, we input
a₁ = 2,
a₂ = -4,
a₃ = 8, and
a₄ = 2.
Similarly, the second row has
b-s in it, so we get
b₁ = 6,
b₂ = -12,
b₃ = 3, and
b₄ = 13.
Once we input the last number, the null space calculator will spit out the answer. However, let's not get ahead of ourselves and take the time to grab a piece of paper and calculate the whole thing ourselves.
We begin by applying the Gauss-Jordan elimination to
A. It has only two rows, so it shouldn't be too difficult.
We want to use the first element in the first row, i.e., the
2 to kill the entry below it. Since
6 + (-3)*2 = 0, we add a multiple of
-3 of the top row to the bottom one. This gives:
Next, just as Gauss-Jordan elimination states, we divide each row by the first non-zero entry. In our case, this translates to dividing the first row by
2 and the second by
A piece of cake, wasn't it?
Next, following the instructions from
1 from the second row to kill the
4 above it. Since
4 + (-4)*1 = 0, we add a multiple of
-4 of the bottom row to the top one and obtain
We got a matrix with two leading ones - in the first and third columns. Therefore, the nullity of our matrix is
2 (since there are four columns and
4 - 2 = 2).
To determine a basis for the null space, we again recall the instructions from
eₖ. We move on to check the columns that don't have leading ones: the second and fourth.
For the second, we construct a vector
v₁ with four coordinates (since the matrix has four columns). The first coordinate is
-2*(-1) = 2 (because we have
-2 in the row with the leading one in the first column), the second coordinate is
1 (because we're considering the second column), and the rest are zero. All in all, we have
v₁ = (2, 1, 0, 0).
Similarly, for the fourth, we get
v₂ whose first coordinate is
2⅓*(-1) = -2⅓ (because we have
2⅓ in the row with the leading one in the first column), the third is
-⅓*(-1) = ⅓ (because we have
-⅓ in the row with the leading one in the third column), the fourth one is
1 (because we're considering the fourth column), and the rest are zero. This gives
v₂ = (-2⅓, 0, ⅓, 1).
To sum up, the basis for the null space consists of two vectors:
v₁ = (2, 1, 0, 0) and
v₂ = (-2⅓, 0, ⅓, 1). The nullity of the matrix is
Keep the engine running; we're ready to hit the road and begin the winter break!