Practice in higher dimensions
Here are three functions with a point and direction for each of them. Your task is to compute the gradients of the functions, then evaluate their gradients at the point given. Next, compute the directional derivative of the function at that point in the direction 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 (× squared) y plus x(y squared) at the point (x=-1, y=2), and in the direction of the vector (3, 4). f(x,y)=x^2y+xy^2, P=(-1,2),v->=(3,4) The vector (x,y,) can be represented by the vector of its three elements, the square root of (× squared plus y squared plus z squared). Point P is the point (2, 6, minus 3). And v is the direction (1, 1, 1) g(x,y,z)=sqrt(x^2+y^2+z^2),P=(2,6,-3),v->(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). h(w, x,y,z) = wx + wy + wz + xy + xz + yz, P = 2, 0, – 1, – 1 V = (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 y squared, plus x times y squared. f(x,y)=x^2y+xy^2 To compute the gradient, we first compute the first partials of our function and then put them into a single vector. This is the gradient. Thus, the gradient of fat (x, y) is equal to– it’s the vector, and its first component is the first partial of f with respect to x, so that’s going to be 2xy plus y squared. The second component of the partial derivative off with respect to y is x squared plus 2xy. ∇f(x,y)=(2xy+y^2,x^2+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 this formula. When x is equal to negative 1, y equals 2, this is 2 times negative times 2 plus 2 squared, so that’s minus 4 plus 4, so that’s just zero. is The second term is minus 1 squared plus 1 2 times minus 1 times 2, which equals plus negative 4. So the second-order equation is 3-negative 3. ∇f(-1,2)=(0,-3) Nice. In the following graph, we see the gradient of fat (x = -1, y = 2). Now we need to take the directional derivative off in the direction of vector v. But when we take directional derivatives, we want to work with unit vectors. df/ds| hat u Reasonable. Thus, the given vector was (3,4), right here. In order to apply the standard formula for finding the dot product, we need to find a unit vector u in the direction of v. To do so, we divide v by its length. hat u=hat v->/hat v-> The vector (3, 4), then, has a length of 5 by the Pythagorean theorem. This can be written as (3/5, 4/5). hat u=hat v->/hat v->=3/5,4/5 The directional derivative in the direction of v, which is this vector u, is identical to the gradient at that point dotted with the direction vector. It equals to gradient of fat that point dot u. As we are interested at the point p; we see that it is equal to (0, minus 3) dot our vector u, which is (3/5, 4/5). So that dot-product is negative 12/5. =∇f*hat u=(0,-3)*(3/5,4/5)=-(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 one has a different variable or set of variables. Obviously, you know how to find the gradient of a function of three variables. So in this case, our function g is given by the square root of x squared plus y squared plus z squared. g(x,y,z)=sqrt(x^2+y^2+z^2) 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 composition of 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 inside function is x squared plus y squared plus z squared, so its derivative is over 2 times the square root of (x squared plus y squared plus z squared). Then we must multiply by the derivative of the inside, which is 2x. Thus, the 2s cancel out and we have x/x?+y/Vy?+z/z?. Similarly, this function is symmetric with respect to its variables. And if we were to change x or y, the resulting expression 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 (× squared plus y squared plus z squared). g(x,y,z)=〈(1*2x)/(2sqrt(x^2+y^2_z^2),y/sqrt(x^2+y^2+z^2),z/sqrt(x^2+y^2+z^2)〉 That’s a rather long formula. Anyway, there we have it. This is the gradient, the vector of partial 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 the numbers into our formula, g. at (2, 6, -3). ∇g(2, 6, – 3) = Well, OK. So the square root of x squared plus y plus z squared appears in all terms, so let’s compute that first. So x squared is 4, y squared is 36, and z squared is 9. I add those numbers together and get 49. Then I take the square root of that and get 7. And then, at the top of the fraction, we have x, y, and z. Thus. (2 over 7, 6 over 7, minus 3 over 7). ∇g(2, 6, – 3) =〈2/7,6/7,-3/7〉 So the gradient at our point is given by this formula. By plugging the values at this point into this formula, I get a gradient of. And now, once again, I want to compute the particular directional derivative of this function. So in order to do that, I need a unit vector in the direction v with coordinates (1, 1, 1). v->=〈1,1,1〉 So, again, this is not a unit vector, which means we need to divide it by its length to find the 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). v->=〈1,1,1〉 -> hat u=1/sqrt3 =〈1,1,1〉 The directional derivative, dg/ds, in the direction -hat is obtained by dotting the gradient with 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 this result. This gives me 5 over (7 square root of 3), if all numbers are correct. dg/ds | hat u=1/sqrt3(2/7+6/7-3/7)=5/7sqrt3 The last function is very similar to the previous one, but now it involves four variables. But is pretty much the same. So in part C, h of (w,x,y.z) is equal to wx + wy + wz + xy + x z + y•z. h(w,x,y,z)=wx+wy+wz+xy+xz+yz So the gradient of h, we will take the partial derivative with respect to w, as the first coordinate. Four partial derivatives. We will take the derivative of A with respect to x, which is w plus y plus z. Likewise, we will take the partial derivative of A with respect to y, which is x plus z. And finally, we will take the partial derivative of A with respect to z, which is x plus y. ∇h(2,0,-1,-1)=〈-2,0,1,1〉 The gradient of this function at this point p is given by vector (1, minus 1, 1, minus 1). v->〈1,-1,1,-1〉 In order to find the directional derivative, we need a unit vector. Since the vector v is not a unit 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 produce 4. The square root of 4 is 2; therefore, v over 2 is the geometric mean. hat u=v->/|v->|=v->/sqrt(1+1+1+1)=v->/2 Finally, I understand that the directional derivative dh/ds in this direction u is what I get when 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 just computed direction. dh/ds | hat u = 〈-2,0,1,1〉*1/2〈1,-1,1,-1〉 Thus, the final solution is a dot product. Now you are better at computing gradients and directional derivatives from gradients.