# Change-of-basis matrix

#### dingo

##### New member
Hi

How can I get the change-of-basis matrix from basis (4,7) to basis (2,1)

Also, how do I use it once I get it.

MHB Math Scholar
Basis for what?

#### dingo

##### New member
Basis for what?
I mean a basis of vectors for the 2-dimensional vector space R^2

#### Deveno

##### Well-known member
MHB Math Scholar
(4,7) is not a basis for $\Bbb R^2$, which having dimension 2, needs a basis of 2 vectors.

#### dingo

##### New member
(4,7) is not a basis for $\Bbb R^2$, which having dimension 2, needs a basis of 2 vectors.
Yes, you are right. My amended version is to get the change-of-basis matrix from basis A=(1,0),(4,7) to basis B=(0,2),(2,1)

#### Evgeny.Makarov

##### Well-known member
MHB Math Scholar
The change-of base matrix consists of vectors from the second basis written by their coordinates in the first basis as columns. (I think I heard that sometimes the convention is to write vectors of the first basis in the second one.) So, find the coordinates of (0,2) in A and write them as the first column. Do similarly with (2,1). To find the coordinates of a vector $v$ in a basis $(e_1,e_2)$, you need to solve a system of two equations $xe_1+ye_2=v$ in $x,y$. Each coordinate of this vector equation gives a numerical equation in $x,y$.

#### ThePerfectHacker

##### Well-known member
Hi

How can I get the change-of-basis matrix from basis (4,7) to basis (2,1)

Also, how do I use it once I get it.
Say $(b_1,b_2)$ is an (ordered) basis for $\mathbb{R}^2$ and $(b_1',b_2')$ is another (ordered) basis for $\mathbb{R}^2$. We can express $b_1' = Ab_1 + Bb_2$ and $b_2' = Cb_1 + Db_2$. Then the change of basis matrix from $(b_1,b_2)$ to $(b_1',b_2')$ is given by,
$$\begin{bmatrix} A & C \\ B & D \end{bmatrix}$$

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Yes, you are right. My amended version is to get the change-of-basis matrix from basis A=(1,0),(4,7) to basis B=(0,2),(2,1)
Hi dingo!

Suppose $(x_A,y_A)$ is a vector with respect to basis A and let $(x_B,y_B)$ be the same vector with respect to basis B.

Then with respect to the standard basis $\{(1,0), (0,1)\}$ they are both equal to:
$$\begin{bmatrix}1&4\\0&7\end{bmatrix} \begin{pmatrix}x_A\\y_A\end{pmatrix} = \begin{bmatrix}0&2\\2&1\end{bmatrix} \begin{pmatrix}x_B\\y_B\end{pmatrix}$$

Solve for $\begin{pmatrix}{x_B\\y_B}\end{pmatrix}$ to find the change-of-basis matrix.

#### Evgeny.Makarov

##### Well-known member
MHB Math Scholar
Solve for $\begin{pmatrix}{x_B\\y_B}\end{pmatrix}$ to find the change-of-basis matrix.
I think one has to solve for $(x_A,y_A)$ to find the change-of-basis matrix:
$\begin{pmatrix}{x_A\\y_A}\end{pmatrix}=C \begin{pmatrix}{x_B\\y_B}\end{pmatrix}$
where $C$ is the required matrix.
(To the OP: this is a theorem, not the definition of a change-of-basis matrix.)

#### Klaas van Aarsen

##### MHB Seeker
Staff member
I think one has to solve for $(x_A,y_A)$ to find the change-of-basis matrix:
$\begin{pmatrix}{x_A\\y_A}\end{pmatrix}=C \begin{pmatrix}{x_B\\y_B}\end{pmatrix}$
where $C$ is the required matrix.
(To the OP: this is a theorem, not the definition of a change-of-basis matrix.)
As I interpret it, the change-of-basis matrix from basis A to basis B would convert a vector with respect to basis A to a vector with respect to basis B.
So:
$\begin{pmatrix}{x_B\\y_B}\end{pmatrix}=C \begin{pmatrix}{x_A\\y_A}\end{pmatrix}$

But to be honest, I always get confused with what is from and what is to.

Edit: So I usually take a peek in a text book what they feel what is from and what is to, and then copy them.

#### Evgeny.Makarov

##### Well-known member
MHB Math Scholar
The coordinates $(x_B,y_B)$ express some vector $v$ in terms of basis vectors $b_1,b_2$ of the second basis. (Sorry, I'll change the notation of post #7 a little so that basis $A$ consists of $a_1,a_2$.) In turn, the change-of-basis (COB) matrix expresses $b_1,b_2$ in terms of $a_1,a_2$ of the first basis. Multiplying the COB matrix by the column vector $\begin{pmatrix}{x_B\\y_B}\end{pmatrix}$, we take the composition of these conversions and get the expression of $v$ in terms of $a_1,a_2$.

In contrast, the COB matrix $C$ can be considered as a matrix of a linear operator that maps $a_1,a_2$ into $b_1,b_2$, respectively. Then some vector $v$ with coordinates $(x_A,y_A)$ in basis $A$ gets mapped into a different vector $v'$ with some coordinates $(x_A',y_A')$ still in the first basis. Note that the operator being linear, the coordinates of $v'$ in $B$ are the same as the coordinates of $v$ in $A$, i.e., $(x_A,y_A)$. By the reasoning in the first paragraph, the coordinates of $v'$ in $A$ are $C\begin{pmatrix}{x_A\\y_A}\end{pmatrix}$.

Thus, if $C$ is the COB matrix from $A$ to $B$ or, which is the same, the matrix of a linear operator that maps $A$ to $B$, then:
• If the same vector $v$ has coordinates $(x_A,y_A)$ and $(x_B,y_B)$ in $A$ and $B$, respectively, then
$\begin{pmatrix}{x_A\\y_A}\end{pmatrix}= C\begin{pmatrix}{x_B\\y_B}\end{pmatrix}$
("old" coordinates are expressed through the "new" ones).
• If a vector $v$ with coordinates $(x_A,y_A)$ in $A$ is mapped into a different $v'$ with coordinates $(x_A',y_A')$ still in $A$, then
$\begin{pmatrix}{x_A'\\y_A'}\end{pmatrix}= C\begin{pmatrix}{x_A\\y_A}\end{pmatrix}$
("new" coordinates are expressed through the "old" ones).

#### Klaas van Aarsen

##### MHB Seeker
Staff member
It seems that I am "stuck" in applied science, because what you write makes no sense to me (it's the wrong way around). To me it is very obvious from an applied point of view that one wants to switch coordinate system and find the coordinates of a specific point in a new system. That is what the "relevant" matrix is for.

To figure this out and see if it is really as counter-intuitive as you write, I've googled "change of basis matrix". First hit was on wikipedia: https://en.wikipedia.org/wiki/Change_of_basis.

The best I can find is a section that is labeled General case, which refers to $φ_2^{−1} ∘ φ_1$. I am assuming that this is supposed to represent the COB matrix. If it is, I believe it is aligned with my interpretation.

I'm afraid that other google hits do not really give any further enlightenment.

To be fair, whenever I try to help someone with this topic, I always refer to examples in their text book and copy whatever is there.

#### Evgeny.Makarov

##### Well-known member
MHB Math Scholar
If further help is needed, the OP is requested to provide the definition of a change-of-basis matrix.

#### ThePerfectHacker

##### Well-known member
Who needs change-of-basis when one has commutative diagrams?

#### Deveno

##### Well-known member
MHB Math Scholar
This is a notation I have found useful. But, before I begin:

To determine a vector by its coordinates, one needs a priori some idea of "what the coordinates mean". For example, if I tell you to "go that way 1, and turn left and go 4", a natural question to ask is: "which way" is "that" way (north? south? down a certain road?), and 1 and 4 "whats" (feet? miles? kilometers? blocks?)?.

So, given a basis $B = \{v_1,v_2\}$ of a two-dimensional vector space $V$ over a field $F$, I will write:

$[c_1,c_2]_B$ as shorthand for the formal linear combination:

$c_1v_1 + c_2v_2$.

It is important to realize that a matrix $A$ DOES NOT REPRESENT a linear transformation, per se. It rather represents a linear transformation GIVEN bases for the domain space, and co-domain space. If our linear transformation is $T$, we might write:

$A = [T]_B^C$

to denote that:

$[T]_B^C[v]_C = [T(v)]_B$

(It is a matter of choice which base one puts "up" or "down", I have made MY choice so that "up and down cancel" mimicking the Einstein summation convention).

When one writes an element of $\Bbb R^2$ as $(x,y)$, one is actually appealing to the "standard basis": $\{(1,0),(0,1)\}$ sometimes written as $\{e_1,e_2\}$ or $\{\mathbf{i},\mathbf{j}\}$. This basis is "invisible" because the coordinates in this basis match the vector itself.

But a vector space is not, "linear combinations of basis elements" per se, a vector space does not "care" which coordinates you use. A basis is a way of DESCRIBING a vector space, and different descriptions (different coordinate systems) are possible for the SAME vector space.

In $\Bbb R^2$ any pair of linearly independent vectors, can be used as a basis. In what follows I will call the bases like so:

$C = \{(1,0),(4,7)\} = \{u_1,u_2\}$

$B = \{(0,2),(2,1)\} = \{v_1,v_2\}$.

So, for example, $[1,0]_C = 1u_1 + 0u_2 = 1(1,0) + 0(4,7) = (1,0) + (0,0) = (1,0)$ whereas:

$[0,1]_C = 0u_1 + 1u_2 = 0(1,0) + 1(4,7) = (0,0) + (4,7) = (4,7)$

The "change-of-basis" matrix from $C$ to $B$ is simply the matrix:

$_B^C$, where $I$ is the identity linear transformation. Given a vector $[v]_C$ in $C$-coordinates it spits out $[I(v)]_B = [v]_B$ in $B$-coordinates.

It should be clear that the first column of this matrix will be the image of $[1,0]_C$, that is whatever (1,0) is in $B$-coordinates. To find this, we set:

$(1,0) = [a,b]_B = av_1 + bv_2 = a(0,2) + b(2,1) = (0,2a) + (2b,b) = (2b,2a+b)$

and solve for $a$ and $b$. This makes it clear that:

$b = \frac{1}{2}$

$a = -\frac{1}{4}$

Similarly, the second column of the matrix will be the image of $[0,1]_C$, that is, whatever (4,7) is in $B$-coordinates. Again, we solve:

$(4,7) = [a',b']_B = a'v_1 + b'v_2 = a'(0,2) + b'(2,1) = (2b',2a'+b')$ giving:

$b' = 2$

$a' = \frac{5}{2}$.

So our matrix should be:

$A = \begin{bmatrix}-\frac{1}{4}&\frac{5}{2}\\ \frac{1}{2}&2 \end{bmatrix}$

Let's, as a sanity check, verify that this matrix does what we want it to. Let's pick a random vector in $\Bbb R^2$, say (-2,5). If we've done our job right, then:

$A([v]_C) = [v]_B$

So first, we find what (-2,5) is in $C$-coordinates. This is the same process we've done twice already:

$(-2,5) = [r,s]_C = r(1,0) + s(4,7) = (r+4s,7s)$, yielding:

$r = -\frac{34}{7}$

$s = \frac{5}{7}$

Computing $A([-\frac{34}{7},\frac{5}{7}]_B)$ we obtain:

$[3,-1]_B$. Is this (-2,5) in $B$-coordinates? Let's see:

$[3,-1]_B = 3(0,2) - 1(2,1) = (0,6) - (2,1) = (-2,5)$.

Why, yes, it is.

*******************

There is an alternate way to do this, by relating both $B$ and $C$ to the standard basis. What we do here is find the change-of-basis matrices that do this:

$P: B \to \text{standard}$
$Q: C \to \text{standard}$

then it stands to reason that $P^{-1}$ is the matrix that does this:

$P^{-1}: \text{standard} \to B$

so that $P^{-1}Q$ does this:

$P^{-1}Q: C \to \text{standard} \to B$

which is what we want. The matrices $P$ and $Q$ are easy to write down, the columns are just the vectors of $B$ and $C$ in the standard basis. That is:

$P = \begin{bmatrix}0&2\\2&1 \end{bmatrix}, Q = \begin{bmatrix}1&4\\0&7 \end{bmatrix}$.

(Take a moment to see why this is so).

The difficulty here is in inverting $P$, but for a 2x2 matrix this is not so difficult, we find that:

$P^{-1} = -\frac{1}{4}\begin{bmatrix}1&-2\\-2&0 \end{bmatrix}$

and thus:

$P^{-1}Q = \begin{bmatrix}-\frac{1}{4}&\frac{1}{2}\\ \frac{1}{2}&0 \end{bmatrix}\begin{bmatrix}1&4\\0&7 \end{bmatrix}$

$= \begin{bmatrix}-\frac{1}{4}&\frac{5}{2}\\ \frac{1}{2}&2 \end{bmatrix}$

which is the same matrix we obtained above.

Perhaps it is just me, but I found most of the previous posts nearly impossible to decipher. The above approach was adapted largely from a similar discussion on Paul's Notes on Linear Algebra site, which unfortunately no longer exists.

#### Evgeny.Makarov

##### Well-known member
MHB Math Scholar
So, given a basis $B = \{v_1,v_2\}$ of a two-dimensional vector space $V$ over a field $F$, I will write:

$[c_1,c_2]_B$ as shorthand for the formal linear combination:

$c_1v_1 + c_2v_2$.

It is important to realize that a matrix $A$ DOES NOT REPRESENT a linear transformation, per se. It rather represents a linear transformation GIVEN bases for the domain space, and co-domain space. If our linear transformation is $T$, we might write:

$A = [T]_B^C$

to denote that:

$[T]_B^C[v]_C = [T(v)]_B$
There is a type mismatch here. In order for the notation $[v]_C$ to make sense, $v$ has to be a pair of coordinates rather than a vector. But $T$ acts on vectors, not coordinates, so then $T(v)$ does not make sense. I assume that, contrary to the previous convention, $[v]_C$ denotes the coordinates of $v$ in the basis $C$.

#### Deveno

##### Well-known member
MHB Math Scholar
There is a type mismatch here. In order for the notation $[v]_C$ to make sense, $v$ has to be a pair of coordinates rather than a vector. But $T$ acts on vectors, not coordinates, so then $T(v)$ does not make sense. I assume that, contrary to the previous convention, $[v]_C$ denotes the coordinates of $v$ in the basis $C$.
Yes, I am "abusing the notation" somewhat to write:

$[v]_C = [c_1,c_2]_C$ where:

$v = c_1u_1 + c_2u_2$

so that if $[T]_B^C = A$ we have:

$A((c_1,c_2)^T) = [d_1,d_2]_B$

where $[d_1,d_2]_B = d_1v_1 + d_2v_2 = T(v)$.

In other words, I am using "square brackets tagged with a subscript" to indicate which basis my coordinates express something in, and ALSO using them "conceptually" to indicate when I am writing a vector $v$ (which is "basis-less") in some particular basis.

The situation is complicated somewhat by the fact that we "identify" the representation of an element of $F^n$ with its coordinates in the standard basis, although these are actually two different things. So, in $\Bbb R^2$ for example, we will talk about "the vector (2,1)" which implicitly assumes a basis, whereas in an actual (physical) situation, we may have a force of a certain magnitude acting in a certain direction, and how we resolve that into coordinates depends essentially on where we put the origin, and how we orient our axes (these are choices we make to simplify calculation, and are not inherent in the situation).

A similar ambiguity results when we use permutation representations to represent permutation groups themselves.

Nonetheless, despite the ambiguity, the notation is useful. If you can see a "better" way to preserve rigor AND clarity, by all means, present it.