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 𝑇:ℝ2→ℝ2 is a linear transform and it’s given that

𝑇((34))=(𝜋9) and 𝑇((100100))=(012)

what are the vectors for 𝑇((103104)) and 𝑇((203204))?

Q2.

If 𝑇:ℝ2→ℝ2 is a linear transform and it’s given that

𝑇((10))=(13) and 𝑇((01))=(24)

what is 𝑇((5070))?

Now if I wanted to make life harder for you, I could have asked:

Q3.
Given 𝑇((34))=(𝜋9) and 𝑇((100100))=(012), what is 𝑇((1337))?

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:

(1337)=24(34)−0.59(100100)⟹𝑇((1337))=24(𝜋9)−0.59(012)=(24𝜋208.92).

So this shows you something interesting: actually, (10) and (01) are only special insomuch as they make arithmetic easy. But if you know the outputs of 𝑇((34)) and 𝑇((100100)), you can still find all the outputs of 𝑇 you want. So really (10) and (01) aren’t that special.

Hence we say (34) and (100100) are a basis of ℝ2 (we’ll give the definition in just a moment). Every 𝐯 like (1337) can be written as 𝑐1(34)+𝑐2(100100) for some 𝑐1 and 𝑐2, and hence you can solve Q3.

However, let’s consider more variations of the question Q3.

Q4.

Given 𝑇((34))=(𝜋9), what is 𝑇((1337))?

Q5.

Given 𝑇((34))=(𝜋9), 𝑇((100100))=(012), and 𝑇((103104))=(𝜋21) what is 𝑇((1337))?

Q6.

Given 𝑇((34))=(𝜋9) and 𝑇((300400))=(100𝜋900), what is 𝑇((1337))?

The variants Q4, Q5, Q6 are all strange in some way and should make you squint.

With the examples illustrated here, let me give the relevant terms:

Definition of a basis

A linear combination of a set of vectors 𝐯1, …, 𝐯𝑘 in ℝ𝑛 is a sum of the form 𝑐1𝐯1+…+𝑐𝑘𝐯𝑘.

Then a set of vectors 𝐯1, …, 𝐯𝑘 in ℝ𝑛 is:

  • linearly independent if every linear combination gives a different vector; equivalently, there’s no nontrivial linear combination giving 𝟎 other than 𝑐1=…=𝑐𝑘=0;
  • 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.

Example
  • In Q3, (34) and (100100) are a basis of ℝ2. Hence, Q3 is a well-formed question.

  • In Q4, the vector (34) by itself is not spanning (though it is linearly independent). That’s what makes Q4 impossible to answer: you can’t make (1337) out of just (34).

  • In Q5, (34), (100100), (103104) are not linearly independent (though they are spanning), because there’s a dependence

    (34)+(100100)=(103104)

    between them.

  • In Q6, the two vectors (34) and (300400) are missing both good properties. The two vectors give redundant information; because (300400)=100(34), there is a dependence between the vectors. And the two vectors are not spanning: you can’t make (1337) out of (34) and (300400).

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

§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 ℝ2, you can probably tell by looking. But for ℝ𝑛 for 𝑛≥3, it might be trickier.

In fact, the following theorem is true, though we won’t prove it.

Memorize: Basis for ℝ𝑛, “buy two get one free”

Suppose you have a bunch of vectors in ℝ𝑛. Any two of the following imply the third:

  1. There are exactly 𝑛 vectors.
  2. The vectors are linearly independent.
  3. The vectors span all of ℝ𝑛.

Moreover, if item 1 is true, the following fourth item works too:

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

Digression on why determinant does the right thing

Let 𝑛=3 and consider three vectors 𝐮, 𝐯, 𝐰 in ℝ3. 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 det(𝐴) 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, det(𝐴)=0.

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, det(𝐴)≠0. (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:

Recipe for checking if vectors form a basis

Suppose you’re given a list of vectors in ℝ𝑛 and want to know if they’re a basis.

  1. If the number of vectors is not 𝑛, output “no” and stop.
  2. 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 𝑛=2 the determinant is unnecessary, because you can just use “slope”: it’s obvious that (12) and (100200) have a dependence. But for 𝑛≥3 you can’t eyeball it13. For example, the three vectors

𝐯1=(134),𝐯2=(10111),𝐯3=(−9101)

might look like unrelated small numbers, but surprisingly it turns out that

109(134)−37(10111)−29(−9101)=𝟎.

(5)

Without “slope”, you cannot notice these dependences by sight for 𝑛≥3, so use the determinant.

Sample Question
Is (12), (100200) a basis for ℝ2?
Solution. No because |11002200|=0. In this case you can also see directly that 100(12)=(100200), so the vectors are not linearly independent.□
Sample Question
Is (1337), (4288) a basis for ℝ2?
Solution. Yes, because |13423788|=13⋅88−42⋅37≠0.□
Sample Question
Is 𝐯1=(134), 𝐯2=(10111), 𝐯3=(−9101) a basis for ℝ3?

Solution. No, because

|110−931104111|=1|110111|−10|31041|+(−9)|31411|=1(1−110)−10(3−40)+(−9)(33−4)=0.

□

Sample Question
Is (34218), (15317), (719113) a basis for ℝ3?

Solution. Yes, because

|3171425391181713|=ugly arithmetic=−18522≠0.

□

Remark: If you randomly generate numbers, you’ll get a basis

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

Sample Question
Is (1458), (38116), (619102) a basis for ℝ4?
Solution. No, there are three vectors, and ℝ4 needs to have exactly four vectors in every basis.□

§8.3 [TEXT] Spans

The basis is the “best-case scenario”, because if you have a basis 𝐯1, …, 𝐯𝑛 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 𝐯𝑖”.

Definition of span
The span of a set of vectors 𝐯1, …, 𝐯𝑘 in ℝ𝑛 refers to the vectors that you can make out of 𝐯𝑖 (i.e. can be written as a linear combination of 𝐯𝑖).
Example of spans in ℝ2

Consider vectors in ℝ2.

  • The span of any basis, like (35) and (711), is all of ℝ2, by definition.
  • Moreover, the span of any set containing a basis is also all of ℝ2. For example, the span of (35), (810), (711), (7001100) is still all of ℝ2. (Sure, it’s not a basis as there are lots of dependencies, but that doesn’t change that you can make any vector in ℝ2 out of them; you just have some extra vectors you don’t have to use.)
  • The span of the vectors (12), (1020), (100200) is the line 𝑦=2𝑥. These are the only vectors you can make out of combinations of these three vectors.
  • The span of the single vector (12) is also the line 𝑦=2𝑥. That is, in the previous example, (1020) and (100200) were totally useless.
  • The span of the single vector (00) is only one point: (00) itself.
Examples of spans in ℝ3

Consider vectors in ℝ3.

  • The span of any basis, like (34218), (15317), (719113) is all of ℝ3, by definition.

  • The span of the vectors (123), (102030), (100200300) is the line consisting of multiples of 𝑦=2𝑥 and 𝑧=3𝑥, though I think it’s easier to express this as “multiples of (123)”. These are the only vectors you can make out of combinations of these three vectors.

  • The span of the single vector (123) is the same line. That is, in the previous example, (102030) and (100200300) were totally useless.

  • The span of (134), (10111), (−9101) 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 ℝ3.

    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 (133720253362) then it turns out the relevant combination is

    (133720253362)=1891329(134)+198629(10111)

    (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 (000) is only one point: (000) itself.

What you are probably gathering from all these examples is that the span also has a concept of dimension: for example in ℝ3, we saw an example of

This is worth knowing:

Tip

Remember, in ℝ𝑛, the span of a bunch of vectors is

  • always 𝑑-dimensional for some 𝑑=0,…,𝑛 (so there are 𝑛+1 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 ℝ2 and ℝ3. From the examples above, you should be able to extrapolate the recipe.

Recipe for describing the span of vectors in ℝ2
  • 0D case: Are all the vectors the zero vector (00)? 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 ℝ2.
Sample Question
What is the span of the vectors (36), (1020), (100200), (500010000) in ℝ2?
Solution. All the vectors are multiples of (12), so the answer is a line: the multiples of (12).□
Sample Question
What is the span of (420321) and (6665) in ℝ2?
Solution. Because the two vectors are not multiples of each other, they are linearly independent. (The determinant lets you see this too: |4206663215|=420⋅5−321⋅666=−211686≠0.) Hence they are a basis of ℝ2 and the span is all of ℝ2.□
Recipe for describing the span of vectors in ℝ3
  • 0D case: Are all the vectors the zero vector (000)? 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 ℝ3.

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

Sample Question
What is the span of the vectors (369), (102030) and (100200300) in ℝ3?
Solution. All the vectors are multiples of (123), so it’s a line: the multiples of (123).□
Sample Question
What is the span of (134), (10111) and (−9101) in ℝ3?

Solution. It should be a two-dimensional plane. This follows by process of elimination: we know 𝑑=0 and 𝑑=1 don’t apply here (none of these vectors are zero or are multiples of each other) and we can rule out 𝑑=3 because we can calculate the determinant

|110−931104111|=0

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 (1,3,4), (10,1,11), (−9,10,1) (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:

(134)×(10111)=|𝐞1𝐞2𝐞313410111|=29𝐞1+29𝐞2−29𝐞3.

That’s the normal vector we wanted, so we now know 29𝑥+29𝑦−29𝑧=0 is the plane needed. This simplifies to just 𝑥+𝑦−𝑧=0.□

Digression

Just for comparison, if you had used the second and third vector instead, you’d get

(134)×(−9101)=|𝐞1𝐞2𝐞3134−9101|=−37𝐞1−37𝐞2+37𝐞3

while the second and third vectors would give

(10111)×(−9101)=|𝐞1𝐞2𝐞310111−9101|=−109𝐞1−109𝐞2+109𝐞3

which are all still multiples of 𝐞1+𝐞2−𝐞3, so the plane is still 𝑥+𝑦−𝑧=0.

It’s not a coincidence that the magic numbers 29, 37, 109 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.

Sample Question
What is the span of (34218), (15317), (719113) in ℝ3?

Solution. As we mentioned above (Equation 5), you shouldn’t eyeball three or more dimensions; if you get three vectors in ℝ3 and want to know if they are linearly independent or not, you should always take the determinant:

|3171425391181713|=ugly arithmetic=−18522≠0.

So the three vectors are a basis and the span is all of ℝ3.□

§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

𝑥1+2𝑥2=143𝑥1+4𝑥2=38.

You can do this using whatever method you’re used to; you should find (𝑥1,𝑥2)=(10,2) as the only solution. And you can probably already tell that 14 and 38 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

𝑥1(13)+𝑥2(24)=(1438).

That means our observations can be rephrased in terms of our linear algebra language:

Idea
(13) and (24) are a basis of ℝ2, so any vector like (1438) can be made in exactly one way.

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.

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

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

Recipe for computing the number of solutions to a system of equations

Suppose you are asked to find the number of solutions to a square system

𝑎11𝑥1+𝑎12𝑥2+…+𝑎1𝑛𝑥𝑛=𝑏1𝑎21𝑥1+𝑎22𝑥2+…+𝑎2𝑛𝑥𝑛=𝑏2⋮𝑎𝑛1𝑥1+𝑎𝑛2𝑥2+…+𝑎𝑛𝑛𝑥𝑛=𝑏𝑛.

Let 𝐴 be the 𝑛×𝑛 matrix formed by the 𝑎𝑖𝑗.

  1. If det𝐴≠0, you don’t even have to look at 𝑏𝑖; just output “exactly 1 solution”.
  2. If det𝐴=0, 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 𝑏1=𝑏2=…=𝑏𝑛=0, where the system has an obvious solution 𝑥1=…=𝑥𝑛=0. Thus output “infinitely many solutions”.

    • When 𝑛=2, 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 𝑛≥3, 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 𝑛=2:

§8.7 [EXER] Exercises

Exercise 8.1. Take your birthday and write it in eight-digit 𝑌1𝑌2𝑌3𝑌4-𝑀1𝑀2-𝐷1𝐷2 format. Consider the two vectors

𝐯1=(𝑀1𝑀2𝐷1𝐷2) and 𝐯2=(𝑌1𝑌2𝑌3𝑌4).

For example, if your birthday was May 17, 1994 you would take 𝐯1=(517) and 𝐯2=(1994).

Exercise 8.2. In ℝ5, consider the vector 𝐯=⟨1,2,3,4,5⟩. Compute the maximum possible number of linearly independent vectors one can find which are all perpendicular to 𝐯.
  1. 13Though if you have a set of exactly two vectors, they’re dependent if and only if they’re multiples, even in ℝ𝑛. Which you can eyeball; so if you’re trying to tell whether a span of two vectors in ℝ3 is a line or plane, that’s easy. (Even more stupidly, a single vector is linearly dependent only when it’s the zero vector.)