Change of Basis
A change of basis rewrites a vector’s coordinates from one basis to another. If B is a basis, the coordinate vector [x]_{\mathcal{B}} lists the weights that build x from the basis vectors. The change-of-coordinates matrix P_{\mathcal{C} \leftarrow \mathcal{B}} converts B-coordinates into C-coordinates with one matrix multiplication.
Before this lesson: Basis and Dimension, Linear Combinations and Inverse Matrices
What coordinates relative to a basis mean
The standard coordinates of a vector, like (4, 5), are really weights: 4 copies of e₁ plus 5 copies of e₂. A different basis gives a different grid, and the same vector gets different weights on that grid.
In the picture below, the basis B = {b₁, b₂} has b₁ = (2, 1) and b₂ = (−1, 1). The point x = (4, 5) is 3 steps along b₁ and then 2 steps along b₂, so its B-coordinates are (3, 2). The point never moves. Only the grid used to describe it changes.
Coordinates turn any n-dimensional vector space into ℝⁿ. Once a basis is fixed, polynomials, matrices and other vectors can be handled with ordinary column vectors and row reduction.
Coordinate vectors and change-of-coordinates matrices
Let B = {b₁, …, bₙ} be a basis of a vector space V. Because the weights are unique for a basis, every x in V has exactly one coordinate vector:
x = c_1 b_1 + c_2 b_2 + \cdots + c_n b_n \quad \Longleftrightarrow \quad [x]_{\mathcal{B}} = \begin{bmatrix} c_1 \\ \vdots \\ c_n \end{bmatrix}Basis to standard coordinates in ℝⁿ. Put the basis vectors in the columns of P_{\mathcal{B}} = [\, b_1 \; \cdots \; b_n \,]. Then:
x = P_{\mathcal{B}}\,[x]_{\mathcal{B}} \qquad [x]_{\mathcal{B}} = P_{\mathcal{B}}^{-1}\,xP_{\mathcal{B}} is invertible because its columns are a basis (see the invertible matrix theorem).
One basis to another. For two bases B and C of V, the change-of-coordinates matrix from B to C has the C-coordinates of the B vectors as its columns:
P_{\mathcal{C} \leftarrow \mathcal{B}} = \big[\, [b_1]_{\mathcal{C}} \; [b_2]_{\mathcal{C}} \; \cdots \; [b_n]_{\mathcal{C}} \,\big] \qquad [x]_{\mathcal{C}} = P_{\mathcal{C} \leftarrow \mathcal{B}}\,[x]_{\mathcal{B}}The reverse matrix is the inverse: P_{\mathcal{B} \leftarrow \mathcal{C}} = (P_{\mathcal{C} \leftarrow \mathcal{B}})^{-1}.
How to change basis
- To get x from [x]_{\mathcal{B}}: multiply, x = P_{\mathcal{B}}[x]_{\mathcal{B}}. This is just the linear combination c₁b₁ + ⋯ + cₙbₙ.
- To get [x]_{\mathcal{B}} from x: row reduce the augmented matrix [\, P_{\mathcal{B}} \mid x \,]. The last column of the reduced form is [x]_{\mathcal{B}}. For a 2 × 2 basis matrix you can also use the inverse formula.
- To get P_{\mathcal{C} \leftarrow \mathcal{B}} in ℝⁿ: row reduce [\, c_1 \cdots c_n \mid b_1 \cdots b_n \,] to [\, I \mid P_{\mathcal{C} \leftarrow \mathcal{B}} \,]. The new basis C goes on the left.
- In a space like P₂ (polynomials of degree at most 2), first write each vector in standard coordinates, then use the same steps.
Change of basis examples
Example 1: From B-coordinates to the vector
B = {b₁, b₂} with b₁ = (2, 1) and b₂ = (−1, 1). If [x]_{\mathcal{B}} = (3, 2), find x.
x = 3\begin{bmatrix} 2 \\ 1 \end{bmatrix} + 2\begin{bmatrix} -1 \\ 1 \end{bmatrix}The coordinates are the weights on b₁ and b₂.
= \begin{bmatrix} 6 \\ 3 \end{bmatrix} + \begin{bmatrix} -2 \\ 2 \end{bmatrix}Multiply each vector by its weight.
= \begin{bmatrix} 4 \\ 5 \end{bmatrix}Add the vectors entry by entry.
Answer: x = (4, 5). This is the point in the figure above.
Example 2: From the vector to B-coordinates
B = {b₁, b₂} with b₁ = (1, 3) and b₂ = (2, 5). Find [x]_{\mathcal{B}} for x = (4, 9).
\left[\begin{array}{cc|c} 1 & 2 & 4 \\ 3 & 5 & 9 \end{array}\right]Augment P_{\mathcal{B}} with x.
\sim \left[\begin{array}{cc|c} 1 & 2 & 4 \\ 0 & -1 & -3 \end{array}\right]R₂ − 3R₁ → R₂ (see reduced row echelon form).
\sim \left[\begin{array}{cc|c} 1 & 2 & 4 \\ 0 & 1 & 3 \end{array}\right]−R₂ → R₂.
\sim \left[\begin{array}{cc|c} 1 & 0 & -2 \\ 0 & 1 & 3 \end{array}\right]R₁ − 2R₂ → R₁.
-2\begin{bmatrix} 1 \\ 3 \end{bmatrix} + 3\begin{bmatrix} 2 \\ 5 \end{bmatrix} = \begin{bmatrix} -2 + 6 \\ -6 + 15 \end{bmatrix} = \begin{bmatrix} 4 \\ 9 \end{bmatrix}Check by rebuilding x.
Answer: [x]_{\mathcal{B}} = (-2, 3).
Example 3: The change-of-coordinates matrix between two bases
In ℝ², let B = {b₁, b₂} with b₁ = (3, 7), b₂ = (2, 3), and C = {c₁, c₂} with c₁ = (1, 2), c₂ = (1, 3). Find P_{\mathcal{C} \leftarrow \mathcal{B}}, then find [x]_{\mathcal{C}} when [x]_{\mathcal{B}} = (1, 2).
\left[\begin{array}{cc|cc} 1 & 1 & 3 & 2 \\ 2 & 3 & 7 & 3 \end{array}\right]Put the new basis C on the left and B on the right.
\sim \left[\begin{array}{cc|cc} 1 & 1 & 3 & 2 \\ 0 & 1 & 1 & -1 \end{array}\right]R₂ − 2R₁ → R₂.
\sim \left[\begin{array}{cc|cc} 1 & 0 & 2 & 3 \\ 0 & 1 & 1 & -1 \end{array}\right]R₁ − R₂ → R₁.
P_{\mathcal{C} \leftarrow \mathcal{B}} = \begin{bmatrix} 2 & 3 \\ 1 & -1 \end{bmatrix}Read the right half.
[x]_{\mathcal{C}} = \begin{bmatrix} 2 & 3 \\ 1 & -1 \end{bmatrix}\begin{bmatrix} 1 \\ 2 \end{bmatrix}Multiply by the B-coordinates (see matrix multiplication).
= \begin{bmatrix} 2 + 6 \\ 1 - 2 \end{bmatrix} = \begin{bmatrix} 8 \\ -1 \end{bmatrix}Row times column for each entry.
Check: b₁ = 2c₁ + c₂ = (2, 4) + (1, 3) = (3, 7) and b₂ = 3c₁ − c₂ = (3, 6) − (1, 3) = (2, 3). Also x = b₁ + 2b₂ = (7, 13) and 8c₁ − c₂ = (8, 16) − (1, 3) = (7, 13).
Answer: P_{\mathcal{C} \leftarrow \mathcal{B}} = \begin{bmatrix} 2 & 3 \\ 1 & -1 \end{bmatrix} and [x]_{\mathcal{C}} = (8, -1).
Example 4: Coordinates of a polynomial
In P₂, the set B = {1, t − 1, (t − 1)²} is a basis. Find the B-coordinates of p(t) = 2 − t + 3t².
(t - 1)^2 = 1 - 2t + t^2
Expand the third basis vector (see special products of binomials).
\begin{bmatrix} 1 & -1 & 1 \\ 0 & 1 & -2 \\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} c_1 \\ c_2 \\ c_3 \end{bmatrix} = \begin{bmatrix} 2 \\ -1 \\ 3 \end{bmatrix}Use standard coordinates for 1, t, t²: each column is a basis vector.
c_3 = 3
Row 3.
c_2 - 2(3) = -1
Row 2, with c₃ = 3.
c_2 = 5
Add 6 to both sides.
c_1 - 5 + 3 = 2
Row 1, with c₂ = 5 and c₃ = 3.
c_1 - 2 = 2
Combine −5 + 3.
c_1 = 4
Add 2 to both sides.
4 + 5(t - 1) + 3(t - 1)^2 = 4 + 5t - 5 + 3t^2 - 6t + 3
Check: expand each term.
= 2 - t + 3t^2
Combine like terms (see combining like terms).
Answer: [p]_{\mathcal{B}} = (4, 5, 3). These are p(1), p′(1) and p″(1)/2, the Taylor polynomial coefficients centered at 1.
Example 5: Lattice coordinates of an atom
A crystal layer is built from the lattice vectors a = (2, 1) and b = (1, 3), measured in ångströms. An atom sits at (7, 11) in the lab’s standard coordinates. Find its lattice coordinates, the numbers u and v with (7, 11) = ua + vb.
\left[\begin{array}{cc|c} 2 & 1 & 7 \\ 1 & 3 & 11 \end{array}\right]Augment the lattice matrix with the position.
\sim \left[\begin{array}{cc|c} 1 & 3 & 11 \\ 2 & 1 & 7 \end{array}\right]Swap R₁ and R₂.
\sim \left[\begin{array}{cc|c} 1 & 3 & 11 \\ 0 & -5 & -15 \end{array}\right]R₂ − 2R₁ → R₂.
\sim \left[\begin{array}{cc|c} 1 & 3 & 11 \\ 0 & 1 & 3 \end{array}\right]−⅕R₂ → R₂.
\sim \left[\begin{array}{cc|c} 1 & 0 & 2 \\ 0 & 1 & 3 \end{array}\right]R₁ − 3R₂ → R₁.
2\begin{bmatrix} 2 \\ 1 \end{bmatrix} + 3\begin{bmatrix} 1 \\ 3 \end{bmatrix} = \begin{bmatrix} 4 + 3 \\ 2 + 9 \end{bmatrix} = \begin{bmatrix} 7 \\ 11 \end{bmatrix}Check.
Answer: the lattice coordinates are (u, v) = (2, 3). Whole-number lattice coordinates mean the atom sits on a lattice point, 2 steps along a and 3 steps along b.
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Putting the old basis on the left | Row reducing [b₁ b₂ ∣ c₁ c₂] to find P_{\mathcal{C} \leftarrow \mathcal{B}} | The basis you convert into (C) goes on the left: [c₁ c₂ ∣ b₁ b₂] → [I ∣ P_{\mathcal{C} \leftarrow \mathcal{B}}]. |
| Multiplying by P_{\mathcal{B}} instead of its inverse | Finding [x]_{\mathcal{B}} as P_{\mathcal{B}}x | P_{\mathcal{B}} turns B-coordinates into x. To go from x to [x]_{\mathcal{B}}, solve P_{\mathcal{B}}c = x or use P_{\mathcal{B}}^{-1}. |
| Ignoring the order of the basis | Treating {b₂, b₁} as the same basis as {b₁, b₂} | Coordinates follow the order of the basis. Swapping b₁ and b₂ swaps the coordinates. |
| Using a set that is not a basis | Finding coordinates relative to {(1, 2), (2, 4)} | Check independence first. Dependent vectors give no coordinates or more than one set of weights. |
| Confusing a vector with its coordinates | Saying p(t) = (4, 5, 3) in Example 4 | (4, 5, 3) is [p]_{\mathcal{B}}. The polynomial itself is 2 − t + 3t². |
Related ideas
Matrices of transformations. A linear transformation has a different matrix in each basis. If A is its standard matrix, its matrix relative to B is P_{\mathcal{B}}^{-1} A P_{\mathcal{B}}. Matrices related this way are called similar.
Choosing a good basis. The next lesson, Eigenvalues and Eigenvectors, finds the special directions of a matrix. Diagonalization uses those directions as a basis, so the matrix becomes diagonal.
Practice problems
- B = {(1, 0), (1, 1)} and [x]_{\mathcal{B}} = (4, -1). Find x.
- B = {(1, 1), (1, −1)}. Find [x]_{\mathcal{B}} for x = (6, 2).
- B = {(2, 5), (1, 3)}. Find P_{\mathcal{B}}^{-1} and use it to find [x]_{\mathcal{B}} for x = (1, 2).
- In P₁, B = {1 + t, 1 − t}. Find the B-coordinates of p(t) = 5 + t.
- In ℝ², B = {(2, 3), (1, 0)} and C = {(1, 1), (0, 1)}. Find P_{\mathcal{C} \leftarrow \mathcal{B}}.
- Using Problem 5, find [x]_{\mathcal{C}} when [x]_{\mathcal{B}} = (3, 1), and check your answer.
- Using Problem 5, find P_{\mathcal{B} \leftarrow \mathcal{C}}.
- In ℝ³, B = {(1, 0, 0), (1, 1, 0), (1, 1, 1)}. Find [x]_{\mathcal{B}} for x = (4, −2, 5).
- B = {(3, 1), (1, 1)}. Find P_{\mathcal{B}} and P_{\mathcal{B}}^{-1}, the matrices that convert B-coordinates to standard coordinates and back.
- A drone camera is turned so its axes point along u₁ = (3/5, 4/5) and u₂ = (−4/5, 3/5). A landmark is at (10, 5) in ground coordinates. Find its coordinates relative to the camera basis {u₁, u₂}.
Show answers
1.
x = 4\begin{bmatrix} 1 \\ 0 \end{bmatrix} - 1\begin{bmatrix} 1 \\ 1 \end{bmatrix}Use the coordinates as weights.
= \begin{bmatrix} 4 \\ 0 \end{bmatrix} - \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 3 \\ -1 \end{bmatrix}Multiply, then subtract entry by entry.
Answer: x = (3, −1).
2.
\left[\begin{array}{cc|c} 1 & 1 & 6 \\ 1 & -1 & 2 \end{array}\right]Augment P_{\mathcal{B}} with x.
\sim \left[\begin{array}{cc|c} 1 & 1 & 6 \\ 0 & -2 & -4 \end{array}\right]R₂ − R₁ → R₂.
\sim \left[\begin{array}{cc|c} 1 & 1 & 6 \\ 0 & 1 & 2 \end{array}\right]−½R₂ → R₂.
\sim \left[\begin{array}{cc|c} 1 & 0 & 4 \\ 0 & 1 & 2 \end{array}\right]R₁ − R₂ → R₁.
Answer: [x]_{\mathcal{B}} = (4, 2). Check: 4(1, 1) + 2(1, −1) = (6, 2).
3.
P_{\mathcal{B}} = \begin{bmatrix} 2 & 1 \\ 5 & 3 \end{bmatrix}Basis vectors as columns.
\det P_{\mathcal{B}} = 2(3) - 1(5) = 1Find the determinant (see determinant of a matrix).
P_{\mathcal{B}}^{-1} = \begin{bmatrix} 3 & -1 \\ -5 & 2 \end{bmatrix}Swap the diagonal entries, negate the other two and divide by the determinant, 1 (see inverse of a 2 × 2 matrix).
[x]_{\mathcal{B}} = \begin{bmatrix} 3 & -1 \\ -5 & 2 \end{bmatrix}\begin{bmatrix} 1 \\ 2 \end{bmatrix} = \begin{bmatrix} 3 - 2 \\ -5 + 4 \end{bmatrix}Multiply.
= \begin{bmatrix} 1 \\ -1 \end{bmatrix}Simplify.
Answer: [x]_{\mathcal{B}} = (1, -1). Check: (2, 5) − (1, 3) = (1, 2).
4.
a(1 + t) + b(1 - t) = (a + b) + (a - b)t
Write the combination and group by powers of t.
a + b = 5,\quad a - b = 1
Match the constant terms and the t terms with 5 + t.
2a = 6
Add the two equations.
a = 3
Divide both sides by 2.
b = 5 - 3 = 2
Substitute a = 3 into a + b = 5.
Answer: [p]_{\mathcal{B}} = (3, 2). Check: 3(1 + t) + 2(1 − t) = 5 + t.
5.
\left[\begin{array}{cc|cc} 1 & 0 & 2 & 1 \\ 1 & 1 & 3 & 0 \end{array}\right]C on the left, B on the right.
\sim \left[\begin{array}{cc|cc} 1 & 0 & 2 & 1 \\ 0 & 1 & 1 & -1 \end{array}\right]R₂ − R₁ → R₂.
Answer: P_{\mathcal{C} \leftarrow \mathcal{B}} = \begin{bmatrix} 2 & 1 \\ 1 & -1 \end{bmatrix}. Check: 2(1, 1) + (0, 1) = (2, 3) and (1, 1) − (0, 1) = (1, 0).
6.
[x]_{\mathcal{C}} = \begin{bmatrix} 2 & 1 \\ 1 & -1 \end{bmatrix}\begin{bmatrix} 3 \\ 1 \end{bmatrix} = \begin{bmatrix} 6 + 1 \\ 3 - 1 \end{bmatrix}Multiply by P_{\mathcal{C} \leftarrow \mathcal{B}}.
= \begin{bmatrix} 7 \\ 2 \end{bmatrix}Simplify.
Answer: [x]_{\mathcal{C}} = (7, 2). Check: x = 3(2, 3) + (1, 0) = (7, 9), and 7(1, 1) + 2(0, 1) = (7, 9).
7.
\det P_{\mathcal{C} \leftarrow \mathcal{B}} = 2(-1) - 1(1) = -3Find the determinant.
P_{\mathcal{B} \leftarrow \mathcal{C}} = -\tfrac{1}{3}\begin{bmatrix} -1 & -1 \\ -1 & 2 \end{bmatrix}Use the 2 × 2 inverse formula.
= \begin{bmatrix} \tfrac{1}{3} & \tfrac{1}{3} \\ \tfrac{1}{3} & -\tfrac{2}{3} \end{bmatrix}Multiply each entry by −⅓.
Answer: P_{\mathcal{B} \leftarrow \mathcal{C}} = \begin{bmatrix} 1/3 & 1/3 \\ 1/3 & -2/3 \end{bmatrix}. Check: it sends (7, 2) back to (3, 1).
8.
\left[\begin{array}{ccc|c} 1 & 1 & 1 & 4 \\ 0 & 1 & 1 & -2 \\ 0 & 0 & 1 & 5 \end{array}\right]Augment P_{\mathcal{B}} with x.
\sim \left[\begin{array}{ccc|c} 1 & 1 & 1 & 4 \\ 0 & 1 & 0 & -7 \\ 0 & 0 & 1 & 5 \end{array}\right]R₂ − R₃ → R₂.
\sim \left[\begin{array}{ccc|c} 1 & 1 & 0 & -1 \\ 0 & 1 & 0 & -7 \\ 0 & 0 & 1 & 5 \end{array}\right]R₁ − R₃ → R₁.
\sim \left[\begin{array}{ccc|c} 1 & 0 & 0 & 6 \\ 0 & 1 & 0 & -7 \\ 0 & 0 & 1 & 5 \end{array}\right]R₁ − R₂ → R₁.
Answer: [x]_{\mathcal{B}} = (6, -7, 5). Check: 6(1, 0, 0) − 7(1, 1, 0) + 5(1, 1, 1) = (4, −2, 5).
9.
P_{\mathcal{B}} = \begin{bmatrix} 3 & 1 \\ 1 & 1 \end{bmatrix}Basis vectors as columns.
\det P_{\mathcal{B}} = 3(1) - 1(1) = 2Find the determinant.
P_{\mathcal{B}}^{-1} = \tfrac{1}{2}\begin{bmatrix} 1 & -1 \\ -1 & 3 \end{bmatrix}Use the 2 × 2 inverse formula.
= \begin{bmatrix} \tfrac{1}{2} & -\tfrac{1}{2} \\ -\tfrac{1}{2} & \tfrac{3}{2} \end{bmatrix}Multiply each entry by ½.
Answer: P_{\mathcal{B}} = \begin{bmatrix} 3 & 1 \\ 1 & 1 \end{bmatrix} and P_{\mathcal{B}}^{-1} = \begin{bmatrix} 1/2 & -1/2 \\ -1/2 & 3/2 \end{bmatrix}.
10.
P = \begin{bmatrix} \tfrac{3}{5} & -\tfrac{4}{5} \\ \tfrac{4}{5} & \tfrac{3}{5} \end{bmatrix}Camera basis vectors as columns.
\det P = \tfrac{9}{25} + \tfrac{16}{25} = 1Find the determinant.
P^{-1} = \begin{bmatrix} \tfrac{3}{5} & \tfrac{4}{5} \\ -\tfrac{4}{5} & \tfrac{3}{5} \end{bmatrix}Use the 2 × 2 inverse formula with determinant 1.
P^{-1}\begin{bmatrix} 10 \\ 5 \end{bmatrix} = \begin{bmatrix} 6 + 4 \\ -8 + 3 \end{bmatrix} = \begin{bmatrix} 10 \\ -5 \end{bmatrix}Multiply.
Answer: the camera coordinates are (10, −5). Check: 10(3/5, 4/5) − 5(−4/5, 3/5) = (6 + 4, 8 − 3) = (10, 5).
Change of basis FAQ
What is a change of basis matrix?
It is the matrix P_{\mathcal{C} \leftarrow \mathcal{B}} whose columns are the old basis vectors written in the new basis C. Multiplying it by [x]_{\mathcal{B}} gives [x]_{\mathcal{C}}.
How do you find the coordinate vector of x relative to a basis?
Solve c₁b₁ + ⋯ + cₙbₙ = x by row reducing the augmented matrix [b₁ ⋯ bₙ ∣ x]. The solution (c₁, …, cₙ) is [x]_{\mathcal{B}}.
Why does the order of the basis vectors matter?
The coordinates are listed in the same order as the basis. Reordering the basis reorders the coordinates and swaps the columns of every change-of-coordinates matrix.
How is change of basis related to similar matrices?
If A is the standard matrix of a transformation, its matrix in the basis B is P_{\mathcal{B}}^{-1}AP_{\mathcal{B}}. Two matrices related like this describe the same transformation in different coordinates and are called similar.
Summary
- [x]_{\mathcal{B}} lists the weights that build x from the basis vectors, in order.
- In ℝⁿ, x = P_{\mathcal{B}}[x]_{\mathcal{B}}, where the columns of P_{\mathcal{B}} are the basis vectors.
- To find [x]_{\mathcal{B}}, row reduce [b₁ ⋯ bₙ ∣ x].
- P_{\mathcal{C} \leftarrow \mathcal{B}} has columns [b_i]_{\mathcal{C}}; row reduce [C ∣ B] to [I ∣ P_{\mathcal{C} \leftarrow \mathcal{B}}].
- P_{\mathcal{B} \leftarrow \mathcal{C}} is the inverse of P_{\mathcal{C} \leftarrow \mathcal{B}}.
Previous lesson: Rank of a Matrix
Next lesson: Eigenvalues and Eigenvectors
Back to the Linear Algebra Index