# Change of basisÂ matrix

## Video transcript

Let's say I've got some
basis B, and it's made up of k vectors. Let's say it's v1, v2,
all the way to vk. Let's say I have some vector
a, and I know what a's coordinates are with
respect to B. So this is the coordinates of
a with respect to B are c1, c2, and I'm going to have k
coordinates, because we have k basis vectors. Or if this describes a
subspace, this is a k-dimensional subspace. So I'm going to have k of
these guys right there. All this means, by our
definition of coordinates with respect to a basis, this
literally means that I can represent my vector a as a
linear combination of these guys, where these coordinates
are the weights. So a would be equal to c1 times
v1, plus c2 times v2, plus all the way, keep adding
them up, all the way to ck times vk. Now, another way to write
this is that-- let me write it this way. If I had a matrix where the
column vectors were the basis vectors of B-- so let me write
it just like that. So let me see I have some matrix
C that looks like this, where its column vectors are
just these basis vectors. So we have v1, v2, all
the way to vk. If we assume that all of these
are a member of Rn, then each of these are going to have n
entries, or it's going to an n by k matrix. Each of these guys
have n entries. So we're going to have n rows,
and we have k columns. So let's imagine this
matrix right there. Another way to write this
expression right there, is to say that a is equal to the
vector c1, c2, all the way to ck, multiplied by this
matrix right there. This would be equal to a. This statement over here and
this expression over here are completely identical. If I take this matrix vector
product, what do I get? I get c1 times v1, plus c2 times
v2, plus c3 times v3, all the way to ck times
vk, is equal to a. We've seen this multiple
times in multiple different contexts. But what's interesting
here is this expression is the same thing. And really I'm just applying new
words to things that we've seen probably 100
times by now. We can rewrite this
expression. This is C-- and remember C is
just a matrix with our basis vectors as columns-- C
is equal to this guy. This is just the coordinates
of a with respect to the basis B. So C times the vector that has
the coordinates of the vector a with respect to the basis B. That is going to
be equal to a. Now, why did I go through the
trouble of doing this? Because now you have a fairly
straightforward way of-- if I were to give you this, if I were
to give you that right there, and say, hey, what is a,
if I wanted to write it in standard coordinates, or with
respect to the standard basis? Which is just kind of
the way we've been writing vectors all along? Then you just multiply it times
this matrix C, this matrix that has the basis
vectors as columns. The other way, if you have some
vector a that you know can be represented as a linear
combination of B, or it's in the span of these basis vectors,
then you could solve for this guy right here to
figure out a's coordinates with respect to B. So this little matrix right
here, what does it do? It helps us change bases. If you multiply it times this
guy, you're going from the vector represented by
coordinates with respect to some basis, and you multiply
it times this guy, you're going to get to the vector
just with standard coordinates. So we call this matrix right
here change of basis matrix, which sounds very fancy. But all it literally is is a
matrix with the basis vectors as columns. Let's just apply this a little
bit to see if we can do anything vaguely constructive
with it. Let's say that I have
some basis. let's say B for basis. Let's say I have two vectors. I'll define the vectors
up here. Let's say vector 1, let's say
we're dealing with R3. So vector 1 is 1, 2, 3. And let's say that vector
2 is 1, 0, 1. And let's say I'm going to
define some basis B as being the set of the vectors
v1 and v2. I'll leave it to you to verify
that these are not linear combinations of each other,
so this is a valid basis. These aren't in any way
linearly dependent. Now, let's say that I know some
vector that's in the span of these guys. All I know is how it happens
to be represented in coordinates with respect
to this basis. So let's say I have
some vector a. And when I represent the
coordinates of a with respect to this basis, it's equal
to 7, 7, minus 4. So how can we represent this
guy in its standard coordinates? What is a equal to? Well, you could just say a is
equal to 7 times v1, minus 4 times v2, and you'd be
completely correct. But let's actually use this
change of basis matrix that I've introduced you
to in this video. So the change of basis matrix
here is going to be just a matrix with v1 and v2 as
its columns, 1, 2, 3, and then 1, 0, 1. And then if we multiply our
change of basis matrix times the vector representation with
respect to that basis, so times 7 minus 4, we're going to
get the vector represented in standard coordinates. So what is this going
to be equal to? We have a 3 by 2 matrix,
times a 2 by 1. We're going to get a 3 by 1
matrix, which makes complete sense because we're
dealing in R3. a is going to be member of R3. So when we write it with
standard coordinates, we should have 3 coordinates
right there. Now when we represented a with
respect to the basis, we only had two coordinates, because a
was in the plane spanned by these two guys. Actually this is a good
excuse to draw this. So let me draw it in
three dimensions. Let's say the span of v1
and v2 looks like this. Let's say this is the 0
vector right there. So this right here is the
span of v1 and v2. Or another way, this is
the subspace that B is the basis for. So we know that a
is in this guy. So let's say v1 looks like this,
and that v2-- I'm not even looking at the numbers,
I'm just doing it fairly abstract-- let's say v2 looks
like this right here. Now, the fact that a can be
represented as a linear combination of v1 and v2, tells
us that a is also going to be in this plane in R3. In fact, it's 7 times v1,
so it's 1 v1, 1 v1's, 3 v1's, 4, 5, 6, 7. So it's 7 in that direction, and
then it's minus 4 in the v2 direction. So that's 1 in the
v2 direction. This is minus 1 in the v2
direction, minus 2, minus 3, minus 4. Or we can do it here,
1, 2, 3, 4. So our vector a is going
to look like this. It's going to sit
on the plane. So this is our vector a. It's going to sit
on the plane. And when we represent it with
respect to this basis, when we represent these coordinates with
respect to our basis B, we say oh OK, it's
7 of this guy. I'm just doing this
abstractly. Don't pay attention to
the numbers just now. I just want you to understand
the idea. We said it's 7 of this guy,
minus 4 of this guy. So it takes you back here. And you get this vector,
which is in this plane. So we only needed two
coordinates to specify it within this plane, because
this subspace was two-dimensional. But we're dealing in R3. And if we just want the general
version of a in standard coordinates, we'll have
to essentially get three coordinates. I want you to understand that
a is sitting on this plane. This plane just keeps going on
and on and on in all of these directions. a actually sits on that plane. It's a linear combination of
that guy and that guy. But let's figure out what
a looks like in standard coordinates. In standard coordinates, we get
the first term is going to be 1 times 7, plus
1 times minus 4. So that's going to be 3. We get 2 times 7, plus
0 times minus 4. That is 14. You're going to get 3 times
7, plus 1 times minus 4. So 3 times 7 is 21,
minus 4, is 17. So a is the vector 3, 14, 17. That is equal to a. Now let's say we wanted
to go the other way. Let's say we have some vector--
let me pick a letter I haven't used recently-- let's
say I have some vector d, which is 8, minus 6, 2. And let's say we know that d is
a member of the span of our basis vectors, the span of v1
and v2, which tells us that d can be represented as a linear
combination of these guys, or that d is in this subspace, or
that d can be represented as coordinates with respect
to the basis B. Remember, the basis B was just
equal to the set of v1 and v2. That's all that basis B was. Now, we know that if we have
our change of basis matrix times the vector made up of
the coordinates, of d with respect to B-- so let me write
that down, d with respect to B-- is equal to d. We know that. We know if we have this guy's
coordinates and we multiply it by the change of basis matrix,
we'll just get the regular standard coordinate
representation of d. Now in this case, we have d. We're given this. We of course know what the
change of basis matrix is. So if we wanted to represent d
in coordinates with respect to B, we're going to have to
solve this equation. So let's do that. So our change of basis matrix
is 1, 1, 2, 0, 3, 1. And we're going to have to
multiply it times some coordinates. This thing right here, we can
represent it as-- I'll do it in yellow-- we're going to
need two coordinates. It's going to be some
multiple of v1, plus some multiple of v2. So it's c1, c2. We know it has to be two
coordinates because this matrix vector product is only
well-defined if this is a member of R2, because this
is a 3 by 2 matrix. We have two columns here,
so we have to have two entries here. Then that's going to
be equal to d. So we have 8, minus 6, 2. So if we figure out what this
vector is, we've figured out what the representation, or
the coordinates of d with respect to B, are. So let's solve this. So to solve this, we can just
set up an augmented matrix. That's just our traditional
way of solving a linear equation. So we have 1, 1, 2, 0, 3, 1. We augment it with this
side right there. So we have 8, minus 6, and 2. And let's keep my first
row the same. So I have 1, 1, augmented
it with 8. And let's replace my second row
with the second row minus 2 times the first row. So I'm going to get 2 minus 2
times 1 is-- actually, let me do it the other way. Let me replace my second row
with 2 times my first row, minus my second row. So two times 1, minus 2, is 0. 2 times 1, minus 0, is 2. 2 times 8 is 16,
minus 6, is 10. Now let's replace the third
row with 3 times the first row, minus the third row. So 3 times 1, minus 3, is 0. 3 times 1, minus 1, is 2. And then 3 times 8 is 24, minus
2, is going to be 22. See it looks like I must have
made a mistake someplace, because I have these two would
lead to no solutions. Let me verify what I did, make
sure that I didn't make any strange errors. So the second row, I replaced it
with 2 times the first row, minus the second row. So 2 times 1, minus 2, is 0. 2 times 1, minus 0, is 2. 2 times 8, minus minus 6-- so
there's my error-- that's equal to 22. That was my error. So these two things
are equivalent. I'll do one step at a time. Let me replace my third row with
my third row, minus my second row, just get
it out of the way. So I"ll keep this 1,
1, 8, 0, 2, 22. And then the third row, I'm
going to replace it with my third row, minus
my second row. So it's going to be 0, 0, 0. So that just gets zeroed out. Now let me divide my
second row by 2. So I get 1, 1, and 8. And then this one becomes
0, 1, and 11. Then of course the third row
is just a bunch of 0's. Then let me keep my middle
row the same. So it's 0, 1, and 11. Then let me replace my first
with my first row, minus my middle row. So 1 minus 0 is 1. 1 minus 1 is 0. 8 minus 11 is minus 3. And I'll keep my last
row the same. So I put the left-hand side in
reduced row echelon form. So this right here
is essentially telling me my solution. So I could write it this way. I could write that 1, 0, 0, 1,
0, 0 times c1, c2 is equal to minus 3, 11, 0. Or another way of writing this,
is that 1 times c1, plus 0 times c2, or c1, is
equal to minus 3. Then we have 0 times c1, plus
1 times c2 is going to be equal to 11. So our solution to this equation
is minus 3, 11. Or another way of saying this,
is that if I wanted to write my vector d in coordinates with
respect to my basis B, it would be the coordinates minus
3, 11, which implies-- let me write it this way-- which
implies that d is equal to minus 3 times vector 1, plus
11, times vector 2. I'll leave that for
you to verify. But just like that, using this
change of basis matrix, we can go back and forth. If you have this representation,
it's very easy to take the product and
get the standard representation for d. If you have the standard
representation or the coordinates with respect
to the standard basis, it's very easy. Well, it's a little
more involved. But then you just solve
for your coordinates with respect to B.