🧮 Linear Algebra Kingdom · Linear Algebra

Basis, Dimension & Coordinates

The smallest set that still reaches everywhere: decide whether a set is a basis, count the dimension of a span or a subspace, write a vector in coordinates relative to a chosen basis, and turn those coordinates back into the ordinary vector.

In short

  • A basis both spans and is independent: it is the smallest set that still reaches everywhere, and a basis for Rn always holds exactly n vectors.
  • Every basis of a given space holds the same number of vectors, and that number is the dimension — it belongs to the space, not to whoever chose the basis.
  • The dimension of a span is how many vectors survive the reduction, never how many were written down and never the dimension of the surrounding space.
  • Coordinates relative to a basis are the unique weights in v = c1·b1 + c2·b2, and their order is part of the answer.
  • The change-of-coordinates matrix P holds the basis vectors as columns and gives v = P·[v]_B; going the other way means using P inverse.

Two poles, and why exactly two

Cartwright Vela describes the whole isle from two poles driven into the stone: so far along this one, so far along that one. Every field has an address, and the address is a pair of numbers.

A set B of vectors is a basis for a space when it does two jobs at once.

  • It spans. Every vector of the space can be written as a combination of the vectors in B, so nowhere is out of reach.
  • It is independent. No vector in B is a combination of the others, so nothing in the set is wasted.

Those two demands pull in opposite directions. Adding more vectors makes spanning easier and independence harder; removing them does the reverse. A basis is exactly where the two meet — the smallest set that still reaches everywhere, and equally the largest set that is still free of repetition.

That tug-of-war has a consequence worth knowing before you calculate anything. In Rn, a basis always has exactly n vectors. Fewer than n can never span, and more than n can never be independent. So a set of the wrong size is settled by counting alone, with no arithmetic at all:

  • fewer than n vectors: too few, it cannot reach everywhere;
  • more than n vectors: too many, one of them must repeat a direction;
  • exactly n vectors: count is right, and now you have to check independence.

For that last case, put the vectors in as the rows of a matrix and reduce. If every row survives — n non-zero rows — the set is independent and therefore a basis. If a row reduces to zero, one vector was a combination of the others and the set is not a basis, however many vectors there are.

Dimension: the number that does not depend on your choice

A space has many bases. In R2 you could use { [1, 0], [0, 1] }, or { [2, 1], [-1, 1] }, or a thousand other pairs. What every single one of them shares is how many vectors it holds, and that shared number is the dimension.

This is the quiet theorem the whole topic rests on: any two bases of the same space have the same number of vectors. Because of it, "dimension" is a property of the space, not of the person who chose the basis.

To find the dimension of a span, list the vectors as rows, reduce, and count the rows that survive. The vectors that reduce away were already reachable from the others, so they add nothing:

span of [1, 2], [2, 4], [0, 1] -> [2, 4] is 2 times [1, 2], so it adds nothing -> two directions survive, dimension 2

Note that the answer is not the number of vectors written down, and it is not the dimension of the space they live in. Three vectors in R4 can span something of dimension 3, 2 or 1, depending entirely on how much they repeat one another.

To find the dimension of a subspace given by a homogeneous system, count the unknowns and take one away for each genuinely different equation. One equation in R3 leaves a plane, of dimension 2. Two real equations leave a line, of dimension 1.

For the null space of a matrix A — every x with Ax = 0 — the same count is usually phrased through pivots. Reduce A, count the pivot columns, and every column without a pivot belongs to a free unknown. A basis for the null space carries exactly one vector for each free unknown, so:

number of vectors in a basis for the null space = (columns of A) - (pivots of A)

Three phrasings, one idea: the dimension counts the directions that are still free once every condition has had its say.

Coordinates: the same vector, a different address

Once a basis B = { b1, b2 } is fixed, every vector v can be written in exactly one way as

v = c1·b1 + c2·b2

and that pair of weights is the coordinate vector of v relative to B, written [v]_B = (c1, c2). Uniqueness is what makes it an address rather than a guess: if two different pairs of weights gave the same v, subtracting them would produce a dependence relation, and a basis has none.

The ordinary way of writing a vector is itself a coordinate vector — it is the address relative to the standard basis { [1, 0], [0, 1] }, and it looks like the vector because [3, -2] really is 3 of the first standard vector and -2 of the second. Relative to any other basis, the numbers change while the vector itself sits exactly where it was. The field has not moved; Vela has moved her poles.

Finding coordinates means solving. Write v = c1·b1 + c2·b2, compare slots, and you have a small system in c1 and c2. For B = { b1 = [2, 1], b2 = [-1, 1] } and v = [-7, -2]:

slot 1: 2c1 - c2 = -7 slot 2: c1 + c2 = -2

Adding the two equations gives 3c1 = -9, so c1 = -3, and then c2 = 1. So [v]_B = (-3, 1). Check it: -3[2, 1] + 1[-1, 1] = [-6 - 1, -3 + 1] = [-7, -2].

Going back is the easy direction, with no solving at all. Given [v]_B = (4, 2) for the same basis, just build the combination: 4[2, 1] + 2[-1, 1] = [8 - 2, 4 + 2] = [6, 6].

Two habits are worth forming. Keep the order of the basis, because the first weight always belongs to the first basis vector, and (3, -1) is a different address from (-1, 3). And check by rebuilding: it costs one line and catches almost every slip.

The change-of-coordinates matrix

Building v out of its coordinates is a matrix product waiting to happen. Put the basis vectors in as the columns of a matrix P — first vector, first column — and then

v = P·[v]_B

For B = { [2, 1], [-1, 1] }, that matrix is P = [[2, -1], [1, 1]], and P·(4, 2) = [6, 6], which is the same arithmetic as before, packed up. P is called the change-of-coordinates matrix for B; it takes an address in Vela's poles and hands back the ordinary one.

The single most common error here is laying the basis vectors in as rows. They are columns, and the whole formula depends on it: reading the entry in row 1, column 2 of P means looking at the second basis vector and taking its first entry, not the other way round.

Running the map backwards means inverting it:

[v]_B = P^(-1)·v

which is why finding coordinates was the harder direction. For a 2 by 2 matrix the inverse has a formula: swap the two entries on the main diagonal, change the sign of the other two, and divide everything by the determinant.

P = [[a, b], [c, d]] -> P-1 = (1 / (ad - bc))·[[d, -b], [-c, a]]

For P = [[3, -1], [1, 2]] the determinant is (3)(2) - (-1)(1) = 7, the swapped-and-negated matrix is [[2, 1], [-1, 3]], and the inverse is that with every entry over 7. Its entry in row 1, column 2 is 1/7. Entries of an inverse are often fractions, and they should be left exact rather than rounded.

P is invertible precisely because B is a basis: the columns are independent, so the determinant is not 0. If someone hands you a set whose matrix has determinant 0, you have been handed a dependent set, and it was never a basis in the first place.

Worked examples

Example 1

Is B = { [1, 2], [3, 6] } a basis for R2? Is C = { [1, 2], [3, 5] }?

  1. Count first. Both sets hold 2 vectors and R2 has dimension 2, so the count is right in each case and independence decides.
  2. For B, look for a repeat: [3, 6] = 3[1, 2], so the second vector points along the first.
  3. That makes B dependent, and its span is only the line through the origin in the direction [1, 2] — a set of dimension 1. So B is not a basis for R2.
  4. For C, check the determinant of the matrix with those vectors as columns: (1)(5) - (3)(2) = 5 - 6 = -1, which is not 0.
  5. A non-zero determinant means the columns are independent, so C spans R2 as well, and C is a basis.

Example 2

B = { b1 = [2, 1], b2 = [-1, 1] } is a basis for R2 and v = [1, 5]. Find [v]_B, then turn (3, -2) back into an ordinary vector.

  1. Write v = c1·b1 + c2·b2, which slot by slot is 2c1 - c2 = 1 and c1 + c2 = 5.
  2. Add the two equations to remove c2: 3c1 = 6, so c1 = 2.
  3. Substitute back into c1 + c2 = 5: 2 + c2 = 5, so c2 = 3. That gives [v]_B = (2, 3).
  4. Check by rebuilding: 2[2, 1] + 3[-1, 1] = [4 - 3, 2 + 3] = [1, 5], which is v.
  5. Now the other direction, which needs no solving: (3, -2) means 3·b1 + (-2)·b2.
  6. That is 3[2, 1] - 2[-1, 1] = [6 + 2, 3 - 2] = [8, 1].

Example 3

H is the span of [1, -1, 2], [2, -2, 4] and [0, 1, 1] in R3. How many vectors does a basis for H contain, and what is the dimension of H?

  1. Write the three vectors as the rows of a matrix and look for repetition before reducing anything.
  2. [2, -2, 4] is 2 times [1, -1, 2], so the second row will reduce to zero: it reaches nothing the first row did not already reach.
  3. [0, 1, 1] is not a multiple of [1, -1, 2] — the first entries alone settle that — so it contributes a direction of its own.
  4. Two rows survive the reduction, so a basis for H contains 2 vectors, for instance { [1, -1, 2], [0, 1, 1] }.
  5. The dimension is that same count, 2, so H is a plane through the origin sitting inside R3.
  6. Note what the answer is not: not 3, the number of vectors written down, and not 3, the dimension of the space H lives in.

Practice problems, with solutions

Three problems of increasing difficulty, each with the full working. In the game these are generated fresh every time; these three are fixed so this page always shows the same ones.

Problem 1

Difficulty 1 of 5

B = { [-2, 1], [-4, 2] } Is B a basis for R2?

  1. No: there are too many vectors — more than 2 vectors in R2 are always dependent.
  2. No: there are too few vectors — a set of fewer than 2 can never reach the whole of R2.
  3. Yes: it has exactly as many vectors as R2 has directions, and none of them repeats the others.
  4. No: the count is right, but one of the vectors is a combination of the others.

Answer: D. No: the count is right, but one of the vectors is a combination of the others.

  1. R2 needs 2 independent directions, and B has 2 vectors.
  2. The count is right, so reduce the set and count the non-zero rows: there is 1 of them.
  3. One row reduces away, so one of the vectors is a combination of the others and B is not a basis.

Problem 2

Difficulty 3 of 5

H is the span of [-5, 5, 0], [1, 3, -1], [3, 11, -11], [2, -16, 11], [1, 4, -5] in R3 — every vector you can build as a combination of them. What is the dimension of H? Give a whole number.

Answer: 3

  1. Write the 5 vectors as the rows of a matrix and reduce it.
  2. 2 rows reduce to zero, because those vectors are already a combination of the others.
  3. 3 non-zero rows are left, so the dimension of H is 3.

Problem 3

Difficulty 4 of 5

A = [[0, -6, -5, 3], [0, 4, 0, -5], [-3, -1, -6, -3], [-3, 9, -1, -11]] The null space of A is the set of vectors x in R4 with Ax = 0, and it is a subspace of R4. How many vectors does a basis for that null space contain? Give a whole number.

Answer: 1

  1. A has 4 columns, one for each unknown.
  2. Reducing A leaves 3 pivots, so 3 unknowns are pinned down by the others.
  3. The remaining 1 unknown is free, and a basis for the null space has one vector for each of them: 1.

Common mistakes

  • Counting the vectors written down instead of the ones that survive reduction, so a span of three vectors is reported as dimension 3 when one of them was a combination of the others.
  • Giving the dimension of the surrounding space rather than of the subspace, which reports every plane in R3 as dimension 3.
  • Laying the basis vectors into the change-of-coordinates matrix as rows instead of columns, which reads every entry from the transposed position.
  • Swapping the two coordinates, or attaching a weight to the wrong basis vector, since the order the basis is written in is part of the address.
  • Stopping after the swap-and-negate step when inverting a 2 by 2, and forgetting to divide every entry by the determinant.

What you should be able to do

  • Decide whether a set of vectors is a basis for a space, and say which of the two conditions fails.
  • Find the dimension of a span or a subspace, and how many vectors a basis for it needs.
  • Find the coordinates of a vector relative to a given basis.
  • Convert coordinates back to the standard vector, and read an entry of a change-of-coordinates matrix.

Where this fits in the curriculum

Common Core

  • HSN-VM.C.10

    High school — Understand that the zero and identity matrices play a role in matrix addition and multiplication similar to the role of 0 and 1 in the real numbers; the determinant of a square matrix is nonzero if and only if the matrix has a multiplicative inverse.

    HSN-VM.C.10 is a (+) standard — beyond the college- and career-ready threshold, i.e. precalculus rather than Algebra II. HSN-VM.C.10 covers the determinant test, which asks of a square matrix the same question a basis for n dimensions answers. A basis, a dimension and coordinates relative to a chosen basis are named in no published framework; the Common Core stops at the determinant.

  • HSN-VM.C.11

    High school — Multiply a vector (regarded as a matrix with one column) by a matrix of suitable dimensions to produce another vector; work with matrices as transformations of vectors.

    HSN-VM.C.11 is a (+) standard — beyond the college- and career-ready threshold, i.e. precalculus rather than Algebra II. Turning coordinates relative to a basis back into an ordinary vector is exactly this matrix-times-vector product.

Learn these first

This leads on to