# Multivariable Calculus-Dot Product

Transcript - Lecture 1

Take your seats. OK, so, hi everyone. Welcome to 18.02. So, the first announcement, if you are actually looking for 18.01, it's not it here. 18.01 is in 54-100. That's the green building. There was a misprint in the 18.01 syllabus. OK, so if everyone here is present for 18.02, let me introduce myself. My name is Denis Auroux. You can call me Denis if, well, anyway, so you'll notice quickly that I have a strange name, and I speak in a strange way.

And, there's a common reason for both, namely, I'm French. So, hopefully my accent will not be too much of a problem. Hopefully you'll get used to it quickly. Hopefully I will write enough on the board that you can figure out what's going on this class. Well, be patient with me, and ask me to repeat if it's getting hard to follow. So, how to find me: well, my office is in building two. That's the building where most of you have recitations. But, it's one floor above. And, my office hours are on Tuesday and Wednesday afternoons. How to find? Well, you can also reach me by email 24/7. I do not answer 24/7, but almost. And, the Courseware page is at this address. So, in particular, if you still don't have the first problem set, you can find a problem set there.

And, all the handouts, generally speaking, will be on the Courseware page. So, well, just to say very briefly, the main goal of this course will be to develop the language that we need to deal with math problems where things depend on more than one parameter. So, in real life, a function doesn't depend on only one variable like you've seen in calculus so far. So, we'll need to develop tools, and see all sorts of things that relate to functions of two, three, or more variables. And, of course, for that, we'll first need to do some preliminaries. But, so you'll see over time how things go. So, you should all have this document that has course information. And, on the back, it has the syllabus and the schedule, which will tell you, roughly speaking, what we will be doing every single day of the semester.

And, well, anyway, we are going to start slowly. So, just to point out some useful things from that sheet of information, so, one thing is for this class, you should have a textbook which looks like this. And, you should have additional notes which do not look like this because yours should be gray. If you have notes from the past year or two years ago, that's fine. They are the same. And, if you don't have a book yet and you find that the price of a new book is a bit high, you can get used copies in various places that are a little bit less expensive. So, this course is split into lectures and recitations like you probably have already seen. So, recitations meet on Mondays and Wednesdays, and lectures are the other days of the week, Tuesday, Thursday, and Friday in this room.

So, here, while I'll be mostly lecturing, you'll have the chance to ask questions, but it's probably easier to get one on one feedback in recitations. I'm sorry for that. It's unavoidable when there's 300 people in the room. Well, welcome to this class. Work in this class: there will be a bunch of problem sets basically once a week that will be due on Thursdays. So, you should already have the first one.

And, you will notice quickly the problem sets are pretty long in this class. There's a lot of homework, so it's a good idea not to save it for the very last night. Problem sets consist of two parts, part A and part B. Part A is problems from the book and from the notes, which is why it's important that you get these as soon as you can if you don't have them already. And, so problems in the notes have solutions already. So, you should think about them yourself, but have a look at the solutions if you need some hints, and then work on it yourself. The goal is to learn how to solve this problem yourselves. But, don't spend an hour on each problem. If you get stuck, look at the solutions, and then go back to work.

Part B on the other hand is something that's more original, and you have to work on it yourself because there's no solutions. You are allowed to collaborate with each other as long as you think independently and you find independently your solutions. OK, so it's fine with me if you study in small groups of three or four or an entire dorm, or whatever. But don't copy solutions from each other. Don't copy solutions from any other sources that you might find. For example, some of these problems exist on the web. A look at the solutions. If you do that, that's considered cheating and it can have serious consequences if you get caught.

OK, so consider yourselves warned. Also, if you work with someone, then you should indicate on your problems set. Write on your problem set who you consulted, and which sources you used. OK, so I can be just, my roommate, the guy next to me in recitation, my TA, whatever. And, there will also be exams, so, more about that when the first exam comes up. And, for each exam, well, I expect most of you will do very well. But, if that is not the case, you will have a second chance. There are makeup exams in case you did not pass on the first attempt. Also, if he had to be absent, if, for example, you have a sport tournament, then let me know and let your recitation instructor know in advance.

Then you will be excused, and you can take the makeup exam for full credit. If you're sick, let us know, obviously not an advance, well, hopefully. And then, you can also take the makeup for full credit. For all sorts of day-to-day questions, you can go to your recitation instructor or you can talk to me about questions that come up. So, a small warning again about homework, homework is kind of intensive in this class, and take it seriously because at the end of the term, it's going to account for quite a bit in your total term grade. OK, so that should take care of explaining the first couple of handouts about syllabus and problem set.

What about these strange things? So, math is about numbers. But that's not the only thing here. So, this is a way for me to get a feeling about how you were doing in the class. Namely, once in a while I will ask you questions, and there will be multiple choices listed on the screens. Then, I'm expecting you to somehow vote with one of these numbers. You can see it's very high-tech. And then, if I ask a question, you can answer with the appropriate number. So, we'll see in a few minutes how that works.

So -- OK, so another announcement I have to make while you are busy folding is that the lectures in the scores are being videotaped for Open Courseware. So, there's a camera that's filming me. It might actually get some of the back of your heads accidentally. If you have serious objections about the back of your head showing up in the corner of the picture, then you should go sit in the corner over there.

There is a section where it's guaranteed that the camera and microphones will not pick you up. That being said, you know, the goal of the camera is really to keep an eye on me, not to keep an eye on you. OK, so if I mess up, people will notice. If you're making funny faces at your neighbor, nobody will notice. OK, I think that's about it for the initial announcements. So, do you have any questions concerning the way the course works, concerning videotaping, anything like that?

Yes? Ah, so the question is, how do we switch recitations? So, to switch recitations, the first thing to do right now is to just go to the recitation that you want to. The second thing to do is on the courseware page, there's a link to something that's called the Online Course Management System. And, that's where you will see your grades, by the way. And, that's also where you can switch recitations. So, when you get there, it will ask you to log in with an MIT certificate, and then you can see your grades, and you can switch recitations. There is a small problem, which is that recitation changes do not work yet. So, you have to wait until sometime this weekend, maybe Monday, it should be working. Yes?

Yes, I will be able to sign add/drop forms for anybody who wants to add this class. If you want to drop this class, I don't think you need my signature. So, if you have add/drop forms to sign bring them to me at any time. After lecture, or during office hours, or anytime. OK, any other questions? OK, yes? I think you have to pay for them, but they're hopefully not too expensive. OK, they're just a few dollars, and you can get them from building 11, CopyTech Center. There's also a Copy Text Center in Stata. And, well, if you know someone who has notes from a past year, they are also pretty much the same.

OK, any more questions? I cannot see you if you are raising your hand. OK, I think that's it for questions. So, let's see, so let's start right away with stuff that we will need to see before we can go on to more advanced things. So, hopefully yesterday in recitation, you heard a bit about vectors. How many of you actually knew about vectors before that? OK, that's the vast majority. If you are not one of those people, well, hopefully you'll learn about vectors right now. I'm sorry that the learning curve will be a bit steeper for the first week. But hopefully, you'll adjust fine. If you have trouble with vectors, do go to your recitation instructor's office hours for extra practice if you feel the need to. You will see it's pretty easy.

So, just to remind you, a vector is a quantity that has both a direction and a magnitude of length. So -- So, concretely the way you draw a vector is by some arrow, like that, OK? And so, it has a length, and it's pointing in some direction. And, so, now, the way that we compute things with vectors, typically, as we introduce a coordinate system. So, if we are in the plane, x-y-axis, if we are in space, x-y-z axis. So, usually I will try to draw my x-y-z axis consistently to look like this.

And then, I can represent my vector in terms of its components along the coordinate axis. So, that means when I have this row, I can ask, how much does it go in the x direction? How much does it go in the y direction? How much does it go in the z direction? And, so, let's call this a vector A. So, it's more convention. When we have a vector quantity, we put an arrow on top to remind us that it's a vector. If it's in the textbook, then sometimes it's in bold because it's easier to typeset.

If you've tried in your favorite word processor, bold is easy and vectors are not easy. So, the vector you can try to decompose terms of unit vectors directed along the coordinate axis. So, the convention is there is a vector that we call hat that points along the x axis and has length one. There's a vector called hat that does the same along the y axis, and the hat that does the same along the z axis.

And, so, we can express any vector in terms of its components. So, the other notation is between these square brackets. Well, in angular brackets. So, the length of a vector we denote by, if you want, it's the same notation as the absolute value. So, that's going to be a number, as we say, now, a scalar quantity. OK, so, a scalar quantity is a usual numerical quantity as opposed to a vector quantity. And, its direction is sometimes called dir A, and that can be obtained just by scaling the vector down to unit length, for example, by dividing it by its length.

So -- Well, there's a lot of notation to be learned. So, for example, if I have two points, P and Q, then I can draw a vector from P to Q. And, that vector is called vector PQ, OK? So, maybe we'll call it A. But, a vector doesn't really have, necessarily, a starting point and an ending point. OK, so if I decide to start here and I go by the same distance in the same direction, this is also vector A. It's the same thing. So, a lot of vectors we'll draw starting at the origin, but we don't have to.

So, let's just check and see how things went in recitation. So, let's say that I give you the vector <3,2,1>. And so, what do you think about the length of this vector? OK, I see an answer forming. So, a lot of you are answering the same thing. Maybe it shouldn't spoil it for those who haven't given it yet. OK, I think the overwhelming vote is in favor of answer number two. I see some sixes, I don't know. That's a perfectly good answer, too, but hopefully in a few minutes it won't be I don't know anymore.

So, let's see. How do we find -- -- the length of a vector three, two, one? Well, so, this vector, A, it comes towards us along the x axis by three units. It goes to the right along the y axis by two units, and then it goes up by one unit along the z axis. OK, so, it's pointing towards here. That's pretty hard to draw. So, how do we get its length? Well, maybe we can start with something easier, the length of the vector in the plane. So, observe that A is obtained from a vector, B, in the plane. Say, B equals three (i) hat plus two (j) hat.

And then, we just have to, still, go up by one unit, OK? So, let me try to draw a picture in this vertical plane that contains A and B. If I draw it in the vertical plane, so, that's the Z axis, that's not any particular axis, then my vector B will go here, and my vector A will go above it. And here, that's one unit. And, here I have a right angle. So, I can use the Pythagorean theorem to find that length A^2 equals length B^2 plus one. Now, we are reduced to finding the length of B. The length of B, we can again find using the Pythagorean theorem in the XY plane because here we have the right angle. Here we have three units, and here we have two units.

OK, so, if you do the calculations, you will see that, well, length of B is square root of (3^2 2^2), that's 13. So, the square root of 13 -- -- and length of A is square root of length B^2 plus one (square it if you want) which is going to be square root of 13 plus one is the square root of 14, hence, answer number two which almost all of you gave. OK, so the general formula, if you follow it with it, in general if we have a vector with components a1, a2, a3, then the length of A is the square root of a1^2 plus a2^2 plus a3^2.

OK, any questions about that? Yes? Yes. So, in general, we indeed can consider vectors in abstract spaces that have any number of coordinates. And that you have more components. In this class, we'll mostly see vectors with two or three components because they are easier to draw, and because a lot of the math that we'll see works exactly the same way whether you have three variables or a million variables.

If we had a factor with more components, then we would have a lot of trouble drawing it. But we could still define its length in the same way, by summing the squares of the components. So, I'm sorry to say that here, multi-variable, multi will mean mostly two or three. But, be assured that it works just the same way if you have 10,000 variables. Just, calculations are longer. OK, more questions? So, what else can we do with vectors? Well, another thing that I'm sure you know how to do with vectors is to add them to scale them.

So, vector addition, so, if you have two vectors, A and B, then you can form, their sum, A plus B. How do we do that? Well, first, I should tell you, vectors, they have this double life. They are, at the same time, geometric objects that we can draw like this in pictures, and there are also computational objects that we can represent by numbers. So, every question about vectors will have two answers, one geometric, and one numerical.

OK, so let's start with the geometric. So, let's say that I have two vectors, A and B, given to me. And, let's say that I thought of drawing them at the same place to start with. Well, to take the sum, what I should do is actually move B so that it starts at the end of A, at the head of A. OK, so this is, again, vector B. So, observe, this actually forms, now, a parallelogram, right? So, this side is, again, vector A. And now, if we take the diagonal of that parallelogram, this is what we call A plus B, OK, so, the idea being that to move along A plus B, it's the same as to move first along A and then along B, or, along B, then along A. A plus B equals B plus A.

OK, now, if we do it numerically, then all you do is you just add the first component of A with the first component of B, the second with the second, and the third with the third. OK, say that A was B was , then you just add this way. OK, so it's pretty straightforward. So, for example, I said that my vector over there, its components are three, two, one. But, I also wrote it as 3i 2j k. What does that mean? OK, so I need to tell you first about multiplying by a scalar. So, this is about addition.

So, multiplication by a scalar, it's very easy. If you have a vector, A, then you can form a vector 2A just by making it go twice as far in the same direction. Or, we can make half A more modestly. We can even make minus A, and so on. So now, you see, if I do the calculation, 3i 2j k, well, what does it mean? 3i is just going to go along the x axis, but by distance of three instead of one. And then, 2j goes two units along the y axis, and k goes up by one unit. Well, if you add these together, you will go from the origin, then along the x axis, then parallel to the y axis, and then up. And, you will end up, indeed, at the endpoint of a vector.

OK, any questions at this point? Yes? Exactly. To add vectors geometrically, you just put the head of the first vector and the tail of the second vector in the same place. And then, it's head to tail addition. Any other questions? Yes? That's correct. If you subtract two vectors, that just means you add the opposite of a vector. So, for example, if I wanted to do A minus B, I would first go along A and then along minus B, which would take me somewhere over there, OK? So, A minus B, if you want, would go from here to here.

OK, so hopefully you've kind of seen that stuff either before in your lives, or at least yesterday. So, I'm going to use that as an excuse to move quickly forward. So, now we are going to learn a few more operations about vectors. And, these operations will be useful to us when we start trying to do a bit of geometry. So, of course, you've all done some geometry. But, we are going to see that geometry can be done using vectors.

And, in many ways, it's the right language for that, and in particular when we learn about functions we really will want to use vectors more than, maybe, the other kind of geometry that you've seen before. I mean, of course, it's just a language in a way. I mean, we are just reformulating things that you have seen, you already know since childhood. But, you will see that notation somehow helps to make it more straightforward.

So, what is dot product? Well, dot product as a way of multiplying two vectors to get a number, a scalar. And, well, let me start by giving you a definition in terms of components. What we do, let's say that we have a vector, A, with components a1, a2, a3, vector B with components b1, b2, b3. Well, we multiply the first components by the first components, the second by the second, the third by the third.

If you have N components, you keep going. And, you sum all of these together. OK, and important: this is a scalar. OK, you do not get a vector. You get a number. I know it sounds completely obvious from the definition here, but in the middle of the action when you're going to do complicated problems, it's sometimes easy to forget. So, that's the definition. What is it good for? Why would we ever want to do that? That's kind of a strange operation. So, probably to see what it's good for, I should first tell you what it is geometrically. OK, so what does it do geometrically?

Well, what you do when you multiply two vectors in this way, I claim the answer is equal to the length of A times the length of B times the cosine of the angle between them. So, I have my vector, A, and if I have my vector, B, and I have some angle between them, I multiply the length of A times the length of B times the cosine of that angle. So, that looks like a very artificial operation. I mean, why would want to do that complicated multiplication? Well, the basic answer is it tells us at the same time about lengths and about angles. And, the extra bonus thing is that it's very easy to compute if you have components, see, that formula is actually pretty easy. So, OK, maybe I should first tell you, how do we get this from that?

Because, you know, in math, one tries to justify everything to prove theorems. So, if you want, that's the theorem. That's the first theorem in 18.02. So, how do we prove the theorem? How do we check that this is, indeed, correct using this definition? So, in more common language, what does this geometric definition mean? Well, the first thing it means, before we multiply two vectors, let's start multiplying a vector with itself. That's probably easier. So, if we multiply a vector, A, with itself, using this dot product, so, by the way, I should point out, we put this dot here. That's why it's called dot product. So, what this tells us is we should get the same thing as multiplying the length of A with itself, so, squared, times the cosine of the angle.

But now, the cosine of an angle, of zero, cosine of zero you all know is one. OK, so that's going to be length A^2. Well, doesn't stand a chance of being true? Well, let's see. If we do AdotA using this formula, we will get a1^2 a2^2 a3^2. That is, indeed, the square of the length. So, check. That works. OK, now, what about two different vectors? Can we understand what this says, and how it relates to that? So, let's say that I have two different vectors, A and B, and I want to try to understand what's going on.

So, my claim is that we are going to be able to understand the relation between this and that in terms of the law of cosines. So, the law of cosines is something that tells you about the length of the third side in the triangle like this in terms of these two sides, and the angle here. OK, so the law of cosines, which hopefully you have seen before, says that, so let me give a name to this side.

Let's call this side C, and as a vector, C is A minus B. It's minus B plus A. So, it's getting a bit cluttered here. So, the law of cosines says that the length of the third side in this triangle is equal to length A2 plus length B2. Well, if I stopped here, that would be Pythagoras, but I don't have a right angle. So, I have a third term which is twice length A, length B, cosine theta, OK? Has everyone seen this formula sometime? I hear some yeah's. I hear some no's. Well, it's a fact about, I mean, you probably haven't seen it with vectors, but it's a fact about the side lengths in a triangle. And, well, let's say, if you haven't seen it before, then this is going to be a proof of the law of cosines if you believe this. Otherwise, it's the other way around.

So, let's try to see how this relates to what I'm saying about the dot product. So, I've been saying that length C^2, that's the same thing as CdotC, OK? That, we have checked. Now, CdotC, well, C is A minus B. So, it's A minus B, dot product, A minus B. Now, what do we want to do in a situation like that? Well, we want to expand this into a sum of four terms. Are we allowed to do that? Well, we have this dot product that's a mysterious new operation. We don't really know. Well, the answer is yes, we can do it. You can check from this definition that it behaves in the usual way in terms of expanding, vectoring, and so on.

So, I can write that as AdotA minus AdotB minus BdotA plus BdotB. So, AdotA is length A^2. Let me jump ahead to the last term. BdotB is length B^2, and then these two terms, well, they're the same. You can check from the definition that AdotB and BdotA are the same thing. Well, you see that this term, I mean, this is the only difference between these two formulas for the length of C. So, if you believe in the law of cosines, then it tells you that, yes, this a proof that AdotB equals length A length B cosine theta.

Or, vice versa, if you've never seen the law of cosines, you are willing to believe this. Then, this is the proof of the law of cosines. So, the law of cosines, or this interpretation, are equivalent to each other. OK, any questions? Yes? So, in the second one there isn't a cosine theta because I'm just expanding a dot product. OK, so I'm just writing C equals A minus B, and then I'm expanding this algebraically. And then, I get to an answer that has an A.B. So then, if I wanted to express that without a dot product, then I would have to introduce a cosine. And, I would get the same as that, OK? So, yeah, if you want, the next step to recall the law of cosines would be plug in this formula for AdotB.

And then you would have a cosine. OK, let's keep going. OK, so what is this good for? Now that we have a definition, we should figure out what we can do with it. So, what are the applications of dot product? Well, will this discover new applications of dot product throughout the entire semester,but let me tell you at least about those that are readily visible. So, one is to compute lengths and angles, especially angles. So, let's do an example.

Let's say that, for example, I have in space, I have a point, P, which is at (1,0,0). I have a point, Q, which is at (0,1,0). So, it's at distance one here, one here. And, I have a third point, R at (0,0,2), so it's at height two. And, let's say that I'm curious, and I'm wondering what is the angle here? So, here I have a triangle in space connect P, Q, and R, and I'm wondering, what is this angle here? OK, so, of course, one solution is to build a model and then go and measure the angle. But, we can do better than that. We can just find the angle using dot product. So, how would we do that? Well, so, if we look at this formula, we see, so, let's say that we want to find the angle here.

Well, let's look at the formula for PQdotPR. Well, we said it should be length PQ times length PR times the cosine of the angle, OK? Now, what do we know, and what do we not know? Well, certainly at this point we don't know the cosine of the angle. That's what we would like to find. The lengths, certainly we can compute. We know how to find these lengths. And, this dot product we know how to compute because we have an easy formula here. OK, so we can compute everything else and then find theta. So, I'll tell you what we will do is we will find theta --

-- in this way. We'll take the dot product of PQ with PR, and then we'll divide by the lengths. OK, so let's see. So, we said cosine theta is PQdotPR over length PQ length PR. So, let's try to figure out what this vector, PQ, well, to go from P to Q, I should go minus one unit along the x direction plus one unit along the y direction. And, I'm not moving in the z direction. So, to go from P to Q, I have to move by <-1,1,0>. To go from P to R, I go -1 along the x axis and 2 along the z axis. So, PR, I claim, is this. OK, then, the lengths of these vectors, well,(-1)^2 (1)^2 (0)^2, square root, and then same thing with the other one.

OK, so, the denominator will become the square root of 2, and there's a square root of 5. What about the numerator? Well, so, remember, to do the dot product, we multiply this by this, and that by that, that by that. And, we add. Minus 1 times minus 1 makes 1 plus 1 times 0, that's 0. Zero times 2 is 0 again. So, we will get 1 over square root of 10. That's the cosine of the angle. And, of course if we want the actual angle, well, we have to take a calculator, find the inverse cosine, and you'll find it's about 71.5°.

Actually, we'll be using mostly radians, but for today, that's certainly more speaking. OK, any questions about that? No? OK, so in particular, I should point out one thing that's really neat about the answer. I mean, we got this number. We don't really know what it means exactly because it mixes together the lengths and the angle. But, one thing that's interesting here, it's the sign of the answer, the fact that we got a positive number. So, if you think about it, the lengths are always positive. So, the sign of a dot product is the same as a sign of cosine theta. So, in fact, the sign of AdotB is going to be positive if the angle is less than 90°.

So, that means geometrically, my two vectors are going more or less in the same direction. They make an acute angle. It's going to be zero if the angle is exactly 90°, OK, because that's when the cosine will be zero. And, it will be negative if the angle is more than 90°. So, that means they go, however, in opposite directions. So, that's basically one way to think about what dot product measures. It measures how much the two vectors are going along each other. OK, and that actually leads us to the next application. So, let's see, did I have a number one there? Yes. So, if I had a number one, I must have number two.

The second application is to detect orthogonality. It's to figure out when two things are perpendicular. OK, so orthogonality is just a complicated word from Greek to say things are perpendicular. So, let's just take an example. Let's say I give you the equation x 2y 3z = 0. OK, so that defines a certain set of points in space, and what do you think the set of solutions look like if I give you this equation? So far I see one, two, three answers, OK.

So, I see various competing answers, but, yeah, I see a lot of people voting for answer number four. I see also some I don't knows, and some other things. But, the majority vote seems to be a plane. And, indeed that's the correct answer. So, how do we see that it's a plane? So, I should say, this is the equation of a plane. So, there's many ways to see that, and I'm not going to give you all of them. But, here's one way to think about it. So, let's think geometrically about how to express this condition in terms of vectors. So, let's take the origin O, by convention is the point (0,0,0).

And, let's take a point, P, that will satisfy this equation on it, so, at coordinates x, y, z. So, what does this condition here mean? Well, it means the following thing. So, let's take the vector, OP. OK, so vector OP, of course, has components x, y, z. Now, we can think of this as actually a dot product between OP and a mysterious vector that won't remain mysterious for very long, namely, the vector one, two, three. OK, so, this condition is the same as OP.A equals zero, right? If I take the dot product OPdotA I get x times one plus y times two plus z times three.