Skip to content
Tutorials Center
My learning

Topics

Lesson 21 of 62 ยท Vector Spaces

Vector Spaces and Subspaces

Learn the ten vector space axioms, the three-step subspace test, and why polynomials, matrices and functions are vector spaces too, with NumPy checks.

So far a vector has been a list of numbers. But look at what you actually did with vectors: you added them and you scaled them. Nothing else. That observation is the doorway to a bigger idea. Any collection of objects that can be added and scaled in the right way behaves just like lists of numbers, and everything you have learned about span, independence and dimension carries over to it.

This lesson names the rules, gives the subspace test that lets you check them quickly, and shows vector spaces made of polynomials, matrices and functions. After it, the later lessons on span, independence and basis and dimension will read as statements about any vector space, not only about arrows.

The ten axioms

A vector space over the real numbers is a set V of objects ("vectors") with two operations, addition u + v and scalar multiplication c ยท v, such that for all vectors u, v, w in V and all real numbers c, d:

Addition

  1. Closure: u + v is in V.
  2. Commutative: u + v = v + u.
  3. Associative: (u + v) + w = u + (v + w).
  4. Zero vector: there is a 0 in V with v + 0 = v.
  5. Additive inverse: for each v there is -v in V with v + (-v) = 0.

Scalar multiplication

  1. Closure: c ยท v is in V.
  2. Distributes over vectors: c(u + v) = cu + cv.
  3. Distributes over scalars: (c + d)v = cv + dv.
  4. Compatible: c(dv) = (cd)v.
  5. Identity: 1 ยท v = v.

Closure is the one that fails most often. The rest are usually inherited automatically when your objects are numbers, functions or matrices that already follow ordinary arithmetic.

Spaces that are not just arrows

Polynomials Add them, scale them, stay a polynomial.
Matrices Same-size matrices form a space.
Functions Add two functions to get a function.
1 / 2

Examples

  • R^n: lists of n numbers. The prototype.
  • Matrices M(m, n): all m ร— n matrices, with entrywise addition and scaling. Dimension m ยท n.
  • Polynomials P_k: all polynomials of degree at most k. A polynomial aโ‚€ + aโ‚x + ... + a_k x^k is determined by its coefficient list (aโ‚€, ..., a_k), so P_k behaves exactly like R^(k+1). Dimension k + 1.
  • Functions: all functions from the real line to itself, adding (f + g)(x) = f(x) + g(x). This space is infinite-dimensional, and so are the continuous functions and the solutions of many differential equations.
  • The trivial space : just the zero vector.

Not everything qualifies. The set of polynomials of degree exactly 2 is not a vector space: xยฒ + (-xยฒ) = 0 has degree 0, so addition escapes the set. The set of integer-only vectors is closed under addition but not under scaling by 1/2.

Vector spaces inside vector spaces: subspaces

A subspace of a vector space V is a subset W that is itself a vector space with the same operations. Rechecking ten axioms would be tedious, but most are inherited from V. The subspace test reduces everything to three checks:

  1. W contains the zero vector.
  2. W is closed under addition: u, v in W implies u + v in W.
  3. W is closed under scalar multiplication: v in W and c a scalar implies c ยท v in W.

(Checks 1 and 3 together are the same as "W is non-empty and closed under scaling", because 0 ยท v = 0.)

Geometric intuition for R^3: the subspaces are the origin, lines through the origin, planes through the origin, and the whole space. A plane that does not pass through the origin fails check 1 and is therefore not a subspace, even though it looks like a flat sheet. The first quadrant fails check 3, because multiplying by -1 leaves it.

Typical subspaces from earlier lessons: the span of any set of vectors, the column space and null space of a matrix, and the solutions of any homogeneous system A x = 0.

Python The subspace test on subsets of R^3

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Only the plane through the origin and the line through the origin pass. The offset plane misses zero, the octant fails scaling, the sphere fails everything, and the union xยทy = 0 of two planes is closed under scaling but not under addition: (1, 0, 0) and (0, 1, 0) are in it, but their sum (1, 1, 0) is not. (A finite sample like this can only refute closure; to prove a subspace you argue symbolically, as the axioms demand.)

Vectors that do not look like vectors

A good test of understanding is whether you accept a strange space once the axioms hold. Take the positive real numbers, define "addition" as multiplication, u โŠ• v = u ยท v, and "scaling" as powers, c โŠ™ v = v^c. The "zero vector" is 1 (since v ยท 1 = v), the "inverse" of v is 1/v, and every axiom checks out. That is a legitimate vector space, even though it looks nothing like arrows. Polynomials and matrices, meanwhile, can be turned into coordinate vectors and handled with NumPy.

Python Polynomials as vectors, and an exotic vector space

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Which condition is NOT part of the subspace test?

    A subspace needs zero, closure under addition and closure under scaling. It does not need to contain a basis of the larger space; a line is a subspace of R^3.
  2. 2. Which subset of R^2 is a subspace?

    y = 3x passes through the origin and is closed under addition and scaling. y = 2x + 1 misses zero, the circle fails both closures, and the first quadrant fails scaling by negative numbers.
  3. 3. Why are polynomials of degree exactly 2 not a vector space?

    Closure under addition fails: x^2 + (-x^2) = 0 has degree 0, and the zero polynomial is not of degree 2.
  4. 4. What is the dimension of the space of 3 x 4 real matrices?

    A basis is the 12 matrices with a single 1 and zeros elsewhere, so the dimension is 3 x 4 = 12.
  5. 5. In R^3, which of these can be a subspace?

    Lines through the origin are subspaces. The others fail to contain zero or fail closure.

Summary

  • A vector space is any set with addition and scalar multiplication obeying ten axioms; R^n, matrices, polynomials and functions are all examples.
  • A subspace is a subset that contains zero and is closed under addition and scaling.
  • In R^3 the subspaces are the origin, lines through the origin, planes through the origin, and the whole space.
  • Span, null space and column space are always subspaces.
  • Polynomials of degree at most k behave like R^(k+1), and the derivative acts on them as a matrix.

Next: Linear Combinations and Span, where you meet the most important way to build a subspace.