Gradient, Chain Rule for Paths The Gradient If f (x, y) is a function of two variables, the gradient of f is a vector given by ∂f ∂f (∇f )(x, y) = , . ∂x ∂y The gradient is our first example of what’s called a vector field : a function that associates to each point (x, y) a vector (∇f )(x, y). Example. Suppose that f (x, y) = x2 + y 2 . Then (∇f )(x, y) = h2x, 2yi Remember our “universal derivative” D: ∂f ∂f D(x) + D(y) D(f ) = ∂x ∂y we could also write this formula as D(f ) = ∇f · hD(x), D(y)i . For example, if D(x) = 1, D(y) = 0, we get ∂f = ∇f · h1, 0i ∂x and if D(x) = 0, D(y) = 1, we get ∂f = ∇f · h0, 1i . ∂y More generally, if v is a unit vector, the directional derivative of f in the direction v is Dv f = ∇f · v (dot product). From this fact, we can see that the greatest change of f occurs in the direction of ∇f . Chain Rule for Paths One of the most interesting applications of the gradient occurs when we compute the rate of change of a function f (x, y) along a path c(t) = hx(t), y(t)i. Remember that ∂f ∂f D(f ) = D(x) + D(y) ∂x ∂y while along the path dx dx D(x) = dt, D(y) = dt dt dt Hence, along the path, D(f ) = ∂f dx ∂f dy D(t) + D(t) ∂x dt ∂y dt 1 2 d f (c(t)) by setting D(t) = 1: dt ∂f dx ∂f dy d f (c(t)) = + dt ∂x dt ∂y dt Another way of writing the same equation is d f (c(t)) = (∇f ) (c(t)) · c0 (t). dt We get