Vector and matrix forms for systems of linear equations
2.83K subscribers
SUBSCRIBED
A system of linear equations may also be viewed in vector form, as an attempt to write one vector as a linear combination of other vectors. Or it more alternatively be viewed in matrix form. We discuss the matrix of coefficients, the vector of variables and the vector of constants. Putting these together requires an understanding of how a matrix and a vector multiply. This is the starting point of arithmetic with vectors! We also briefly introduce the augmented matrix of a system of linear equations.
00:01
hello everyone I'm no 1 robber in this
00:04
lecture I'm gonna have another look at
00:06
systems of linear equations but from
00:10
some alternate points of view so we be
00:12
looking at the vector and matrix forms
00:15
for a system of linear equations ok so a
00:18
good place to start is with two examples
00:21
that I showed you last time the first
00:23
one was this one right here
00:25
involving two equations in two unknowns
00:28
X plus 2y equals two and three X minus y
00:31
equals three we saw that those two
00:34
equations represented geometrically two
00:36
lines in the plane and that their common
00:40
point of intersection basically what you
00:42
get when you solve for x and y and we
00:45
did solve we got that x and y was equal
00:47
to 8 over 7 and 3 over 7 and that's that
00:51
point right there that's the meet of
00:54
these two lines
00:55
ok so that's all well and good now today
00:58
I want to talk about an alternate an
01:04
alternate interpretation of this system
01:12
of equations ok and this will be a kind
01:16
of a vector form for interpreting things
01:20
so we look at the system as actually
01:23
being another way of writing the
01:25
following system x times the vector 1 3
01:30
plus y times the vector 2 minus 1 equals
01:36
the vector 2 3 so can you see what we
01:43
don't we've replaced the system of two
01:47
equations with a single equation but now
01:51
on equation involving vectors so if we
01:54
look at this equation here this one and
01:57
say look at the top entry of all of the
02:02
vectors then we get the first equation
02:05
instar and if we look at the second
02:07
entry 3x minus y equals 3 then of course
02:11
we get the second equation
02:13
when we write things like this we can
02:15
really geometrically get a different
02:19
picture of what the meaning of this
02:23
system of equations is because we can
02:26
graph these vectors in the familiar
02:29
plane 1 2 3 X 1 2 3
02:35
that's why then the first vector is 1 3
02:40
there'll be that one right there
02:42
that's the vector 1 3 and the vector 2
02:46
minus 1 put a minus 1 down there so then
02:49
the vector 2 minus 1 is going down to
02:52
here it's that one there
02:53
now what about the vector 2 3 that will
02:57
be this one here it's the vector 2 3 ok
03:06
so when we solve this system what we're
03:09
doing is we're trying to express the
03:11
vector 2 3 as a linear combination of
03:14
the vectors 1 3 and a 2 -1 so this is
03:20
asking for or asking to write given
03:27
vector name is vector 2 3 as a linear
03:32
combination of other vectors in this
03:41
case the vector 1 3 and the vector 2
03:44
minus 1 and the answer well we know the
03:47
answer is 8 7 and 3/7 and so we know
03:50
that actually x equals 8 sevenths and y
03:54
equals 3/7 is a solution and what does
03:56
that mean geometrically well it means we
04:01
should take 8/7 of this first vector let
04:03
me go maybe that's eight seventh of that
04:06
first vector and 3/7 of the second
04:09
vector that's maybe like that okay and
04:11
then the claim is that the sum of those
04:13
two vectors is the given vector and you
04:15
can see that's working there all right
04:18
so we're taking we're taking eight
04:22
seventh of this vector one three and
04:25
we're adding
04:27
three sevenths of this vector which is
04:29
the vector which is the vector 2 minus 1
04:33
and we're getting the vector 2 3 which
04:37
is this one here
04:38
so it's an other interpretation of the
04:41
meaning of this system of equations
04:42
let's have a look at the same kind of
04:45
thing with this 3 by 3 the example that
04:48
we looked at so here we have three
04:50
equations in three variables x1 x2 x3 we
04:54
saw that geometrically we could
04:57
represent each of those equations by a
04:59
plane in 3-dimensional space so we
05:02
really have sort of three planes somehow
05:04
it may be this is not a big backyard we
05:07
have three planes may be that's two of
05:10
them and there's a third one you know
05:11
and then the meeting point of these
05:13
three planes will be some point like
05:15
this that's somehow the geometry
05:17
although that's not an accurate drawing
05:19
okay now we're looking at another way of
05:22
thinking about this so in the vector
05:25
form this same system can be expressed
05:31
in the following way so we're looking at
05:32
the system here let's call it double
05:36
star
05:37
okay so double star becomes okay so the
05:44
x1 is appearing here here and here with
05:50
coefficients one two and one so with x1
05:54
times 1 to 1 plus x2 times
06:01
well x2 occurs minus 1 coefficient 0
06:04
coefficient and minus 2 coefficient so
06:07
minus 1 0 minus 2 and what about x3 x3
06:13
appears with coefficients 1 minus 1 and
06:16
2 1 minus 1 and 2 and altogether that
06:23
should be the right hand side which is
06:25
cumulatively the vector 1 3 and minus 2
06:28
1 3 and minus 2 so
06:35
now the interpretation is that what
06:38
we're trying to do is we're trying to
06:39
write this vector as a linear
06:41
combination of these three vectors but
06:45
to choose the coefficients so that the
06:47
sum of these multiples of these three
06:50
given vectors is the vector on the right
06:52
hand side that we're aiming for and the
06:55
answer well we know because we've solved
06:57
already that X 1 is 4 X 2 equals 5 and X
07:02
3 equals 2 so this works both ways
07:08
because it also shows us that if we have
07:11
this kind of problem okay that this kind
07:15
of problem expressing one vector as a
07:17
linear combination of others really ends
07:19
up being a system of linear equations
07:22
and so it has the same kind of
07:25
technology deployed as when we're
07:28
finding the meats of planes okay so this
07:33
is the vector interpretation of a system
07:37
of equations great ok now I want to show
07:41
you another way of writing or thinking
07:44
about a system of equations maybe call
07:48
this the matrix form matrix form for a
07:53
system of linear equations ok so maybe
08:02
we'll go back to this first one ok so
08:06
let's have another look at this thing
08:08
and we're going to so set up bookkeeping
08:14
a bookkeeping to kind of efficiently
08:16
encode the information in this pair or
08:20
system of equations so the ingredients
08:23
really are of three kinds the
08:26
ingredients consist of well first of all
08:32
in matrix or an array matrix is just
08:35
another word for array of coefficients
08:39
on the left hand side what would that
08:45
look like so if we look here on the left
08:48
hand side
08:49
the coefficients involved are one two
08:52
three and minus one those four numbers
08:56
encode the left-hand side apart from the
08:59
variables and we can put them in a
09:01
little array or call matrix and let's
09:05
give it a name let's call it a capital A
09:08
okay this is what we call a 2 by 2
09:12
matrix 2 means 2 rows and 2 columns rows
09:21
first column second so that's one of the
09:25
ingredients the second ingredient is the
09:29
list or vector of the actual variables
09:33
that are involved in the system okay
09:37
so a vector of variables one of the
09:44
variables the variables are x and y
09:46
we're gonna organize them in a column
09:49
make them into a vector and then we
09:53
could give that vector a name we could
09:56
call it say X and I'll put an X on top
10:00
so that's a vector
10:01
okay the vector X which is the vector
10:05
consisting of the two variables x and y
10:08
and over here the third ingredient is
10:12
the vector of the right-hand side the
10:17
right-hand side constants okay which in
10:21
this case is 2 & 3 we make a vector out
10:25
of that so we could give that vector a
10:27
name as well maybe we'll call it the
10:28
vector B okay so now we have these three
10:33
ingredients the matrix a the vector X
10:38
and the vector B so that we rewrite we
10:46
rewrite the equation in matrix form as
10:59
a x equals B ax equals B ax equals B
11:12
that's a general form or more explicitly
11:17
as the matrix a which is the matrix 1 2
11:21
3 minus 1 followed by the vector X which
11:25
is X y equals the vector B which is 2 3
11:38
now what we're really doing here is
11:41
introducing some new kinds of
11:43
mathematical objects we're introducing
11:46
the ideas of matrices and vectors and
11:49
implicit on the left hand side is an
11:52
idea of multiplication okay so to
11:55
actually really make sense of this we
11:56
have to define what we mean by the
11:58
product of this 2 by 2 matrix and this
12:03
vector so let's do that and so let's
12:06
introduce matrix multiplication which is
12:09
a very important topic in linear algebra
12:11
and it's making its appearance here
12:16
matrix multiplication with a vector ax
12:25
it's a special kind of matrix
12:29
multiplication we're going to be looking
12:31
at more general products later but this
12:33
is sort of the baby case ok so the first
12:37
definition is to multiply a row vector
12:44
by a column vector and it's important
12:52
that they have to be this of the same
12:54
size okay so they have to be of the same
12:59
size so I'll do the 2 by 2 case first so
13:04
suppose that we have a vector I say V 1
13:07
V 2 and we have another vector W 1
13:12
w-2 so the first one is a row vector and
13:15
the second one is a column vector then
13:19
we're going to define their product v1
13:23
v2 times w1 w2 to be the 1 by 1 vector
13:32
v1 times w1 plus v2 times w2 that's a
13:41
definition of how you multiply a row
13:45
vector by a column vector more generally
13:54
more generally we have vectors with n
13:58
components a v1 v2 all the way up to the
14:02
n then we're allowed to multiply that by
14:05
a column vector of the same size say a
14:09
vector W 1 W 2 down to WN and the
14:14
definition of that product is + 1 by 1
14:18
vector which is the sum of v1 times w1
14:22
plus v2 times w2
14:25
all the way up to VN x WN that's how we
14:33
multiply a row vector by a column vector
14:39
okay so for example okay example if we
14:44
have the vector 1 2 3 and we want to
14:47
multiply by - 1 5 4 well this is going
14:51
to be 1 times minus 1 plus 2 times 5 you
14:56
don't need that bracket 2 times 5 plus 3
15:01
times 4 which is a grand total of minus
15:05
1 plus tan ISM is 9 plus 12 21 and so
15:09
we'll put it in the bracket now you've
15:17
seen this before okay because this is
15:20
really just the same as the dot product
15:22
of the two vectors with a slight
15:25
difference in that the two vectors are
15:28
not both column vectors now one of them
15:31
is a row vector and the other one's a
15:34
column vector but it's really just the
15:36
same as a dot product of vectors okay so
15:40
this is just another form another form
15:46
of the dot product of two vectors okay
16:00
great and now we are in position to
16:04
extend our definition to defining the
16:08
product of a matrix by a vector so
16:14
before I do that I have to tell you
16:16
about the sizes of matrices the sizes of
16:21
matrices so a general matrix not just a
16:29
small one but a general one we often
16:31
write it in this kind of form here so
16:34
maybe the entry up at the top is a 1 1
16:37
and then the next entry will be a 1 2
16:40
and then a 1 3 all the way up to maybe a
16:45
1n okay well that means so that means
16:50
that there are to be n columns okay
16:54
that's the first row of this matrix in
16:57
the second row we're going to label the
17:00
entries a 2 1 a 2 2 up to a 2 and that's
17:08
a second row and then down to the last
17:12
row which will maybe we'll say is the M
17:15
throw okay so we start with a M 1 and
17:18
then a M 2 all the way up to a M and all
17:25
right so have a look at this this is a
17:26
kind of a general nominal Eicher we're
17:31
organizing the elements in an array so
17:34
when we say a IJ this means the entry
17:39
in the 8th row and Jeff column so for
17:50
example this thing here okay that's a m2
17:55
that means that we are in the F ro M row
18:00
and in the second column okay
18:08
the M tells us which row we're in the
18:12
two represents which column oriented
18:15
okay so that's how the indices work the
18:17
first indicee is telling you which row
18:19
you're in how far down you have to go
18:21
the second entry is telling you in which
18:23
column you are in other words how far
18:25
right you have to go again this kind of
18:32
matrix this matrix has size the size of
18:35
this matrix is it's an M by n okay it's
18:42
M by n so sometimes we say m and n
18:50
stands for the matrices of size intra
18:55
C's of this size size M by n okay great
19:04
so now I can tell you how to multiply
19:08
matrix by a vector I'm going to do that
19:13
with an example first so the product of
19:17
a matrix with a vector okay but there's
19:28
a condition that has to be satisfied if
19:31
the number of columns of the matrix
19:41
equals the number of entries of the
19:46
vector
19:52
so let's do an example so let's say we
19:56
have here's 1 3 2 minus 1 4 5 yeah this
20:03
is a 2 by 3 matrix it's a 2 by 3 matrix
20:08
it has 2 rows it has 3 columns we are
20:13
going to multiply it by a vector whose
20:18
number of entries is the same as the
20:21
number of columns maybe 2-3 1 2-3 1 now
20:37
how are we going to define this this
20:40
product well what we're going to be
20:43
doing is we're going to be looking back
20:45
at what we've defined already this
20:48
product of vectors with vectors where
20:56
the product of vectors with vectors
20:58
right here this product of vectors with
21:00
vectors well maybe this is the more
21:02
general one okay so we know how to
21:04
multiply a row vector by a column vector
21:09
what we're going to be doing is we're
21:11
going to be applying this same formula
21:13
as many times as we can as many times as
21:17
we can so let's go back to here so we
21:20
want to look for row vectors that we can
21:23
multiply by column vectors so here is a
21:26
row vector here is a column vector so
21:33
we're going to multiply these two
21:35
together what do we get so we get 1
21:40
times 2 plus 3 times minus 3 plus 2
21:46
times 1 and that's going to be the first
21:50
entry of our product the second entry of
21:55
our product is going to be when we get
21:56
when we take the second very difficult
21:59
the second row
22:03
multiply it by well there's actually
22:05
only one column on the right-hand side
22:08
that we can multiply the same one okay
22:10
and when we do that we're going to get
22:13
minus 1 times 2 plus 4 times minus 3
22:19
plus 5 times 1 okay so that is a grand
22:25
total of let's see 1 times 2 that's 2
22:28
plus minus lines that's minus 7 plus 2
22:32
that will be minus 5 and the second
22:36
entry is minus 1 times 2 that's minus 2
22:38
and then plus minus 12 that's minus 14
22:41
plus 5 will be minus 9 so that's what we
22:48
get we started with is 2x3 matrix this
22:52
vector well it's also a matrix it really
22:56
has three rows and one column so we
22:59
could say that it's a three by one
23:01
matrix okay and then the result over
23:06
here is something with two rows and one
23:08
column so that's a two by one so this is
23:16
how we multiply a matrix by a vector
23:24
okay so let's now go back to finish off
23:27
let's go back to that other example that
23:29
I had where we had a system of three
23:32
equations in three unknowns okay so
23:35
let's have a look at this example where
23:38
that was one of the things that we were
23:40
already looking at today I think we
23:41
called it double star let's have another
23:42
look at it now from this matrix point of
23:46
view okay so the three ingredients here
23:49
are the matrix of coefficients so a is
23:51
the matrix of coefficients and they are
23:54
1 minus 1 and 1 the coefficients of X 1
23:57
X 2 and X 2 in the first row on our left
24:01
hand side and then the second row to 0
24:04
minus 1 because there's zero X 2's in
24:07
that second row and then 1 minus 2 2
24:11
that represents the left hand side of
24:14
the third row
24:15
so that matrix that's a 3x3 matrix that
24:19
encodes or captures all of the
24:22
coefficients on the left hand side of
24:24
the equation then the other ingredient
24:27
the next ingredient is the vector of
24:29
variables there are three variables X 1
24:31
X 2 X 3 so we make a vector out of them
24:35
okay a matrix kind of includes the
24:40
notion of a vector a vector is a sort of
24:42
special kind of matrix you can see a
24:44
vector is a special kind of array where
24:47
there's only one column so as a matrix
24:50
this would be a 3 by 1 matrix and the
24:58
other ingredient is what's on the
24:59
right-hand side let's call that B that's
25:02
the vector 1 3 minus 2 so now we want to
25:09
rewrite the original system as an
25:11
expression or an equation involving
25:14
these three objects ok so we're going to
25:17
we get a write star now as the equation
25:22
a x equals B that's the short form
25:27
involving these short form 1 minus 1 1
25:31
then 2 0 minus 1 1 minus 2 2 the vector
25:38
X is X 1 X 2 X 3 and the right-hand side
25:45
is the vector B which is the vector 1 3
25:51
minus 2 now I want to convince you that
25:57
this is consistent with the way we
26:00
describe the product of a matrix by a
26:03
vector so here is a matrix it's a 3 by 3
26:05
matrix and here is a vector it's a 3 by
26:07
1 vector let's just make sure that we
26:11
appreciate what the product of these two
26:13
things is ok so let's rewrite this left
26:19
hand side by actually writing out this
26:21
product of this matrix times the vector
26:24
ok so what are we going to get so what
26:27
we have to do is a
26:28
think about there's rose here okay
26:31
there's three rows here and there's in
26:34
fact only one column here okay and what
26:37
we're gonna be doing is we're gonna be
26:38
multiplying rows times columns rows tens
26:41
column rows tens columns rows times cold
26:43
yeah you're gonna do all possible
26:45
products of rows times columns that's
26:48
how we multiply this matrix with this
26:50
vector okay so what are we going to get
26:52
so the first row times the vector will
26:55
be 1 times X 1 minus 1 times X 2 so with
27:01
AD that's what's minus X 2 plus 1 times
27:04
X 3 so that's plus X 3 that's the result
27:09
of the multiplication of the matrix by
27:12
the vector the second entry is the
27:15
second row times the same column on the
27:18
right-hand side so it's 2 X 1 plus 0 X 2
27:24
minus X 3 and then the third product is
27:29
the product of this third row 1 minus 2
27:32
2 with the same column vector that's X 1
27:35
minus 2 X 2 plus 2 X 3 so that's the
27:41
result of the left-hand side and that's
27:43
equal to 1 3 minus 2 and we see that
27:48
that is indeed just kind of a vector
27:52
form for the system appeared system
27:55
double star it's just another way of
27:58
writing it where we've written all three
28:00
equations basically in vector form this
28:04
is really the vector form that we talked
28:06
about earlier for that same system
28:10
another way of writing the vector form
28:13
okay great so we have introduced the
28:16
matrix of coefficients we've introduced
28:19
the vector matrix of coefficients we've
28:25
introduced the vector of variables that
28:26
we've introduced this vector of
28:28
constants on the right hand side there's
28:30
one more kind of way of encoding
28:33
everything which is called
28:36
the Augmented matrix I'll mention that
28:37
here just to finish augmented matrix of
28:40
this system if we're just interested in
28:45
sort of you know getting a computer to
28:47
remember all the numbers are that are
28:49
involved what we can do is we can take
28:51
the the matrix matrix a which is right
28:55
here and the right hand side those are
28:58
all the numbers and we can kind of put
29:00
them together so that they're all
29:02
together that's called the Augmented
29:04
matrix so that will be squeezed over
29:08
here so 1 minus 1 1 2 0 minus 1 1 minus
29:15
2 2 and then we put a bar across to
29:19
separate from the right hand side which
29:20
is just this matrix of constants on the
29:24
other side so another way of saying that
29:27
is we're taking the matrix of
29:29
coefficients which we are calling
29:31
capital A and the vector of constants
29:34
which we're calling B and we're putting
29:35
them together sort of augmenting the
29:38
matrix a with another column and we're
29:41
calling that the Augmented matrix of the
29:43
system of the system and that's really
29:56
all that we need to actually perform the
29:58
main technology of row reduction or
30:01
Gaussian elimination which is the
30:03
technology that we're going to develop
30:05
for systematically solving bigger
30:09
systems of equations set up in this sort
30:11
of matrix fashion so see you