Main content
Precalculus
Course: Precalculus > Unit 7
Lesson 12: Representing systems of equations with matricesRepresenting systems of equations with matrices
Given a system of 3 linear equations with 3 variables, we can represent it with the equation Ax=b, where A is a 3x3 matrix, x is a 3D vector with the variables, and b is a constant 3D vector. Why is this useful? We can solve the system by solving the equation, which in many cases is much more efficient. Created by Sal Khan.
Want to join the conversation?
- How did this way of representing systems come to be?(1 vote)
Video transcript
- [Instructor] I'm a big fan
of looking at the same problem in different ways or different
ways to conceptualize them. And so, for example, if I had
a system of three equations with three unknowns,
let me just make one up, 3x - 2y - z = -1, that's one equation. And in three dimensions,
this would represent a plane. And then I have another one, 2x + 5y + z = 0. That would represent another plane. Now, if you had two non-parallel planes, they would intersect each
other and form a line. But then if we have a fourth
plane, so let me write that as -4x - y = 8, it's possible, not always going to be the case, but it's possible that
they will all intersect in exactly one x,y,z-coordinate. And so, in other videos, we talk about solving systems of equations like this, with three equations and three unknowns. Now, what I want to do in this
video is connect this idea to the notion of matrices
and matrix multiplication, which we've already
reviewed in other videos. So we can think of this exact same problem in the following way. If we take all of the coefficients and we create a three by
three matrix with them, So let me do that. So for example, let me get
all of the x-coefficients, a 3, a 2 and a -4, and I'll put it in this first
column here, 3, 2 and -4. Let me get all the y-coefficients, - 2, 5 and essentially a -1. - 2, 5 and a -1. And then last but not least, all the coefficients on the z's, a -1, a +1 and then there's
implicitly a 0z here. You can't see it. So it would be -1, +1 and then a 0. So these are the
coefficients on x in purple, on y in yellow and in like a salmon color for the z's right over here. If we said that that is
going to be multiplied by a three-dimensional vector, that is, I guess we could
say, unknown, x, y and z, that is going to be equal to a second three-dimensional
vector, which we do know, and that's -1, 0 and 8. And I know there's a
lot of things going on in your brain right now. You're like, Sal, this
looks somewhat magical. You just took the coefficients,
put the x,y,z's here, put the right-hand sides of
the equal sign, in this case, the sides that didn't
have the variables on it, put it over here. Does this actually make sense?
Does this actually work? And to validate that,
let's actually multiply out the left-hand side of this
equation right over here. So in other videos, we've talked about multiplying a three by three matrix times a, in this case,
a three by one matrix, and this is going to actually
give us a three by one matrix. So that's looking good already, and the reason why we know
that is these two have to match in order for the multiplication
to even be defined. And then, the dimensions of the product are going to be three by one. But let's actually multiply things out. Well, we know one way to construct this, I'm just gonna focus on
the left-hand side here, is to say, all right, let's essentially take
this row and this column and then take the sum of the product of the corresponding terms,
I guess you could say. So this is gonna be 3
times x, which is 3x, minus 2 times y, -2y, minus 1 times z, -1z, like that. And then, the next one, I'm going to take all of this business and
multiply it by this column. So it's gonna be 2 times x, and this is just a review
of multiplying matrices, plus 5 times y, plus 5y, plus 1 times z, plus 1z. And then last but not
least, if I take this and I do the same thing with that column, gonna be -4 times x, -4x, minus 1 times y minus, I can just write
-y, and then 0 times z, which I could write if
I want to or not write, but I could write it. So let me just write it
to make things clear. And so, the product of what
we have on the left-hand side is this right over here. And it might look like a three by three, but it's actually a three by one here, where this would eval..., if
you knew what x, y and z is, this is going to evaluate to some number. Likewise, this is going to
evaluate to some other number, and this is going to
evaluate to another number. And we know, from this,
I guess you could say, matrix vector or this matrix
equation that we have set up, that this, the left-hand
side, this product, needs to be equal to what we
have on the right-hand side. It needs to be equal to -1, 0 and 8, which means, and I think
things might be connecting for you now, that this
needs to be equal to that, and that this needs to be equal to that, and last but not least, -4x - y + 0z needs to be equal to eight, which is exactly what that original system of equations was telling us. Now, I know, well, there's
still probably some things that are circulating in your mind. One question is, well, that's all nice, you found a different
way of representing that, but how do, does this introduce
a new way of solving this? And the answer I'll
give you for now is yes, it will lead to a new way of solving this. Because if you think about
it, we're taking the product of a matrix and a vector
here to get another vector. If there's some way to essentially unwind this matrix multiplication,
then you might be able to do that, apply it to
this vector on the right, and then solve for this
unknown vector here. And that's the way that
things like a computer, a lot of computer algorithms,
actually try to solve problems like this, by representing
them as matrices. Now, another interesting thing just with the representation itself is it makes you think about the problem a little bit differently. You could view this as three
planes in three dimensions and what is the x,y,z-coordinates where they could intersect, or you could view this
three by three matrix here as a transformation matrix that's applying to, is being applied to some unknown three-dimensional vector, and under transformation, that unknown three-dimensional vector is equal to this known
three-dimensional vector, - 1, 0 and 8. And so the question of
solving this would say, all right, can we somehow
perform a reverse transformation, an inverse transformation, so to speak, on the right-hand side to figure out what that unknown vector really is? And I'll just leave you there, and we'll continue that line
of thought in future videos.