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 3 variables

Sal solves a system of three variables using elimination. Created by Sal Khan and Monterey Institute for Technology and Education.

Want to join the conversation?

  • leaf blue style avatar for user Sarah
    How do you solve for 4 variables?
    (33 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Paul Sevilla
    do you always have to check your answer or do you just do it so we can see the answer is right?
    (13 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user Sarah
      It is definitely better to check your answers when doing problems like these because having to do so much work can sometimes make us miss something as little as forgetting a negative sign. Also, make sure to check it for each equation because sometimes it equals one or two of them but not all three.
      (44 votes)
  • male robot hal style avatar for user Cozmo Kramer
    at why is he adding all the numbers when he could be subtracting?
    (7 votes)
    Default Khan Academy avatar avatar for user
  • female robot grace style avatar for user mythili_jk
    At , he says to eliminate the y variable by multiplying by 7. The equations are:
    16x+7y=-2
    8x-y=-10
    Wouldn't it be easier to eliminate the x variable by multiplying the second equation by -2?
    (13 votes)
    Default Khan Academy avatar avatar for user
  • piceratops tree style avatar for user Bob
    How do you solve 2 equations with 3 unknowns?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user john
    I added all three equations to eliminate the y variable but ended up getting a wrong answer. Is adding all the equations a valid operation?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Exodia Obliterate
      There is actually a way to solve this with just a graphing calculator!
      Here are the steps.
      1. Turn on your graphing calculator. (It needs to be a TI-83 or better)
      2. click 2nd, matrix.
      3. click to the right until you are on the setting, EDIT.
      4. select 1 of the matrices. It will bring up the matrix size on the top row and the matrix at the bottom.
      5. change the matrix size to 3 x 4.
      6. click to the right until you are in the matrix itself.
      7. The equation we are doing is x+y-3z= -10, x-y+2z= 3, 2x+y-z= -6. Take the coefficients and plug them into the matrix. This includes the values in the last column.
      8. click 2nd QUIT.
      9. now click 2nd matrix again but now press right to go to the setting MATH.
      scroll down the list until you find the option RREF. (not REF).
      10. click RREF then go back to 2nd matrix then press the letter of the 3 x 4 matrix.
      11. press enter!
      Your calculator will form a row of answers in the shape of the identity matrix with all of the values for the variables in the last column.
      Enjoy!
      if the matrix does not become the identity matrix, it means that the planes are either parallel, overlapping, intersecting a line of points or never all touching at once.
      If my instruction were confusing, there are actually videos on this that can explain it better than I can.
      I hope I helped! :)
      After learning this, I never had to do these again!
      (6 votes)
  • aqualine ultimate style avatar for user Mehar Imran
    Is it possible to scale all 3 equations at once to save time?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • leaf grey style avatar for user Dan  Stadden
      Yes. But unless you're scaling them mentally as you copy them down (which I often do), it doesn't really save much time. Another problem is that you may end up working with much larger numbers than necessary, because you need to find the least common multiple of 3 numbers rather than 2. Considering you will probably need to multiply at least one of the equations by a negative as well, the chance of making a careless mistake is pretty high.
      (8 votes)
  • blobby green style avatar for user kddyd74
    Could you expand on scaling up when needing to eliminate a variable. Where can I find more examples of this?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user cbruns
      To "scale up," one would simply multiply both sides of the equation by a value. The reason why one would scale up is to rewrite the equation so that a variable term will eliminate when it is added to another equation. A simpler example is to consider the system, 2x + 3y = 2 and x + 4y = 5. You can "scale up" the second equation by -2, that is in other words, multiply both sides of the second equation by -2 so that the "x" term becomes "-2x." Since the second equation has a "-2x" and the first equation has a "2x" the x-terms will eliminate when the equations are combined.

      Good luck!
      (4 votes)
  • starky sapling style avatar for user Ashleigh
    could you cancel out any variable, such as x or y? or does it have to be z?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Anne Farmer
    What if you have three equations but only two of them have three variables and the other equation has only two variables?
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

Solve this system. And once again, we have three equations with three unknowns. So this is essentially trying to figure out where three different planes would intersect in three dimensions. And to do this, if we want to do it by elimination, if we want to be able to eliminate variables, it looks like, well, it looks like we have a negative z here. We have a plus 2z. We have a 5z over here. If we were to scale up this third equation by positive 2, then you would have a negative 2z here, and it would cancel out with this 2z there. And then if you were to scale it up by 5, you'd have a negative 5z here, and then that could cancel out with that 5z over there. So let's try to cancel out. Let's try to eliminate the z's first. So let me start with this equation up here. I'll just rewrite it. So we have-- I'll draw an arrow over here-- we have x plus 2y plus 5z is equal to negative 17. And then to cancel out or to eliminate the z's, I'll multiply this equation here times 5. So I'm going to multiply this equation times 5. So we have to multiply both sides by 5. So 3x times 5 is 15x, y times 5 is plus 5y, and then negative z times 5 is negative 5z-- that's the whole point and why we're multiplying it by 5-- is equal to 3 times 5, which is equal to 15. And so if we add these two equations, we get x plus 15x is 16x, 2y plus 5y is 7y, and 5z minus 5z or plus negative 5z, those are going to cancel out. And that is going to be equal to negative 17 plus 15 is negative 2. So we were able to use the constraints in that equation and that equation, and now we have an equation in just x and y. So let's try to do the same thing. Let's trying to eliminate the z's. But now I'll use this equation and this equation. So this equation-- let me just rewrite it over here. We have 2x minus 3y plus 2z is equal to negative 16. I just rewrote it. And now, so that this 2z gets eliminated, let's multiply this equation times 2. So let's multiply it times 2, so we'll have a negative 2z here to eliminate with the positive 2z. So 2 times 3x is 6x, 2 times y is plus 2y, and then 2 times negative z is negative 2z is equal to 2 times 3 is equal to 6. And now we can add these two equations. 2x plus 6x is 8x, negative 3y plus 2y is negative y, and then these two guys get canceled out. And then that is equal to negative 16 plus 6 is negative 10. So now we have two equations with two unknowns. We've eliminated the z's. And let's see, if we want to eliminate again, we have a negative y over here. We have a positive 7y. Well, we could eliminate the y's if we multiplied this times 7 and add the two equations. So let's do that. So let's multiply this times 7. 7 times 8 is 56, so it's 56x minus 7y is equal to 7 times negative 10, is equal to negative 70. And now we can add these two equations. I'm now trying to eliminate the y's. So we have 16x plus 56x. That is 72x. So we have 72x, these guys eliminate, equal to negative 72, negative 2 plus negative 70. Divide both sides by 72, and we get x is equal to negative 1. And now we just have to substitute back to figure out what y and z are equal to. So let's go back to this equation right over here. So we have 8x minus y is equal to negative 10. If x is equal to negative 1, that means 8 times negative 1, or negative 8 minus y is equal to negative 10. We can add 8 to both sides. And so we have negative y is equal to negative 2, or multiplying both sides by negative 1, y is equal to 2. let me square that off. So x is equal to negative 1, y is equal to 2. We now just have to worry about z, and we can go back to any of these up here. So I'll just use this last one. The numbers seem lower. So if we substitute back into this last equation right over here, we have 3 times x, which is 3 times negative 1 plus y, which is 2, minus z is equal to 3. So it's negative 3 plus 2 minus z is equal to 3. And this is negative 1 minus z is equal to 3. And then add 1 to both sides, we get-- these cancel out-- negative z is equal to 4. Multiplying both sides by negative 1, you get z is equal to negative 4. So we're done. Let's verify that these solutions, or the solution of x is negative 1, y is equal to 2, z is equal to negative 4, actually satisfies all three of these constraints. So let's substitute into this first one. So you have x plus 2y plus 5z. So x is negative 1 plus 2 times y, so plus 4, plus 5z. So minus 20 has to be equal to negative 17. And this is negative. This right here is positive 3 minus 20 is indeed equal to negative 17. So it satisfies the first constraint. Let's look at the second one. 2 times x, 2 times negative 1. That's negative 2 minus 3 times y. That's minus 6-- 3 times 2 is 6-- plus 2 times z. z is negative 4, so that's 2 times negative 4 is negative 8. That needs to equal negative 16. Negative 2 minus negative 8 is-- sorry, negative 2 minus negative 6 is negative 8. Subtract another 8, you get negative 16. So it meets the second constraint. And then, finally, let's look at the last constraint. We have 3 times x, so negative 3 plus y, so plus 2, minus z. So minus negative 4 is the same thing as plus 4. That needs to be equal to 3. So negative 3 plus 2 is negative 1 plus 4 is indeed equal to 3. So we found the point of intersection in three dimensions of these three planes. x is negative 1, z is negative 4, y is 2. And we were able to verify that it does indeed meet all of the constraints.