<<

MultivariateCalculus;Fall2013 S.Jamshidi

5.4 Directional and the Vector

Objectives

⇤ IunderstandthenotionofagradientvectorandIknowinwhatdirectionitpoints.

⇤ Iknowhowtocalculateadirectionalderivativeinthedirectionofagivenvector~v .

⇤ Iknowhowtofindtheunitvector~u that creates the maximum directional , Duf.

Mathematically speaking, the derivative of a f(x)atapointx should be thought of as the of f at that point x. If we want to be really precise, we should think of it as the slope of the line of f at x.Thisisthebestwaytoconceptuallyunderstandaderivative. For example, if you’re given the function f(x)= x2 +2,youknowthederivativeof f at x =1 will be 2. This value corresponds to the slope of the line tangent to f at x =1. 3 y

2

1

x 2 1 1 2 1 2 For higher dimensions, we want to find an analogous value. That is, we want to find something that can represent a slope of a tangent. In the last section, we found partial derivatives, but as the word “partial” would suggest, we are not done! These partial derivatives are an intermediate step to the object we wish to find. Recall that in three dimensions are described with vectors (see section 3.5 Lines and Planes) because vectors describe movement. So our true derivative in higher dimensions should be a vector. This vector is called the gradient vector. Definition 5.4.1 The gradient vector of a function f, denoted f or grad(f), is a vectors whose entries are the partial derivatives of f. That is, r f(x, y)= f (x, y),f (x, y) r h x y i 114 of 142 MultivariateCalculus;Fall2013 S.Jamshidi

This is a generalization of a derivative of a function of several variables.

A natural question you may ask is in what direction does the vector point? The answer is that it points in the direction of steepest ascent.Ifyouimaginewalkingonahillyarea,thegradient is a vector that points you toward the steepest climb. Here is a picture of a three dimensional . The arrows at the bottom represent the gradient vectors. They each point in the direction where it is steepest. Longer the vector (the greater its ), the steeper the surface is at that point.

Here is a good thought exercise to test your understanding of . What do you think the gradient vector should be for the function f(x, y)=x2 + y2 at the point (0, 0)?Remember, this function is the paraboloid and (0, 0) is its vertex.

115 of 142 MultivariateCalculus;Fall2013 S.Jamshidi

5.4.1 Examples

Example 5.4.1.1 Find the gradient vector of

f(x, y)=x2 + y2

What are the gradient vectors at (1, 2), (2, 1) and (0, 0)?

We begin with the formula.

f = f ,f = 2x, 2y r h x yi h i Now, let us find the gradient at the following points.

f(1, 2) = 2, 4 • r h i f(2, 1) = 4, 2 • r h i f(0, 0) = 0, 0 • r h i Notice that at (0, 0) the gradient vector is the zero vector. Since the gradient corresponds to the notion of slope at that point, this is the same as saying the slope is zero.

Example 5.4.1.2 Find the gradient vector of

f(x, y)=2xy + x2 + y

What are the gradient vectors at (1, 1), (0, 1) and (0, 0)?

f = f ,f = 2y +2x, 2x +1 r h x yi h i Now, let us find the gradient at the following points.

f(1, 1) = 4, 3 • r h i f(0, 1) = 2, 1 • r h i f(0, 0) = 0, 1 • r h i

So far, we’ve learned the definition of the gradient vector and we know that it tells us the direction of steepest ascent. What if, however, we want to know the of ascent in another direction? For that, we use something called a .

116 of 142 MultivariateCalculus;Fall2013 S.Jamshidi

Definition 5.4.2 The directional derivative, denoted Dvf(x, y), is a derivative of a multivari- able function in the direction of a vector ~v . It is the scalar projection of the gradient onto ~v . f(x, y) ~v D f(x, y)=comp f(x, y)=r · v vr ~v | | This produces a vector whose magnitude represents the rate a function ascends (how steep it is) at point (x, y) in the direction of ~v .

If our function has three inputs, the math works out the same. Suppose f(x, y, z)=w. Then,

f(x, y, z)= f (x, y, z),f (x, y, z),f (x, y, z) r h x y z i and the directional derivative in the direction of ~u is f(x, y, z) ~v D f(x, y, z)=r · v ~v | | Let’s look at some examples.

5.4.2 Examples

Example 5.4.2.1 Find the directional derivative of x f(x, y)= x2 + y2 in the direction of ~v = 3, 5 at the point (1, 2). h i First, we find the gradient. d x f (x, y)= x dx x2 + y2 ✓ ◆

(x2 + y2) x(2x) = (x2 + y2)2

y2 x2 = (x2 + y2)2

117 of 142 MultivariateCalculus;Fall2013 S.Jamshidi

d x f (x, y)= y dy x2 + y2 ✓ ◆

2xy = (x2 + y2)2

The gradient is then 4 1 4 3 4 1 f(1, 2) = , = , = 3, 4 r (4 + 1)2 (4 + 1)2 25 25 25 h i ⌧ ⌧ We now find the magnitude of ~v .Weget

~v = p9+25=p34 | | The directional derivative is then

f(1, 2) ~v 1 1 11 Dvf(1, 2) = r · = 3, 4 3, 5 = (9 20) = ~v 25p34 h i·h i 25p34 25p34 | |

Example 5.4.2.2 Find the directional derivative of

f(x, y, z)=pxyz in the direction of ~v = 1, 2, 2 at the point (3, 2, 6). h i First, we find the partial derivatives to define the gradient. yz fx(x, y, z)= 2pxyz xz fy(x, y, z)= 2pxyz xy fz(x, y, z)= 2pxyz

The gradient is 12 18 6 3 1 1 f(3, 2, 6) = , , = 1, , = 2, 3, 1 r 2(6) 2(6) 2(6) 2 2 2 h i ⌧ ⌧ 118 of 142 MultivariateCalculus;Fall2013 S.Jamshidi

The magnitude of ~v = 1, 2, 2 is h i ~v = p1+4+4=3 | | Therefore, the directional derivative is f(3, 2, 6) ~v 1 1 D f(3, 2, 6) = r · = 2, 3, 1 1, 2, 2 = ( 2 6+2)= 1 v ~v 3(2) h i·h i 6 | |

The next natural question is:

In what direction is the derivative maximum?

As we just saw, the directional derivative is calculated by taking the scalar projection of f onto a vector ~v .Define✓ be the angle between ~v and f.Then, r r f ~v f ~u cos(✓) r · = |r || | = f cos(✓) ~v ~v |r | | | | | This is maximized if ✓ =0.Fromthis,weknowthefollowing: The maximum rate of change (the largest directional derivative) is f . • |r | This occurs when ~v is parallel to f,i.e.whentheypointinthesamedirection. • r That makes sense since f is the vector pointing toward steepest ascent,soitshouldbethe direction with the largest derivative.r You’ll typically be asked for the , ~u ,thatcreatesthemaximumdirectionalderivative. This is because unit vectors are thought of as vectors that just contain information about direction. Based on our discussion above, this will always be f ~u = r f |r | Let’s look at two examples.

5.4.3 Examples

Example 5.4.3.1 1. Find the maximum rate of change of f at the given point and the direction in which it occurs. f(s, t)=test, (0, 2)

119 of 142 MultivariateCalculus;Fall2013 S.Jamshidi

The maximum rate of change is f(0, 2) . Let’s first find the gradient. |r | f = test,stest + est r Then ⌦ ↵ f(0, 2) = (2)2 +12 = p5 |r | The direction is the unit vector. p

f(0, 2) 2 1 r = , f(0, 2) p5 p5 |r | ⌧

Note: for this problem, it may not have been clear which component was the first and which was the second since s and t are atypical variables. For clues about the order, look out how the ordered pairs are defined in the function. It was written as “f(s, t),” which tells us our vectors are s, t . h i

Example 5.4.3.2 2. Find the maximum rate of change of f at the given point and the direction in which it occurs. f(x, y, z)= x2 + y2 + z2, (3, 6, 2) As above, the maximum rate of changep is f(3, 6, 2) . |r | x y z f(x, y, z)= , , r * x2 + y2 + z2 x2 + y2 + z2 x2 + y2 + z2 + Then p p p 3 6 2 f(3, 6, 2) = , , r 7 7 7 ⌧ The f(3, 6, 2) =1/7p9+36+4= 1 Since|r it’s already | a unit vector, the direction is

3 6 2 , , 7 7 7 ⌧

120 of 142 MultivariateCalculus;Fall2013 S.Jamshidi

Summary of Ideas: Directional Derivatives and the Gradient Vector

The gradient vector of a function f,denoted f or grad(f), is a vectors whose • entries are the partial derivatives of f. r

f(x, y)= f (x, y),f (x, y) r h x y i It is the generalization of a derivative in higher dimensions.

The gradient points in the direction of steepest ascent. •

The directional derivative,denotedDvf(x, y), is a derivative of a f(x, y)inthe • direction of a vector ~v . It is the scalar projection of the gradient onto ~v .

f(x, y) ~v D f(x, y)=comp f(x, y)=r · v vr ~v | | This produces a vector whose magnitude represents the rate a function ascends (how steep it is) at point (x, y)inthedirectionof~v .

Both the gradient and the directional derivative the same in higher variables. • The maximum directional derivative is always f . • |r | This happens in the direction of the unit vector • f ~u = r f |r | Remember, we use the unit vector as a convention. Any vector parallel to f will work. r

121 of 142