# Partial Derivatives

## Partial Derivatives

Transcript: So, so far, we've seen things about vectors, equation of planes, motions in space, and so on. Basically we've done geometry in space. But, calculus, really, is about studying functions. Now, we're going to actually move on to studying functions of several variables. So, this new unit, what we'll do over the next three weeks or so will be about functions of several variables and their derivatives.

OK, so first of all, we should try to figure out how we are going to think about functions. So, remember, if you have a function of one variable, that means you have a quantity that depends on one parameter. Maybe f depends on the variable x. And, for example, a function that you all know is f of x equals sin(x). And, the way we would represent that is maybe just by plotting the graph of the function. So, the graph of a function, we plot y = f(x). And, the graph of a sine function that looks like this. OK, so now, let's say that we had, actually, a function of two variables.

So, that means that the value of F depends actually on two different parameters, say, if the variables are x and y, or they can have any names you want. So, given values of the two parameters, x and y, the function will give us a number that we'll call f(x, y). That depends on x and y according to some formula, OK, not very surprising so far. So, for example, I can give you the function f(x, y) = x^2 y^2. And, of course, as with functions of one variable, we don't need things to be defined everywhere.

Sometimes there is the domain of definition. So, this one is defined all the time. But, if I tell you, say, f of x, y equals square root of y, well, this is only defined if y is nonnegative. If I tell you f(x, y) equals one over x y, that's only defined if x y is not zero, and so on. Now, so these are mathematical examples given by explicit formulas. And, of course, there's physical examples. For example, so examples coming from real life, so for example, you can look at the temperature at the certain point on the surface of the earth. So, you use maybe longitude and latitude; that's x and y. And then you have f(x, y) equals the temperature at that point.

In fact, because temperature depends also may be on how high up you are. It depends on elevation. So, it's actually a function of maybe x, y, z. And, it also depends on time. So, in fact, maybe it's a function of t in x y z coordinates in space. So, you see that real-world functions can depends on a lot of variables. So, our goal will be to understand how to deal with that. OK, so now you will see very soon, but actually it's already tricky enough to picture a function of two variables. So, we are going to focus on the case of functions of two variables. And then, we'll see that if we have more than two variables, then it's harder to plot the function. We cannot draw with the graph looks like anymore.

But, the tools are the same, the notion of partial derivatives, grade and vector, and so on, all the tools that we will develop work exactly the same way no matter how many variables you have. So, I'll say, for simplicity -- -- we'll focus mostly on two or sometimes three variables. But, it works the same in any number of variables. OK, so the first question is how to visualize a function of two variables.

So, the first thing we can do is try to draw the graph of f. So, maybe I should say f -- which is a function of two variables. So, the first answer will be, we can try to look at it's graph. And, the idea is the same as with one variable, namely, we look at all the possible values of the parameters, x and y, and for each of them, we plot a point whose height is the value of a function at these parameters. So, we'll plot, let's say, z equals f(x, y).

And, now that will become, actually, a surface in space. OK, so for each value of x and y, yeah, we have x, y in the x, y plane, then we'll plot the point in space at position x, y. And, z equals f of x, y. OK, and if we take all of these points together, they will give us some surface that sits in space. Yes? Oh, a function of two variables, shorthand. Well, let's say how to visualize a function of two variables. OK, so, how do we do that concretely? Say that I give you a formula for f. How do we try to represent it?

So, let's do our first example. Let's say I give you a function f(x, y) = -y. OK, so it looks a little bit silly because it doesn't depend on x. But, that's not the problem. It's still a valid function of x and y. It just happens to be constant with respect to x. So, to draw the graph we look at the surface in space defined by z equals y. What kind of surface is that? It's a plane, OK? And, if we want to draw it, z equals minus y will look, well, let's put y axis. Let's put x axis. Let's put z axis. If I look at what happens in the y, z plane in the plane of a blackboard, it will just look like a line that goes downward with slope one.

OK, so it will be this. And, what happens if I change x? Well, if I change x, nothing happens because x doesn't appear in this equation. So, in fact, if instead of setting x equal to zero I set x equal to one, I'm in front of the blackboard, or minus one at the back. Well, it still looks exactly the same. So, I have this plane that actually contains the x axis and slopes downwards with slope one.

It's kind of hard to draw. Now, you see immediately what the big problem with graphs will be. But, these pictures are hard to read. But that's our first graph. OK, a question so far? OK, so let's say that we have a slightly more complicated function. How do we see it? So, let's draw another example. Let's say I give you f(x, y) = 1 - x^2-y^2. So, we should try to picture what the surface z=1- x^2-y^2 looks like. So, how do we do that? Well, maybe you are very fast and figured out what it looks like. But, if not, then we need to work piece by piece.

So, maybe it will help if we understand first what it does in the plane of the blackboard. So, if we look at it in the y, z plane, that means we set x equal to zero. And then, z becomes 1 - y^2. What is that? It's a parabola pointing downwards, and starting at one. So, we should draw maybe this downward parabola. It starts at one and it cuts the y axis at one. When y is one, that gives us zero. So, we might have an idea of what it might look like, or maybe not. Let's get more slices.

Let's see what it does in the x, z plane, this other vertical plane that's coming towards us. So, in the x, z plane, if we set y equal to zero, we get z equals one minus x^2. It's, again, a parabola going downwards. OK, so I'm going to try to draw a parabola that goes downward, but now to the front and to the back. So, we are starting to have a slightly better idea but we still don't know whether the cross section of this thing might be round, square, something else. So, it wants more confirmation. We might want to also figure out where the surface intersects the x, y plane.

So, we hit the x, y plane when z equals zero. That means 1-x^2-y^2 should be 0, that becomes x^2 y^2 = 1. That is a circle of radius 1. That's the unit size. So, that means that here, we actually have the unit circle. And now, you should imagine that you have this thing that when you slice it by a vertical plane, looks like a downwards parabola. And, it's actually a surface of revolution. You can rotate it around the z axis, OK? Now, if you stare long enough at that equation, you'll actually see that, yes, we know that it had to be like that. But, see, so these are useful ways of trying to guess what the graph looks like. Of course, the other way is to just ask your computer to do it.

And then, you know, you will get that kind of formula. OK, well, I can leave it on if you want. No, because I plotted a different function that I will show you later. So, it goes this way. I mean, if you want, it's really going downward. Yes, I agree that the sheet is upside down. That's because I plotted something else. OK, so, in fact, so I plotted in my computer was actually x^2 y^2 that looks like that. See, it's the same with a parabola going upwards. If you want to see more examples, I have various examples to show, well, here's the graph, y^2-x^2. See, so that one is kind of interesting.

It looks like a saddle. If you look at it in the y, z plane, then it's a parabola going up, z = y^2. And, that's what we see to the left and to the right. But, if you put it in the x, z plane, then that's a parabola going downwards, z = - x^2. So, we have a parabola going downwards in one direction, upwards in the other one. And together, they form this surface. And of course, you can plot much more complicated functions. So, this one, well, if you can read very small things, you can see the formula. It doesn't matter, just to show you that you can put a formula into a computer: it will show you a picture.

OK, so that's pretty good. I mean, you can see that it can get a bit cluttered because maybe those features that are hidden behind, or maybe we have trouble seeing if we don't have a computer, that looks very readable. But, this is kind of hard to visualize sometimes. So, there is another way to plot the functions of two variables. And, let's call it the contour plot. So, the contour plot is a very elegant solution to the problem that it's difficult to draw to space pictures on a sheet of paper or on a blackboard. So, instead, let's try to represent the function of two variables by just the map, you know, the same way that when you walk around, you have actually geographical maps that fit on a piece of paper that tell you about what the real world looks like. So, what contour plot looks something like this?

So, it's an x, y plot. And, that, you have a bunch of curves. And, what the curves represent are the elevations on the graph. So, for example, this curve might correspond to all the points where f(x, y) = 1. And, that curve might be all the points where f=2 and f=3 and so on, OK? So, when you see you this kind of plot, you're supposed to think that the graph of the function sits somewhere in space above that. It's like a map telling you how high things are. And, what you would want to do with the function, really, is be able to tell quickly what's the value at a given point? Well, let's say I want to look at that point. I know that f is somewhere between 1 and 2.

Actually, it's much faster to read than the graph. On the graph I might have to look carefully, and then measure things, and so on. Here, I can just raise the value of f by comparing with the nearby lines. OK, so let me try to make that more precise. So, it shows all the points -- -- where f(x, y) equals some fixed values, some fixed constants. And, these constants typically are chosen at regular intervals. For example, here I chose one, two, three, and they could continue with zero minus one, and so on. So, one way to think about it, how does this relate to the graph?

Well, that's the same thing as cutting, I mean, we slice the graph by horizontal planes. So, horizontal planes have equations of a form z equals some constant, z equals zero, z equals one, z equals two, and so on. So, maybe the graph of my function will be some sort of plot out there. And, if I slice it by the plane z equals one, then I will get the level curve, which is the point where f(x, y) = 1, and so, that's called a level curve of f.

OK, and so we repeat the process with maybe z equals two, and we get another level curve, and so on. And, then we squish all of them up, and that's how we get the contour plot. OK, so each of these lines, imagine that this is like some mountain or something that you are hiking on. Each of these lines tells you how you could move to stay at a constant height if you want to get to the other side of the mountain but without ever going up or down.

You would just walk along that path, and it will get you there without effort. So, in fact, if you have been talking about hiking on mountains, well, that's exactly what a topographical map is about. So, I need to zoom a bit. So, a topographic map, this one from the US geological survey shows you, basically, all the level curves of an altitude function on a piece of land. So, you know that if you walk right along these curves, you will stay along the same height. And you know that if you walk towards, these don't have numbers.

Let me find a place with numbers. Here, there is a 500 in the middle. So, you know that if you walk on the line that says 500, you stay always at 500 meters in elevation. If you walk towards the mountain that I think is below it, then you will go up, and so on. So, you can see, for example, here there's a peak, and here there is a valley with the river in it, and the altitudes go down, and then back up again on the other side.

OK, so that's an example of a contour plot of a function. Of course, we don't have a formula for that function, but we have a contour plot, and that's what we need actually to understand what's going on there. OK, any questions? No? OK, so another example of contour plots, well, you've probably seen various versions of these temperature maps. So, that's supposed to be how warm it is right now. So, this one is color-coded. Instead of having curves, it has all these colors. But, the effect is the same. If you look at the separations between consecutive colors, these are the level curves of a function that tells you the temperature at a given point. OK, so these are examples of contour plots in real life.

OK, no questions? No? OK, so basically, one of the goals that one should try to achieve at this point is becoming familiar with the contour plot, the graph, and how to view and deal with functions. [APPLAUSE] OK, so -- Let's do an example. Well, let's do a couple of examples. So, let's start with f(x,y) = - y. And, I'm going to take the same two examples as there to start with so that we see the relation between the graph and the contour plots.

So, let's try to plot it. So, we are asked for the level curve, f equals 0 for this one? Well, f is zero when y is zero. So, that's the x axis. OK, so that's the level, zero. Where's the level one? Well, f is one when negative y is one. That means when y is negative one. So, you go to minus one, and that will be where my level one is, and so on. f is two when y is negative two. F is negative one when y is one, and so on. Is that convincing? Do you see how we got that? OK, let me do it again. I don't see anybody nodding, so that's kind of bad news. So, if I want to know, where is the level curve, say, one, I try to set f equals to one.

Let's do this one. f equals one means that negative y is one means that y is minus one, and y equals minus one is this horizontal line on this chart. OK, and same with the others. So, you can see on the map that the value of a function doesn't depend on x. If you move parallel to the x axis, nothing happens. If you move in the y direction, it decreases at a constant rate. That's why the contours are evenly spaced. How spaced out they are tells you, actually, how steep things are. So, that corresponds exactly to that picture, except that here we draw x coming to the front, and y to the right. So, you have to rotate the map by 90° to get to that. It's an unfortunate consequence of the usual way of plotting things in space.

OK, so these horizontal lines here correspond actually to horizontal lines here. OK, second example. Let's do 1-x^2-y^2. OK, or maybe I will write it as 1 - (x^2 y^2). It's really the same thing. So, x, y, let's see, where is this function equal to zero? Well, we said f is zero in the unit circle. OK, so, the zero level, well, let's say that this is my unit. That's where it's at zero. What about f equals one? Well, that's when x^2 y^2 = 0. Well, that's only going to be here.

So, that's just a single point. What about f equals minus one? That's when x^2 y^2 =2. That's a circle of radius square root of two, which is about 1.4. So, it's somewhere here. Then, minus two, similarly, will be x^2 y^2 = 3. Square root of three is about 1.7. And then, minus three will be of radius two, and so on. So, what I want to show here is that they are getting closer and closer apart, OK? So, first it's concentric circles that tells us that we have a shape that's a solid of the graph is going to be a surface of revolution.

Things don't change if I rotate. And second, the level curves are getting closer and closer to each other. That means it's getting steeper and steeper because I have to travel a shorter distance if I want my altitude to change by one. OK, so, this top here is kind of flat. And then it gets steeper and steeper. And, that's what we observe on that picture there. OK, so just to show you a few more, where did I put my, so, for x^2 y^2, the contour plot looks like this. Maybe actually I'll make it. OK, so it looks exactly the same as this one. But, the difference is if you can see the numbers which are not there, so you can see them, then you would know that instead of decreasing as we move out, this one is increasing as we go out.

OK, so that's where we use, actually, the labels on the level curves that tell us whether things are going up or down. But, the contour plots look exactly the same. For the next one I had, I think, was y^2-x^2. So, the contour plot, well, let me actually zoom out. So, the contour plot looks like that. So, the level curve corresponding to zero is actually two diagonal lines. And, if you look on the plot, say that you started at the saddle point in the middle and you try to stay at the same level. So, it looks like a mountain pass, right? Well, there's actually four directions from that point that you can go staying at the same height. And actually, on the map, they look exactly like this, too, these crossing lines. OK, so, these are things that go on the side of the two mountains that are to the left and right, and stay at the same height as the mountain pass.

On the other hand, if you go along the y direction, to the left or to the right, then you go towards positive values. And, if you go along the x axis, then you get towards negative values. OK, the equation for, the function was y^2-x^2. So, you can try to plot them by hand and confirmed that it does look like that. But, I trust my computer. And, finally, this one, well, so the contour plot looks a bit complicated. But, you can see two things. In the middle, you can see these two origins with these concentric circles which are not really circles, but, you know, these closed curves that are concentric.

And, they correspond to the two mountains. And then, at some point in the middle, we have a mountain pass. And there, we see the two crossing lines again, like, on the plot of y^2-x^2. And so, at this saddle point here, if we go north or south, then we go down on either side to the Valley. And, if we go east or west, then we go towards the mountains. We'll go up. OK, does that make sense a little bit? OK, so, reading plots is not easy, but hopefully we'll get used to it very soon.

OK, so actually let's say, well, OK, so, I want to point out one thing. The contour plot tells us, actually, what happens when we move, when we change x and y. So, if I change the value of x and y, that means I'm moving east-west or north-south on the map. And then, I can ask myself, is the value of the function increase or decrease in each of these situations? Well, that's the kind of thing that the contour plot can tell me very quickly.

So -- OK, so say, for example, that I have a piece of contour plot. That looks, you know, like that. Maybe this is f equals one, and this is f equals two. And here, this is f equals zero. And, let's say that I start at the point, say, at this point. OK, so here I have (x0, y0). And, the question I might ask myself is if I change x or y, how does f change? Well, the contour plot tells me that if x increases, and I keep y constant, then what happens to f(x, y)? Well, it will increase because if I move to the right, then I go from one to a value bigger than one.

I don't know exactly how much, but I know that somewhere between one and two, it's more than one. If x decreases, then f decreases. And, similarly, I can tell that if y increases, then f, well, it looks like if I increase y, then f will also increase. And, if y decreases, then f decreases. And, that's the kind of qualitative analysis that we can do easily from the contour plot. But, maybe we'd like to actually be more precise in that, and tell how fast f changes if I change x or y. OK, so to find the rate of change, that's exactly where we use derivatives. So --

So, we are going to have to deal with partial derivatives. So, I will explain to you soon why partial. So, let me just remind you first, if you have a function of one variable, then so let's say f of x, then you have a derivative, f prime of x is also called df/dx. And, it's defined as a limit when delta x goes to zero of the change in f. Sorry, it's not going to fit. I have to go to the next line. It's going to be the limit as delta x goes to zero of the rate of change. So, the change in f between x and x plus delta x divided by delta x.

Sometimes you write delta f for the change in f divided by delta x. And then, you take the limit of this rate of increase as delta x goes to zero. Now, of course, if you have a formula for f, then you know, at least you should know, I suspect most of you know how to actually take the derivative of a function from its formula. So -- Now, how do we do that? Sorry, and I should also tell you what this means on the graph. So, if I plot the graph of a function, and to have my point, x, and here I have f of x, how do I see the derivative? Well, I look at the tangent line to the graph, and the slope of the tangent line is f prime of x, OK?

And, not every function has a derivative. You have functions that are not regular enough to actually have a derivative. So, in this class, we are not going to actually worry too much about differentiability. But, it's good, at least, to be aware that you can't always take the derivative. So, yes, and what else do I want to remind you of? Well, they also have an approximation formula -- -- which says that, you know, if we have the value of f at some point, x0, and that we want to find the value at a nearby point, x close to x0, then our best guess is that it's f of x0 plus the derivative f prime at x0 times delta x, or if you want, x minus x0, OK?

Is this kind of familiar to you? Yeah, I mean, maybe with different notations. Maybe you called that delta x or something. Maybe you called that x0 plus h or something. But, it's the usual approximation formula using the derivative. If you put more terms, then you get the dreaded Taylor approximation that I know you guys don't like. So, the question is how do we do the same for a function of two variables, f(x, y)? So, the difficulty there is we can change x, or we can change y, or we can change both. And, presumably, the manner in which f changes will be different depending on whether we change x or y. So, that's why we have several different notions of derivative.

So, OK, we have a notation. OK, so this is a curly d, and it is not a straight d, and it is not a delta. It's a d that kind of curves backwards like that. And, this symbol is partial. OK, so it's a special notation for partial derivatives. And, essentially what it means is we are going to do a derivative where we care about only one variable at a time. That's why it's partial. It's missing the other variables. So, a function of several variables doesn't have the usual derivative. It has only partial derivatives for each variable.

So, the partial derivative, the partial f partial x at (x0, y0) is defined to be the limit when I take a small change in x, delta x, of the change in f -- -- divided by delta x. OK, so here I'm actually not changing y at all. I'm just changing x and looking at the rate of change with respect to x. And, I have the same with respect to y. Partial f partial y is the limit, so I should say, at a point x0 y0 is the limit as delta y turns to zero. So, this time I keep x the same, but I change y.

OK, so that's the definition of a partial derivative. And, we say that a function is differentiable if these things exist. OK, so most of the functions we'll see are differentiable. And, we'll actually learn how to compute their partial derivatives without having to do this because we'll just have the usual methods for computing derivatives. So, in fact, I claim you already know how to take partial derivatives. So, let's see what it means geometrically.

So, geometrically, my function can be represented by this graph, and I fix some point, (x0, y0). And then, I'm going to ask myself what happens if I change the value of, well, x, keeping y constant. So, if I keep y constant and change x, it means that I'm moving forwards or backwards parallel to the x axis. So, that determines for me the vertical plane parallel to the x, z plane when I fix y equals constant.

And now, if I slice the graph by that, I will get some curve that goes, it's a slice of the graph of f. And now, what I want to find is how f depends on x if I keep y constant. That means it's the rate of change if I move along this curve. So, in fact, if I look at the slope of this thing. So, if I draw the tangent line to this slice, then the slope will be partial f of partial x. I think I have a better picture of that somewhere. Yes, here it is. OK, that's the same picture, just with different colors. So, I take the graph. I slice it by a vertical plane. I get the curve, and now I take the slope of that curve, and that gives me the partial derivative.

And, to finish, let me just tell you how, and I should say, partial f partial y is the same thing but slicing now by your plane that goes in the y, z directions. OK, so I fix x equals constant. That means that I slice by a plane that's parallel to the blackboard. I get a curve, and I looked at the slope of that curve. OK, so it's just a matter of formatting one variable, setting it constant, and looking at the other one. So, how to compute these things, well, we actually, to find, well, there's a piece of notation I haven't told you yet. So, another notation you will see, I think this is what one uses a lot in physics. And, this is what one uses a lot in applied math, which is the same thing as physics but with different notations.

OK, so it just too different notations: partial f partial x, or f subscript x. And, they are the same thing. Well, we just treat y as a constant, and x as a variable. And, vice versa if we want to find partial with aspect to y. So, let me just finish with one quick example. Let's say that they give you f of x, y equals x^3y y^2, then partial f partial x. Well, let's take the derivative. So, here it's x^3 times a constant. Derivative of x^3 is 3x^2 times the constant plus what's the derivative of y^2? Zero, because it's a constant. If you do, instead, partial f partial y, then this is actually a constant times y.

The derivative of y is one. So, that's just x^3. And, the derivative of y^2 is 2y. OK, so it's fairly easy. You just have to keep remembering which one is a variable, and which one isn't. OK, so more about this next time, and we will also learn about maxima and minima in several variables.