# MOOC_LinearAlgebra_Lesson03

0 (0 Likes / 0 Dislikes)

Hello, and welcome to Lesson 3
of this Introduction to Linear Algebra
with Wolfram U.
The topic for this lesson is
row reduction and echelon forms.
Let's begin with a brief overview
of the lesson.
Here's a matrix,
and it looks like it's got
pretty random entries;
some are large, some are small.
The goal of this lesson is
to transform such a matrix
to a simpler echelon form.
That's like a much more ordered
set of entries.
So you see over here,
this looks much more orderly
than the earlier matrix.
For example, you've got
the 1s along over here,
and the last column
looks like it's got
some very interesting
and useful information.
The question is:
how do you obtain an echelon form?
Well, an echelon form
can be obtained
by using the process
of row reduction.
Fortunately, we have
a very nice function
called RowReduce
in the Wolfram Language,
which will give you
the reduced echelon form
of a matrix,
like the one you see over here.
The point is that once you have
this reduced echelon form,
you can solve linear systems.
Let's begin with
a formal definition
of a reduced echelon form.
A matrix is said to be
in a reduced echelon form
if it has a few properties.
The first property is that
all nonzero rows are above
any rows with all zeros.
You can think of
the rows with all zeros
as being kind of redundant.
You don't want them
to be on top at all.
Next, the leading entry
in each nonzero row must be 1.
So, you always start with
a 1 in each nonzero row.
Next, each leading entry of a row
is to the right
of the leading entry
of the row above it.
That's where the word echelon
comes from—
it's an orderly arrangement,
like groups of soldiers
in an army.
Finally, you want each leading 1
to be the only nonzero entry
in its column.
Here's an example
of a matrix that is
in a reduced echelon form.
You can see over here
the zeros are all at the end
and then every row
begins with a 1.
If you look at
any column with a 1 in it,
then that's the only
nonzero entry.
The fact is that every matrix has
a unique reduced echelon form,
which can be found
using RowReduce.
Before going into RowReduce,
let's just look at an example
of how you might actually find
the reduced echelon form
using elementary row operations,
just by manipulating the rows
and getting the answer.
Here's the matrix.
You want to reduce it
to echelon form.
What you do is you take
the second row, R2.
Then you do R2 minus twice R1.
That becomes 0 over here.
After that, you divide by -3
to get that to be a 1.
The -3 becomes a 1.
Then you still want to
make that 5 into a 0,
so you do R1 + (-5)R2,
so you get a 0 over there.
Finally, you do R3.
Goes to R3 + R1 - R2,
and you get back
this nice echelon form.
You can check the answer
with RowReduce
and you see that you get back
just the same result.
Let's try and use
RowReduce directly.
Here's a matrix.
The matrix has three rows
and four columns.
Apply RowReduce to it,
and sure enough,
you get back
a reduced echelon form.
You see that this echelon form
is so much nicer in structure
than the matrix
that you began with.
A slightly larger example now:
here's a random 8-by-9 matrix.
I used SeedRandom
just to make sure
I get roughly the same answer
every time.
Here's the random matrix
with 8 rows and 9 columns.
I apply RowReduce to it
and what you get back
is a very nice simple form.
Once we know
how to use RowReduce,
we can now talk about
solving linear systems.
The question is:
how do you solve a linear system
using row reduction?
Well, the steps are
you first of all
write in the augmented matrix
with both the left- and right-hand
sides of the system.
Apply RowReduce to it,
and then, looking at
the output from RowReduce,
you can write down
the solution set.
In fact, there are
three possibilities.
The first possibility is that
you actually have
a unique solution for your system,
just one solution,
or you might have
infinitely many solutions,
and both of those are said to
give you a consistent system.
The third case is where
you have no solutions,
and that's referred to
as having an inconsistent system.
Just to summarize and make sure
we understand terminology,
you can either have
a unique solution
or you can have
infinitely many solutions
or you can have no solution at all.
One example of each.
Here is a system of equations,
a linear system,
three equations, three unknowns:
<i>x</i>, <i>y</i> and <i>z</i>.
You first of all set up
the augmented matrix for the system.
Make sure it looks right.
You have {3, 5, 11, 46}
in the first row—
that looks correct—
{2, -3, 4, 8} second row,
and {1, 6, -7, -38}
in the third row.
All that looks just right.
When you apply RowReduce to it,
look at the matrix form,
and now it's clear
that this first one over here
is just a placeholder for <i>x</i>,
so <i>x</i> is 1;
that's a <i>y</i>, so <i>y</i> is 2;
and that's a <i>z</i>, so <i>z</i> is 3.
So <i>x</i> = 1, <i>y</i> = 2 and <i>z</i> = 3
is a very nice, simple,
unique solution
for this system of equations.
On to a slightly harder example,
where we actually have
infinitely many solutions.
Here's a system.
Write in the augmented matrix again.
Make sure it looks right
with MatrixForm.
For example, the first equation is
5<i>x</i> + 2<i>y</i> + 11<i>z</i> = 4.
So you've got {5, 2, 11, 4}, etc.
Apply RowReduce to it.
Look at the matrix form
and you see that the last row
is just a bunch of zeros;
that says you actually have
infinitely many solutions.
The question is:
how do you write them down?
This first row over here
says that <i>x</i> = -25<i>z</i> + 10,
because the <i>z</i> goes across
the right-hand side,
and <i>y</i> = 57<i>z</i> - 23.
For each value of <i>z</i>,
you actually get a value of <i>x</i>
and a value of <i>y</i>.
For example, if <i>z</i> is 1,
then if you plug back over there,
<i>x</i> is -15,
and you plug back over there
and <i>y</i> is 34.
In fact, you have
infinitely many solutions,
each one corresponding to
a different value of <i>z</i>.
The question is:
how did this example come about?
What I did was I simply took
the first two equations over here
and I added them, I summed them
to get the third here.
So 5 + 7 = 12, 2 + 3 = 5,
11 + 4 = 15 and 4 + 1 = 5.
The third equation
is in fact redundant over here;
it's got no new information,
and hence, you actually have
infinitely many solutions
to that system of two equations.
That's one way you might get
infinitely many solutions.
The question is:
can we then go ahead
and construct an example
where you have
an inconsistent system,
like, can I make this
slightly different
to have no solutions at all?
Well I could just
make the 5 something else
and that's exactly what I'll do
on the next slide.
I take the first two equations
but I replace the 5 by a 6,
and that's going to give us
an inconsistent system.
The sign of inconsistency is
you have a row
that looks like zeros
all the way up there
where you have a 1.
That says 0 = 1,
which is never possible.
You have a system.
Write the matrix for it,
the augmented matrix.
Look at the matrix form
and make sure it's all OK.
It does look OK.
Apply RowReduce
and you see over here that
the last row is 0 = 1.
That's no good;
there is no solution
for this system,
but of course, we knew that—
we just constructed it
the way we wanted to,
to make sure that
there is no solution.
So the 6 over here made sure
that there is no solution.
So, this is a system
which has no solution.
That brings me
to the end of this lesson.
The main point is that
every matrix can be
reduced to an echelon form
by using
elementary row operations,
which are nothing but
what you do if you actually
solve the equation by hand.
Namely, you could, let's say,
interchange two equations,
or you might
add one multiple of an equation
to another, etc.
Those are called
elementary row operations.
Of course,
within the Wolfram Language,
we have a nice function
called RowReduce,
which will let you do much more
and get to the reduced echelon form
in no time at all.
Now, the point about
this row reduction
is that it can be used
to determine whether
there are any solutions at all
for a system
and how many solutions are there.
So, RowReduce and row reduction
are a great way to
solve linear systems.
Of course, row reduction
is a bit more technical
than using LinearSolve,
but it's a very powerful way of
understanding linear systems.
That's the end of this lesson,
and next lesson we'll talk about
vectors in <i>n</i>-dimensional space.
Do review this very important lesson
on row reduction.
I hope you've enjoyed it
and learned a lot from it.
Thank you very much.
I'll stop over here.