Practice in higher dimensions Here are three functions with a point and a direction for each of them. Your task is to compute the gradients of the functions, then evaluate their gradients at thepoint given. Next, compute the directional derivative of the function at that point in thedirection given by its vector component along that direction. Here, for example, in part a I've given you the function f(x,y) equal to (x squared) y plus x(ysquared) at the point (x=−1, y=2), and in the direction of the vector (3, 4). The vector (x,y,z) can be represented by the vector of its three elements, the square rootof (x squared plus y squared plus z squared). Point P is the point (2, 6, minus 3). And v isthe direction (1, 1, 1). Our third example, h is a function of four variables, (w, x, y, and z). It is given by wx + wy +wz + xy + xz + yz at the point (2, 0, −1, −1), in the direction (1, −1, 1 , −1). Think about those problems. Let us begin with the first function. The function f of (x,y) is equal to x squared plus ysquared, plus x times y squared. To compute the gradient, we first compute the first partials of our function and then putthem into a single vector. This is the gradient. Thus, the gradient of f at (x, y) is equal to-- it's the vector, and its first component is the firstpartial of f with respect to x, so that's going to be 2xy plus y squared. The second component of the partial derivative of f with respect to y is x squared plus 2xy. So this is the derivative of our function at the particular point (minus 1, 2).
The gradient of f at the point (–1, 2) can be found by substituting –1 for x and 2 for y in thisformula. When x is equal to negative 1, y equals 2, this is 2 times negative 1 times 2 plus 2squared, so that's minus 4 plus 4, so that's just zero. The second term is minus 1 squared plus 2 times minus 1 times 2, which equals 1 plusnegative 4. So the second-order equation is 3—negative 3. Nice. In the following graph, we see the gradient of f at (x = -1, y = 2). Now we need to take the directional derivative of f in the direction of vector v. But when wetake directional derivatives, we want to work with unit vectors. Reasonable. Thus, the given vector was (3,4), right here. In order to apply the standard formula forfinding the dot product, we need to find a unit vector u in the direction of v. To do so, wedivide v by its length. The vector (3, 4), then, has a length of 5 by the Pythagorean theorem. This can be writtenas (3/5, 4/5). The directional derivative in the direction of v, which is this vector u, is identical to thegradient at that point dotted with the direction vector. It equals to gradient of f at that point dot u. As we are interested at the point p, we see thatit is equal to (0, minus 3) dot our vector u, which is (3/5, 4/5). So that dot-product isnegative 12/5.
In this direction, the function decreases at about that rate at the given point. Okay. That was A part, let’s move on to part B. You may have noticed that the asked questions are similar in some respects, but each onehas a different variable or set of variables. Obviously, you know how to find the gradient of a function of three variables. So in thiscase, our function g is given by the square root of x squared plus y squared plus zsquared. So if it is okay, this is the function that measures the distance of a point from the origin.We're asked first to find the gradient of g. What are the next steps? So I take the partial derivative of this expression with respect to x. Since it is a compositionof functions, I must use the chain rule. It may be a little complicated. You get the derivative of the inside function times the derivative of the outside function.The outside function is a square root, so its derivative is to the 1/2 power. The insidefunction is x squared plus y squared plus z squared, so its derivative is over 2 times thesquare root of (x squared plus y squared plus z squared). Then we must multiply by thederivative of the inside, which is 2x. Thus, the 2s cancel out and we have x/√x²+y/√y²+z/√z². Similarly, this function issymmetric with respect to its variables. And if we were to change x or y, the resultingexpression would be identical. Therefore, the other partial derivatives are also similar. These are y over the square root of(x squared plus y squared plus z squared), and z over the square root of (x squared plus ysquared plus z squared). That's a rather long formula. Anyway, there we have it. This is the gradient, the vector ofpartial derivatives. You will compute it at a particular point. The point of interest is at (2,6,-3). We want to compute the gradient there. So we plug thenumbers into our formula, g, at (2, 6, -3).
Well, OK. So the square root of x squared plus y plus z squared appears in all terms, solet's compute that first. So x squared is 4, y squared is 36, and z squared is 9. I add thosenumbers together and get 49. Then I take the square root of that and get 7. And then, atthe top of the fraction, we have x, y, and z. Thus, (2 over 7, 6 over 7, minus 3 over 7). So the gradient at our point is given by this formula. By plugging the values at this pointinto this formula, I get a gradient of . And now, once again, I want to compute the particular directional derivative of thisfunction. So in order to do that, I need a unit vector in the direction v with coordinates (1, 1,1). So, again, this is not a unit vector, which means we need to divide it by its length to findthe unit vector that we will use. The length of this vector is the square root of 1 squared plus 1 squared plus 1 squared,which is the square root of 3. So u is equal to 1 over the square root of 3 times the vector(1, 1, 1). The directional derivative, dg/ds, in the direction u-hat is obtained by dotting the gradientwith this u. In our case, so that 1 over the square root of 3 lives out front. And then, to complete the calculation, we multiply 2/7 by 6/7 and subtract 3/7 from thisresult. This gives me 5 over (7 square root of 3), if all numbers are correct. The last function is very similar to the previous one, but now it involves four variables. Butis pretty much the same. So in part C, h of (w,x,y,z) is equal to w·x + w·y + w·z + x·y + x·z + y·z.
So the gradient of h, we will take the partial derivative with respect to w, as the firstcoordinate. Four partial derivatives. We will take the derivative of A with respect to x, which is w plus y plus z. Likewise, we willtake the partial derivative of A with respect to y, which is x plus z. And finally, we will takethe partial derivative of A with respect to z, which is x plus y. Thus, we have derived the following partial derivatives. Now the question is about the gradient at a particular point. The gradient at the point (2, 0, −1, −1) is −2. Plugging this into our equation gives us 0 +(−1) + (−1) = −2. The gradient at the point (2, 0, 1) is 2; plugging this into our equationgives us 2 + 0 + (−1) = 1. The gradient at the point (2, 0, 1) is 2; plugging this into ourequation gives us 2 + 0 + (−1) = 1. The gradient of this function at this point p is given by vector (1, minus 1, 1, minus 1). In order to find the directional derivative, we need a unit vector. Since the vector v is not aunit vector, u is equal to v divided by the length of v. How do we find the length of v? The geometric mean of the coordinates is found by squaring the values and adding them.In this case, 1 plus 1 plus 1 plus 1 equals 4. When squared and added, the values produce4. The square root of 4 is 2; therefore, v over 2 is the geometric mean. Finally, I understand that the directional derivative dh/ds in this direction u is what I getwhen I dot this gradient together with the direction in which I'm heading. The gradient of the function, minus 2, 0, 1, 1, dotted with the unit vector of the justcomputed direction. Thus, the final solution is a dot product. Now you are better at computing gradients and directional derivatives from gradients.