Linear AlgebraVector Spaces

Coordinates and Change of Basis

Describe vectors in a new basis with a change-of-coordinates matrix.

Not started Jump to practice

A basis lets us describe every vector by its weights. The standard basis is only one choice. Often another basis fits a problem better, and then we need to translate between descriptions. The translation uses inverse matrices.

If $\mathcal{B} = \{\mathbf{b}_1, \dots, \mathbf{b}_n\}$ is a basis of $\mathbb{R}^n$ and $\mathbf{x} = c_1\mathbf{b}_1 + \cdots + c_n\mathbf{b}_n$, the coordinate vector of $\mathbf{x}$ relative to $\mathcal{B}$ is $[\mathbf{x}]_{\mathcal{B}} = (c_1, \dots, c_n)$. With $P_{\mathcal{B}} = [\,\mathbf{b}_1\ \cdots\ \mathbf{b}_n\,]$, that equation says $$\mathbf{x} = P_{\mathcal{B}}[\mathbf{x}]_{\mathcal{B}}, \qquad [\mathbf{x}]_{\mathcal{B}} = P_{\mathcal{B}}^{-1}\mathbf{x}.$$

The grid of the basis $\mathbf{b}_1 = (2, 1)$, $\mathbf{b}_2 = (1, 1)$. The point $(5, 4)$ is $1$ step along $\mathbf{b}_1$ and $3$ steps along $\mathbf{b}_2$, so its $\mathcal{B}$-coordinates are $(1, 3)$.

Worked example: Finding coordinates

With $\mathcal{B} = \left\{\begin{bmatrix} 2 \\ 1 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \end{bmatrix}\right\}$, find $[\mathbf{x}]_{\mathcal{B}}$ for $\mathbf{x} = \begin{bmatrix} 5 \\ 4 \end{bmatrix}$.
  1. $P_{\mathcal{B}} = \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix}$ has determinant $1$, so $P_{\mathcal{B}}^{-1} = \begin{bmatrix} 1 & -1 \\ -1 & 2 \end{bmatrix}$.
  2. $[\mathbf{x}]_{\mathcal{B}}$ $= P_{\mathcal{B}}^{-1}\mathbf{x}$ $= \begin{bmatrix} 1 & -1 \\ -1 & 2 \end{bmatrix}\begin{bmatrix} 5 \\ 4 \end{bmatrix}$ $= \begin{bmatrix} 1 \\ 3 \end{bmatrix}$.
  3. Check: $\begin{bmatrix} 2 \\ 1 \end{bmatrix} + 3\begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 5 \\ 4 \end{bmatrix}$. ✓

Answer: $[\mathbf{x}]_{\mathcal{B}} = (1, 3)$

Between two bases

For two bases $\mathcal{B}$ and $\mathcal{C}$, the change-of-coordinates matrix $P_{\mathcal{C} \leftarrow \mathcal{B}}$ turns $\mathcal{B}$-coordinates into $\mathcal{C}$-coordinates: $[\mathbf{x}]_{\mathcal{C}} = P_{\mathcal{C} \leftarrow \mathcal{B}}[\mathbf{x}]_{\mathcal{B}}$. Its columns are the $\mathcal{C}$-coordinates of the $\mathcal{B}$ vectors, $P_{\mathcal{C} \leftarrow \mathcal{B}}$ $= \left[\,[\mathbf{b}_1]_{\mathcal{C}}\ \cdots\ [\mathbf{b}_n]_{\mathcal{C}}\,\right]$ $= P_{\mathcal{C}}^{-1}P_{\mathcal{B}}$, and going back uses its inverse.

Why it works

Read $P_{\mathcal{C}}^{-1}P_{\mathcal{B}}$ right to left, the way a vector travels: $P_{\mathcal{B}}$ turns $\mathcal{B}$-coordinates into ordinary (standard) coordinates, and then $P_{\mathcal{C}}^{-1}$ turns ordinary coordinates into $\mathcal{C}$-coordinates. The column formula says the same thing: $\mathbf{b}_j$ has $\mathcal{B}$-coordinates $\mathbf{e}_j$, so column $j$ must be $[\mathbf{b}_j]_{\mathcal{C}}$.

Worked example: A change-of-coordinates matrix

$\mathcal{B}$ is as above and $\mathcal{C} = \left\{\begin{bmatrix} 1 \\ 0 \end{bmatrix}, \begin{bmatrix} 1 \\ 1 \end{bmatrix}\right\}$. Find $P_{\mathcal{C} \leftarrow \mathcal{B}}$.
  1. $[\mathbf{b}_1]_{\mathcal{C}}$: solve $c_1(1, 0) + c_2(1, 1) = (2, 1)$: $c_2 = 1$, $c_1 = 1$.
  2. $[\mathbf{b}_2]_{\mathcal{C}}$: $c_1(1, 0) + c_2(1, 1) = (1, 1)$: $c_2 = 1$, $c_1 = 0$.
  3. $P_{\mathcal{C} \leftarrow \mathcal{B}} = \begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix}$. Same as $P_{\mathcal{C}}^{-1}P_{\mathcal{B}}$ $= \begin{bmatrix} 1 & -1 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix}$. ✓
  4. Use it on the earlier vector: $[\mathbf{x}]_{\mathcal{C}}$ $= \begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix}\begin{bmatrix} 1 \\ 3 \end{bmatrix}$ $= \begin{bmatrix} 1 \\ 4 \end{bmatrix}$, and indeed $1(1, 0) + 4(1, 1) = (5, 4)$.

Answer: $\begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix}$

Common mistake

Using the matrix in the wrong direction: multiplying $\mathbf{x}$ by $P_{\mathcal{B}}$ to "get $\mathcal{B}$-coordinates". $P_{\mathcal{B}}$ goes from $\mathcal{B}$-coordinates to standard ones; for the other direction you need $P_{\mathcal{B}}^{-1}$. Quick check: feed in $\mathbf{b}_1$. Its $\mathcal{B}$-coordinates must come out as $(1, 0, \dots, 0)$.

Why bother with other bases? A basis adapted to a problem makes it simpler. In a picture tilted at an angle, coordinates along the tilt are more natural; in a vibrating system, coordinates along the natural modes separate the motion; in data, coordinates along the main directions of spread compress the information. All of these are changes of basis.

Changing basis also changes the matrix of a map. If $T(\mathbf{x}) = A\mathbf{x}$, then in $\mathcal{B}$-coordinates $T$ has matrix $P_{\mathcal{B}}^{-1}AP_{\mathcal{B}}$. Choosing a basis that makes this matrix diagonal is the whole idea behind diagonalization.

Key idea

$[\mathbf{x}]_{\mathcal{B}} = P_{\mathcal{B}}^{-1}\mathbf{x}$ and $\mathbf{x} = P_{\mathcal{B}}[\mathbf{x}]_{\mathcal{B}}$. Between bases, $P_{\mathcal{C} \leftarrow \mathcal{B}} = P_{\mathcal{C}}^{-1}P_{\mathcal{B}}$, whose columns are the $\mathcal{C}$-coordinates of the $\mathcal{B}$ vectors.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • Margalit and Rabinoff, Interactive Linear Algebra (Georgia Tech), §2.8 Bases as Coordinate Systems
  • MIT OpenCourseWare 18.06 Linear Algebra (Gilbert Strang, Spring 2010), Lecture 31: Change of Basis; Image Compression
@teddyrookbook GitHub