Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 1

Introduction to Vector Spaces

Recommended resources

Hello! Welcome to the first lesson of our course. Our journey into the mathematics of machine learning begins with the most fundamental structure in linear algebra: the vector space.

This first module will build the bedrock for everything that follows. In this lesson, we will focus on understanding what a vector space is, why this abstract concept is so powerful, and how we can formally prove that a given set of objects qualifies as a vector space. Mastering this definition is crucial, as it provides the framework for applying linear algebra tools to a vast range of objects you'll encounter in machine learning and other advanced fields—from data vectors and matrices to function spaces and quantum states.

Let's begin by exploring the motivation behind this level of abstraction.

What is a Vector? The Power of Abstraction

You might be used to thinking of vectors as arrows in space or as lists of numbers (e.g., a column in a dataset). While these are essential examples, the concept is far more general and powerful. Mathematicians and scientists found that many different types of objects—like polynomials, matrices, and functions—could be "added" together and "scaled" in ways that followed the same underlying rules.

Instead of developing separate theories for each of these object types, it is far more efficient to create a single, unified theory. This is the purpose of defining an abstract vector space.

To get a better sense of this motivation, let's start with a short, conceptual reading.

What is a Vector Space?

This reading from Geoffrey Scott at the University of Toronto explains why the abstract definition of a vector space is necessary. It shows how the same fundamental problem appears in different contexts, motivating the need for a unified theory.

Please read the first section, titled 'Why we need vector spaces' (page 1). Pay attention to how it connects solving a system of linear equations (Problem 1) with finding coefficients for polynomials (Problem 2) and functions (Problem 3).

To build on this idea, the following video provides a brilliant visual intuition for why objects like functions can be treated as vectors.

Abstract vector spaces | Chapter 16, Essence of linear algebra

This video from the 'Essence of linear algebra' series by 3Blue1Brown is excellent for developing an intuitive feel for abstract vector spaces. It uses functions as a primary example to demonstrate vector-like properties.

Please watch the following two segments: Functions as Vectors (2:00 - 3:33): Focus on how function addition and scalar multiplication are analogous to the operations on geometric vectors. The Axioms as an Interface (11:19 - 15:08): This part introduces the formal axioms. The analogy of the axioms as a 'checklist' or an 'interface' is particularly useful, especially given your computer science background. It separates the abstract theory from its concrete implementations.


The Formal Definition of a Vector Space

As you saw in the video, if we want to create a general theory, we need a formal definition. A vector space is a collection of objects (called vectors) for which two operations—addition and scalar multiplication—are defined and satisfy a specific set of rules, or axioms.

These axioms are not arbitrary; they are the minimum set of properties required for our standard algebraic manipulations to work consistently.

Let's look at the formal definition.

Definition of a Vector Space

This document from Purdue University's math department provides a clear, formal definition of a vector space, listing the ten axioms that must be satisfied. It serves as our primary formal reference for this lesson.

Please read the section 'Definition of a Vector Space' (pages 240-242). Focus on DEFINITION 4.2.1, which lists the ten axioms, often grouped as follows: Closure Axioms (A1, A2): The set is 'closed' under the operations, meaning the result of an operation is still in the set. Addition Axioms (A3, A4, A5, A6): These ensure addition behaves as expected (commutativity, associativity, existence of a zero vector, and an additive inverse for every vector). Scalar Multiplication Axioms (A7, A8, A9, A10): These govern how scalars and vectors interact (unitarity, associativity, and distributivity).

A structure is a vector space if it satisfies these ten axioms, where is a set of vectors, is a field of scalars (for us, this will typically be the real numbers or complex numbers ), is vector addition, and is scalar multiplication.


Verification in Action: Proving a Set is a Vector Space

Now comes the practical part: how do we use this definition? To show that a set with given operations is a vector space, you must systematically verify that all ten axioms hold.

Example 1: The Canonical Vector Space

The most familiar vector space is , the set of all -tuples of real numbers, which we often write as column vectors. Let's walk through the formal proof that is indeed a vector space over the field of real numbers with the standard component-wise addition and scalar multiplication.

Prove R^n is a Vector Space

This video from Mathispower4u provides a meticulous, step-by-step verification of the ten vector space axioms for the set R^n. It's a perfect template for how to structure such a proof.

Watch the entire video (approximately 7 minutes). Notice how each proof step relies on the known properties of real number arithmetic. For example, the associativity of vector addition in R^n is a direct consequence of the associativity of real number addition.

Example 2: The Vector Space of Matrices

In machine learning, you'll constantly work with matrices. The set of all matrices with real entries, denoted , also forms a vector space with the usual matrix addition and scalar multiplication.

The proof is very similar to the one for , as matrix operations are also defined element-wise.

Definition of a Vector Space

Let's return to the Purdue University PDF, which contains a detailed verification for the space of 2x2 matrices.

Read 'Example 4.2.2' on pages 242-244. Follow the verification of axioms A3 through A10. Think about how this specific proof for 2x2 matrices would generalize to any m x n matrix.

Example 3: The Vector Space of Functions

As hinted at in the 3Blue1Brown video, the set of all real-valued functions defined on an interval also forms a vector space. This is a very important example in many areas of mathematics and physics, including functional analysis, which has deep connections to ML theory (e.g., kernel methods).

Definition of a Vector Space

The Purdue PDF also provides a formal proof for the space of real-valued functions.

Read 'Example 4.2.3' on pages 244-245. This proof is slightly more abstract because the 'vectors' are now functions. Pay close attention to how the verification of each axiom, like f + g = g + f, depends on showing that the functions are equal for all inputs x in their domain.


Properties Derived from the Axioms

The power of an axiomatic system is that we can derive all other properties of a vector space from just those ten axioms. This is the essence of mathematical proof and rigor. As an example, let's prove the uniqueness of the zero vector.

Theorem: In any vector space , the zero vector is unique.

Proof:
Suppose there are two zero vectors, and , in .

  1. By the definition of a zero vector (Axiom A5), for any vector , .
  2. Let's use as our "vector" and as our "zero vector". From A5, we get:
  3. Now, let's use as our "vector" and as our "zero vector". From A5, we get:
  4. By the commutativity of addition (Axiom A3), we know that .
  5. Therefore, by combining our results from steps 2 and 3, we must have .
    This proves that there can only be one zero vector. Q.E.D.

This is a classic example of a proof built directly from axioms. Several other fundamental properties can be proven this way, such as the uniqueness of the additive inverse and the fact that multiplying any vector by the scalar 0 yields the zero vector.

You can find proofs for these additional properties in Theorem 4.2.6 (pages 246-247) of the Purdue PDF (LINK) we've been using. A quick look at these proofs will further solidify your understanding of axiomatic reasoning.


Conclusion

In this lesson, we have laid the formal groundwork for our study of linear algebra. Here are the key takeaways:

  • A vector space is an abstract structure containing a set of "vectors" and a set of "scalars" that are related by two operations: vector addition and scalar multiplication.
  • These operations must satisfy ten axioms that guarantee they behave in a consistent and predictable manner.
  • The abstract definition is powerful because it allows us to apply the same linear algebra tools to diverse objects, including -tuples (), matrices, and functions.
  • To verify if a set is a vector space, one must rigorously check that all ten axioms hold true for the defined operations.

This abstract foundation is what makes linear algebra such a versatile and universal tool.

Preview of the next lesson:
Now that we have defined what a vector space is, we can explore vector spaces that exist inside of other vector spaces. These are called subspaces. In the next lesson, we will define what a subspace is and learn a much more efficient method to check for them—a shortcut that saves us from re-verifying all ten axioms every time.