# Change of basis formula

When I ask you to picture the vector $\begin{pmatrix} 2 \\ 2 \end{pmatrix}$, most of you see this in your head:

To be precise, what you are picturing is the vector $\begin{pmatrix} 2 \\ 2 \end{pmatrix}$ in the standard basis for $\mathbb{R}^2$: $\mathcal{B} = \begin{pmatrix} e_1, e_2 \end{pmatrix}$, where $e_1$ represents a unit vector in the direction of the positive $x$-axis, and $e_2$ represents a unit vector in the direction of the positive $y$-axis.

We write $\begin{pmatrix} 2 \\ 2 \end{pmatrix}_{\mathcal{B}} = 2 e_1 + 2 e_2$, and we think of $\begin{pmatrix} 2 \\ 2 \end{pmatrix}$ as being the coordinates of this vector with respect to this basis.

Why this pedantry? We might, for example, want to express the vector above as a linear combination of different basis vectors, e.g. $\mathcal{B}' = \begin{pmatrix} \begin{pmatrix} 1 \\ 1\end{pmatrix}_{\mathcal{B}}, \begin{pmatrix} 1 \\ -1\end{pmatrix}_{\mathcal{B}} \end{pmatrix}$:

Using the notation above, we have

$\begin{pmatrix} 2 \\ 2 \end{pmatrix}_{\mathcal{B}} = 2 e_1 + 2 e_2 = 2 \begin{pmatrix} 1 \\ 1\end{pmatrix} + 0 \begin{pmatrix} 1 \\ -1\end{pmatrix} = \begin{pmatrix} 2 \\ 0 \end{pmatrix}_{\mathcal{B}'}.$

The vector has coordinates $\begin{pmatrix} 2 \\ 0 \end{pmatrix}$ in this new basis.

Is there a way to get directly from the LHS to the RHS? The theorem below tells us how to:

Let $\mathcal{B} = \begin{pmatrix} e_1, \dots, e_n \end{pmatrix}$ and $\mathcal{B}' = \begin{pmatrix} e_1', \dots, e_n' \end{pmatrix}$ be two bases for a given space. Let $M$ be an $n \times n$ matrix such that for any $i = 1, \dots, n$, $e_j = \sum_{i=1}^n M_{ij} e_i'$. (The $j$th column of $M$ is $e_j$ expressed as a linear combination in $\mathcal{B}'$.)

Then, for any $x = \begin{pmatrix} x_1 \\ \vdots \\ x_n \end{pmatrix}$, $\begin{pmatrix} x \end{pmatrix}_{\mathcal{B}} = \begin{pmatrix} Mx \end{pmatrix}_{\mathcal{B}'}$.

The proof consists solely of matrix algebra:

\begin{aligned} \begin{pmatrix} x \end{pmatrix}_{\mathcal{B}} &= \sum_{j=1}^n x_j e_j \\ &= \sum_{i=1}^n x_j \left(\sum_{i=1}^n M_{ij} e_i' \right) \\ &= \sum_{i=1}^n \left( \sum_{j=1}^n M_{ij} x_j \right) e_i' \\ &= \begin{pmatrix} Mx \end{pmatrix}_{\mathcal{B}'}. \end{aligned}

Let’s see this theorem in action for our example above. With respect to the standard coordinate system, we have

$e_1 = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, e_2 = \begin{pmatrix} 0 \\ 1 \end{pmatrix}, e_1' = \begin{pmatrix} 1 \\ 1 \end{pmatrix}, e_2' = \begin{pmatrix} 1 \\ -1 \end{pmatrix},$

and so

\begin{aligned} e_1 &= \frac{1}{2} e_1' + \frac{1}{2} e_2', \\ e_2 &= \frac{1}{2} e_1' - \frac{1}{2} e_2', \end{aligned}

which means $M = \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}$. Hence,

\begin{aligned} \begin{pmatrix} 2 \\ 2 \end{pmatrix}_{\mathcal{B}} &= \left( \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\begin{pmatrix} 2 \\ 2 \end{pmatrix}\right)_{\mathcal{B}'} = \left( \frac{1}{2}\begin{pmatrix} 4 \\ 0 \end{pmatrix}\right)_{\mathcal{B}'} \\ &= \begin{pmatrix} 2 \\ 0 \end{pmatrix}_{\mathcal{B}'}, \end{aligned}

as we saw earlier.