# Change of Bases

by Joseph Ruan, proud Member of the Math Squad

## Basic overview of Canonical basis

In most systems of math, we write things with a canonical basis. For example, a polynomial, such as

$3x^2+2x+3$,


is already in the form of

$c_1*x^2+c_2*x+c_3*1$,

since $x^2,x,1$

form a natural basis.

And thus, we can just rewrite our basis vectors as vector expressions:

$x^2 = \vec v_1, x=\vec v_2, 1 =\vec v_3$.

Then our polynomial

$3x^2+2x+3 = 3*\vec v_1 +2*\vec v_2 +3*\vec v_3$.

If we write this in coordinate form (just taking the coefficients), we get that the coordinates are, from this basis (3,2,3). Immediately you can begin to see that bases are inextricably linked to the concept of dimensions.

Another example of a canonical basis is with a 2x2 matrice. An arbitrary 2x2 matrix, such as

$\begin{pmatrix}1 & 2 \\3 & 4\end{pmatrix}$

can be rewritten in the form

$1*\begin{pmatrix}1 & 0 \\0 & 0\end{pmatrix}+2*\begin{pmatrix}0 & 1 \\0 & 0\end{pmatrix}+3*\begin{pmatrix}0 & 0 \\1 & 0\end{pmatrix}+4*\begin{pmatrix}0 & 0 \\0 & 1\end{pmatrix}$

Therefore our natural basis is

$\begin{pmatrix}1 & 0 \\0 & 0\end{pmatrix}, \begin{pmatrix}0 & 1 \\0 & 0\end{pmatrix},\begin{pmatrix}0 & 0 \\1 & 0\end{pmatrix},\begin{pmatrix}0 & 0 \\0 & 1\end{pmatrix}$.

Again, in coordinate form, we get that our arbitrary matrix is just (1,2,3,4), using the aforementioned canonical basis.

## Coordinates

As you know, the coordinates are merely the coefficients of the set of basis vectors such that the sum equals to an element in V. To put this more clearly, let $\vec b$ be the element in our subspace A and let $\vec v_1, \vec v_2, ... \vec v_n$ be our set of basis vectors. Since our basis vectors span A, there exists this equation:

$c_1*\vec v_1 +c_2*\vec v_2 +...c_n*\vec v_n = \vec b$,

where

$c_1, c_2, ... c_n$ have a unique solution.

This can also be written in matrix form:

$\begin{pmatrix}\vec v_1 & \vec v_2 & ... & \vec v_n\end{pmatrix}* \begin{pmatrix}c_1 \\c_2\\ ... \\ c_n\end{pmatrix} =\begin{pmatrix}b_1 \\b_2\\ ... \\ b_n\end{pmatrix}$.

The v vector matrix is a square matrix, and has an inverse.

Our coordinates of $\vec b$ is just the group $(c_1, c_2....,c_n)$.

## Conceptually, how to convert from one basis to another

Now, let's say that for given basis vectors,

$\vec v_1, \vec v_2, ... \vec v_n$,

we have the given coordinates :

$(c_1, c_2....,c_n)$.

Now let's say that we are also given a set of basis vectors:

$\vec w_1, \vec w_2....\vec w_n$.

We know that because each vector w is in A, there exists a linear combination of the vectors v that can make each vector w. However, the whole linear combination aspect is just another way of saying a Transformation. And as we know, transformations involve matrix multiplication.

In other words, there exists a matrix B such that

$\begin{pmatrix}\vec w_1 & \vec w_2 & ... & \vec w_n\end{pmatrix} = B*\begin{pmatrix}\vec v_1 & \vec v_2 & ... & \vec v_n\end{pmatrix}$.

Moreover,

$B(\vec v_k)=\vec w_k$,

where k is all indices from 1 to n. Therefore, it is possible to derive B.

So now, let's set up the equation for the coordinates of $\vec b$ in basis w.

$\begin{pmatrix}\vec w_1 & \vec w_2 & ... & \vec w_n\end{pmatrix} *\begin{pmatrix}k_1 \\k_2\\ ... \\ k_n\end{pmatrix} =\begin{pmatrix}b_1 \\b_2\\ ... \\ b_n\end{pmatrix}$.

Through substitution we get that

$B* \begin{pmatrix}\vec v_1 & \vec v_2 & ... & \vec v_n\end{pmatrix} *\begin{pmatrix}k_1 \\k_2\\ ... \\ k_n\end{pmatrix} =\begin{pmatrix}b_1 \\b_2\\ ... \\ b_n\end{pmatrix}$.

Then through a little manipulation, we get

$\begin{pmatrix}\vec v_1 & \vec v_2 & ... & \vec v_n\end{pmatrix} *\begin{pmatrix}k_1 \\k_2\\ ... \\ k_n\end{pmatrix} =B^{-1}*\begin{pmatrix}b_1 \\b_2\\ ... \\ b_n\end{pmatrix}$.

Since we know that the v matrix has an inverse, we get that

$\begin{pmatrix}k_1 \\k_2\\ ... \\ k_n\end{pmatrix} =\begin{pmatrix}\vec v_1 & \vec v_2 & ... & \vec v_n\end{pmatrix}^{-1}*B^{-1}*\begin{pmatrix}b_1 \\b_2\\ ... \\ b_n\end{pmatrix}$.


And thus we have our general equation for change of basis.

## Actual Example

The following example converts a polynomial from one basis to another.

For simplicity's sake, let's take the polynomial $x^2+2x+3$

under the canonical basis

($x^2,x,1$)

Now, let's convert it to the basis

$x^2+x+1, x+1, 1$.


Obviously, the initial coordinates are (1,2,3)

First, let's make our v matrix.

For simplicity, we can call

$x^2 = \begin{pmatrix}1\\0\\0\end{pmatrix}, x =\begin{pmatrix}0\\1\\0\end{pmatrix}, 1 =\begin{pmatrix}0\\0\\1\end{pmatrix}$.

Technically, you can do this with any basis. Anyway, our equation for the coordinates under the canonical basis is merely

$\begin{pmatrix}1&0&0\\0&1&0\\0&0&1\end{pmatrix} * \begin{pmatrix}1\\2\\3\end{pmatrix}=\begin{pmatrix}1\\2\\3\end{pmatrix}$

Now, let's solve for this matrix B.

Since

$B(\begin{pmatrix}1\\0\\0\end{pmatrix})=\begin{pmatrix}1\\1\\1\end{pmatrix}$

(since x^2 +x +1, converted to matrix form, is $\begin{pmatrix}1\\1\\1\end{pmatrix}$,)

we know that the first column of B is equal to

$\begin{pmatrix}1\\0\\0\end{pmatrix}$.

Using the same method, we find that the second column of B is equal to

$\begin{pmatrix}0\\1\\1\end{pmatrix}$

and the third column is likewise equal to

$\begin{pmatrix}0\\0\\1\end{pmatrix}$.

And thus we have our matrix

$\begin{pmatrix} 1&0&0\\1&1&0\\1&1&1\end{pmatrix}$.

Using our equation,

$\begin{pmatrix}k_1 \\k_2\\ ... \\ k_n\end{pmatrix} =\begin{pmatrix}\vec v_1 & \vec v_2 & ... & \vec v_n\end{pmatrix}^{-1}*B^{-1}*\begin{pmatrix}b_1 \\b_2\\ ... \\ b_n\end{pmatrix}$,

we know that the v-matrix is just identity, so that be ignored. the inverse of B can be calculated and our original

$\begin{pmatrix} b_1 \\b_2\\ ... \\ b_n\end{pmatrix}= \begin{pmatrix}1\\2\\3\end{pmatrix}$.

It turns out that the end result is such that

$k_1=1, k_2=1, k_3=1$.


This makes sense because if we add our original basis vectors

$1*(x^2+x+1)+1*(x+1)+1 = x^2+2x+3$

which is our desired result. So the new coordinates are <1,1,1>.