If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Change of basis matrix

Using a change of basis matrix to get us from one coordinate system to another. Created by Sal Khan.

Want to join the conversation?

  • leaf green style avatar for user Christopher Allen Mason
    At - How are these two vectors a basis for R^3? A basis for R^3 must not only be linearly independent, but should span R^3 - which two vectors cannot! The augmented matrix of these vectors cannot have a pivot in each row. Am I missing something?
    (11 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user Gobot
      You are right, a basis for R3 would require 3 independent vectors - but the video does not say it is a basis for R3. In fact, it is instead only a basis of a 2 dimensional subspace within R3. In this case the subspace would just be the plane given by the span of the two vectors.
      (43 votes)
  • mr pink red style avatar for user Samara Assis
    Is the standard basis Sal refers to any basis that I choose to begin my problem with?
    (4 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Misty Khan-Becerra
    wouldn't d=[-3 -11] because 0-2=-2?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • mr pants teal style avatar for user Dorus Dijkstra
      I understand your confusion, but [d]b=[-3 11] is right. At first Sal was thinking of replacing the second row with "the second row minus 2 times the first row". However, soon after he decides to replace the second row with "2 times the first row minus the second row".

      So what he actually does at is 2-0=2, and thus [d]b=[-3 11] is correct!
      (4 votes)
  • spunky sam blue style avatar for user Rafael Oliveira
    Let me see if I got it right. The vectors v1 v2 defined the base, and c1 c2 defines the matrix that will multiply vector d and represent it in base B. right?
    (4 votes)
    Default Khan Academy avatar avatar for user
  • leaf green style avatar for user Machiaweliczny
    From what I see C is change from base B to standard base( because we multiply B's coordinates by this and we get standard coordinates). But why people call it change of base from standard base to B( base C vectors as columns are change of base matrix from standard base to base C). I am confused.
    (5 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Khan. S
      I think the idea is that, C is the CHANGE OF BASIS matrix from standard base to base B.

      SO what we're doing here exactly is not changing or moving the vectors from standard base to base B, but representing them in these bases.

      If we have a vector in the standard base, and we have its coordinates in this base, then to get its coordinates in a different base, we are not going to move it to that different base, but get its coordinates in that different base.

      So the idea is, what we did to the initial basis to get the second basis, is change of basis,

      But what we did to get the coordinates of a vector in the initial basis from its coordinates in the second basis,
      (keeping in mind that a vector's coordinates in the second basis are its original coordinates in this basis) is applying the change of basis matrix to the coordinates of this vector in this same basis, we're getting the coordinates in the initial basis, not moving the vector, but getting it's coordinates knowing the change we did to the second base, so we were considering the second base the original base, but now we're applying the change on the coordinates.
      (2 votes)
  • blobby green style avatar for user MRHENRYHENRYHENRY
    Does a coordinate matrix always have to be a column vector( in other word, is it a convention that a coordinate matrix be a matrix of a single column) ?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user udayanmaurya
    Suppose we know that a vector does not belong to a span of v1 and v2.
    But still we solve equation c[a]b = a, and figure out a c1 and c2. So what does this c1 and c2 i.e. [a]b represent?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user Kyler Kathan
      C[a]b = a is the equation for a change of basis. A basis, by definition, must span the entire vector space it's a basis of. C is the change of basis matrix, and a is a member of the vector space. In other words, you can't multiply a vector that doesn't belong to the span of v1 and v2 by the change of basis matrix. Put another way, the change of basis matrix in the video will be a 2x2 matrix, but a vector that doesn't belong to the span of v1 and v2 will have 3 components. You can't multiply a 2x2 matrix with a 3x1 vector. Therefore, you can't solve for c1 and c2 at all in the scenario you gave.
      (3 votes)
  • leaf blue style avatar for user Dalton
    For the first 13 seconds of the video what do you mean by vk?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user nova.core
    I'm wondering about finding the coordinate vector by solving the matrix that represents the system of linear equations like you start doing at around . Say you use interchange (ie. you swap rows around while solving the matrix), do you have to keep track of where your (c1 c2 c3...) in the last column go? I mean, the matrix was originally set up in a specific order:
    [ 0 1 0 c1
    1 1 0 c2
    0 0 1 c3 ]
    If you swap a row, say the first row for the second row, your augmented matrix is now (c2 c1 c3). Do you have to undo this once you are at reduced echelon form to get the correct coordinate vector?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user Aaron Williams
      Once you have written the matrix in reduced row echelon form, you should be able to determine what the solution is by inspection, because interchanging the rows does not change the ordering of the columns and therefore does not change the ordering of the variables you are solving for(since each variable corresponds to a column, due to how matrix multiplication is defined).

      Hence, it is not necessary to rearrange the rows back into their original order. In fact, doing so would only make things worse, because interchanging the rows after writing A in its reduced row echelon form would undo some of the work that was already done to solve the system.
      (2 votes)
  • blobby green style avatar for user forest
    At wouldn't you say Sal is pretty lucky that the reduced row echelon form only had 2 pivots? Or said in another way that the reduced row echelon form had all zeroes in the bottom row? Otherwise d couldn't have been represented in terms of B!
    (2 votes)
    Default Khan Academy avatar avatar for user
    • mr pants teal style avatar for user Robert
      I wouldn't call it lucky but rather good planning on Sal's part for choosing d to be in the span of v1 and v2. Had he not planned ahead, as I suspect he did, then yes, Sal did get quite lucky that the row reduced form of the augmented matrix didn't end up with a pivot in the final row/column, as that would've led to d being found outside the span of v1 and v2.
      (1 vote)

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.