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

Solving linear systems with matrices

Sal solves a linear system with 3 variables by representing it with an augmented matrix and bringing the matrix to reduced row-echelon form. Created by Sal Khan.

Want to join the conversation?

  • male robot hal style avatar for user Christiansen Lawhorn
    This method (converting to reduced row echelon form) seems somewhat incoherent. I'm not understanding the pattern to doing this. How is this possible without unbalancing the equations?
    (80 votes)
    Default Khan Academy avatar avatar for user
  • primosaur tree style avatar for user George Soilis
    I wonder if there is a specific method we choose what operations to perform in the matrix when we try to reduce it,like if there is a method for example "first subtract the 1st row from the 2nd,then the 2nd from the multiple of the 3rd by 2 ",etc.I guess probably not,but i had to ask to be sure i m not missing something.
    (27 votes)
    Default Khan Academy avatar avatar for user
    • duskpin ultimate style avatar for user W
      There is no specific method to simplify any system of three equations. One simply has to look at the equations that one is given and determine how to make the X, Y, and Z zero based on that system's coefficients.
      Fascinating question.
      (13 votes)
  • male robot hal style avatar for user Raivat Shah
    Is there a video that introduces the reduced row echelon form ?
    (34 votes)
    Default Khan Academy avatar avatar for user
  • leafers seed style avatar for user zezz vevv
    I see Khan is using " = " sign but in my book we aren't allowed to use it between matrices, we use " ~ " instead. Can anyone explain that?
    (17 votes)
    Default Khan Academy avatar avatar for user
    • leaf grey style avatar for user Qeeko
      a ~ b usually refers to an equivalence relation between objects a and b in a set X. A binary relation ~ on a set X is said to be an equivalence relation if the following holds for all a, b, c in X:
      (Reflexivity) a ~ a.
      (Symmetry) a ~ b implies b ~ a.
      (Transitivity) a ~ b and b ~ c implies a ~ c.

      In the case of augmented matrices A and B, we may define A ~ B if and only if A and B are augmented matrices corresponding to systems of equations having the same solution set. In this case ~ clearly is an equivalence relation. Since A may be different from B (they may have the same solution set, but they need not be the same system), writing A = B is not strictly correct. In short: use ~.
      (30 votes)
  • piceratops ultimate style avatar for user Dayvyd
    I've progressed through the videos, and don't recall him covering augmentation at any point. What is augmentation exactly? What video does he cover it in?
    (20 votes)
    Default Khan Academy avatar avatar for user
    • leafers ultimate style avatar for user Emily Ju
      An augmented matrix simply means that there's that division between the part you have to reduce and the last column, which is the "answer".
      {1+2+3
      {3+2+1
      would be represented in a "normal" matrix like this:
      [1 2 3]
      [3 2 1]
      while
      {1+2+3=6
      {3+2+1=6
      would have an augmented matrix, with the line instead of the = sign.
      [1 2 3 |6]
      [3 2 1 |1]
      (20 votes)
  • blobby green style avatar for user Christian Paul
    The bird sounded beautiful!
    (22 votes)
    Default Khan Academy avatar avatar for user
  • leaf green style avatar for user mullenel
    Is the reduced row echelon form the same as the guass jordan elimination?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • winston baby style avatar for user Coconut Water
    When he said 3 unknown and 3 equations, did he mean that the x,y,z are the unknowns and the augmented values are the equations?

    Please I don't know for sure. I don't want to guess on a quiz.

    Thanks for your time!
    (11 votes)
    Default Khan Academy avatar avatar for user
  • leafers ultimate style avatar for user Rok Wisdawn
    Woah, woah, that's exactly why I'm watching this to begin with! And I've watched all the previous lessons, read the articles, and answered their questions successfully. And yet ... you lost me there, Sal. First of all, that's not how an "augmented matrix" looked like just a few articles/lessons ago; it was just a 2x3 matrix. Secondly, what on earth is reduced row-echelon form? And why does it seem in this video like augmented matrix = reduced row-echelon form?

    This lesson feels like a jump and it's confusing me as someone who wants to understand what things are and why we're doing them. I understand that we're doing this to solve for x, y, and z, but pretty much everything else in this video is confusing now.

    P.S. I came here via the "Introduction to matrices" series of videos at: https://www.khanacademy.org/math/precalculus/precalc-matrices
    (17 votes)
    Default Khan Academy avatar avatar for user
  • aqualine seed style avatar for user ss17214017
    Sorry I'm not here to challenge anyone, but just confused. Because, what's the point of converting to row-echelon form? Using the equations in the video, x+y+z=3 can be rewritten as x=3-y-z. And so we can substitute x=3-y-z into equation 2, then we can find out that y=-3-2z. Finally substitute x=3-y-z and y=-3-2z into the 3rd equation, then we can find out the value of z. After finding out the value of z, we can find out everything else by substituting the value of z into other equations. So why would we use the row-echelon form instead? Is finding out the values of x, y and z the only purpose?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user kubleeka
      Because substituting like that requires a little creativity, and we can often find shortcuts if the coefficients happen to look right. Our goal with row-echelon form is to develop a purely mechanical way to solve linear systems of equations that we could potentially give to a computer to execute, and that works with any coefficients we may have.
      (6 votes)

Video transcript

I figure it never hurts getting as much practice as possible solving systems of linear equations, so let's solve this one. What I'm going to do is I'm going to solve it using an augmented matrix, and I'm going to put it in reduced row echelon form. So what's the augmented matrix for this system of equations? Three unknowns with three equations. I just have to do the coefficents. So the coefficients of x terms are just 1, 1, 1. Coefficients of the y terms are 1, 2, and 3. Coefficients of the z terms are 1, 3, and 4. And let me show that it's augmented. And then they equal 3, 0, and minus 2. Now, I want to get this augmented matrix into reduced row echelon form. So the first thing, I have a leading 1 here that's a pivot entry. Let me make everything else in that column equal to a 0. So I'm not going to change my first row. So it will just be a 1, a 1, a 1, and then my dividing line, and then I have a 3. Now, to zero this out, let me just replace the second row with the first row minus the second row. So 1 minus 1 is 0. 1 minus 2 is-- actually, a better thing to do, because I eventually want this to be 1 anyway, let me replace this row with this row, with the second row minus the first row instead of the first row minus the second row. I can do it either way. So the second row minus the first row. So 1 minus 1 is 0. 2 minus 1 is 1. 3 minus 1 is 2. And then 0 minus 3 is minus 3. Now I want to also zero this out. So let me replace this guy with this equation minus that equation. So 1 minus 1 is 0. 3 minus 1 is 2. 4 minus 1 is 3. Minus 2 minus 3 is minus 5. Fair enough. So I got my pivot entry here. I have another pivot entry here. It's to the right of this one, which is what I want for reduced row echelon form. Now, I need to target this entry and that entry. I need to zero them out. So let's do it. So I'm going to keep my second row the same. My second row is 0, 1, 2, and then I have a minus 3, the augmented part of it. And to zero this guy out, what I can do is I can replace the first row with the first row minus the second row. So I get 1 minus 0 is 1. 1 minus 1-- there's a bird outside. Let me close my window. So where was I? I'm replacing the first row with the first row minus the second row. So 1 minus 0 is 1. 1 minus 1 is 0. 1 minus 2 is minus 1. And then 3 minus minus 3, so that's equal to 3 plus 3, so that's equal to 6. 1 minus 0 is 1. 1 minus 1 is 0, negative 1. And then 3 minus negative 3, that's 6. I always want to make sure I don't make a careless mistake. Now, let me get rid of this entry right here. Let me zero that out. So let me replace the third row with the third row minus 2 times the second row. So we have 0 minus-- well, 2 times 0. That's just going to be 0. 2 minus 2 times 1, that's 2 minus 2, that's 0. 3 minus 2 times 2, that's 3 minus 4, or minus 1. And then finally, minus 5 minus 2 times minus 3. Let me write that down. That's minus 5, minus minus 6. That's minus 5 plus 6 is equal to 1. I really wanted to make sure I didn't make a careless mistake there. So that is equal to 1. So I'm almost done, but I'm still not in reduced row echelon form. This has to be a positive 1 in order to get there. It can't be anything other than a 1. That's just the style of reduced row echelon form. And then these guys up here have to be zeroed out. Well, the easy thing to do, let me just multiply this equation by minus 1. So then this becomes a plus 1 and that becomes a minus 1. And then I just need to zero out these two guys up here. So let's do it. So my equation, I'm going to keep my third row the same. My third row is now 0, 0, 1, minus 1. And now I want to zero this guy out. So what I can do is I could set my first row equal to my first row plus my last row, because if these two add up, they're going to be equal to 0. So what do I get? 1 plus 0 is 1. 0 plus 0 is 0. Minus 1 plus 1 is 0. 6 plus minus 1 is 5. Now, I want to zero this row out. And to zero this row out, what I can do is I'll replace it with the second row minus 2 times the first row. So 0 minus 2 times 0 is just 0. 1 minus 2 times 0 is just 1. 2 minus 2 times 1 is 0. Minus 3 minus 2 times negative 1. Let me write that down. Minus 3 minus 2 times minus 1. I don't want to make a careless mistake. So what is that equal to? This is equal to minus 3 minus minus 2, or minus 3 plus 2, which is equal to minus 1. So that's equal to minus 1. And now I have my augmented matrix in reduced row echelon form. My pivot entries are the only entries in their columns. Each pivot entry in each successive row is to the right of the pivot entry before it. And actually, I have no free variables. Every column has a pivot entry. So let's go back from the augmented matrix world and kind of put back our variables there. So what do we get? We get x plus 0y plus 0z is equal to 5. That's that row right there. We get 0x plus 1y plus 0z is equal to minus 1. That's that row right there. And then finally, we have 0x plus 0y plus 1z is equal to minus 1. That's that row right there. And just like that, we've actually solved our system of three equations with three unknowns. That's the solution right there. I just wrote it in this way just so you can see the corresponding, but obviously, I could have written them closer to their equal sign. So hopefully, you found that vaguely useful.