Chapter 8. Linear combinations of vectors
§8.1 [TEXT] Definition of a basis
Recall in Section 7.1 the following two questions I posed:
- Q1.
If is a linear transform and it’s given that
what are the vectors for and ?
- Q2.
If is a linear transform and it’s given that
what is ?
Now if I wanted to make life harder for you, I could have asked:
- Q3.
- Given and , what is ?
This is a lot harder than Q1; however, the question is still solvable. If I locked you in a room for an hour and told you to work on it, I think many of you would eventually get the answer:
So this shows you something interesting: actually, and are only special insomuch as they make arithmetic easy. But if you know the outputs of and , you can still find all the outputs of you want. So really and aren’t that special.
Hence we say and are a basis of (we’ll give the definition in just a moment). Every like can be written as for some and , and hence you can solve Q3.
However, let’s consider more variations of the question Q3.
- Q4.
Given , what is ?
- Q5.
Given , , and what is ?
- Q6.
Given and , what is ?
The variants Q4, Q5, Q6 are all strange in some way and should make you squint.
- Q4 is obviously impossible; not enough information to find an answer.
- Q5 is solvable, but has redundant information. You can delete any one hypothesis.
- Q6 suffers from both defects. Even though there are two givens, they are redundant.
With the examples illustrated here, let me give the relevant terms:
A linear combination of a set of vectors , …, in is a sum of the form .
Then a set of vectors , …, in is:
- linearly independent if every linear combination gives a different vector; equivalently, there’s no nontrivial linear combination giving other than ;
- spanning in if every other vector in can be written as some linear combination;
- a basis of if both of the above are true; in other words, every vector in can be made in exactly one way.
The punch line is that these concepts correspond to the behaviors in the questions above; Q3 has all the “good” properties above, and each of Q4, Q5, Q6 are missing something.
In Q3, and are a basis of . Hence, Q3 is a well-formed question.
In Q4, the vector by itself is not spanning (though it is linearly independent). That’s what makes Q4 impossible to answer: you can’t make out of just .
In Q5, , , are not linearly independent (though they are spanning), because there’s a dependence
between them.
In Q6, the two vectors and are missing both good properties. The two vectors give redundant information; because , there is a dependence between the vectors. And the two vectors are not spanning: you can’t make out of and .
So that’s the example showing what the definition is trying to communicate.
You might have a sense already that there’s no way to write a “good” question like Q3 for that uses any number of vectors other than two, and you’d be right. It turns out a basis for always has exactly vectors; that’s what it means that “ is -dimensional”. More examples of correct hunches that we’ll explain momentarily:
- In , at least vectors are never linearly independent.
- In , at most vectors are never spanning. (So a basis is always vectors exactly.)
- Also, if you have exactly vectors in , and they’re linearly independent, then they’re a basis.
- Also, if you have exactly vectors in , and they’re spanning, then they’re a basis.
§8.2 [RECIPE] How to detect a basis
This begs the question: does there exist a way to easily tell whether some vectors are a basis? For , you can probably tell by looking. But for for , it might be trickier.
In fact, the following theorem is true, though we won’t prove it.
Suppose you have a bunch of vectors in . Any two of the following imply the third:
- There are exactly vectors.
- The vectors are linearly independent.
- The vectors span all of .
Moreover, if item 1 is true, the following fourth item works too:
- The determinant of the matrix with the vectors as column vectors is nonzero.
We can’t prove this result in this class, but you might have the instinct that 1-3 should all be true for a basis. The determinant might be more surprising, so here’s an explanation why.
Let and consider three vectors , , in . We give an informal explanation for why the determinant lets you tell whether these three vectors are a basis or not.
The matrix in question is formed by taking , , as the columns of the matrix:
Recall the determinant geometrically represents the signed volume of the parallelepiped spanned by these vectors.
Suppose , , are not spanning (i.e. not a basis), meaning they fail to occupy the full three-dimensional space. Then these vectors are coplanar: you can only get “some” vectors out of them. So geometrically, the parallelepiped they form lacks height in the direction perpendicular to the plane; resulting in zero volume, that is, .
Conversely, if , , were a basis, then pictorially this means they span the entire space, so the parallelepiped had better be nondegenerate. The nondegeneracy corresponds to having nonzero volume, that is, . (The sign of the determinant tells you something about the orientation, but we don’t care about this sign, just the nonzero-ness.)
Anyway, in practice, if you have an explicit set of vectors, the recipe is simple now:
Suppose you’re given a list of vectors in and want to know if they’re a basis.
- If the number of vectors is not , output “no” and stop.
- Otherwise, form the matrix with the vectors as columns, and compute its determinant. Output “yes” if and only if the determinant is nonzero.
The determinant thing matters: the determinant is doing a lot of work for you. When the determinant is unnecessary, because you can just use “slope”: it’s obvious that and have a dependence. But for you can’t eyeball it13. For example, the three vectors
might look like unrelated small numbers, but surprisingly it turns out that
(5)
Without “slope”, you cannot notice these dependences by sight for , so use the determinant.
Solution. No, because
Solution. Yes, because
The above sample was generated randomly when I gave this lecture at MIT. The way I presented this was I went up to the board and wrote:
“Is , , a basis for ? Answer: yes.”
Then I asked my students to make up nine numbers to fill in the question marks. Of course, they picked big numbers, and I got to show off my amazing five-digit multiplication skills.
I did this stunt of writing the answer before I even knew the question to make a point: if you pick large truly random numbers, the determinant will be some large random number too, so there’s no chance you’ll just get . So you should always expect “random” vectors in to be a basis, and it’s only if you cherry-pick them you’ll get a non-basis.
§8.3 [TEXT] Spans
The basis is the “best-case scenario”, because if you have a basis , …, of then it means every vector of can be made out of in exactly one way. We won’t always be so lucky, so we have a word that means “what you can make out of ”.
Consider vectors in .
- The span of any basis, like and , is all of , by definition.
- Moreover, the span of any set containing a basis is also all of . For example, the span of , , , is still all of . (Sure, it’s not a basis as there are lots of dependencies, but that doesn’t change that you can make any vector in out of them; you just have some extra vectors you don’t have to use.)
- The span of the vectors , , is the line . These are the only vectors you can make out of combinations of these three vectors.
- The span of the single vector is also the line . That is, in the previous example, and were totally useless.
- The span of the single vector is only one point: itself.
Consider vectors in .
The span of any basis, like , , is all of , by definition.
The span of the vectors , , is the line consisting of multiples of and , though I think it’s easier to express this as “multiples of ”. These are the only vectors you can make out of combinations of these three vectors.
The span of the single vector is the same line. That is, in the previous example, and were totally useless.
The span of , , is more interesting. We saw before that these three vectors actually have a dependence, so they are not a basis and the span is not all of .
But the span is not just a line either: it’s a two-dimensional plane! In fact, all three vectors are contained inside the plane
And the span is actually that entire plane; any point in the plane turns out to be formed as a combination, in fact just using the first two vectors is enough. For example, if I picked a random point on the plane like then it turns out the relevant combination is
(I won’t explain how I got these coefficients, but you could probably figure out yourself if you wanted to).
The span of the single vector is only one point: itself.
What you are probably gathering from all these examples is that the span also has a concept of dimension: for example in , we saw an example of
- a 0-dimensional span, just the single point .
- a 1-dimensional span, the line consisting of multiples of
- a 2-dimensional span, the plane .
- a 3-dimensional span if you have a full basis.
This is worth knowing:
Remember, in , the span of a bunch of vectors is
- always -dimensional for some (so there are kinds of answers);
- always contains the origin .
§8.4 [RECIPE] Describing the span of several vectors
In 18.02 you might be asked to describe the span of some vectors in and . From the examples above, you should be able to extrapolate the recipe.
- 0D case: Are all the vectors the zero vector ? If so the span is just a single point.
- 1D case: Are all the vectors pointing the same direction (i.e. multiples of each other)? If so, and there is at least one nonzero vector, the span is a line through the origin in the common direction of the vectors.
- 2D case: Are there two (nonzero) vectors not pointing in the same direction (equivalently, are linearly independent)? If so, the span is all of .
- 0D case: Are all the vectors the zero vector ? If so the span is just a single point.
- 1D case: Are all the vectors pointing the same direction (i.e. multiples of each other)? If so, and there is at least one nonzero vector, the span is a line through the origin in the common direction of the vectors.
2D case: Is there more than one direction present, but you can’t find three vectors which are linearly independent? If so, the span is a plane through the origin.
- If you want the equation of the plane, use the cross product.
- 3D case: Are there three vectors among them which are linearly independent from each other? If so, the span is all of .
(In 18.02 the reason for the 2D case is really by process of elimination: you can think of the 2D bullet as what’s left over if you rule out 0D, 1D, 3D.)
Solution. It should be a two-dimensional plane. This follows by process of elimination: we know and don’t apply here (none of these vectors are zero or are multiples of each other) and we can rule out because we can calculate the determinant
to see that our three vectors are not linearly independent.
How do we actually find the equation of the plane? Well, really what we’re asking is to find a plane through the origin passing through all of , , (we’re promised it exists from the determinant being zero: again, that’s what it means to not be spanning). We just want a normal vector to the plane, which we can get by taking the cross product of any two of the vectors. Arbitrarily, we use the first two:
That’s the normal vector we wanted, so we now know is the plane needed. This simplifies to just
Just for comparison, if you had used the second and third vector instead, you’d get
while the second and third vectors would give
which are all still multiples of , so the plane is still .
It’s not a coincidence that the magic numbers , , from Equation 5 are reappearing in the normal vectors, but this time I won’t explain why this is happening, and let you ruminate on it yourself if you want to figure out.
Solution. As we mentioned above (Equation 5), you shouldn’t eyeball three or more dimensions; if you get three vectors in and want to know if they are linearly independent or not, you should always take the determinant:
So the three vectors are a basis and the span is all of .
§8.5 [TEXT] Systems of equations
As we commented earlier, a randomly chosen set of vectors is “usually” a basis for . I want to now connect this to something else you’ve seen in high school: a “random” linear system of equations and variables “usually” has only one solution.
For example, in high school algebra, you probably were asked to solve systems of equations like
You can do this using whatever method you’re used to; you should find as the only solution. And you can probably already tell that and could have been any numbers, and you’d still always get exactly one solution.
Why is this relevant to the stuff about basis? Well, the point is you can view the variables above as coefficients in a linear combination and consider the previous system of equations as saying
That means our observations can be rephrased in terms of our linear algebra language:
In other words, as long as the column vectors made from the coefficients on the left-hand side of the system of equations form a basis, there’s always in fact one solution.
So what goes wrong when it’s not a basis? Let’s bring back the example we had in Equation 5.
Consider a system like
This equation obviously has at least one solution: . We saw that , , is not a basis of , and what that translates to is saying there are other solutions too: reading off Equation 5, note that , , is a solution for any .
What if we consider something like
instead? We still know the coefficients on the left-hand side have a dependency, so we expect something to “go wrong”.
In this case, the kind of failure is different: turns out to not be in the span of our three vectors. In fact, we earlier saw that the span of the vectors was the plane , which doesn’t contain .
So for this system, satisfying these three equations simultaneously should be impossible (that is, there are no solutions rather than too many solutions). And in fact you might be able to see this directly: if you add the first two equations and subtract the last one you can see the contradiction:
On the other hand, if we have
then the span does contain , so we expect to be back in the “too many solutions” case. I won’t show you how to come up with these numbers (though it’s actually not that hard), but you can find one example of a solution is . If you put that together with Equation 5 you can come up with a lot of solutions now:
In summary, what we’ve seen in this section is that for a system of equations in variables, we should look at the column vectors made by the coefficients. Then
- If those vectors form a basis of (usual case), the system of equations always has one solution.
- Otherwise, the system of equations is defective: either it has no solutions at all (is self-contradictory), or there are actually infinitely many solutions.
§8.6 [RECIPE] Number of solutions to a square system of linear equations
Now, remember that in practice the way we see whether or not vectors form a basis is by considering a determinant. So we can rephrase our findings from the previous section into the following recipe using the word “determinant” in place of “basis”.
Suppose you are asked to find the number of solutions to a square system
Let be the matrix formed by the .
- If , you don’t even have to look at ; just output “exactly 1 solution”.
If , you should output either “zero solutions” or “infinitely many solutions”, depending on whether there is at least one solution. To see which case you’re in:
There’s a common case , where the system has an obvious solution . Thus output “infinitely many solutions”.
When , you can usually tell by looking whether the two equations are redundant or not. Output “infinitely many solutions” if the two equations are multiples of each other; output “zero solutions” if the two equations contradict each other.
Otherwise, for , if you can’t guess a solution, you should eliminate variables one by one. However, this case doesn’t occur in 18.02.
Examples of what I mean when I say “tell by looking” for :
The system and is obviously “infinitely many”, because the two equations are the same. In a case like this, output “infinitely many”.
The system and is obviously “no solutions”, because it would imply , which is self-contradictory. In a case like this, output 0.
§8.7 [EXER] Exercises
Exercise 8.1. Take your birthday and write it in eight-digit -- format. Consider the two vectors
For example, if your birthday was May 17, 1994 you would take and .
- Compute the span of those two vectors in .
- Find a current or former K-pop idol who gets a different answer from you when they use their birthday.