Transcript
Use with ChatGPT / Claude Auto-scroll A
Hi, this is the first lecture in MIT's course 18.06 linear algebra.And I'm Gilbert Strang.Um the text for the course is uh this book uh introduction to linear algebra.And uh the course web page, which has got a lot of exercises from the past, uh MATLAB codes, uh the syllabus for the course is web.mit.edu/18.06.
And this is the first lecture, lecture one.So uh and later we'll say where which we'll give the web address for viewing these uh video tapes.Okay, so what's in the first lecture?Um This is my plan.Uh the fundamental problem of linear algebra, which is to solve a system of linear equations.So let's start with the case when we have some number of equations, say n equations and n unknowns.So an equal number of equations and unknowns.That's the normal nice case.And what I want to do is with examples, of course, to describe first uh what I call the row picture.That's the picture of one equation at a time.It's the picture you've seen before in two by two equations where lines meet.So in a minute you'll see lines meeting.The second picture, I'll I'll I put a star beside that cuz that's such an important one and maybe new to you is the picture a column at a time.
And those are the rows and columns of a matrix.So the third, the algebra way to look at the problem is the matrix form in using a matrix that I'll call A.Okay, so can I do an example?The whole semester will be uh examples and then see what's going on with the with the example.So take an example.Two equations, two unknowns.So let me take 2x - y = 0, let's say, and - x + say 2y = 3.Okay.Uh let me I can even say right away what's the matrix that that is what's the coefficient matrix?The matrix that involves these numbers.A matrix is just a rectangular array of numbers.Here the here it's two rows and two columns.So two and minus one in the first row, minus one and two in the second row.That's the matrix.And the right hand the uh unknown, well, we've got two unknowns.
So we've got a vector x with two components x and y and we've got two right hand sides that go into a vector 0 3.I couldn't resist writing the matrix form uh right of even before the before the pictures.So I always will think of this as the matrix A, the matrix of coefficients.Then there's a vector of unknowns.Here we've only got two unknowns.Later we'll have any number of unknowns.And that vector of unknowns, well, I'll often I'll make that x extra extra bold.Uh and the right hand side is also a vector that I'll always call B.So linear equations are Ax = B and the idea now is to solve this particular example and then step back to see the bigger picture.Okay, what's the picture for this example?The row picture.Okay, so here comes the row picture.
So that means I take one row at a time and I'm drawing here the xy plane and I'm going to put plot all the points that satisfy that first equation.So I'm looking at all the points that satisfy 2x - y = 0.I I'm often it's often good to start with which point on the horizontal line.On this horizontal line, y is zero.The x-axis has y is zero and that in this case actually then x is zero.So the point, the origin, the point with coordinates 0 0 is on the line.It solves that equation.Okay, uh tell me an Well, I guess I have to tell you uh another point that solves this uh same equation.Let me suppose x is one.So I'll take x to be one, then y should be two, right?So there's the point 1 2 that also solves this equation.
And I could put in more points.But but uh let me put in all the points at once because they all lie on a straight line.This is a linear equation and that word linear got the letters for line in it.That's the equation.That's this is the line that of that of solutions to 2x - y = 0, my first row, first equation.So typically maybe x equal a half, y equal one will work and it sure enough it does.Okay.That's the first one.Now the second one is not going to go through the origin.It's always important do we go through the origin or not?In this case, yes, because there's a zero over there.In this case, we don't go through the origin because if x and y are zero, we don't get three.So let me again say, suppose y is zero, what x do we actually get?
If y is zero, then I get x is minus three.So if y is zero, I go along minus three.So there's one point on this second line.Now let me say, well, suppose x is minus one.Just to take another x.If x is minus one, then this is a one and I think y should be a one.Cuz if x is minus one, then I think y should be a one and we'll get that point.Is that right?If x is minus one, that's a one.If y is a one, that's a two and the one and the two make three and that point's on the equation.Okay, now I should just draw the line, right?Connecting those two points at that will give me the whole line.And if I've done this reasonably well, I think it's going to happen to go through Well, not happen.
It was arranged to go through that point.So I think that the second line is this one and this is the all-important point that lies on both lines.Shall we just check that that point, which which is the point x equal one and y was two, right?That's the point there and that I believe solves both equations.Let's just check this.If x is one, I have a minus one plus four equals three.Okay.Apologies for drawing this picture that you've seen before.But uh this seeing the row picture first of all for n equal two, two equations and two unknowns, it's the right place to start.Okay, so we've got the solution, the point that lies on both lines.Now can I come to the column picture?Pay attention.This is the key point.So the column picture.I'm now going to look at the columns of the matrix.
I'm going to look at this part and this part.I'm going to say that the the x part is really So so it is really x times You see I'm putting the two I'm I'm I'm kind of getting the two equations at once.That part and then I have a y and and in the first equation it's multiplying a minus one and in the second equation a two.And on the right hand side, zero and three.
You see the columns of the matrix?The columns of A are here and the right hand side B is there.And now what is the equation asking for?It's asking us to find somehow to to combine that vector and this one in the right amounts to get that one.It's asking us to find the right linear combination.This is called a linear combination.And it's the most fundamental operation in the whole course.It's a linear combination of the columns.That's what we're seeing on the left side.Again, I don't want to write down a big definition.You can see what it is.There's column one, there's column two.I multiply by some numbers and I add.That's a combination, a linear combination, and I want to make those numbers the right numbers to produce 0 3.Okay.Now, I want to draw a picture that represents what this This is algebra.
What's the geometry?What's the picture that goes with it?Okay.So, again, these vectors have two components, so I better draw a picture like that.So, can I put down these columns?I'll draw these columns as they are, and then I'll do do a combination of them.So, the first column is over two and down one, right?So, there's the first column.The first column.Column one.It's the vector 2 - 1.The second column is Let's see.I go over minus one is the first component and up two.It's here.There's column two.So, this again, you see what its components are.Its components are minus one, two.Good.That's this guy.Now, what is what Now, I have to take a combination.What combination shall I take?Why not the right combination?What the hell?Okay.So, what the combination I'm going to take is the right one to produce 0 3, and then and then we'll see it happen in the picture.
So, the right combination is to take X is one of those and two of these.
It's because we already know that that's the right X and Y, so why not take the correct combination here and see it happen.Okay.So, how do I picture this this linear combination?So, I start with this vector that's already here.So, that's one of column one.That's one times column one.Right there.And now I want to add on, so I'm going to hook the next vector on to the front of the arrow.We'll start the next vector and it'll go this way.So, let's see.Can I do it right?If I add it on one of these vectors, it would go left one and up two.So, it would go left one and up two.So, it probably get us to there.Maybe I'll do dotted line for that.Okay.That's one of column two tucked on to the end, but I wanted to tuck on two of column two.
So, that the second one will go up left one and up two also.It'll probably end there.And there's another one.So, so what I've put in here is two of column twoadded on.And where did I end up?What are the coordinates of this result?What do I get when I take one of this plus two of that?I do get that, of course.There it is.There it is.X is zero, Y is three.That's B.That's the That's the answer we wanted.And how do I do it?You see I do it just like the first component, I have a two and a and a minus two.That produces a zero.And then the second component, I have a minus one and a four.They combine to give the three.But look at this picture.So, here's our key picture.I I combine this column and this column to get Maybe I better to get this guy.
That was the B.That's the 0 3.Okay.So, that idea of linear combinations is crucial and and also do we want to think about this question?Sure, why not?What are all the combinations?If I took Can I go back to X's and Y's?This is a This is a question for really it's it's going to come up over and over, but why don't we see it once now?If I took all the X's and all the Y's, all the combinations, what would be all the results?And actually, the result would be that I could get any right-hand side at all.The combinations of this and this would fill the whole plane.You can tuck that away.We'll explore it further.But this idea of what linear combination gives B and what do all the linear combinations give?What are all the possible achievable right-hand sides B?
That's going to be basic.Okay.Can I move to three equations and three unknowns?Cuz it's easy to picture the two by two case.Let me do a three by three example.Okay.I'll sort of start at the same way.Say maybe 2X - Y and maybe I'll take no no Z's is a zero.And maybe a minus X and a 2Y and maybe a minus Z is a Oh, let me make that a minus one.And just for variety, let me take minus 3Z minus 3Y's.I should keep the Y's in that line.And 4Z's is say four.Okay.That's three equations.I'm in three dimensions, XYZ.And I don't have a solution yet.So, I want to understand the equations and then solve them.Okay.So, how do I How do you understand them?The row picture is one way.The column picture is another very important way.
Just Let's remember the matrix form here, cuz that's easy.The matrix form, what's our matrix A?Our matrix A is this right-hand side, the two and the minus one and the zero from the first row.The minus one and the two and the minus one from the second row.The zero, the minus three, and the four from the third row.So, it's a three by three matrix.Three equations, three unknowns.And what's our right-hand side?Of course, it's the vector 0 - 1 4.Okay.So, that's the way Well, that's the shorthand to write out the three equations.But it's the picture that I'm looking for today.Okay.So, the row picture.
All right.So, I'm in three dimensions, X Y and Z.And I want to take those equations one at a time and ask and make a picture of all the points that satisfy Let's take equation number two.If I make a picture of all the points that satisfy, all the XYZ points that solve this equation.Well, first of all, the origin is not one of them.XYZ being 0 0 0 would not solve that equation.So, what what are some points that do solve the equation?Let's see.Maybe if X is one, Y and Z could be zero.That would work, right?So, there's one point.I'm looking at this second equation here just to start with.Let's see.Also, I guess if Z Z could be one, X and Y could be zero.So, that would just go straight up that axis.And probably I want a third point here.
Let me take X to be zero.Let's say X to be zero, Z to be zero, then Y would be minus a half, right?So, there's a third point somewhere Oh, my.Okay.Let's see.I want to put in all the points that satisfy that equation.Do you know what that bunch of points will be?It's a plane.If we have a linear equation, then fortunately, the graph of the thing, the the plot of all the points that solve it are a plane.So, I and three these three points determine a plane, but your lecturer is not Rembrandt, and this the art is going to be the weak point here.So, I'm just going to draw a plane, right?There's a plane somewhere.That's my plane.That draw that that that plane is all the points that solves this guy.Then, what about this one?
2x - y + 0 z's.So, z actually can be anything.Again, it's going to be another plane.Each row in a 3 by 3 problem gives us a plane in three dimensions.So, this one is going to be some other plane.Maybe it Maybe I'll try to draw it like this.And those two planes meet in a line.So, if I have two equations, just the first two equations in in three dimensions, those give me a line.The line where those two planes meet.And now, the third guy is a third plane.And it goes somesomewhere.Okay, those three things meet in a point.Now, I don't know where that point is, frankly.Uh but uh linear algebra will find it.Main point is that there is that the three planes, because they're you know, they're not parallel, they don't they're not special, they're they do meet in one point, and that's the solution.
But, uh maybe you can see that this row picture is getting a little hard to see.The row picture was a cinch uh when we looked at two two lines meeting.When we look at three planes meeting, it's not so clear, and in four dimensions, probably a little less clear.So, can I quit on the row picture?I'll quit on the row picture before I've successfully found the point where the three planes meet.All I really want to to see is that there the the row picture consists of three planes, and if everything works right, three planes meet in one point, and that's the solution.Now, you can tell I prefer the column picture.Okay?So, let me take the column picture.That's x times So, there were two x's in the first equation, minus one x's.I'm just take and no x's in the third.
It's just the first column of that.And how many y's are there?There's minus one in the first equation, two in the second, and maybe minus three in the third.Just the second column of my matrix.And z times no z's, minus one z's, and four z's.And it's those three columns, right?That I have to combine to produce the right-hand side, which is 0 - 1 4.
Okay.So, what have we got on this left-hand side?A linear combination.It's a linear combination now of three vectors, and they happen to be Each one is a three-dimensional vector.So, we want to We want to know what combination of those three vectors produces that one.Shall I try to draw the column picture then?So, since these vectors have three components, so it's some multiple Well, let me draw in the first column as before.So, I x is two, and y is minus one.Maybe Maybe there's the first column.
Why the second column has maybe a minus one and a two in the y's and minus three some somewhere there, possibly.Column two.And the third column has no no 0 - 1 4.So, how should I draw that?So, nothing in this is This was the This was the first component, the second component was a minus one.Maybe up here.That's column three.That's That's the column 0 - 1 and 4.This guy.So, again, what's my problem?My My What this equation is asking me to do is to combine these three vectors with a right combination to produce this one.Well, you can see what the right combination is.Because in this special problem, specially chosen by the lecturer, uh that right-hand side that I'm trying to get is actually one of these columns.So, I know how to get that one.So, what's the solution?
What combination will work?I just want one of these and none of these.So, x should be zero, y should be zero, and z should be one.The com- That's the combination.None of that, none of that, one of those is obviously the right one.So, this column three is actually the same as b in this particular problem.
I I I made it work that way just so we would get an answer, 0 0 1.So, somehow that's the point that where those three planes met, and I couldn't see it before.Of course, I won't always be able to see it from the column picture, either.It's the next lecture, actually, which is about elimination, which is the systematic way that everybodyevery every bit of software, too, uh a production large-scale software would solve the the equations.So, the the lecture that's coming up, if I was to add that to the to the syllabus, will be about how to find x y z in in all cases.Can I just think again, though, about the big picture?The big By the big picture, I mean, let's keep this same matrix on the left, but imagine that we have a different right-hand side.Oh, let me take a different right-hand side.
Uh so, I'll change that right-hand side to something that actually is also pretty special.Let me change it to Suppose I If I add those first two columns, that would give me a one and a one and a minus three.There's a very special right-hand side.I I just cooked it up by adding this one to this one.Now, what's the solution with this new right-hand side?The solution with this new right-hand side is clear.It took Now, I took one of these, one of these, and none of those.So, So, actually, it just changed around to this when I took this new right-hand side.Okay.So, the in the in the row picture, I have three different planes.Three three three new planes meeting now at this point.In the column picture, I have the same three columns, but now I'm combining them to produce this guy.
And it turned out that column one plus column two, which would be somewhere there, there is the right column.One of this and one of this would give me the the new b.Okay.So, that's like we squeezed in an extra example.But, now think about all b's.All right-hand sides.Could I get Can I solve these equations for every right-hand side?Uh it Can I say that ask that question?So, that's the algebra question.Can I solve Ax = b for every b?Let me write that down.Can I solve Ax = b for every right-hand side b?I mean, is there a solution?And then, if there is, elimination will give me a way to find it.I'm just I really wanted to ask, is there a solution for every right-hand side?So, now, can I put that in different words?In this linear combination words.
So, in linear combination words, do the linear combinations of the columns
fill three-dimensional space?Every b means all the b's in three-dimensional space.So, I'm Do you see that I'm just asking the same question in in different words?Solving a Ax Oh, that's very important.A times x, when I multiply a matrix by a vector, I get a combination of the columns.Let me I'll write that down in a moment.So, that Do you see But, in my column picture, that's really what I'm doing.I'm taking linear combinations of these three columns, and I'm trying to find B.And actually, the answer for this matrix will be yes.For this matrix, for this for this matrix A, for these columns, the answer is
yes.This matrix is this this this matrix that that that I chose for an example is a good matrix, a non-singular matrix, an invertible matrix.So, those will be the matrices that we like best.There could be other and we will see other matrices where the answer becomes no.Oh, actually, you can see when it would become no.When could What What could go wrong?How could it go wrong that out of these out of three columns and all their combinations when would I not be able to produce some B off here?When When could it go wrong?Do you see that the combinations Suppo- Let me say when it goes wrong.If these three columns all lie in the same plane
then their combinations will lie in that same plane.So, then we're in trouble.If the three columns of my matrix if those three vectors happen to lie in the same plane for example, if column three is just the sum of column one and column two I would be in trouble.That would be a matrix A where the answer would be no.Because the combinations if column three is in the same plane as column one and two, I don't get anything new from that.All the combinations are in the plane, and the only right-hand sides B that I could get would be the ones in that plane.So, I could solve it for some right-hand sides when B is in the in the plane, but most right-hand sides would be out of the plane and unreachable.So, that would be a singular case.The matrix would be not invertible.
There would not be a solution for every B.The answer would become no for that.Okay.Um I don't know Should we take just a little shot at thinking about nine dimensions?Imagine that we have vectors with nine components.Well, it's going to be hard to visualize those.Uh I don't pretend to do it, but somehow pretend you do.Pretend we have if if this was nine equations in nine unknowns, then we would have nine columns and each one would be a vector in nine-dimensional space, and we would be looking at their linear combinations.So, we we'd having the linear combinations of nine vectors in nine-dimensional space, and we would be trying to find the combination that hit the correct right-hand side B.And we might also ask the question can we always do it?Can we get every right-hand side B?And certainly, it will depend on those nine columns.
Some Sometimes the answer will be yes.If I picked a random matrix, it would be yes, actually.If I used MATLAB and just used the random command, picked out a 9 by 9 matrix I guarantee it would be good.It would be non-singular, it would be invertible, all beautiful.But if I choose those columns so that they're not independent so that they're they're so that the the ninth column is the same as the eighth column then it contributes nothing new, and there would be right-hand sides Bthat I couldn't get.Can you sort of think about nine vectors in nine-dimensional space and take their combinations?That's really the the central thought that that you get kind of used to in linear algebra.Even though you can't really visualize it, you sort of think you can after a while.Those nine columns and all their combinations may very well fill out the whole nine-dimensional space.
But if the ninth column happened to be the same as the eighth column and gave nothing new, then probably what it would fill out would be
I hesitate even to say this.It would be a com- a sort of plane an eight-dimensional plane inside nine-dimensional space.And it's those eight-dimensional planes inside nine-dimensional space that we have to work with eventually.For now, let's stay with the nice case where uh the matrices work.We can get every right-hand side B, and here we see how to do it with columns.Okay.There was one step that I real- which I realized I was saying in words that I now want to write in letters.Because I'm coming back to the matrix form of the equation so let me write it here.The matrix form of my equation of my of my system is some matrix A times some vector X equals some right-hand side B.Okay.So, this is a multiplication, A times X, matrix times vector, and I just want to say, how do you multiply a matrix by a vector?
Okay, so I'm just going to create a a matrix.Let me take 2 5 1 3 and let me take a vector X to be, say, 1 and 2.How do I multiply a matrix by a vector?Andjust We'll just think a little bit about matrix notation and how to do that multiplication.So, let me say how I multiply a matrix by a vector.Actually, there are two ways to do it.Let me tell you my favorite way.It's a It's It's columns again.It's a column at a time.For me, that matrix this matrix multiplication says I take one of that column and two of that column and add.So, this is in my the way I would think of it is one of the first column and two of the second column and and let's just see what we get.So, in the first component, I'm getting a two and a 10, I'm getting a 12 there.
In the second component, I'm getting a one and a six, I'm getting a seven.So, that that matrix times that vector is 12 7.Now you could do that another way.You could do it a row at a time.You could do and you would get this 12, and actually, I pretty much did it here.This way, two I could take that row times my vector.This is This is all the time.This is the idea of a dot product.This vector times this vector, 2 * 1 + 5 * 2 is the 12.This vector times this vector, 1 * 1 + 3 * 2 is the 7.So, I can do it by rows and in each row each row times my X is what I'll later call a dot product.But I also like to see it by columns.I see this as a linear combination of the columns.
So, here's my point.A times X is a combination of the columnsof A.That's That's uh how I hope you will think of A times X when we need it.Right now, we've got with small ones, we can always do it in different ways, but later, think of it that way.Okay, so that's uh um the picture for uh 2 by 2 system and if the right-hand side B happened to be 12 7, then of course, the correct solution would be 1 2.Okay, so let me come back next time to a systematic way using elimination to find the solution, if there is one to any a system of any size and find out because the system because eliminate if elimination failsfind out when there isn't a solution.Okay, thanks.
Hey.