2 6 gradients and directional derivatives
play

2.6 Gradients and Directional Derivatives Prof. Tesler Math 20C - PowerPoint PPT Presentation

2.6 Gradients and Directional Derivatives Prof. Tesler Math 20C Fall 2018 Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 1 / 35 Hiking trail and chain rule Altitude z=f(x,y) x,y,z in feet, t in hours 40000 30000 5 4


  1. 2.6 Gradients and Directional Derivatives Prof. Tesler Math 20C Fall 2018 Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 1 / 35

  2. Hiking trail and chain rule Altitude z=f(x,y) x,y,z in feet, t in hours 40000 30000 5 ● 4 ● 20000 3 ● y ● ● 2 1 10000 t=0 ● 0 0 10000 20000 30000 40000 x A mountain has altitude z = f ( x , y ) above point ( x , y ) . Plot a hiking trail ( x ( t ) , y ( t )) on the contour map. This gives altitude z ( t ) = f ( x ( t ) , y ( t )) , and 3D trail ( x ( t ) , y ( t ) , z ( t )) . We studied using the chain rule to compute the hiker’s vertical speed, dz / dt . Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 2 / 35

  3. How steep are different cross-sections of a mountain? Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 3 / 35

  4. Partial derivatives Altitude z=f(x,y) x,y,z in feet, t in hours 40000 30000 20000 ● y 10000 0 0 10000 20000 30000 40000 x Slope at point P = ( x , y ) = ( a , b ) when traveling east → Hold y constant ( y = b ) and vary x , giving z = f ( x , b ) . Get a 2D curve in the vertical plane y = b . Slope at P is ∂ z ∂ x = f x ( a , b ) . Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 4 / 35

  5. Partial derivatives Altitude z=f(x,y) x,y,z in feet, t in hours 40000 30000 20000 ● y 10000 0 0 10000 20000 30000 40000 x Slope at point P = ( x , y ) = ( a , b ) when traveling north ↑ Hold x constant ( x = a ) and vary y , giving z = f ( a , y ) . Get a 2D curve in the vertical plane x = a . Slope at P is ∂ z ∂ y = f y ( a , b ) . Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 5 / 35

  6. Directional derivatives Altitude z=f(x,y) x,y,z in feet, t in hours 40000 30000 20000 ● y 10000 0 0 10000 20000 30000 40000 x Slope at P = ( x , y ) = ( a , b ) when traveling on diagonal line ր On the 2D contour map, draw a diagonal line through P . On the 3D plot, this is a 2D curve on a vertical cross-section. What’s the slope when traveling through P along this curve? Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 6 / 35

  7. Directional derivatives Altitude z=f(x,y) x,y,z in feet, t in hours 40000 30000 20000 ● y 10000 0 0 10000 20000 30000 40000 x Let � u = � u 1 , u 2 � be a unit vector in the xy plane. On the map, travel on the line through ( a , b ) with direction � u : r ( t ) = � x ( t ) , y ( t ) � = � a , b � + t � u . � Each ( x , y ) point gives a z coordinate via z = f ( x , y ) . Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 7 / 35

  8. Directional derivatives Traveling on line � r ( t ) = � x ( t ) , y ( t ) � = � a , b � + t � u : Time ( x , y ) z ( a , b ) f ( a , b ) t = 0 t = ∆ t ( a + u 1 ∆ t , b + u 2 ∆ t ) f ( a + u 1 ∆ t , b + u 2 ∆ t ) Between times 0 and ∆ t , the change in altitude is ∆ z = f ( a + u 1 ∆ t , b + u 2 ∆ t ) − f ( a , b ) ≈ f x ( a , b ) u 1 ∆ t + f y ( a , b ) u 2 ∆ t = ∇ f ( a , b ) · � u ∆ t The horizontal change (in the xy plane) is � � u ∆ t � = � � u � ∆ t = 1 ∆ t = ∆ t The slope on the mountain at ( x , y ) = ( a , b ) in that cross-section is Vertical change Horizontal change = ∆ z ∆ t ≈ ∇ f ( a , b ) · � u As ∆ t → 0 , this gives the instantaneous rate of change: ∇ f ( a , b ) · � u Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 8 / 35

  9. Directional derivatives — Second method Let � u = � u 1 , u 2 � be a unit vector, and travel on line � r ( t ) = � a , b � + t � u . Time t = 0 corresponds to point P = ( a , b ) . Use the chain rule to find the instantaneous slope at time t = 0 : � � d = d � � dt f ( � r ( t )) dt f ( � a , b � + t � u ) � � � � t = 0 t = 0 �� � r ′ ( t )) = ∇ f · � � t = 0 r ′ ( 0 ) = ∇ f ( a , b ) · � = ∇ f ( a , b ) · � u Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 9 / 35

  10. Directional derivatives The directional derivative of f ( � x ) in the direction � u (a unit vector) is � x ) = d � u f ( � dt f ( � x + t � u ) (useful theoretically) D � � � t = 0 = ∇ f ( � x ) · � (easier for computations) u Notation warning Df for the derivative matrix and D � u f for directional derivative are completely different, even though the notations look similar. Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 10 / 35

  11. Directional derivatives The directional derivative of f ( � x ) in the direction � u (a unit vector) is u f ( � x ) = ∇ f ( � x ) · � D � u Examples � � ı f ( a , b ) = ∇ f ( a , b ) · ˆ · ˆ ı = f x ( a , b ) , f y ( a , b ) ı = f x ( a , b ) D ˆ � �  f ( a , b ) = ∇ f ( a , b ) · ˆ  = f x ( a , b ) , f y ( a , b ) · ˆ  = f y ( a , b ) D ˆ Be careful: � u must be a unit vector � � ı f ( a , b ) = ∇ f ( a , b ) · 2 ˆ ı = f x ( a , b ) , f y ( a , b ) · 2 ˆ ı = 2 f x ( a , b ) D 2 ˆ ˆ ı and 2 ˆ ı have the same direction, but this is not the slope; it’s off by a factor of 2 . Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 11 / 35

  12. Example Find the directional derivative of f ( x , y , z ) = x 2 − 3 xy + z 3 at the point P = ( 1 , 2 , 3 ) in the direction towards Q = ( 6 , 5 , 4 ) . We’ll apply the formula D � u f = � u · ∇ f . Gradient The gradient (as a function): 2 x − 3 y , − 3 x , 3 z 2 � � ∇ f = The gradient at point P : 2 ( 1 ) − 3 ( 2 ) , − 3 ( 1 ) , 3 ( 3 2 ) � � ∇ f ( 1 , 2 , 3 ) = = � − 4 , − 3 , 27 � Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 12 / 35

  13. Example Find the directional derivative of f ( x , y , z ) = x 2 − 3 xy + z 3 at the point P = ( 1 , 2 , 3 ) in the direction towards Q = ( 6 , 5 , 4 ) . Direction vector The vector from P to Q is v = − → PQ = � 5 , 3 , 1 � � However, this is not a unit vector. It has length √ √ � 5 2 + 3 2 + 1 2 = � � v � = 25 + 9 + 1 = 35 Unit vector: v � = � 5 , 3 , 1 � u = � v √ � � � 35 Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 13 / 35

  14. Example Find the directional derivative of f ( x , y , z ) = x 2 − 3 xy + z 3 at the point P = ( 1 , 2 , 3 ) in the direction towards Q = ( 6 , 5 , 4 ) . So far: v � = � 5 , 3 , 1 � u = � v √ ∇ f ( 1 , 2 , 3 ) = � − 4 , − 3 , 27 � � � � 35 The directional derivative at this point: u f ( 1 , 2 , 3 ) = � u · ∇ f ( 1 , 2 , 3 ) D � = � 5 , 3 , 1 � · � − 4 , − 3 , 27 � = 5 (− 4 ) + 3 (− 3 ) + 1 ( 27 ) √ √ 35 35 2 = − √ 35 Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 14 / 35

  15. Possible values of D � u f f ∆ θ u For a function z = f ( x , y ) and a point P = ( a , b ) , what are the possible values of D � u f ( a , b ) as � u varies over all directions? u · ∇ f = � � u � �∇ f � cos ( θ ) u f = � D � u is a unit vector, so � � u � = 1 and D � u f = �∇ f � cos ( θ ) . � u varies, cos ( θ ) varies between ± 1 . As � u f varies between ± �∇ f � . So D � Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 15 / 35

  16. Special directions 200 100 P 0 Contour map for part of a mountain with altitude z = f ( x , y ) At point P , which direction � u is best for each scenario? The Power Hiker wants the steepest uphill path. The Power Skier wants the steepest downhill path. The Lazy Hiker wants to avoid any elevation change. Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 16 / 35

  17. The Lazy Hiker 200 100 P 0 To avoid elevation change, the lazy hiker walks along a level curve. At point P , the direction � u is tangent to the level curve, giving the two options shown above. No elevation change along this path, so u f = 0 so � u · ∇ f = 0 so � u ⊥ ∇ f D � So at any point P = ( a , b ) , the gradient ∇ f ( a , b ) is perpendicular to the level curve. Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 17 / 35

  18. Direction of gradient vector 200 100 P 0 ∇ f ( a , b ) is perpendicular to the contour through P = ( a , b ) . But which of these choices is it? Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 18 / 35

  19. Power Hiker 200 f ∆ 100 u P 0 u f = � u · ∇ f = � � u � �∇ f � cos ( θ ) = �∇ f � cos ( θ ) D � As � u varies, the maximum value of D � u f is + �∇ f � . The maximum is when cos ( θ ) = 1 , so θ = 0 ◦ = 0 radians. Thus, � u is a unit vector in the same direction as ∇ f , perpendicular to the level curve: u = ∇ f / �∇ f � � This is the direction of steepest ascent , or fastest increase . Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 19 / 35

  20. Power Skier 200 f ∆ 100 u P 0 u f = � u · ∇ f = � � u � �∇ f � cos ( θ ) = �∇ f � cos ( θ ) D � u f is − �∇ f � . As � u varies, the minimum value of D � The minimum is when cos ( θ ) = − 1 , so θ = 180 ◦ = π radians. Thus, � u is a unit vector in the opposite direction of ∇ f , still perpendicular to the level curve: u = − ∇ f / �∇ f � � This is the direction of steepest decent , or fastest decrease . Prof. Tesler 2.6 Directional Derivatives Math 20C / Fall 2018 20 / 35

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend