Chapter 3. Vector spaces

§3.1 Definition and examples of a vector space

We’ll start with the following definition, which is actually a white lie.

Definition 3.1 (Vector space, provisional). A (real) vector space 𝑉 is any set obeying the following two requirements:

The elements of 𝑉 are then referred to as “vectors”.

I say this is a white lie because I haven’t actually defined “addition” 𝐯+𝐰 or “scaling” yet. I will do this in Section 4.1 (and you may skip ahead to there if you like). However, practically speaking in every example of a vector space we encounter, it will be obvious what addition or scaling are intended to be.

Warning: Multiplication of vectors is banned until Phase V

In contrast, we do not talk about multiplying two vectors yet. That is, at present, we only allow scaling vectors by real numbers. Until then, any expression like 𝐯𝐰 or 𝐯⋅𝐰 will always be considered a type error.

The first time we allow any sort of “product” is the wedge products, defined in Chapter 6. Later on in Phase V we then define a “dot product”.

This means that any kind of collection 𝑉 where the two rules above are satisfied qualifies as a vector space. This is an intentionally wide net. In textbooks written by sane people, vector spaces are often restricted to ℝ𝑛 or its subspaces, in order to make things more concrete for beginners. But that won’t be good enough for us: for example, Chapter 6 won’t be possible to do restricted to a subspace of ℝ𝑛.

Here is one example to start:

Quadratic polynomials, aka my favorite example

My favorite example of a vector space is the set of polynomials of degree at most two in a variable 𝑥, namely

ℙ2={𝑎𝑥2+𝑏𝑥+𝑐|𝑎,𝑏,𝑐∈ℝ}.

That is, in this example, the word “vector” refers to such a polynomial, like 𝑥2+5 or 6𝑥+7 or 0 or 3𝑥, and the “vector space” ℙ2 is the set of all such vectors.

For this example ℙ2, we can check the two axioms in the definition above are satisfied:

  1. When you add two polynomials in ℙ2, you get another polynomial in ℙ2: for example if 𝐯=𝑥2+5 and 𝐰=6𝑥+7, then

    𝐯+𝐰=(𝑥2+5)+(6𝑥+7)=𝑥2+6𝑥+12∈ℙ2

    is also an element of ℙ2.

  2. When you scale a polynomial in ℙ2 by a real number, you get another polynomial in ℙ2: for example if 𝐯=𝑥2+5 and 𝑐=8, then

    𝑐⋅𝐯=8(𝑥2+5)=8𝑥2+40∈ℙ2

    is also an element of ℙ2.

From the way ℙ2 is written, you probably already have a hunch this vector space has “dimension 3”, in the sense “it takes three real numbers to specify an element of ℙ2”. That’s right. In general, the correct instinct is “the dimension the number of real parameters”. By the end of this chapter, we’ll make this into a real definition.

Exercise 3.2. In the quadratic polynomial example, I was careful to say “degree at most 2” instead of “degree 2”. Indeed, the set

𝑆={𝑎𝑥2+𝑏𝑥+𝑐|𝑎,𝑏,𝑐∈ℝ,𝑎≠0}

fails both axioms in our definition. Give a counterexample for each axiom.

Further examples of vector spaces

Like in the previous example, we’ll mention what the dimension of each example turns out to be, to test your instincts (even though we haven’t defined dimension officially yet).

  • The complex numbers ℂ={𝑎+𝑏𝑖|𝑎,𝑏∈ℝ} are a two-dimensional vector space too. (The sum of two complex numbers is a complex number; scaling a complex number by a real number gives a complex number.)
  • The real numbers ℝ form a vector space of dimension 1.
  • Three-dimensional Euclidean space ℝ3, defined by

    ℝ3≔{⟨𝑥,𝑦,𝑧⟩|𝑥,𝑦,𝑧∈ℝ}

    forms a 3-dimensional vector space. In case you haven’t seen this before, the addition and scaling are done componentwise:

    ⟨𝑥1,𝑦1,𝑧1⟩+⟨𝑥2,𝑦2,𝑧2⟩≔⟨𝑥1+𝑥2,𝑦1+𝑦2,𝑧1+𝑧2⟩𝑐⋅⟨𝑥,𝑦,𝑧⟩≔⟨𝑐𝑥,𝑐𝑦,𝑐𝑧⟩.
  • More generally, 𝑛-dimensional Euclidean space ℝ𝑛 defined by

    ℝ𝑛≔{⟨𝑥1,…,𝑥𝑛⟩|𝑥1,…,𝑥𝑛∈ℝ}

    forms an 𝑛-dimensional vector space, under componentwise addition and scaling.

Important example: the plane 𝑥+𝑦+𝑧=0

One important further example is

𝑉={⟨𝑥,𝑦,𝑧⟩|𝑥+𝑦+𝑧=0and𝑥,𝑦,𝑧∈ℝ}

which is the set of triples of real numbers ⟨𝑥,𝑦,𝑧⟩ such that 𝑥+𝑦+𝑧=0. For example, ⟨3,4,−7⟩ is a vector in 𝑉, as is ⟨2,−8,6⟩, as is the sum

⟨3,4,−7⟩+⟨2,−8,6⟩=⟨5,−4,−1⟩.

There are a few equivalent ways to write 𝑉, such as (among others):

𝑉={⟨𝑥,𝑦,−(𝑥+𝑦)⟩|𝑥,𝑦∈ℝ}𝑉={⟨𝑥,−(𝑥+𝑧),𝑧⟩|𝑥,𝑧∈ℝ}𝑉={⟨−(𝑦+𝑧),𝑦,𝑧⟩|𝑦,𝑧∈ℝ}.

However, all of them have the property that there are two variables. So we ought to suspect dim𝑉=2, and again, at the end of this chapter, we’ll prove it.

Exercise 3.3. Write down a proof that the vector space 𝑉 above satisfies the two axioms.

Exercise 3.4. Consider instead the set

𝑆={⟨𝑥,𝑦,𝑧⟩|𝑥+𝑦+𝑧=1and𝑥,𝑦,𝑧∈ℝ}.

This set 𝑆 fails both requirements to be a vector space. Find a counterexample for each.

Examples of infinite-dimensional vector spaces

Here are some examples that can be said to be infinite-dimensional. (However, this book will mostly focus on finite-dimensional vector spaces.)

  1. The set of all polynomials with real coefficients is a vector space. (The standard notation for this space is ℝ[𝑥], rather than ℙ∞.)

  2. The set of all functions 𝑓:ℝ→ℝ is also a vector space.

  3. The set of all continuous functions 𝑓:ℝ→ℝ is also a vector space.

  4. The set of all differentiable functions 𝑓:ℝ→ℝ is also a vector space.

§3.2 The definition of basis

Our first goal will be to make precise an official definition of “dimension”. To do this we need to introduce the notion of a basis.

Let’s go back to the favorite example

ℙ2={𝑎𝑥2+𝑏𝑥+𝑐|𝑎,𝑏,𝑐∈ℝ}.

The basic idea is that we “ℙ2 has {1,𝑥,𝑥2} as a basis”. And we can quickly write a definition that makes this precise.

Definition 3.5 (Linear combination). Suppose 𝑆={𝐯1,…,𝐯𝑛} is a finite set of vectors. A linear combination of some vectors is a sum of the form

𝑟1𝐯1+⋯+𝑟𝑛𝐯𝑛,

where 𝑟1,…,𝑟𝑛∈ℝ. The linear combination is called trivial if 𝑟1=𝑟2=⋯=𝑟𝑛=0, and nontrivial otherwise.

Colloquially, the way you should think of this in your head is:

Idea
“A linear combination of a set 𝑆 is a vector you can build out of things in 𝑆.”

Some complications arise if 𝑆 is infinite. We defer that discussion to Section 4.2.

Definition 3.6 (Basis). A basis for a vector space 𝑉 is a set of elements 𝐯1, …, 𝐯𝑛 such that every element of 𝑉 is a linear combination of 𝐯𝑖 in exactly one way.

Let’s give a few examples.

Example
  • For 𝑉={𝑎𝑥2+𝑏𝑥+𝑐|𝑎,𝑏,𝑐∈ℝ}, the set {1,𝑥,𝑥2} forms a basis of 𝑉 by definition.

  • For 𝑉=ℝ2 the standard basis vectors 𝐞1=⟨1,0⟩ and 𝐞2=⟨0,1⟩ are a basis. Indeed, given any ⟨𝑥,𝑦⟩∈ℝ2, the unique combination is

    (𝑥𝑦)=𝑥(10)+𝑦(01).
  • For 𝑉=ℝ𝑛, the standard basis vectors 𝐞1, …, 𝐞𝑛 (defined in Section 2.4) are a basis.

  • The most interesting example we’ve encountered is the plane

    𝑉={⟨𝑥,𝑦,𝑧⟩|𝑥+𝑦+𝑧=0and𝑥,𝑦,𝑧∈ℝ}.

    Here, it is not immediately obvious what the basis should be. If one adopts

    𝑉={⟨𝑥,𝑦,−(𝑥+𝑦)⟩|𝑥,𝑦∈ℝ}

    then one example of a basis would be the two vectors ⟨1,0,−1⟩ and ⟨0,1,−1⟩.

Exercise 3.7. In the last example, convince yourself that ⟨1,0,−1⟩ and ⟨0,1,−1⟩ do form a basis for the plane 𝑥+𝑦+𝑧=0.

Then, give a different example of a basis that looks as different as possible.

There is a second way to define a basis. Recall that in the definition we just gave, we want every vector to be represented as a linear combination in exactly one way. That’s a strong requirement, and when trying to work with proofs, it will often be easier to take it in two halves: “exactly one way” = “at least one way (existence)” + “at most one way (uniqueness)”. There are words corresponding to each of these two halves.

Definition 3.8 (Linear independence and spanning). Let 𝐯1, …, 𝐯𝑛 be elements of a vector space 𝑉.

Proposition 3.9. Let 𝐯1, …, 𝐯𝑛 be elements of a vector space 𝑉. They form a basis if and only it is both spanning and linearly independent.

To reiterate, you should internalize this as: exactly one way⏟basis = at least one way⏟spanning + at most one way⏟linearly independent

TODO. write proof

§3.3 The many possible bases of each vector space

For this discussion let’s specialize to ℝ2. We know of course that 𝐞1=(10) and 𝐞2=(01) form a standard basis. However, what I want to convince you now is that this choice of standard basis is mostly convenient but otherwise not special. In fact, I claim that if I pull two random vectors in ℝ2 out of a hat, they’re almost certainly going to form a basis.

So for this narrative, let’s consider 𝐯1≔(12) and 𝐯2≔(34). I want to convince you this is a basis. Let’s walk through this with some numbers first:

Exercise 3.10.

We could also replace 1, 2, 3, 4 with four variables, to get a six-variable algebra calculation. Although this exercise is starred, it requires only careful bookkeeping. As long as you aren’t afraid of six variables, there’s no “trick” to it. From start to finish, there is only thing you can do.

Exercise 3.11 (*). Let 𝑎, 𝑏, 𝑐, 𝑑 be real numbers. Prove that (𝑎𝑏) and (𝑐𝑑) form a basis of ℝ2 if and only if

𝑎𝑑−𝑏𝑐≠0.

Do so directly from the definition of basis, without quoting any results from later on.

So in fact for ℝ2 we know how to describe exactly what the possible bases are? Unless… why did we only look at the case of two elements?

§3.4 Dimension

Well, if you have common sense, you might have instinctively known this without even realizing it. There’s no way a single vector could span ℝ2, and three vectors is too many: you’d never satisfy linear independence.

Exercise 3.12. If you don’t believe the previous sentence, try enough examples until you do.

The general phenomenon is true: any two bases have the same number of elements. And we can already prove this, and more.

Theorem 3.13 (Steinitz exchange lemma). Let 𝑉 be a vector space. Suppose that

Then 𝑛≥𝑚.

That means spanning sets are always at least as large as linearly independent sets.

Proof. The overall strategy is to start with the original spanning set of 𝑛 vectors, then do 𝑚 replacements. In the 𝑗th step, we replace one of the 𝐯𝑖 with a 𝐰𝑗 while ensuring that the resulting 𝑛 vectors are still spanning. If we can do this 𝑚 times, we’re guaranteed that 𝑛≥𝑚, because every 𝐰𝑗 is replacing a different 𝐯𝑖.

Here are the details.

Let 𝐴0={𝐯1,…,𝐯𝑛} be the initial spanning set. Throw in 𝐰1: by the spanning condition, 𝐰1=𝑐1𝐯1+⋯+𝑐𝑛𝐯𝑛. There’s some nonzero coefficient; let’s suppose it’s 𝑐𝑛. Thus

𝐯𝑛=1𝑐𝑛𝐰1−𝑐1𝑐𝑛𝐯1−𝑐2𝑐𝑛𝐯2−⋯.

Thus 𝐴1={𝐯1,…,𝐯𝑛−1,𝐰1} is spanning too, completing the first step.

For the second step, we do the same thing again: throw in 𝐰2, deleting some (other) 𝐯𝑖. This gives a new set 𝐴2; we then repeat to get 𝐴3, 𝐴4, …, 𝐴𝑚. The condition that the 𝐰𝑗 are linearly independent ensures that some 𝐯𝑖 coefficient must always not be zero.

The total number of vectors in the set never changes, so 𝐴𝑚 is still a set of 𝑛 vectors. But it contains every 𝐰𝑗 now, all 𝑚 of them, so 𝑛≥𝑚.□

Here are some specific exercises/examples that can help you digest the above proof.

TODO. Design an example of the exchange lemma for 𝑛=3 and 𝑚=2, in ℝ3. Cherry-pick the numbers so that there’s only one way to do it.

From this we can conclude:

Theorem 3.14 (Dimension theorem). Suppose 𝑉 is a vector space and 𝐯1, …, 𝐯𝑛 is some basis. Then any other basis has 𝑛 elements.
Proof. If 𝐰1, …, 𝐰𝑚 is another basis, then apply Steinitz exchange lemma twice (flipping the roles the second time around) to get both 𝑚≥𝑛 and 𝑛≥𝑚. It follows that 𝑛=𝑚.□

We can thus finally define “dimension”.

Definition 3.15. Suppose 𝑉 is a vector space and 𝐯1, …, 𝐯𝑛 is some basis. Then the dimension of 𝑉, denoted dim𝑉, is defined as 𝑛. (By Theorem 3.14, this definition makes sense; it doesn’t depend on which basis we choose.)

Remark 3.16 (We agree 0-dimensional means only the zero vector). The case dim𝑉=0 can be confusing if you’re too pedantic, so let’s just agree on the following conventions:

§3.5 The 50%-off proposition if you know the dimension

If you did Exercise 3.11, you had to work pretty hard to verify an intuitive fact. However, now that we have the concept of dimension, we can state some convenience propositions that make Exercise 3.11 much easier. For example, if you’re trying to prove something is a basis, and you already know the dimension of the space, then Proposition 3.17 lets you skip half of the work: you only have to prove one of the two requirements in Proposition 3.9.

Proposition 3.17 (50% off all bases if you know the dimension). Let 𝑉 be an 𝑛-dimensional vector space.

TODO. Write proof

This makes Exercise 3.11 much easier.

Solution to Exercise 3.11 using Proposition 3.17. Note that:

Hence, the proof is complete.□

Here’s some practice with the plane 𝑥+𝑦+𝑧=0 from before:

Exercise 3.18. Show that ⟨5,3,−8⟩ and ⟨2,−1,−1⟩ form a basis of the plane

𝑉={⟨𝑥,𝑦,𝑧⟩|𝑥+𝑦+𝑧=0and𝑥,𝑦,𝑧∈ℝ}.

§3.6 Recap

TODO. write a recap

§3.7 Exercises

Exercise 3.19. Recall ℙ2={𝑎𝑥2+𝑏𝑥+𝑐|𝑎,𝑏,𝑐∈ℝ} is the vector space of real polynomials of degree at most 2. Decide whether each of the following sets is a basis of ℙ2 or not:

Exercise 3.20. Show that the following four vectors form a basis of ℝ4:

(1000),(2300),(4560),(78910).
Exercise 3.21. Recall ℙ𝑛 denotes the vector space of polynomials of degree at most 𝑛. Determine dimℙ𝑛 as a function of 𝑛.

Exercise 3.22. Define

𝑉={⟨𝑥1,𝑥2,…,𝑥100⟩∈ℝ100|𝑥1+𝑥2+…+𝑥100=0}.

Show that 𝑉 forms a vector space, and calculate its dimension.

Exercise 3.23. Let 𝑉 be a vector space and take 𝐯1,…,𝐯𝑛∈𝑉. Prove that the following statements are equivalent:

  1. The 𝐯𝑖 form a basis.
  2. The 𝐯𝑖 are spanning, but no proper subset is spanning.
  3. The 𝐯𝑖 are linearly independent, but adding any other element of 𝑉 makes them not linearly independent.
Exercise 3.24 (LADW 2.6). Suppose that 𝐯1, 𝐯2, and 𝐯3 are three linearly independent vectors in a vector space 𝑉. Prove or disprove: 𝐯1+𝐯2, 𝐯2+𝐯3, and 𝐯3+𝐯1 must also be linearly independent.

Exercise 3.25 (*) (Napkin 9C). Let’s say a magic square is a 3×3 array of real numbers where the sum of all diagonals, columns, and rows is equal, such as

(816357492).

Show that the set of magic squares forms a vector space (with addition and scaling done component-wise) and calculate its dimension.