# Row-Echelon Form and Gaussian Elimination (Step-by-Step)

(D4M) — Here is the video transcript for this video.

00:00
in this episode you’ll learn about the row echelon form of a matrix and why
it’s important you’ll also learn how to perform gaussian elimination to solve a
system of linear equations with this method solving linear systems
becomes much more manageable let’s do some math [Music]
hi everyone welcome back we’re going to begin uh with this question right here
what is row echelon 4 and so let’s get started
so a matrix is in row echelon form if all zero rows if there are any are at
the bottom of the matrix and for the second condition if two successive rows
are non-zero then the second row starts with more zeros than the first

00:01
so let’s look at a couple of the examples here so look at this matrix here
zero zero zero zero zero one zero zero zero zero one
zero and then all columns in the last all zeroes in the last column here so
look at this matrix here by the way some put parentheses i
usually put square brackets and yeah is this in r is this in row
echelon form or not row echelon form and so all zero rows if any
so this fourth row here is all zeros and the third row is also all zeros and
they’re at the bottom of the matrix so so far so good number one holds
and what about number two if two successful rows are non-zero so for
example the first and second rows are non-zero
the second row starts with more zeros than the first

00:02
so this so the second row right here is starting with more zeros it has two
zeros so when we say starting with we’re always talking about reading
matrices from left to right all right and so this one right here is in row
echelon form now let’s consider this matrix here i’ll call that matrix a
and let’s call this matrix here b and let’s put a whole column
of zeros one one zero zero and then all zeros and all zeros
and so what about matrix b here is this matrix right here in row echelon form
so condition one holds um all zeros are at the bottom of the matrix check check
um and then part two if two successful rows are non-zero and we have that the
first and second row are non-zero then the second row so here’s the first and
the second the second row starts with more zeros than the first so let’s say

00:03
so this is not in row echelon form and let’s do one more example here
because i’m using this word second here and in both these examples the second
was referring to the second but the second is really referring to the
idea of successive rows here so let me just make one more example up here so
let’s say we have zero zero zero zero one one zero zero
and so let’s look at matrix b again um and then let’s change it a little bit
so um first off would this be in row echelon form right here
and so this would not be in row echelon form because the two successive non-zero
rows here and this has more zeros um and that’s not the second of those
two successive rows here so that’s that’s not in row echelon form um what

00:04
about if we have all zeros here then that again is not in row echelon
form because we have a non we have a zero row and it’s not at the bottom and
so that would be an example of number one failing
um and then what if we have here a one and then what if we have here a
one here and a one here now is this one in row echelon form so let’s check let’s
leave this as c right here and let’s check one and two here carefully so are
all the zero rows if there are any or at the bottom of the matrix so here’s a
zero row it’s at the bottom now you know if we put a zero and a one here
then there are no zero uh rows and so one would be you know
a check because there wouldn’t be any all right let’s go back to putting them
all zeroes here so with this our our c with this our matrix here
this right here is true all the zero rows are at the bottom now number two

00:05
two successive rows so the two rows that i’m looking at are the second and third
rows and the second row of these two right here which is the third row
so the second of the two successive rows uh starts with more zeros and it’s not
true this starts with one zero this starts with one zero so this one right
here is is not holding for c so not in row echelon form
and the same thing for part c and this one is in is in row echelon form and so
there’s a couple of examples there um illustrating this definition here
um now if you’re not understanding why we would want to even think about
row echelon four well i have something for you here we’re going to start off

00:06
by saying that this episode is part of the series systems of linear equations
in-depth tutorials for linear algebra students so in that series so far
this episode comes after working with matrices and trying to
solve linear systems in this episode we’re really going to
concentrate on gaussian elimination like we said at the beginning
so let’s get started so what is gauss’s method
so here it’s based upon this theorem right here
and this theorem is going to say it’s going to have three parts to it because
there’s three row operations by the way in the previous episode we went over in
great detail these row operations so this is this theorem right here just
kind of summarizes what we said in a previous episode but
an equation is swapped with another equation
an equation uh has both sides multiplied by a non-zero constant
and the third one is an equation is replaced by the sum of itself and a

00:07
multiple of another so when the two systems have so if you
do these three things right here then the two systems have the same set of
which we’ll often write by ax equals b and we will have an augmented matrix
here and i’ll just put a and then the vertical bar and the b column
and we’ll we’ll do some row operations row operations um
well one two and three are allowed and we’ll get some matrix here
which we’ll call a prime and then a b prime and we’ll do these row operations to
transform this but the idea is that this system right
here may be difficult or you know you cannot solve it by just looking at it
whereas this system right here either the solution will be immediate or

00:08
it’ll be a lot easier to find the solution set to this system and the idea is to
take these operations here but it’ll preserve the solution set the solution
set to the original system and and that’s a b not a six um in any case
um that’s the idea and now i just want to point out though that there are three
um you know restrictions here so multiplying by a row by a zero is not
allowed so that’s the most most popular one that you want to
pay attention to or the the obvious one here is is you know
that can change the system the solution set to the system if you
were to multiply by a in a row by all zeros
it’s basically like erasing an equation well that’s certainly going to affect
your solution set adding a multiple of a row to itself is also uh

00:09
not not allowed because it that also has the effect of multiplying by zero so i
can’t just take a row and then um you know you know subtract it from itself and
zero out right so and then the last and the last one is swapping a row with
itself isn’t very useful so we’re just going to not really allow that
um you know just swapping out the the first row of a matrix with itself really
has no effect on anything and so we’re just gonna kind of eliminate that
um possibility um all right and so let’s look at now
how to perform gaussian elimination on our first example here of many to come
and so let’s get rid of this and go on to the next one here
all right so how to perform gauss’s method and here’s our linear system here

00:10
and we can write it in the form of ax equals b and this a and b will make up the
augmented matrix so i’m going to look at the x’s right
here so the x’s is one two one and the y’s here will be one minus one minus two
and then we’ll have a zero 3 and -1 and then we’ll have 0 for the b for the
b vector or the b column we’ll have 0 3 3 and so this is our starting point here
of the gaussian elimination method or gauss’s method here
so i’m going to do the row operations now there’s really no
order in which you do the row operations you can do them in any orders you want
as long as you’re only doing row operations
and then you know there is a strategy because you want to get this matrix
which is not in row echelon form you want to get it in row echelon form

00:11
and and then the solution set will be a lot easier so we cannot just look at the
system right here and intuitively or just you know randomly guess the
solution right so um if even if you can you know make out a
five by five system you can’t you know just draw down an arby’s drop arbitrary
system it can be very difficult to spot the actual solution if there are any or
you know how many there are so we’re going to transform this matrix right
here into row echelon form and so let’s get started so the first operation i’m
going to do is i’m going to say minus 2 row 1 so i’m going to multiply this by
-2 and i’m going to add it to row 2. and the effect that’s going to have is
trying to get a zero here so the the more zeros the lower down you go in the
rows the more zeros that you have generally speaking is the strategy
you’re trying to get more zeros below so i’ll try to get a zero here and a zero
here and i want to first try to get a zero

00:12
here but i’m also going to try to get a zero here and to do that i’m going to
multiply this by minus one and i’m going to add
so i’m going to also do minus row one plus row three
so i’m going to do these two row operations all at the same time
um and so i’ll just i just like to put an arrow over there for the for the you
know direction that we’re going here’s where we’re starting and over here is
what we’re going to end now i’m changing row 2 and i’m changing
row 3 and so i’m not changing row 1 at all so i’m going to keep row 1 the same
here so this is 1 1 0 and then 0 and so you know we’re changing this
matrix to one that is quote unquote closer to row echelon form
and we’re going to change row 2 now so i’m going to multiply by -2 and add
i’m going to multiply this by minus 2 and add
minus 2 and add when we multiply by minus 2 by 0 we get 0 right so minus 2

00:13
and add i get 3 and then minus 2 and add i get 3 again
so we’ve accomplished this first row operation so this is a row operation
right here and we’re going to do a second row operation right here
i generally don’t like to put all of them in one step but you can
but usually you’re going to make a mistake if you do that you know anyways
minus uh times row one minus one times row one minus one and add
so when i do minus one and i add i get minus three and i do minus one and i add
and minus one and i add all right and so this one here is also
not in row echelon form these two have the same number of zeros
have the same number of starting zeros um and so
you know can we you know what can we do to
get this in russian form so i’m going to do one more row operation i’m going to

00:14
do minus row 2 and i’m going to add it to row 3.
reason why i do a minus is because that’ll be a minus times a minus that’ll
turn into a positive 3 plus a minus 3 so that will make a 0 here
all right so here we go we’re leaving row 1 the same
we’re only changing row 3 so we’re leaving row one and two the same
so i’m going to multiply by minus one and add multiply by minus one and add
minus one and add and then now this is in row echelon form
and so whenever we take a matrix coming from a linear system
and we reduce it to row echelon form right so this is called gaussian
elimination method or gauss’s method if you say gauss’s method it’s kind of
ambiguous because there’s really two methods that are going on
um in this video we’re going to cover gauss’s

00:15
gaussian elimination in the next episode we’re going to cover the gauss jordan
elimination so if you were to just say gauss’s method it’s kind of ambiguous so
the directions would be better put using gaussian elimination method
in any case here we have x plus y equals 0 that’s the first row and we
have minus 3 y plus three zero equals three
and then the last one right here is the minus four z equals zero
so this is a system right here and the theorem that we stated um
was that this system and this system have the same solution set because all
we did was row operations this system is much easier to solve in
fact when i look at the equation right here i can see that z has to be zero

00:16
and knowing that z is zero the y here would have to be minus one
right because if that’s zero that that’s gone so y would need to be a minus one
times minus three to get to a positive three
and if y is minus one i move the minus one over and i get positive one
and so there’s the solution set right there the solution set is just the set
containing the point one minus one and then zero
so as a solution set we would just write
out the point or if you just want to say solve the system well here is the
solution right there all right so there’s our first example
using gauss elimination and basically what it comes down to is applying the
row operations getting an easier much easier system and then writing out the
solution set there all right and so you know the a question
that might come up is do you always only get one solution

00:17
or do you sometimes get no solution you know what are the possibilities that
could happen here so let’s look at this right here real quick example two
solve the system of equations using gaussian elimination method
and so this time we got more variables but the idea is the same
so i’m going to start up here and write down the matrix so i’m looking at all
the x’s first so my first column is going to be 1 1 0 x’s 0 x’s so 1 1 0 0
that’s in the wrong place sorry so 1 1 0 0 and so now the y so we have minus one
minus two and one and zero and for the w’s or next for the z’s i’m

00:18
gonna order mine x y z and then w is an afterthought all right and so then um
zero and then one and then zero and then one all right um this last one’s a 2.
and then for the w we have 0 2 1 1. and then now for the constants all the
numbers that don’t have a variable and move them to the right
hand side and we’re going to get 0 4 0 5 and so there’s our starting place
and now let’s do some row operations so first off uh this one right here has
more starting zeros than this one and this one has more starting zeros
than this one but these two are tied so i’m going to do

00:19
um actually how do i get a one here that should be a two right there one two
zero zero all right all right and so i’m going to uh
multiply by minus two and add that’s going to be my row operation right here
so let’s row operation minus 2 times row 1 and then i’m going to add it to row 2
right here so i’m going to do this row operation
right here and i’m not going to change row 1 or row 3 or row 4 i’m only going
to change row 2. so here we go 1 minus 1 0 0 0 and we have 0 1 0 1 0
zero zero two one five all right so that stays the same so i’m
just changing row two so i’m gonna do minus two and add and so that gives me
so if i do a minus 2 i get a positive 2 and that i get another 0 here

00:20
and minus 2 and add i get a 2. sorry minus two and add i get a one and
then a two and i’m gonna do minus two and add all right very good
um and so now i’m trying to get this in row echelon form so i have more star i
always think bottom up so i’m trying to get uh the most zeros possible so i have
two starting zeros i have one starting zero oh this is two starting zero so i
really want to switch out row two and three so that’s going to be my next row
operation so my row operation is to switch row two and three [Music]
i’ll write it like that so row one is going to stay the same
and then now row three and now row two and then i’m not touching the last row

00:21
right there all right good so now are we in row echelon form i got
two starting zeros and then i got two starting zeros so if we’re just looking
at these two last rows here i’m going to need to multiply by -2 and
add so i’ll do that down here so i’m going to do -2 row 3. plus row 4
so i’m only changing row 4 so 1 -1 0 0 and then 0 and 0 1 0 1 0 and 0 0 1 2 4
and now i’m going to multiply row 2 row 3 by minus 2 and add it to row

1. so doing this row operation right here minus 2 and add minus to an add
minus to an add i’m gonna do minus two i get minus four plus one is minus three
and minus two and five is minus three also and so now we can

00:22
write out the system again i’ll do that over here so the system is now is x
x and then minus y equals zero and this is x y so that’s y
and then plus w equals zero and the third row is x y z so z plus two w
equals four and then the last one is minus three w equals minus three
and this system which i didn’t leave room for the bracket very
much all right that’s good enough so this system right here
has the same solution set so we can go find the solution set right here
pretty easily this is called back substitution now and the reason why is
because i want to find here and then back back it all the way up so w is one

00:23
if w is one then i get a two here i’m going to subtract that two over and get
z is two if w is one i’m gonna move the one over and get minus one
and if y is minus 1 then i’m going to get x plus 1 i want to move that plus 1
over and get minus 1. so i’m getting -1 minus 1 2 and 1. and
so we could write the solution set down uh it’s just a single point minus one uh
yeah minus one minus one two and one so there’s the solution set it consists
of just a singular point um and that’s it and so there’s another example of
solving the system and the question is is there always a
unique solution well we just did two where there was a unique solution but
that’s just two examples uh we’re not really ready to answer that question yet

00:24
with just two examples really any kind of theory or
any kind of guessing that you might have you know you should you know see a lot
more examples than just two so let’s see another one all right here we go
and this time we’re looking at the matrix here one two two and three one two
and there’s no z’s w’s there’s nothing else and then we have one minus three
and zero here and so we’re going to try to get row echelon for
so what i’m going to do is i’m going to come over here
come over here now and the row operation
i’m going to do is i’m going to do minus 2 times row 1 plus row 2
so i’m going to change out row 2 and i’m going to do the same thing for

00:25
row 3. i’m going to do minus 2 and then add to row three so i’m going to do
these two row operations at the same time and they involve changing row two and
row three so i’m gonna leave row one the same so i’m gonna do minus two and add
i’m gonna do minus two and add so that’s a minus five
minus two and adds another minus five and we’ll do minus two and add
minus two and add so that should be minus four
minus 2 and add so i get a minus 2 here and so what we end up with here is um
you know not row echelon form yet because
these two rows right here have the same number of starting zeros here
so this is not in row echelon form here um
what i’m going to try to do is get a 1 here i want to say here let’s multiply

00:26
row 3 by trying to get a one here um so you know
we’re going to divide by minus four and you know
just divide by minus one over four one three one and i’m also going to
divide this row right here row two by minus 1 over 5.
now as long as there are non zeros here and i’m not going to change row one
so i’m going to divide by minus five i’m going to get zero one and
here i’m going to get 0 i’m going to divide by so i’m going to get a 1 again
and here i’m getting row 3 i’m getting a minus 2 minus 1 4 right
and so that is just what one half right so one half here um

00:27
so actually maybe we want to let’s say instead let’s just divide it
by minus two so minus one half let’s just chop that row three there and a half
and so here i’m going to get a two and here i’m going to get a one all right
um so now what i’m do is i’m going to multiply by minus 2 and add let’s do
that over here so minus 2 times row 2 and add it to row 3. so 1 3 1 and minus um
and i’m going to do minus two all right so i’m changing row three
and i’m going to do minus two and add minus to an add and then minus 2 and add
when i do minus 2 and i add i’m going to get what minus 1 minus 2

00:28
and then plus 1 right so minus 1. so this system right here is what x plus uh 3y
we never even change the first one right 3y equals 1
and then this will be x y so this will be y equals 1
and then this last one here will be i’ll just write it all out 0x plus 0y
equals minus 1. now as you can see there’s really no
solution at all to this right here if you multiply this by this left-hand
side is 0 the right-hand side is -1 it doesn’t matter what x and y is right so
this has no solution right here no solution now keep in mind that the
solution set for this and the solution set for this are the same we only did
row operations and so these have to have the same
solution set and this has no solution to it so this original one right here has

00:29
no solution to it so the question is there always a unique
solution well here’s one that doesn’t even have a solution at all and so
you know that’s certainly a possibility so is that the scenario that we always
must belong to that either there’s no solution or you know a unique solution
so let’s look at this system right here so i’m going to try to do row echelon
form again so i’m going to get one and two and one and two and four and eight
and what row operation should we try how
about minus 2 and add so i’m going to do minus 2 times row 1 plus row 2
and i’m going to get 1 1 4 and we’ll do minus to an add minus to an add

00:30
and i get all zeros um and so you might be tempted to say
uh we get all zeros so you know what can you say from that so you know
this line or this this line right here is actually the same as this line right
here right if you were to just multiply this
first equation by two or so differently take the second equation and multiply it
by one half you see that it’s really the same line right here
and so this right here didn’t really give us any any uh any information like
that so we do not get a contradictory statement like in the previous example
we we did so this right here is not the signal
uh that a solution has many that the system has many solutions
uh but is sort of a clue but it doesn’t always guarantee you
that we’re going to have infinitely many solutions like in this example here so

00:31
this example here is all x y the solution set is all x y
where x plus y equals 4. that’s the best we can do
can we give some examples uh well we could say x is zero y is four
or we could say x is four y zero but in fact there’s actually many many
xy that satisfy this right here so i’ll just say many solutions
for for this episode all right and so let’s look at another
example where we might get zero zero but in fact we don’t necessarily get many
solutions so let’s check that out so let’s look at the system here
and in this system here we’re going to have as a first column a two
and then a 0 2 and then a 0 again and for the y’s we’re going to have 0 1

00:32
and then 1 3 and for the z we’re going to have minus 2 1 minus 1 and then 3
and then no other variables and then we’re going to have 6 1 7 0
so this is going to be our starting matrix here
and we’re going to try to get this in row echelon form we’re going to try to
do row operations so this one here is we’re going to do row operation
we’re going to add multiply by -1 and add it to row three
so minus row one plus row three so i’m changing row three
and so let’s see here where one stays the same row 2 stays the same
row 4 stays the same and so i’m going to do minus 2 and add
oh sorry minus 1 and add minus one and add minus one and add that gives me a one

00:33
minus one and add and that gives me a one right there so so far so good
um now i’m gonna do two more row operations i’m going to do a minus row 2
and add it to row 3 and i’m going to multiply this by a
minus 3 and add it to row 4. so minus row 2 and row and add it to row four so
i’m changing row three and row four here and we’ll leave row one and row two the
same so row one stays the same row two stays the same and
now i’m going to change row 3 and row 4. so i’m going to do minus 1 and add so
minus 1 and add minus one and add and now i’m gonna change row four

00:34
so i’m gonna do uh minus three and add so minus three and add
minus three and add and now what we can see is that we have
this row right here if we look at these two rows right here remember in the
previous example we got a row that said zero equals zero
and in that example we had many solutions but we also looked at an
example where we had a contradictory statement here this says zero equals
minus three well this 0 equals -3 trumps that is a contradictory statement you
cannot have that this equation says 0x plus 0y
plus 0z all that has to be 0 but this is saying it’s minus three
so this system right here has no solution meaning the original
also has no solution so just because you get all zero zero

00:35
zero doesn’t necessarily mean you’re going to get many solutions
you also have to check if there’s a contradiction statement also
all right so that’s a good example there now
you know it sure would be nice to know if we were able to just look at the
system and know what’s going to happen and so let’s try to take a look at that
can we tell how many solutions just by looking at the system
can you tell just by looking at the system for example the system has three
variables and three unknowns does that tell you anything can it tell
you anything so we’re going to explore those type of questions in upcoming
episodes for right now let’s continue on with gaussian elimination
so the matrix i’m going to get is one one one two

00:36
and i’m going to get two three six and two three five and four five six
so here’s our augmented matrix and let’s do some row operations so i’m
going to do -1 and add and i’m going to do -2 and add
so minus 2 row 1 plus row 3. so i’m going to do these two row
operations by the way if you’re not comfortable yet with doing two at one
time it’s okay just do one of them at a time and it doesn’t matter which one you
do first which one you do second either way you’re still going to get to
this matrix right here if you do this one first and then this one or if you do
this row operation and then this one either way you get to this matrix right
here so i’m going to get row one the same one two two four

00:37
and i’m to do minus 1 and add minus 1 and add and minus 1 and add
n minus 1 and add and now i’m going to do -2 and add so i’m going to do
minus 2 and add and then minus 2 and add so i’m going to have here
minus 2 and add minus to an add oh that 6 is more
minus to an add and then minus 2 and add -2 here and add okay that’s good
all right so good so there’s our first two row operations um is it finished is
it in row echelon form well these two right here have the same number of
starting zeros so let’s see if we can do minus two and add here so i’m gonna do

00:38
row operation now minus two row two and change row three and
all right and so let’s just do that so i’m gonna change row three
so row one stays the same and row two stays the same and we do minus two and add
minus to an add minus to and add minus two and add so i get minus four here
minus two and add and you know now we have row echelon four
and this has more starting zeros than the row above
and this one right here has more starting zeros in the row above
and all the zero rows there aren’t any but if they were some they would all be
at the bottom all right in any case uh what’s the system right here so we have
z equals um well okay let’s just write it out so we have x plus two y
plus two z equals four and then y plus z equals one

00:39
and then this last one is minus z equals minus four
so this is our new system that here that we’re trying to solve this system right
here is simpler or easier to solve than this one
and so let’s see here let’s write the uh answers up here so right here we’re
getting um z equals four and if z is four
then we’re going to move that 4 over and get a minus 3 out of there and then
this last one here we’re going to have to do
you know over here perhaps we’re going to get x equals 4 minus 2 times y
minus 2 times z and so that’ll be so y is minus 3 minus 2 and then z is 4 here

00:40
and so we’re going to get 4 plus 6 minus 8 which is 2
and so we got another system that has one solution 2 minus 3 4
and as always we should be able to substitute this right here in into any
one of these and check so for example if i check the last one here i’m getting 4
minus 18 and then plus 20 and that works that’s a two plus a four is a six
right but this works into all three of them in any case
um that’s it for this video here i hope that you enjoyed the episode and i’ll
see you in the next one if you enjoyed this video please like
and subscribe to my channel and click the bell icon to get new video updates