Main content

### Course: Precalculus > Unit 7

Lesson 12: Representing systems of equations with matrices# Representing systems of any number of equations with matrices

In a previous videos, we saw how to represent a system with 3 equations and variables as a single matrix equation. It turns out we can do the same for a system of n equations and variables. The resulting equation will be Ax=b, where A is an nXn matrix, x is an nX1 unknown vector, and b is the nX1 constant vector. Created by Sal Khan.

## Want to join the conversation?

- But how would we solve it though, and is this method superior to substitution/elimination?(4 votes)
- So it would best you learn the gaussian elimination first before asking question about it.

But to answer your question gaussian elimination provides systematic way of solving systems of equation so it is superior in that sense.(3 votes)

- Is there another reason why we can represent systems of equations in this way besides the reason that it all works out when you multiply the matrices?(1 vote)
- How do we represent the three equations?(0 votes)
- Sal shows the way to represent the three equations with matrices in the top part of the video.(1 vote)

## Video transcript

- [Instructor] In a previous video, we saw that if you have a system of three equations with
three unknowns like this, you can represent it as
a matrix vector equation, where this matrix right over here is a three-by-three matrix. That is essentially a coefficient matrix. It has all of the coefficients of the Xs, the Ys, and the Zs as its various columns. and then you're going to
multiply that times this vector, which is really the vector
of the unknown variables, and this is a three-by-one vector. And then you would result in this other three-by-one
vector, which is a vector that contains these constant
terms right over here. What we're gonna do in
this video is recognize that you can generalize this phenomenon. It's not just true with a system of three equations with three unknowns. It actually generalizes to
N equations with N unknowns. But just to appreciate that
that is indeed the case, let us look at a system of two
equations with two unknowns. So let's say you had 2x
plus y is equal to nine, and we had 3x minus y is equal to five. I encourage you, pause this video and think about how that
would be represented as a matrix vector equation. All right, now let's
work on this together. So this is a system of two
equations with two unknowns. So the matrix that represents
the coefficients is going to be a two-by-two matrix and then that's going to be multiplied by a vector that represents
the unknown variables. We have two unknown variables over here. So this is going to be
a two-by-one vector, and then that's going
to be equal to a vector that represents the constants
on the right-hand side, and obviously we have two of those. So that's going to be a
two-by-one vector as well. And then we can do exactly what we did in that previous example
in a previous video. The coefficients on the
X terms, two and three, and then we have the
coefficients on the Y terms. This would be a positive one and then this would be a negative one. And then we multiply it times the vector of the variables, X, Y, and then last but not least, you have this nine and this
five over here, nine and five. And I encourage you and multiply this out. Multiply this matrix times this vector. And when you do that and you
still set up this equality, you're going to see that
it essentially turns into this exact same system of two equations and two unknowns. Now, what's interesting about this is that we see a generalizable form. In general, you can represent a system of N equations and N unknowns in the form. Sum N-by-N matrix A, N by N, times sum N-by-one vector X. This isn't just the variable X. This is a vector X that
has N dimensions to it. So times sum N-by-one vector X is going to be equal to sum N-by-one vector B. These are the letters that
people use by convention. This is going to be N by one. And so you can see in
these different scenarios. In that first one, this is
a three-by-three matrix. We could call that A, and then we could call this the vector X, and then we could call this the vector B. Now in that second scenario, we could call this the matrix A, we could call this the vector X, and then we could call this the vector B, but we can generalize
that to N dimensions. And as I talked about
in the previous video, what's interesting about this
is you could think about, for example, in this
system of two equations with two unknowns, as all
right, I have a line here, I have a line here, and X and Y represent the
intersection of those lines. But when you represent it this way, you could also imagine it as saying, okay, I have some unknown
vector in the coordinate plane and I'm transforming it using this matrix to get this vector nine five. And so I have to figure out what vector, when transformed in this
way, gets us to nine five, and we also thought about it
in the three-by-three case. What three-dimensional vector,
when transformed in this way, gets us to this vector right over here? And so that hints, that foreshadows where
we might be able to go. If we can unwind this
transformation somehow, then we can figure out what
these unknown vectors are. And if we can do it in two
dimensions or three dimensions, why not be able to do it in N dimensions? Which you'll see is actually very useful if you ever become a data scientist, or you go into computer science, or if you go into computer
graphics of some kind.