Vector Multiplication - 1 Unit # : Goals: Directional Derivatives and the Gradient To learn about dot and scalar products of vectors. To introduce the directional derivative and the gradient vector. To learn how to compute the gradient vector and how it relates to the directional derivative. To explore how the gradient vector relates to contours. Reading: Sections 13.3, 1., and 1.5 Vector Multiplication Unlike for addition and subtraction, vector quantities differ from scalars in that vector multiplication can be defined in several ways. There are two such operations that we will need to use: scalar multiplication dot product Scalar multiplication: λ v combines a scalar, e.g. λ, with a vector, e.g. v to produce a new vector, λ v. the magnitude of the new vector is λ times the original vector length e.g. v = v + v twice as long as the original. If λ >, λ v is a vector in the same direction as v If λ <, λ v is a vector in the opposite direction as v Vector Multiplication - Vector Multiplication - 3 Example: v, Choose a vector v and then draw Example: form: v, For the vector v = 5,, express the following in component v, and v, and ( 1.5) v. ( 1.5) v.
Vector Multiplication - Linearity of Vector Operations Addition, subtraction, and scalar multiplication all obey consistent rules of operation familiar from your experience with scalar operations. These properties are summarized on page 617 of Hughes-Hallett. For convenience we repeat them here. Commutativity v + w = w + v Distributivity Associativity u + ( v + w) = ( u + v) + w Identity (λ + µ) v = λ v + µ v 1 v = v, v = λ( v + w) = λ v + λ w v + = v Note that for any vector v, ( 1) v is a vector with the same magnitude/length as v and opposite direction. Because of this property we write ( 1) v = v. Dot Product of Vectors: v w Dot Product - Angle Definition - 1 Remember that the scalar product multiplies a scalar times a vector. Another possible multiplication between two vectors is called the dot product. The dot product combines two vectors, e.g. v, w to produce a scalar, v w If θ [, π] is the angle between two vectors v and w, then Question: (a) -1 (b) (c) 1 (d) v w = v w cos(θ) Use this definition to find i i. Dot Product - Angle Definition - Dot Product - Angle Definition - 3 Question: (a) -1 (b) (c) 1 (d) Use this definition to find i j. Suppose that v and w are perpendicular to one another. What can you say about v w? What can you conclude if v w =?
Dot Product - Component Definition - 1 The previous definition of dot product involved the angle between the two vectors. It is also helpful to compute the dot product purely in terms of the components of the vectors. Component Definition of Dot Product If v = λ 1 i + λ j + λ 3 k (or = λ 1, λ, λ 3 ) and w = µ 1 i + µ j + µ 3 k, (or = µ 1, µ, µ 3 ) Dot Product - Component Definition - The fact that the two definitions always give the same result is proven in Section 13.3 of Hughes-Hallett. We will study an example demonstrating this general property. Example: Use both definitions of the dot product to calculate in two different ways. 1, 1, 3 then v w = λ 1 µ 1 + λ µ + λ 3 µ 3. It is not at all obvious that this is the same as the other definition! Dot Product - Component Definition - 3 Example: Find a vector u = a, b of magnitude/length 1 which is perpendicular to the vector 3 i + 7 j. u = a, b of magnitude/length 1, perpendicular to 3 i + 7 j. Dot Product - Component Definition -
Dot Product - Component Definition - 5 Using the Dot Product - 1 Are there other possibilities than the perpendicular vector you found? Product Confusion Is ( v 1 v ) v 3 = v 1 ( v v 3 )? Using the Dot Product - Example: Which pairs (if any) of vectors from the following list (a) Are perpendicular? (b) Have an angle less than π/ between them? (c) Have an angle of more than π/ between them? a = 1,, b = 1, 3, c =, 1, 1 Directional Derivative - Concept Directional Derivative - Concept - 1 Now we can return to the study of rates of change of a function f(x, y) whose domain is all or part of IR (in other words, functions of two real variables, x and y). In our new terms, The partial derivative f x is the rate of change of f in the direction of the unit vector i (towards larger x values) The partial derivative f y is the rate of change of f in the direction of the unit vector j (towards larger y values)
On the surface below, find a point that has f x < and f y >. Directional Derivative - Concept - Directional Derivative - Concept - 3 Suppose we now want to find the rate of change in an arbitrary direction. Any direction can be specified by a vector u of length 1. Vectors of length 1 are called unit vectors. Given a unit vector u, we want to find the rate of change of f(x, y) if we move away from (x, y) in the direction of u. From the same point on the graph, indicate a direction where the slope would be steeper than f y. Indicate another direction where the slope would be close to zero. 6 Directional Derivative - Contour Diagrams - 1 Example: Consider the contour diagram for a linear function f(x, y) shown below. P 8 8 8 6 6 6 1 1 1 Directional Derivative - Contour Diagrams - Example - The following is a contour diagram for a more complex function f(x, y). A = (a, b) is a point in the domain of f. On the diagram, mark three directions u, v and w at the point P, chosen so that D u f(a, b) > D v f(a, b) < D w f(a, b) =. On the diagram, mark three directions u, v and w (at A), chosen so that D u f(a, b) > D v f(a, b) < D w f(a, b) =.
Directional Derivative - Contour Diagrams - 3 We now define the slope of f(x, y) in an arbitrary direction, with the direction specified by a unit vector u. Directional Derivative Let u = (u 1 i + u j) = u 1, u with u 1 + u = 1, so that u = 1. Then, at the point (a, b) in the domain of f, the rate of change of f in the direction of u is f(a + hu 1, b + hu ) f(a, b) lim. h h This is called the directional derivative of f at the point (a, b) in the direction of u and it is denoted by D u f(a, b) or f u (a, b) Note: This formula only applies if u is a unit vector. Directional Derivative - Definition - 1 Computing D u f(a, b) How can we go about computing values for D u f(a, b) in a systematic way? Keep in mind the ingredients of our calculation: f(x, y) is a function of two variables, (a, b) is a point in the domain of f, u = u 1, u with u 1 + u = 1 is a unit vector. Unfortunately, this derivative definition is cumbersome as it involves limits. We would prefer to compute these directional derivatives using our simpler derivative rules if we could. Then Directional Derivative - Definition - f(a + hu 1, b + hu ) f(a, b) D u f(a, b) = lim h h f(x, y) f(a, b) = lim (where x = a + hu 1 and y = b + hu ) h h Directional Derivative - Definition - 3 Use that alternate expression to express the directional derivative in terms of partial derivatives. Use local linearity to find an alternate expression for f(x, y) f(a, b).
Computing the Directional Derivative If u = u 1, u is a unit vector ( u = 1), then D u f(a, b) = f x (a, b)u 1 + f y (a, b)u Directional Derivative - Calculation - 1 NOTE: we don t define directional derivatives for non-unit vectors. To find the slope in the direction of a non-unit length vector, v, you must normalize it before computing the directional derivative. If v = v 1, v is not a unit vector, first find u = 1 v v = 1 v 1 + v v, then compute D u f(a, b) Directional Derivative - Calculation - Example: Let f(x, y) = x xy and let u = 3 5, 5. We are going to show the steps required to calculate D u f(, ). First: is u a unit vector? This formula allows us to compute the slope in any direction simply by knowing the partial derivatives. Directional Derivative - Calculation - 3 Directional Derivative - Calculation - f(x, y) = x xy and u = 3 5, 5. f x (x, y) = Now compute the slope in the direction opposite of u. What do you notice about the slope? f y (x, y) = f x (, ) = f y (, ) = u 1 = u = D u f(, ) =
Directional Derivative - Example - 1 Example: Find the slope of the surface f(x, y) = x y at (x, y) = (, 3) if we were to move directly towards the origin. f(x, y) = x y, at (, 3), moving directly towards the origin. Directional Derivative - Example - The Gradient Vector The Gradient Vector - 1 Note that the formula for directional derivatives could be written as a dot product if we so desired: Gradient Vector Definition gradf = f = f x (x, y) i + f y (x, y) j = f x (x, y), f y (x, y) The Gradient Vector - D u f(a, b) = f x (a, b)u 1 + f y (a, b)u = f x (a, b), f y (a, b) u }{{} 1 u }{{} new vector u This is the first appearance of an important vector function called the gradient of f. While f assigns a number to each point in its domain, the gradient of f assigns a vector to each point in the domain of f, provided both partial derivatives of f exist at that point. The gradient is denoted by either grad f or f. Alternate Directional Derivative Definition D u f(x, y) = (gradf) u
The Gradient Vector - 3 Gradient Vector - Importance - 1 Example - Let f(x, y) = xe y Example: Use the gradient-based definition of the directional derivative to determine the direction in which a surface has the largest positive slope. grad f(x, y) = grad f(1, ) = grad f(, 1) = grad f(, 3) = For each point in the domain of f where the partial derivatives are both defined, the gradient vector is also defined. Gradient Vector - Importance - Relationship between the surface and the gradient at a point (a, b) The direction of grad f(a, b) is the direction of maximum increase of the function f at the point (a, b). or The gradient at (a, b) points in the direction of the steepest uphill slope. Gradient Vector - Importance - 3 Example: Consider the plane z = x + y + 3. At the point (x, y) = (1, 1), in which (x, y) direction should we move to move uphill the most quickly?
Gradient Vector - Importance - Support your answer, using the contour diagram for z = x + y + 3 shown below. 1 1 1 8 8 8 8 1 1 1 Gradient Vector - Properties - 1 Properties of the Gradient Vector Use the properties of the directional derivative and the dot product to justify the following conclusions : grad f(a, b) is perpendicular to the contour of f that passes through the point (a, b) 6 6 6 6 grad f(a, b) gives the direction of maximum decrease of the function f at the point (a, b). Gradient Vector - Properties - grad f(a, b) (i.e. the length or magnitude of the gradient vector) is the maximum rate of change of f at (a, b). Gradient Vector - Properties - 3 Reminding ourselves of these properties of the gradient vector, consider the contour diagram for a function f(x, y) For each of the points. A, B, and C, draw a vector that points in the direction of the gradient vector at that point. At which of the points is the gradient vector longest? At which of the points is the gradient vector shortest? Justify your answers.
Gradient and Contours - Example - 1 Putting Gradients and Contours Together We said earlier that the gradient is perpendicular to the contour at the same point. However, that isn t very precise, given that the contours are curves themselves. It is better to say that contours, as curves, have tangent lines, and gradient is perpendicular to those tangent lines. Consider the -variable function f(x, y) = xy. Write an equation for the contour (level curve), C, of f that passes through the point (, 1). Find grad f(, 1). Gradient and Contours - Example - Find an equation for the tangent line at (, 1) to the contour (level curve) C, through (, 1). On the axes below, sketch the level curve C indicate the vector grad f(, 1), and draw the tangent line to the contour at (, 1). Gradient and Contours - Example - 3 Gradient and Contours - Example - For reference, here is a more detailed contour diagram of the function f(x, y) = xy, used in the previous question. 5.5 3.5 6 8 1 1 1 18 16 3 1 18 16 y 5 3.5 1.5 1.5 6 1 8 1.5 1 1.5.5 3 3.5.5 5 6 1 1 8 18 16 1 1 8 6 18 16 1 1 1 1 3 5 x
Gradient and Contours - Example - 5 Note The idea of directional derivative and gradient are new, and are easily confused at first. The following reminders can be useful to help you check that you are on the right track. D u f(a, b) is a number. It is a rate of change associated with a specific direction, chosen regardless of the surface. grad f(a, b) is a vector. Its direction is the direction of maximum increase of f at (a, b). Its length is a number which represent the rate of change in the gradient s direction.