Change of basis matrix | Alternate coordinate systems (bases) | Linear Algebra | Khan Academy

Change of basis matrix | Alternate coordinate systems (bases) | Linear Algebra | Khan Academy

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.

51 thoughts on “Change of basis matrix | Alternate coordinate systems (bases) | Linear Algebra | Khan Academy

  • December 15, 2009 at 11:48 am

    I'm having my exam tomorrow, and this might save me from the devastating D-grade…

    Thank you

  • January 13, 2010 at 12:38 am

    Thank you so much for your videos! I'm a physics student and you have helped me understand so many principles of mathematics that I haven't been able to understand in lectures or textbooks! Thank you so very much!!

  • March 31, 2010 at 1:50 pm

    your video lectures rock man! thanks!

  • April 13, 2010 at 5:22 pm

    very nice explanation sir. Helped.

  • June 15, 2010 at 2:00 am

    oh my god, it finally makes sense

  • August 17, 2010 at 9:17 pm

    I do know what it is about these videos but you seem to have a knack for making complex maths problems seem trivial. I have been trying to read about change of basis matrices in two textbooks and was terrified then I found this and went "ohhh that's all it is". Thanks.

  • November 19, 2010 at 8:38 am

    Good job, you have done saved me again. My grade on tomorrows test will be 100% thanks to you.

  • December 15, 2010 at 2:44 pm

    In 13:56 he calculated wrong? 2*8 – (-6) is not 10, is 22!

  • January 21, 2011 at 12:54 am

    please sal, can u make a vid about the DUAL SPACE and the QUOTENT SPACE!!!

  • March 11, 2011 at 8:24 am

    @jolealdoneto he caught his error, thankfully about a minute later

  • October 20, 2011 at 6:45 pm

    I have learned more from you in the past 2 hours than I have from my professor in the last 2 months. You are awesome. Thank you so much!

  • December 15, 2011 at 4:31 am

    Very talented 3D drawing (Y)

  • December 15, 2011 at 4:43 am

    Very helpful but just a tip: I find it helps to write what row operations you are using beside the matrix before I move on. This would also make it a bit clearer, but overall great stuff thanks for the help!

  • January 10, 2012 at 12:05 pm

    I Really Like The Video Using a change of basis matrix to get us from one coordinate system to another From Your

  • January 30, 2012 at 3:08 am

    You should come to carleton and teach the economics course load…just all the courses…this is better explained than almost any of my profs can manage. Great videos!

  • March 20, 2012 at 5:18 pm

    You sir, are a gentleman. Thank you for taking the time to create this.

  • June 3, 2012 at 9:39 am

    great video, thanks for making it

  • June 26, 2012 at 8:39 am

    I think its just a bit ambiguous. When he writes it he writes C="n x k matrix" and then adds on the other stuff.

  • August 19, 2012 at 3:20 am

    He could have told us that he knew that [8; -6; 2] lie on the plane… One could think he just made that up – but he didn't. Try it yourself: make up a vector that "probably" isn't on the plane – you'll end up with an inconsistent augmented matrix, which lets you know there are no solutions, and therefore the "unlikely" vector isn't lying on that plane. Just wanted to point that out.

  • September 27, 2012 at 2:10 am

    Gotta love being able to get the help I needed. Your discussion is clear and sound. Thanks!

  • October 22, 2012 at 11:06 am

    wow. thank you!

  • October 31, 2012 at 6:19 am

    Holy shit!!! I just learned change of basis in aprx18min…..I spent 1hr30min in my class and didnt learn crap. Thank You!

  • November 9, 2012 at 11:22 am

    thanks sal, the 'abstract' visualization of the process you drew was what made the whole thing click in my brain! what I find most difficult about linear algebra is that I can't visualize it in my head easily, so drawings like that make the numbers much more meaningful to me!

  • March 8, 2013 at 6:43 pm

    you have saved my day good sir! you can have all my likes!!!!

  • September 14, 2013 at 7:44 pm

    yeeei 🙂

  • November 5, 2013 at 8:54 pm

    Yeah. You encapsulated the difference between a good teacher and a bad teacher in one comment. 😀

  • March 12, 2014 at 7:23 pm

    very clear. Than you!

  • June 2, 2014 at 11:28 am

    What is the point of matirx if you do not solve equation in the matrix form?

  • September 21, 2014 at 6:57 pm

    tks for video!
    listen to college class to learn this? I prefer to read books and watch this videos. Also this remembers me of preschool. If little kids saw this videos they would learn this stuff without knowing it was college stuff

  • November 20, 2014 at 7:01 pm

    what is the point if doing this?

  • March 27, 2015 at 4:01 pm

    So… Why can't my professor teach us like this… Everything he has been trying to teach us makes perfect sense now! Thank you Khan Academy for not being completely out of touch with reality! <3 Best lessons ever. 

  • November 29, 2015 at 5:23 pm

    Sal, you did a mistake at 13.50!! 🙂

  • December 14, 2015 at 4:40 pm

    When finding the coordinates for D at 14 min, you make a mistake during row operations on the augmented matrix

  • February 22, 2016 at 8:01 am

    this is just stupid, I was looking for numerical method and I land on that….can't believe I am watching that in 2016.

  • April 21, 2016 at 10:27 pm

    6:41 "change of bitches"

  • May 20, 2016 at 6:58 am

    This is very helpful. I wouldn't have made it this far in Linear Algebra if it weren't for you Sal!

  • May 21, 2016 at 4:26 pm

    Thank you! Wonderful job!

  • September 5, 2016 at 6:00 am

    What about when the basis is made up of 2×2 matrices. I struggle a lot with these:

    B1 = (1 0) , (1 0 ), (1 0) B2 = (1 0) , (1 0) , (0 0)
    (1 1) (1 -1) (-1 1) (0 1) (0 -1) (1 -1)

    Asked to find the transition matrix P(B1 – B2). Please assist.

  • October 22, 2016 at 9:55 am


  • January 16, 2017 at 5:11 pm

    Another way to find c1, c2 – You could just multiply the two matrices and then solve a system of linear equations with 3 equations and 2 unknowns, which is must easier than using an augmented matrix.

  • June 18, 2017 at 5:06 pm

    very helpful and transparent lecture

  • June 22, 2017 at 2:25 pm

    do you know everything?

  • November 12, 2017 at 3:23 am


  • December 5, 2017 at 8:25 pm

    LMAO, so he's row reducing and I got 22 the first time and I'm beating myself up for being dumb enough to make mistakes, then a few seconds after, "looks like I made a mistake" … geez, my shaky heart, give me a break.

  • September 21, 2018 at 7:10 am

    You are my hero!! Your explanation is very clear!

  • March 18, 2019 at 10:54 pm

    Mr.Sal, this is a great video, I can not express my gratitude. Thank you and keep making videos like this which are well explained in detailed.

  • May 6, 2019 at 7:29 pm

    Did he do row reduction incorrectly?

  • August 14, 2019 at 12:25 am

    Newton Master Matrix thansk for you teaching class is Good Education for me.

  • September 10, 2019 at 1:53 pm



Leave a Reply

Your email address will not be published. Required fields are marked *