---
title: Change of Basis
module: Vector Spaces
moduleNumber: 4
lessonNumber: 6
order: 406
summary: >
  Two bases give the same vector two different coordinate vectors, and a single
  invertible matrix converts between them. Its columns are the coordinate vectors
  of the old basis expressed in the new one, and its inverse reverses the
  conversion. In $\mathbb{R}^n$ the change-of-coordinates matrix between two bases
  is found by one row reduction.
topics: [Vector Spaces]
draft: false
sources:
  - book: Lay
    ref: "§4.7 Change of Basis"
---

A basis fixes a coordinate system, and a problem stated in one basis is often
easier to solve in another.
[Diagonalization](/linear-algebra/eigenvalues/diagonalization) rewrites a matrix in
an eigenbasis;
[principal axes](/linear-algebra/symmetric-quadratic-svd/quadratic-forms) rewrite a
quadratic form in an orthogonal one. Switching bases changes the coordinate vector
of every point in a uniform way, and a single invertible matrix carries out the
conversion.[^lay-cob]

## Two coordinate vectors for one point

Let $\mathcal{B} = \{b_1, b_2\}$ and $\mathcal{C} = \{c_1, c_2\}$ be bases for a
space $V$. The same vector $x$ has a $\mathcal{B}$-coordinate vector and a
$\mathcal{C}$-coordinate vector, and they generally differ: each grid measures $x$
against its own axes.

$$
% caption: One vector $x$, two bases. Along the $\mathcal{B}$-grid it reads
% $(2, 1)$; along the $\mathcal{C}$-grid the same point reads $(1, 1)$. The
% transition matrix converts one reading into the other.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.15]
\definecolor{acc}{HTML}{2F6DB5}
\definecolor{red}{HTML}{B23A48}
\coordinate (O) at (0,0);
\coordinate (X) at (3,2);
\draw[acc, dashed] (O) -- (3,1) -- (X);
\draw[->, acc, very thick] (O) -- (1.5,0.5);
\node[acc, anchor=north] at (1.85,0.28) {$b_1$};
\draw[->, acc, very thick] (O) -- (0,1) node[left] {$b_2$};
\draw[red, dashed] (O) -- (2,1) -- (X);
\draw[->, red, very thick] (O) -- (2,1) node[below right] {$c_1$};
\draw[->, red, very thick] (O) -- (1,1) node[above left] {$c_2$};
\draw[->, black, very thick] (O) -- (X);
\fill[black] (X) circle (1.6pt);
\node[black, anchor=south west] at (X) {$x$};
\node[acc, anchor=north, font=\scriptsize] at (1.7,-0.4) {$[x]_{\mathcal{B}} =$ (2, 1)};
\node[red, anchor=north, font=\scriptsize] at (1.7,-0.8) {$[x]_{\mathcal{C}} =$ (1, 1)};
\fill[black] (O) circle (1.4pt);
\end{tikzpicture}
$$

Suppose the two bases are related by

$$
b_1 = 4c_1 + c_2, \qquad b_2 = -6c_1 + c_2.
$$

> **Worked example.** With the bases above and $[x]_{\mathcal{B}} = (3, 1)$ — meaning
> $x = 3b_1 + b_2$ — find $[x]_{\mathcal{C}}$.
>
> Apply the $\mathcal{C}$-coordinate mapping, which is linear:
> $$
> [x]_{\mathcal{C}} = [3b_1 + b_2]_{\mathcal{C}} = 3[b_1]_{\mathcal{C}} + [b_2]_{\mathcal{C}}.
> $$
> The coordinate vectors $[b_1]_{\mathcal{C}} = (4, 1)$ and $[b_2]_{\mathcal{C}} = (-6, 1)$
> come straight off the relations. Writing them as columns turns the sum into a
> matrix product:
> $$
> [x]_{\mathcal{C}} = \big[\,[b_1]_{\mathcal{C}} \;\; [b_2]_{\mathcal{C}}\,\big]
> \begin{bmatrix} 3 \\ 1 \end{bmatrix}
> = \begin{bmatrix} 4 & -6 \\ 1 & 1 \end{bmatrix}
> \begin{bmatrix} 3 \\ 1 \end{bmatrix}
> = \begin{bmatrix} 6 \\ 4 \end{bmatrix}.
> $$

## The change-of-coordinates matrix

The construction generalizes to any two bases of an $n$-dimensional space.

> **Theorem (Change of coordinates).** Let $\mathcal{B} = \{b_1, \dots, b_n\}$
> and $\mathcal{C} = \{c_1, \dots, c_n\}$ be bases of a vector space $V$. There is a
> unique $n \times n$ matrix $P_{\mathcal{C} \leftarrow \mathcal{B}}$ such that
> $$
> [x]_{\mathcal{C}} = P_{\mathcal{C} \leftarrow \mathcal{B}}\,[x]_{\mathcal{B}}
> \quad\text{for all } x \text{ in } V,
> $$
> and its columns are the $\mathcal{C}$-coordinate vectors of the vectors in
> $\mathcal{B}$:
> $$
> P_{\mathcal{C} \leftarrow \mathcal{B}} = \big[\,[b_1]_{\mathcal{C}} \;\; [b_2]_{\mathcal{C}} \;\; \cdots \;\; [b_n]_{\mathcal{C}}\,\big].
> $$

$P_{\mathcal{C} \leftarrow \mathcal{B}}$ is the **change-of-coordinates matrix from
$\mathcal{B}$ to $\mathcal{C}$**: left-multiplication converts
$\mathcal{B}$-coordinates into $\mathcal{C}$-coordinates. To recover the column
rule, read $P_{\mathcal{C} \leftarrow \mathcal{B}}\,[x]_{\mathcal{B}}$ as a linear
combination of the columns; the result is a $\mathcal{C}$-coordinate vector, so the
columns must be $\mathcal{C}$-coordinate vectors too.

$$
% caption: The transition matrix is built one column at a time: its $j$-th column
% is the $\mathcal{C}$-coordinate vector of the $j$-th old basis vector $b_j$.
\begin{tikzpicture}[font=\footnotesize]
\definecolor{acc}{HTML}{2F6DB5}
\draw[thick] (0,0) rectangle (4.2,1.8);
\draw[black] (1.4,0) -- (1.4,1.8);
\draw[black] (2.8,0) -- (2.8,1.8);
\node at (0.7,0.9) {$[b_1]_{\mathcal{C}}$};
\node at (2.1,0.9) {$[b_2]_{\mathcal{C}}$};
\node at (3.5,0.9) {$[b_n]_{\mathcal{C}}$};
\node[anchor=south, font=\small] at (2.1,1.85) {$P$ (transition matrix)};
\node[black, anchor=north, font=\scriptsize] at (2.1,-0.1) {each column: an old basis vector in new coordinates};
\end{tikzpicture}
$$

Its columns are the coordinate vectors of an independent set, so they are
independent and $P_{\mathcal{C} \leftarrow \mathcal{B}}$ is invertible. The inverse
runs the conversion backward:

$$
\big(P_{\mathcal{C} \leftarrow \mathcal{B}}\big)^{-1} = P_{\mathcal{B} \leftarrow \mathcal{C}}.
$$

$$
% caption: The two coordinate maps and the transition matrix form a commuting
% triangle: converting $x$ to $\mathcal{B}$-coordinates then multiplying by
% $P_{\mathcal{C}\leftarrow\mathcal{B}}$ gives the same result as converting $x$
% straight to $\mathcal{C}$-coordinates.
\begin{tikzpicture}[>=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{2F6DB5}
\node[font=\small] (V) at (3,2.2) {$x$ in $V$};
\node (B) at (0,0) {$[x]_{\mathcal{B}}$ in $\mathbb{R}^n$};
\node (C) at (6,0) {$[x]_{\mathcal{C}}$ in $\mathbb{R}^n$};
\draw[->, black, thick] (V) -- (B) node[midway, above left, font=\scriptsize] {to $\mathcal{B}$-coords};
\draw[->, black, thick] (V) -- (C) node[midway, above right, font=\scriptsize] {to $\mathcal{C}$-coords};
\draw[->, acc, very thick] (B) -- (C) node[midway, below, font=\scriptsize] {multiply by $P$ (from $\mathcal{B}$ to $\mathcal{C}$)};
\end{tikzpicture}
$$

## Change of basis in $\mathbb{R}^n$

When $\mathcal{C} = \mathcal{E}$ is the standard basis, $[b_j]_{\mathcal{E}} = b_j$,
so the transition matrix is just the basis-vector matrix from
[coordinate systems](/linear-algebra/vector-spaces/coordinate-systems):

$$
P_{\mathcal{E} \leftarrow \mathcal{B}} = [\,b_1 \;\; b_2 \;\; \cdots \;\; b_n\,] = P_{\mathcal{B}}.
$$

Converting between two _nonstandard_ bases of $\mathbb{R}^n$ needs the columns
$[b_j]_{\mathcal{C}}$, each of which solves a system $[\,c_1 \;\; \cdots \;\;
c_n\,]\,y = b_j$. Solving all $n$ systems at once is a single row reduction.

> **Row-reduction procedure.** To find $P_{\mathcal{C} \leftarrow \mathcal{B}}$ for
> bases of $\mathbb{R}^n$, row reduce the augmented matrix built from the
> $\mathcal{C}$-vectors and the $\mathcal{B}$-vectors:
> $$
> [\,c_1 \;\; \cdots \;\; c_n \;\; \mid \;\; b_1 \;\; \cdots \;\; b_n\,]
> \;\sim\;
> [\,I \;\; \mid \;\; P_{\mathcal{C} \leftarrow \mathcal{B}}\,].
> $$

Reducing the left block to $I$ applies $[\,c_1 \;\; \cdots \;\; c_n\,]^{-1}$ to
every column, and applied to $b_j$ that produces $[b_j]_{\mathcal{C}}$ in the right
block.

> **Worked example.** For $\mathbb{R}^2$ with $b_1 = (-9, 1)$, $b_2 = (-5, -1)$,
> $c_1 = (1, -4)$, $c_2 = (3, -5)$, find $P_{\mathcal{C} \leftarrow \mathcal{B}}$.
>
> Row reduce $[\,c_1 \;\; c_2 \;\; \mid \;\; b_1 \;\; b_2\,]$ until the left block is
> $I$:
> $$
> \left[\begin{array}{cc|cc} 1 & 3 & -9 & -5 \\ -4 & -5 & 1 & -1 \end{array}\right]
> \sim
> \left[\begin{array}{cc|cc} 1 & 3 & -9 & -5 \\ 0 & 1 & -5 & -3 \end{array}\right]
> \sim
> \left[\begin{array}{cc|cc} 1 & 0 & 6 & 4 \\ 0 & 1 & -5 & -3 \end{array}\right].
> $$
>
> The right block is the transition matrix:
> $$
> P_{\mathcal{C} \leftarrow \mathcal{B}} = \begin{bmatrix} 6 & 4 \\ -5 & -3 \end{bmatrix}.
> $$

$$
% caption: The augmented matrix $[\,\mathcal{C}\mid\mathcal{B}\,]$ row-reduces so
% that the left block becomes $I$ and the right block becomes the transition
% matrix $P_{\mathcal{C}\leftarrow\mathcal{B}}$.
\begin{tikzpicture}[font=\footnotesize]
\definecolor{acc}{HTML}{2F6DB5}
% left augmented
\draw[black] (0,0) rectangle (3.4,1.6);
\draw[black] (1.7,0) -- (1.7,1.6);
\node[black] at (0.85,0.8) {$c_1$ ... $c_n$};
\node[acc] at (2.55,0.8) {$b_1$ ... $b_n$};
\node[font=\scriptsize, anchor=north] at (1.7,-0.05) {augment $\mathcal{C}$ with $\mathcal{B}$};
\draw[->, acc, very thick] (3.9,0.8) -- (5.3,0.8) node[midway, above, font=\scriptsize] {reduce};
% right result
\draw[black] (5.8,0) rectangle (9.2,1.6);
\draw[black] (7.5,0) -- (7.5,1.6);
\node[black] at (6.65,0.8) {$I$};
\node[acc] at (8.35,0.8) {$P$ (transition)};
\node[font=\scriptsize, anchor=north] at (7.5,-0.05) {reduced to $I$ and $P$};
\end{tikzpicture}
$$

An equivalent formula uses the two standard-conversion matrices. Since
$P_{\mathcal{B}}[x]_{\mathcal{B}} = x$ and $[x]_{\mathcal{C}} =
P_{\mathcal{C}}^{-1} x$,

$$
[x]_{\mathcal{C}} = P_{\mathcal{C}}^{-1} P_{\mathcal{B}}\,[x]_{\mathcal{B}},
\qquad\text{so}\qquad
P_{\mathcal{C} \leftarrow \mathcal{B}} = P_{\mathcal{C}}^{-1} P_{\mathcal{B}}.
$$

For matrices larger than $2 \times 2$, the single row reduction above is faster than
forming $P_{\mathcal{C}}^{-1}$ and multiplying.

## Working in an abstract space

The same construction handles bases of $\mathbb{P}_n$ or any finite-dimensional
space by working through coordinate vectors.

> **Worked example.** In $\mathbb{P}_2$, find $P_{\mathcal{C} \leftarrow \mathcal{B}}$
> from $\mathcal{B} = \{1 - 2t + t^2,\; 3 - 5t + 4t^2,\; 2t + 3t^2\}$ to the standard
> basis $\mathcal{C} = \{1, t, t^2\}$.
>
> Each $\mathcal{B}$-polynomial is already written in standard coordinates, so its
> $\mathcal{C}$-coordinate vector is its coefficient list: $(1, -2, 1)$,
> $(3, -5, 4)$, $(0, 2, 3)$. These coordinate vectors are the columns of the
> transition matrix:
> $$
> P_{\mathcal{C} \leftarrow \mathcal{B}} =
> \begin{bmatrix} 1 & 3 & 0 \\ -2 & -5 & 2 \\ 1 & 4 & 3 \end{bmatrix}.
> $$

Reversing this — expressing a standard polynomial in the $\mathcal{B}$-basis — uses
$\big(P_{\mathcal{C} \leftarrow \mathcal{B}}\big)^{-1} = P_{\mathcal{B} \leftarrow
\mathcal{C}}$. Change of basis is the coordinate-level version of the
[similarity transformations](/linear-algebra/eigenvalues/eigenvectors-and-linear-transformations)
that rewrite a linear map when its underlying basis changes.

[^lay-cob]: **Lay**, _Linear Algebra and Its Applications_, §4.7 — Change of Basis: Theorem 15 (existence, uniqueness, and column structure of $P_{\mathcal{C} \leftarrow \mathcal{B}}$), the inverse relation, and the row-reduction computation $[\,\mathcal{C} \mid \mathcal{B}\,] \sim [\,I \mid P\,]$.
