Vector spaces and subspaces, visually

A vector space is a collection you cannot leave by adding or stretching. Drag two points on a line and see whether their sum and their double stay on the line.

Short answer. A vector space is a collection where adding two members, or multiplying one by a number, always gives another member. A smaller collection inside it with the same property is a subspace. You check three things: 0 is in it, sums stay in, and multiples stay in. That is why a line in the plane is a subspace only when it goes through the origin.

u = (, )

v = (, )

Drag the circles at green u and blue v, or type numbers (−3 to 3). The purple line W goes through u and v. When 0, u+v and 2u are on the line they are black, and when they are off it they are orange. Their labels also say "on the line" or "off the line".

Definitions

The page below explains with lines in the plane, but the definitions are the same in every vector space. Scalars are real numbers.

vector space
Let V be a set with an addition and a scalar multiplication. V is a vector space if it has a zero vector 0 ∈ V, each u ∈ V has a −u ∈ V, and the axioms below hold for all u, v, w ∈ V and c, d ∈ ℝ. The members of V are called vectors.

𝐮+𝐯∈V,c𝐮∈V

𝐮+𝐯=𝐯+𝐮,(𝐮+𝐯)+𝐰=𝐮+(𝐯+𝐰)

𝐮+0=𝐮,𝐮+(−𝐮)=0

c(𝐮+𝐯)=c𝐮+c𝐯,(c+d)𝐮=c𝐮+d𝐮

c(d𝐮)=(cd)𝐮,1𝐮=𝐮

subspace
A subset W of a vector space V is a subspace of V if W is itself a vector space under the addition and scalar multiplication of V. W is a subspace if and only if the three conditions below hold.

0∈W

𝐮,𝐯∈W⟹𝐮+𝐯∈W

𝐮∈W, c∈ℝ⟹c𝐮∈W

span
The set of all linear combinations of vectors v₁, …, vₖ in V. It is a subspace of V.

span{𝐯1,…,𝐯k}={c1𝐯1+⋯+ck𝐯k∣c1,…,ck∈ℝ}

column space
The subspace of ℝᵐ spanned by the columns a₁, …, aₙ of an m×n matrix A.

ColA=span{𝐚1,…,𝐚n}={A𝐱∣𝐱∈ℝn}

null space
For an m×n matrix A, the subspace of ℝⁿ made of all solutions of Ax = 0.

NullA={𝐱∈ℝn∣A𝐱=0}

1. Vector space: a collection you cannot leave by adding or stretching

So far we have seen vectors as arrows or lists of numbers (vectors, n-dimensional vectors). A vector space asks a different question. Not "what is a vector?" but "what can you do with it?" It needs two things: you can add two members, you can multiply a member by a number, and the result is again in the collection. A few obvious rules come with it, such as "the order of adding does not matter" and "adding 0 changes nothing".

So things that are not arrows can form a vector space too.

On the other hand, polynomials of degree exactly 2 do not form a vector space. x² plus −x² is 0, which is not degree 2. With this definition, what you learned for arrows in the plane (linear combinations, basis, dimension) works the same way for polynomials, functions and matrices.

2. Subspace: only three checks

Take part of a vector space, a collection W. If W is a vector space on its own, it is a subspace. You do not need to recheck every rule. Rules like the order of adding already hold in the big space, so the only question left is "can you leave W?"

Is W a subspace?
① Is 0 in W?                                  0 ∈ W
② For u, v in W, is u + v in W?               u + v ∈ W
③ For u in W and any number c, is c·u in W?   c·u ∈ W
Yes to all three: subspace. No to any one: not a subspace.

Checks ② and ③ must hold for every u, v and c in W. One example that works is not enough. But one example that fails is enough to say no.

PropertyWhat it means
Always contains 0Every subspace goes through the origin. A line or plane that misses the origin is not a subspace
Smallest and largestThe collection holding only 0, {0}, and the whole space are both subspaces
Three kinds in the plane{0}, a line through the origin, the whole plane
The overlap is a subspaceWhere two subspaces overlap is also a subspace. Joining them usually is not: put the x-axis and y-axis together and (1, 0) + (0, 1) = (1, 1) is on neither axis
Closed under linear combinationsIt is closed under adding and scaling, so a·u + b·v is always in it

3. A line through the origin works, a line that misses it does not

Every point on a line through the origin is some multiple of one arrow d: t·d. Add two points and you get s·d + t·d = (s + t)·d. Multiply by c and you get (c·t)·d. Both are again multiples of d, so they stay on the line. A plane through the origin is a subspace for the same reason. In 3D space the subspaces are {0}, lines through the origin, planes through the origin, and the whole space.

A line that misses the origin is a line through the origin pushed sideways by some p, so its points look like p + t·d. Add two of them and you get 2p + (s + t)·d. Now p is in there twice, so the point is off the line that was pushed only once.

Try this. ① The starting line goes through u = (1, 2) and v = (3, 1) and misses the origin by 2.24. u+v = (4, 3) and 2u = (2, 4) are both off the line by 2.24, the same distance as the origin. ② Move v to (−0.5, −1). The line now goes through the origin, u+v = (0.5, 1) and 2u = (2, 4) stay on the line, and the readout says "This line is a subspace." ③ Put v on top of u at (1, 2) and the two points no longer fix one line.

4. How the checks are built: where does a line that misses the origin fail?

We try the three checks one by one on the starting line. It goes through u = (1, 2) and v = (3, 1), and its equation is x + 2y = 5. To see if a point is on the line, put it into x + 2y and see if you get 5. In the formula, W is the set of points on the line, ∈ means "is in", and ⇔ means "exactly when".

Press "Next" to go one step at a time. A check is added to the formula above (the orange background marks the new piece), the point for that check appears in the picture, and its label shows what you get when you put it into x + 2y.

Written only as formulas, the steps above are these.

W={(x,y)∣x+2y=5}

0=(0,0):0+2·0=0≠5⟹0∉W

𝐮+𝐯=(1,2)+(3,1)=(4,3):4+2·3=10≠5

2𝐮=(2,4):2+2·4=10≠5

ax1+by1=k, ax2+by2=k⟹a(x1+x2)+b(y1+y2)=2k,a(cx1)+b(cy1)=ck

2k=k, ck=k(∀c∈ℝ)⟺k=0⟺0∈W

In short. On a line a·x + b·y = k, adding two points gives the value k + k, and multiplying by c gives c×k. For these to stay k every time, you need k = 0, and that is the same as saying the origin (0, 0) is on the line.

5. Worked example: is y = 2x a subspace?

Let W be the points (x, y) with y = 2x. This is the line from "Try this" ②.

  1. Is 0 in it? Put in (0, 0): 0 = 2×0. Yes.
  2. Do sums stay in? Points in W look like (a, 2a). (a, 2a) + (b, 2b) = (a + b, 2(a + b)), so the second number is still twice the first. With numbers: (1, 2) + (−0.5, −1) = (0.5, 1), and 1 = 2×0.5.
  3. Do multiples stay in? c·(a, 2a) = (c·a, 2·c·a). Still twice. With numbers: 2·(1, 2) = (2, 4), and 4 = 2×2.

The same work written as formulas:

W={(x,y)∈ℝ2∣y=2x}={(a,2a)∣a∈ℝ}

(0,0)=(0,2·0)∈W

(a,2a)+(b,2b)=(a+b, 2(a+b))∈W

c(a,2a)=(ca, 2(ca))∈W

(1,2)+(−0.5,−1)=(0.5,1),2(1,2)=(2,4)

All three hold, so it is a subspace. On the other hand, for y = 2x + 1, putting (0, 0) into check ① gives 0 = 1, so it fails right away.

6. Span, and the subspaces a matrix makes

Pick a few vectors and collect every linear combination you can make from them. The result is always a subspace. It is called the space those vectors span. See linear combinations for more. The smallest set of vectors that builds a subspace with nothing extra is a basis, and how many vectors it has is the dimension.

A matrix A comes with four subspaces. Here are two of them.

The other two, and how their sizes relate, are on the rank page.

Where it is used

Common questions

How is a subspace different from a vector space?

A subspace is a vector space too. We call it a subspace when it sits inside another vector space. So when you check one, it inherits the rules of the big space, and you only check three things: is 0 in it, and is it closed under adding and scaling.

Why is a line that misses the origin not a subspace?

A subspace must contain 0, and that line does not contain the origin. On top of that, adding two points on the line or doubling one takes you off the line.

Why check for 0 separately?

If the collection is closed under scaling, multiplying by c = 0 gives 0, so for a collection that is not empty, check ③ already covers check ①. Checking 0 first is still the fastest way to rule out a collection that misses the origin, and it also rules out the empty collection.

Words

Plain words used hereTextbook term
a collection you cannot leave by adding or stretchingvector space, linear space
a smaller collection inside itsubspace
you cannot leave itclosed under addition and scalar multiplication
multiplying by a numberscalar multiplication
the origin, 0zero vector
everything you can makespan
where A·x can reachcolumn space
every answer to A·x = 0null space, kernel
a line or plane that misses the originaffine subspace

Sources

← Vectors in n dimensionsLinear combinations and span →