Search

Search papers and lessons

Vector Space Basis

Level 2 · 11 min read

A basis is a smallest set of vectors that can build every vector in a space, with no vector redundant and every vector built in exactly one way.

On this page

  • Colour = topic mix
  • Linear algebra
  • Discrete math
  • ReadReady to readNot yet

TL;DR

A basis of a vector space is a small set of vectors from which every vector in the space can be built, and each vector in the set is needed. Because of that, every vector has exactly one recipe, so the recipe can be written as a list of numbers. Bases are how linear algebra turns geometry into arithmetic.

Builds on: Vector Space, Linear Independence · Leads to: Basis Expansion, Linear Transformation

Where it's used

Coordinates in computer graphics. A 3D model is stored as points, and the renderer moves them with matrices. Each point is described by its coordinates in a chosen basis, such as the axes of an object or the camera. Changing the basis changes the numbers but not the object, which is why game engines convert between local and world frames all the time.

Feature design in regression. When a model fits a curve, its inputs are functions such as 1, x and x squared. Those functions form a basis for all quadratic curves, so any quadratic can be written as three numbers, and fitting the curve means finding those three numbers. This is the idea behind polynomial regression, which builds on Linear Regression.

Compression and signal processing. A signal sampled at many points can be written in a basis of waves, as in the Fourier transform, which uses sine and cosine waves as its basis. A few large coefficients then describe most of the signal, so the rest can be discarded. JPEG images and MP3 audio rely on this kind of change of basis, with close relatives of the Fourier basis.

How it works

Start with a plain question: how few vectors do you need to reach every point in the flat plane, where each point is a pair of numbers? A linear combination of vectors is a sum of scaled copies, such as a v+c wa\,v + c\,w with numbers aa and cc. The set of all linear combinations of some vectors is their span. The question is which vectors span the plane, and which of those are necessary.

  1. Try the standard pair. Take e1=(1,0)e_1 = (1, 0) and e2=(0,1)e_2 = (0, 1). Any point (x,y)(x, y) equals x e1+y e2x\,e_1 + y\,e_2. Check: for (3,4)(3, 4), 3(1,0)+4(0,1)=(3,4)3(1, 0) + 4(0, 1) = (3, 4). The pair spans the plane.
  2. Try a different pair. Take b1=(1,1)b_1 = (1, 1) and b2=(1,−1)b_2 = (1, -1). To build (3,4)(3, 4) we need a b1+c b2=(3,4)a\,b_1 + c\,b_2 = (3, 4), which means a+c=3a + c = 3 and a−c=4a - c = 4. Adding the equations gives 2a=72a = 7, so a=3.5a = 3.5 and c=−0.5c = -0.5. Check: 3.5(1,1)−0.5(1,−1)=(3,4)3.5(1, 1) - 0.5(1, -1) = (3, 4). This pair also spans the plane, and the same point gets different numbers.
  3. Try a pair that is too small. Take (1,0)(1, 0) and (2,0)(2, 0). Any combination is a(1,0)+c(2,0)=(a+2c,0)a(1, 0) + c(2, 0) = (a + 2c, 0), whose second entry is always 0. So (0,1)(0, 1) can never be reached. This pair does not span the plane.
  4. Try a pair that is too big. Add (1,1)(1, 1) to the standard pair. Now (3,4)(3, 4) can be built as 3(1,0)+4(0,1)+0(1,1)3(1, 0) + 4(0, 1) + 0(1, 1), or as 2(1,0)+3(0,1)+1(1,1)2(1, 0) + 3(0, 1) + 1(1, 1). Check the second one: (2+1,3+1)=(3,4)(2 + 1, 3 + 1) = (3, 4). Two recipes for one point means one of the vectors is redundant, since (1,1)=(1,0)+(0,1)(1, 1) = (1, 0) + (0, 1).
  5. Conclude. A basis is a set that spans the plane and has no redundancy, which is the linear independence test. Steps 1 and 2 pass both tests. Step 3 fails the spanning test, and step 4 fails the redundancy test. Any basis of the plane has exactly two vectors, and each point of the plane has exactly one pair of coordinates in it.

The procedure, as a decision:

flowchart TD
  A["Candidate set of vectors"] --> B{"Do they span the space?"}
  B -- no --> X["Not a basis: add vectors"]
  B -- yes --> C{"Is any vector a combination of the others?"}
  C -- yes --> Y["Not a basis: remove the redundant vector"]
  C -- no --> D["Basis: every vector has unique coordinates"]

The number of vectors in a basis is the dimension of the space. The plane has dimension 2.

The math

Definition: Basis
A basis of a vector space VV is a list of vectors v1,…,vnv_1, \dots, v_n in VV such that two things hold. (1) They span VV: every vv in VV can be written v=c1v1+⋯+cnvnv = c_1 v_1 + \dots + c_n v_n for some numbers c1,…,cnc_1, \dots, c_n. (2) They are linearly independent: c1v1+⋯+cnvn=0c_1 v_1 + \dots + c_n v_n = 0 only when every ci=0c_i = 0.

Condition (1) is "no gaps". Condition (2) is "no redundancy", as defined in Linear Independence. The numbers cic_i in condition (1) are the coordinates of vv in this basis.

Step 1 and 2 in symbols

The standard basis of R2\mathbb{R}^2 is e1=(1,0)e_1 = (1, 0), e2=(0,1)e_2 = (0, 1), and every point (x,y)=xe1+ye2(x, y) = x e_1 + y e_2. For the basis b1=(1,1)b_1 = (1, 1), b2=(1,−1)b_2 = (1, -1), finding the coordinates of v=(vx,vy)v = (v_x, v_y) means solving

a+c=vxa−c=vy\begin{aligned} a + c &= v_x \\ a - c &= v_y \end{aligned}

which gives a=vx+vy2a = \frac{v_x + v_y}{2} and c=vx−vy2c = \frac{v_x - v_y}{2}. For (3,4)(3, 4) this is a=3.5a = 3.5 and c=−0.5c = -0.5, as in the walkthrough.

Step 3 in symbols

Independence fails when a nontrivial combination gives zero. Here 2(1,0)−1(2,0)=(0,0)2(1, 0) - 1(2, 0) = (0, 0) with coefficients 22 and −1-1, not both zero, so (1,0)(1, 0) and (2,0)(2, 0) are dependent.

Step 4 in symbols

For the three vectors (1,0)(1, 0), (0,1)(0, 1), (1,1)(1, 1), the combination 1(1,1)−1(1,0)−1(0,1)=(0,0)1(1, 1) - 1(1, 0) - 1(0, 1) = (0, 0) has nonzero coefficients, which is the redundancy. Because such a relation exists, the coordinates of a point are not unique.

Why the coordinates are unique

Suppose v=∑icivi=∑idiviv = \sum_i c_i v_i = \sum_i d_i v_i are two recipes for the same vv. Subtracting gives ∑i(ci−di)vi=0\sum_i (c_i - d_i) v_i = 0. Independence forces every ci−di=0c_i - d_i = 0, so ci=dic_i = d_i. This is the reason a basis gives each vector exactly one set of coordinates.

Worked examples

Example
1. A line through the origin (tiny)
  1. Let VV be the set of all multiples of (1,2)(1, 2). It is a line through the origin, and it is a vector space.
  2. Candidate basis: the single vector (1,2)(1, 2).
  3. Spanning: any point of the line has the form (t,2t)=t(1,2)(t, 2t) = t(1, 2), so (1,2)(1, 2) reaches all of them.
  4. Independence: c(1,2)=(0,0)c(1, 2) = (0, 0) forces c=0c = 0, since the first entry is cc.
  5. So {(1,2)}\{(1, 2)\} is a basis, and the dimension of VV is 1.
  6. Coordinates of (3,6)(3, 6): (3,6)=3(1,2)(3, 6) = 3(1, 2), so the coordinate is 33.

Interpretation: a line needs one vector, and the coordinate tells you how far along the line the point is, measured in units of (1,2)(1, 2).

Example
2. Three vectors in space (standard)
  1. Candidate basis of R3\mathbb{R}^3: u=(1,1,0)u = (1, 1, 0), w=(0,1,1)w = (0, 1, 1), z=(1,0,1)z = (1, 0, 1).
  2. Independence: a u+c w+d z=(a+d,  a+c,  c+d)=(0,0,0)a\,u + c\,w + d\,z = (a + d,\; a + c,\; c + d) = (0, 0, 0). So a+d=0a + d = 0, a+c=0a + c = 0, c+d=0c + d = 0.
  3. From the first, d=−ad = -a. From the second, c=−ac = -a. Then the third says c+d=−2a=0c + d = -2a = 0, so a=0a = 0, and so c=d=0c = d = 0. Independent.
  4. Spanning: solve the same three equations with a target (p,q,r)(p, q, r) on the right instead of zeros. The solution is a=p+q−r2a = \frac{p+q-r}{2}, c=q+r−p2c = \frac{q+r-p}{2}, d=p+r−q2d = \frac{p+r-q}{2}, and it exists for every target. So the three vectors span R3\mathbb{R}^3, and with step 3 they form a basis.
  5. Coordinates of (2,3,4)(2, 3, 4): put p=2p = 2, q=3q = 3, r=4r = 4 into step 4. That gives a=2+3−42=0.5a = \frac{2+3-4}{2} = 0.5, c=3+4−22=2.5c = \frac{3+4-2}{2} = 2.5 and d=2+4−32=1.5d = \frac{2+4-3}{2} = 1.5.
  6. Check: 0.5(1,1,0)+2.5(0,1,1)+1.5(1,0,1)=(0.5+1.5,  0.5+2.5,  2.5+1.5)=(2,3,4)0.5(1, 1, 0) + 2.5(0, 1, 1) + 1.5(1, 0, 1) = (0.5 + 1.5,\; 0.5 + 2.5,\; 2.5 + 1.5) = (2, 3, 4).

Interpretation: the point (2,3,4)(2, 3, 4) has ordinary coordinates (2,3,4)(2, 3, 4), but in this basis its coordinates, the weights on uu, ww and zz, are (0.5,2.5,1.5)(0.5, 2.5, 1.5).

Example
3. Quadratic curves (realistic)

In curve fitting, a model can use the functions 11, xx and x2x^2 as its building blocks. Every quadratic p(x)=p0+p1x+p2x2p(x) = p_0 + p_1 x + p_2 x^2 is a combination of them, so {1,x,x2}\{1, x, x^2\} spans the quadratics, and it is independent because a polynomial that is zero everywhere has all coefficients zero. The coordinates of pp are (p0,p1,p2)(p_0, p_1, p_2), which is exactly what a regression estimates.

Now use a different basis, {1,  1+x,  x2}\{1,\; 1 + x,\; x^2\}.

  1. Target: 3+2x3 + 2x.
  2. Write 3+2x=a⋅1+c(1+x)+d x23 + 2x = a \cdot 1 + c(1 + x) + d\,x^2.
  3. Match the x2x^2 term: d=0d = 0. Match the xx term: c=2c = 2. Match the constant: a+c=3a + c = 3, so a=1a = 1.
  4. Check: 1+2(1+x)=3+2x1 + 2(1 + x) = 3 + 2x.

Try it: what are the coordinates of 3+2x3 + 2x in the basis {1,  x,  x2}\{1,\; x,\; x^2\}, and why are they different from the answer above? Answer: (3,2,0)(3, 2, 0). The same polynomial has coordinates (1,2,0)(1, 2, 0) in the second basis, because the second basis has 1+x1 + x where the first has xx, so the recipe changes while the polynomial does not.

Common mistakes and tradeoffs

It is tempting to think a basis must be the standard vectors (1,0)(1, 0) and (0,1)(0, 1). In fact any independent set with the right number of vectors is a basis. The standard basis is just the most convenient one, and a good choice of basis often makes a hard problem easy.

It is tempting to think any set that spans the space is a basis. In fact a basis must also be independent. Extra vectors still span, but they make the coordinates of a point non-unique, as step 4 of the walkthrough showed.

It is tempting to think any nn vectors in Rn\mathbb{R}^n form a basis. In fact they do only if they are independent. Three copies of (1,0,0)(1, 0, 0) are three vectors in R3\mathbb{R}^3, but they span only a line.

Use a basis when you need coordinates, when you want to change the description of a problem, or when a matrix is simpler in a good basis, as in the singular value decomposition. Do not expect a basis to remove the underlying geometry: the same object has different coordinates in different bases. In infinite-dimensional spaces, such as spaces of functions, the definition still applies, but a basis may be impossible to write down, so people use other tools instead.

History

Hermann Grassmann introduced linear combinations and the idea of a set of independent generators in his 1844 book Die lineale Ausdehnungslehre. The idea was mostly ignored at first. In 1888 Giuseppe Peano gave the first modern axiomatic definition of a vector space, which made the basis definition easy to state in general terms. The word "basis" and the dimension theorem, that all bases of a space have the same size, became standard in the early twentieth century, as linear algebra was organised into a subject of its own.

Recap

  • A linear combination scales vectors and adds them. The span of a set is every combination it can make.
  • A basis spans the space and is linearly independent, so every vector has exactly one recipe.
  • Coordinates are those recipes, and changing the basis changes the coordinates but not the vector.
  • The number of vectors in any basis is the dimension of the space.

Read next: Basis Expansion for expressing functions in a basis, Linear Transformation for maps that act on coordinates, and Matrix Rank for how many independent directions a matrix can reach.

Check yourself

QuestionRecall: what two conditions must a set of vectors meet to be a basis of a vector space?Show answer
It must span the space, meaning every vector in the space is a linear combination of the set. It must also be linearly independent, meaning the only combination equal to zero is the one with all coefficients zero.
QuestionComputation: using the basis b1=(1,1)b_1 = (1, 1), b2=(1,−1)b_2 = (1, -1), find the coordinates of (5,2)(5, 2).Show answer
Solve a+c=5a + c = 5 and a−c=2a - c = 2. Adding gives 2a=72a = 7, so a=3.5a = 3.5, and then c=1.5c = 1.5. The coordinates are (3.5,1.5)(3.5, 1.5). Check: 3.5(1,1)+1.5(1,−1)=(5,2)3.5(1, 1) + 1.5(1, -1) = (5, 2).
QuestionWhy: why does a basis give every vector a unique set of coordinates?Show answer
If a vector had two different recipes, subtracting them would give a combination of basis vectors equal to zero with some nonzero coefficients. Linear independence rules that out, so the two recipes must be identical.
QuestionApplied: a dataset has three input columns, and the third column is exactly twice the first. Do the three columns form a basis for the space they describe?Show answer
No. The columns are linearly dependent, since the third column minus twice the first is zero. Removing the redundant column leaves two columns. If those two are independent, they form a basis for the same space.

Sources