10. Coordinate vectors relative to a basis, change of basis

📖 Reading · 9 min
💡 Every code box below is live — edit it and hit Run.

§17.2 established that every vector has a unique representation on a given basis. This lesson gives that representation a name — the coordinate vector — and works out how to translate between two different bases, since "unique for basis B" does not mean "unique in absolute terms": the same vector looks different described against a different basis.

Coordinate vectors

Given a basis B=\{\vec b_1,\dots,\vec b_n\} of a vector space V and \vec v\in V, write \vec v=c_1\vec b_1+\cdots+c_n\vec b_n (possible and unique, by §17.2). The coordinate vector of \vec v relative to B is

[\vec v]_B=\begin{pmatrix}c_1\\\vdots\\c_n\end{pmatrix}

For V=\mathbb{R}^n with the standard basis E, [\vec v]_E=\vec v itself — components are standard coordinates, which is why §16.0 never needed to mention coordinates at all: it was implicitly always using E. Coordinates relative to any other basis are generally different numbers entirely, even though they name the same vector.

Why bother with a non-standard basis? Because the right basis can make a vector, or an entire family of vectors, dramatically simpler to describe. This is not an abstract promise: §19.1's diagonalization is exactly choosing a basis (of eigenvectors) in which a linear map's matrix becomes diagonal, and most of the payoff in Modules 19–21 comes from that single trick.

Computing [\vec v]_B

Let P_B=[\vec b_1\ \cdots\ \vec b_n] (the basis vectors as columns). Then \vec v=P_B[\vec v]_B directly from the definition above (§16.2's column-combination reading of a matrix-vector product), so

[\vec v]_B=P_B^{-1}\vec v

P_B is invertible because its columns are independent (they're a basis) — exactly §16.3's invertibility test. P_B is called the change-of-basis matrix from B to standard coordinates; its inverse goes the other way.

Change of basis between two non-standard bases

Given two bases B=\{\vec b_1,\dots,\vec b_n\} and C=\{\vec c_1,\dots,\vec c_n\} of the same space, converting [\vec v]_B\to[\vec v]_C doesn't require detouring through an explicit formula for \vec v itself:

\vec v=P_B[\vec v]_B=P_C[\vec v]_C\ \Longrightarrow\ [\vec v]_C=P_C^{-1}P_B[\vec v]_B

The matrix P_C^{-1}P_B is the change-of-basis matrix from B to C — build it once, and it converts any vector's B-coordinates to C-coordinates by a single matrix-vector product, without ever reconstructing \vec v in between.

Doing it in Python

import sympy as sp

b1 = sp.Matrix([1, 1])
b2 = sp.Matrix([1, -1])
PB = sp.Matrix.hstack(b1, b2)

v = sp.Matrix([5, 1])          # standard coordinates
v_B = PB.solve(v)               # coordinates relative to B
print("[v]_B =", list(v_B))

reconstructed = PB * v_B
print("P_B [v]_B =", list(reconstructed), " (should be v itself)")
[v]_B = [3, 2]
P_B [v]_B = [5, 1]  (should be v itself)

Converting directly between two non-standard bases:

import sympy as sp

b1, b2 = sp.Matrix([1, 1]), sp.Matrix([1, -1])
c1, c2 = sp.Matrix([2, 1]), sp.Matrix([1, 1])
PB = sp.Matrix.hstack(b1, b2)
PC = sp.Matrix.hstack(c1, c2)

v_B = sp.Matrix([3, 2])          # given directly in B-coordinates
change = PC.solve(PB)             # change-of-basis matrix, B -> C
v_C = change * v_B
print("change-of-basis matrix P_C^-1 P_B =")
for row in change.tolist():
    print(row)
print("[v]_C =", list(v_C))

# Verify: reconstruct v in standard coords two ways
v_direct = PB * v_B
v_via_C = PC * v_C
print("agree:", v_direct == v_via_C)
change-of-basis matrix P_C^-1 P_B =
[0, 2]
[1, -3]
[v]_C = [4, -3]
agree: True

Worked example

Given B=\{(1,2),(0,1)\}, find [\vec v]_B for \vec v=(3,7).

Solve c_1(1,2)+c_2(0,1)=(3,7): first component gives c_1=3 directly; second gives 2(3)+c_2=7\Rightarrow c_2=1.

\boxed{[\vec v]_B=(3,1)}

Sanity check. P_B=\begin{pmatrix}1&0\\2&1\end{pmatrix}, P_B^{-1}=\begin{pmatrix}1&0\\-2&1\end{pmatrix} (by §16.3's 2\times2 formula: \det P_B=1). P_B^{-1}\vec v=\begin{pmatrix}1(3)+0(7)\\-2(3)+1(7)\end{pmatrix}=\begin{pmatrix}3\\1\end{pmatrix} ✓ — matches the direct solve exactly, confirming the formula [\vec v]_B=P_B^{-1}\vec v against the definition it was derived from.

Your turn

1. For B=\{(2,0),(0,3)\} and \vec v=(6,9), find [\vec v]_B by inspection (no elimination needed — why?).

2. If [\vec v]_B=(2,-1) for B=\{(1,1),(1,0)\}, find \vec v in standard coordinates.

3. True or false: [\vec v]_E=\vec v for the standard basis E, for every vector \vec v\in\mathbb{R}^n.

Solutions

1. B's vectors are 2\vec e_1 and 3\vec e_2 — scalar multiples of the standard basis, so no elimination is needed: matching components, 6=c_1(2)\Rightarrow c_1=3 and 9=c_2(3)\Rightarrow c_2=3. [\vec v]_B=(3,3). (Whenever a basis is a rescaling of the standard one along each axis, coordinates are just componentwise division — a special case worth recognizing on sight.)

2. \vec v=2(1,1)+(-1)(1,0)=(2,2)+(-1,0)=(1,2).

3. True. This is exactly the remark made just after the definition: for the standard basis, P_E=I (its columns are the \vec e_i's, which form the identity matrix), so [\vec v]_E=P_E^{-1}\vec v=I^{-1}\vec v=\vec v — the formula and the earlier claim are the same statement.

Check yourself in code

For B=\{(1,2),(3,1)\} and \vec v=(11,7), compute [\vec v]_B and confirm P_B[\vec v]_B=\vec v.

Print exactly this:

[v]_B = [2, 3]
P_B [v]_B = [11, 7]
matches v: True
import sympy as sp

b1, b2 = sp.Matrix([1, 2]), sp.Matrix([3, 1])
PB = sp.Matrix.hstack(b1, b2)
v = sp.Matrix([11, 7])

vB = PB.solve(v)
print("[v]_B =", list(vB))
# print "P_B [v]_B = ..." and whether it matches v
import sympy as sp

b1, b2 = sp.Matrix([1, 2]), sp.Matrix([3, 1])
PB = sp.Matrix.hstack(b1, b2)
v = sp.Matrix([11, 7])

vB = PB.solve(v)
print("[v]_B =", list(vB))
reconstructed = PB * vB
print("P_B [v]_B =", list(reconstructed))
print("matches v:", reconstructed == v)

A coordinate vector [\vec v]_B=P_B^{-1}\vec v records how to rebuild \vec v from a chosen basis's vectors, and it's unique because §17.2's basis conditions guarantee it. Converting between two bases never needs to detour through the vector itself: P_C^{-1}P_B does it in one matrix multiplication. The right choice of basis is one of this course's recurring themes, starting in earnest with diagonalization in Module 19.

Next: three subspaces attached to every matrix — null space, column space, and row space — each one a span or a solution set in the sense this module has already developed.