The Chain Rule, Higher Partial Derivatives & Opti- Unit #21 : mization Goals: We will study the chain rule for functions of several variables. We will compute and study the meaning of higher partial derivatives. We will begin a discussion of optimization.
Composing Functions of Several Variables - 1 Composing Functions of Several Variables There are many ways to compose multi-variable functions. Suppose we have a function f(x, y) with output z. That is, z = f(x, y). Suppose we let x be the output of a function g(t) and y the output of a function h(s). Then, by substituting these functions in for x and y, we get a new function f(g(t), h(s)) This is a function of two variables t and s. If, on the other hand, the second function were also a function of t, as in y = h(t), we would end up with a function of a single variable, f(g(t), h(t)) Draw a diagram showing the relationships between the variables in these two examples.
Composing Functions of Several Variables - 2 Example (Ideal Gas) The pressure P (in kilopascals), volume V (in liters), and temperature T (in K) of one mole of an ideal gas are related by the formula P V = nrt = (8.31)T if n = 1. Suppose the pressure is increasing at 0.05 kpa per second, and the temperature is increasing at 0.15 K per second. Identify the way in which functions are composed in this problem.
Composing Functions of Several Variables - 3 Now suppose we want to find the rate of change of volume at the moment when the pressure is 20 kpa and the temperature is 320 K. In other words, we are given dp dt, dt dv, P, and T, and are trying to find. (Think back to our much earlier dt dt work with related rates: this is the same idea coming back!)
The Chain Rule - 1 The Chain Rule The Chain Rule for the form of composition dealt with above should answer the following question: If z = f((g(t), h(t)), how does the derivative dz relate to the dt derivatives of f, g, and h? There is a separate chain rule for every form of composition. By obtaining the chain rule in a few standard cases, it will be straightforward to see how to get others.
The Chain Rule - 2 We start with our understanding of linear approximations: z f x (x, y) x + f y (x, y) y, x g (t) t, y h (t) t, x = g(t) and y = h(t). Combining these, we get z f x (g(t), h(t)) g (t) t + f y (g(t), h(t)) h (t) t Dividing by t and taking limits to get derivatives, we obtain:
The Chain Rule - 3 For short, dz dt = z x dx dt + z y dy dt
The Chain Rule - 4 V = nrt, with n = 1 mole. P Example: Now apply this Chain Rule to find the rate of change of volume V for the ideal gas question on the earlier page. dp dt = 0.05 kpa/s and dt P = 20 kpa = 0.15 K/s dt T = 320 K/s
The Chain Rule - Example - 1 Example: Consider a hillside defined by the function z = f(x, y) = xy 2, where z is in meters, and x and y are in kilometers. We are walking along a straight path, with x(t) = t and y(t) = 3t where t is measured in hours. Sketch out the path we are taking in the xy plane. 5 y 4 3 2 1 0 0 1 2 3 4 5 x
The Chain Rule - Example - 2 Give the units of dz dt, dx z, and dt x.
The Chain Rule - Example - 3 z = f(x, y) = xy 2, x(t) = t and y(t) = 3t How quickly are we moving up or downhill one hour into the hike (at t = 1)?
2 4 8 The Chain Rule - Example - 4 Indicate the interpretation of your result on the contour diagram for f(x, y) = xy 2. 5 20 18 4.5 14 16 12 4 10 3.5 6 3 2.5 2 1.5 1 0.5 2 4 6 10 8 12 2 20 18 16 14 4 6 12 10 8 18 16 14 2 20 4 10 8 6 18 16 14 12 2 4 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Higher-Order Partial Derivatives - 1 Higher Order Partial Derivatives If f(x, y) = xe y + y x then f x (x, y) = and f y (x, y) = These are the first order partial derivatives (only one derivative is taken). If we differentiate f x again, with respect to x, the result is denoted 2 f x2. It is a second order partial derivative (we have taken two derivatives of f).
Higher-Order Partial Derivatives - 2 Compute 2 f x 2. Compute the other second order partial derivatives, 2 f x y = ( ) f = x y 2 f y x = y ( ) f x = 2 f y 2 = y ( ) f y =
Higher-Order Partial Derivatives - 3 Find 2 f x y and 2 f y x for f(x, y) = sin(x2 y).
Higher-Order Partial Derivatives - 4 The pattern in these two examples are not a coincidence. It is a general theorem that for all reasonable functions f, 2 f x y = 2 f y x. The results for higher derivatives are the same: only the variables used in the derivative matter, not the order in which the derivatives are taken.
Interpretation of the Pure Second Derivatives - 1 Interpretation of the Pure Second Derivatives Example: Consider the function z = x 2 y 2. Find each of the first and second partial derivatives, evaluated at the point ( 2, 1).
Interpretation of the Pure Second Derivatives - 2 The point (-2, 1) is indicated on the graph. Indicate the interpretation of the first derivatives on the graph.
Interpretation of the Pure Second Derivatives - 3 Indicate now the interpretation of the second derivatives, 2 f x and 2 f 2 y2, on the graph.
The Mixed Second Derivatives, Estimating from Contour Diagrams - 1 Interpretation of the Mixed Second Derivatives 2 f The value of answers the question: for a small step in the x direction, what x y is the rate of change of the y-slope? (or vice-versa) Consider the function f(x, y) = xy. If you slice through the graph of f(x, y) = xy using the plane x = k, what does the intersection look like? Note that it passes through the point (k, 0, 0) on the x-axis.
The Mixed Second Derivatives, Estimating from Contour Diagrams - 2 What happens to the slope of this intersection when you change k? At what rate does the slope change? How would you describe, in words, the change in the shape of the surface as you move along the x-axis? i.e. What would the 2 f sign of x y be?
The Mixed Second Derivatives, Estimating from Contour Diagrams - 3 Example: Consider the contour diagram below. y x P 2 1 0 2 Determine the sign of each of the following first derivatives. f x (P ) Neg Pos f y (P ) Neg Pos
The Mixed Second Derivatives, Estimating from Contour Diagrams - 4 y x 2 Determine the sign of each of the following pure second derivatives. P 1 0 2 f xx (P ) Neg Pos f yy (P ) Neg Pos
The Mixed Second Derivatives, Estimating from Contour Diagrams - 5 y 2 x P 1 0 2 Determine the sign of the mixed second derivative. f xy (P ) Neg Pos
Taylor Polynomials of Degree Two for Functions of Several Variables - 1 Taylor Polynomials of Degree Two for Functions of Several Variables We have already discussed the linear approximation f(x, y) f(a, b) + f x (a, b)(x a) + f y (a, b)(y b), which is valid if (x, y) is near (a, b). This formula can be called: the local linearization of f near (a, b) the equation of the plane tangent to the surface f(x, y) at (a, b) the Taylor polynomial of degree 1 for f(x, y) centered at (a, b)
Taylor Polynomials of Degree Two for Functions of Several Variables - 2 If we wanted a better approximation, we could use a 2D parabolic shape to mimic the function, instead of a simple plane. Write your guess as to the natural form of a quadratic Taylor polynomial for a 2-variable function, around the point (x, y) = (a, b). Be careful with the constants. The reason for some coefficients having 2 s, and others not, comes from matching the second derivatives of the function and the Taylor polynomial. The derivation of this is tedious, but straightforward.
Taylor Polynomials of Degree Two for Functions of Several Variables - 3 Example: Construct the quadratic Taylor polynomial approximating cos(3x)y 2 for (x, y) near (0, 1).
Local and Global Extrema - 1 Local and Global Extrema The definitions for local maximum, global maximum, local minimum, and global minimum are very similar to those used for functions of a single variable. Local Extrema f has a local maximum/minimum at (a, b) if (a, b) is not on the boundary of the domain, and f(a, b) f(x, y) for all points (x, y) near (a, b). minimum) ( f(x, y) for a local
Local and Global Extrema - 2 Global Extrema f has a global maximum/minimum at (a, b) if f(a, b) f(x, y) for all points (x, y) in the domain of f. (f(a, b) f(x, y) for a local minimum) The definition of global extremum captures our goal in a search for global optima, but it is not necessarily easy to find! We need to do some work to find a strategy for identifying global extrema.
Local and Global Extrema - 3 Example: Draw a contour diagram for f = x 2 + y 2 on the domain 2 x 2, 2 y 2. Use heights of z = 0, 1, 2, 3, 4, etc. 2 y 1 2 1 1 2 x 1 2 As a review, draw the direction of the gradient vector at several points on the contour diagram.
Local and Global Extrema - 4 Based on the contour diagram, identify the global maxima and minima of f(x, y) = x 2 + y 2 on the domain D, where D is the square 2 x 2, 2 y 2. What can you say about the gradient at the global minimum?
Global Extrema on a Closed and Bounded Domain - 1 Global Extrema on a Closed Bounded Domain If f(x, y) is defined on a closed, bounded domain, the global extrema occur either on the boundary of the domain, or at a point where grad f = 0, 0 in the interior of the domain. (Note: closed means the domain includes its boundary, and bounded means that the domain does not stretch out to infinity in any direction. )
Global Extrema on a Closed and Bounded Domain - 2 Example: Where are the global maximum and global minimum of the function on the area shown below? 70 90 50 100 30 0 20 80 70 40 80 60
Global Extrema on a Closed and Bounded Domain - 3 Identify any local min and max points on the contour diagram below. 240 260 180 210 230 100 160 190 200 170 90 70 50 30 80 60 40 20 130 150 120 140 110 Where are the global maximum and global minimum of the function on the domain shown?
Global Extrema on a Closed and Bounded Domain - 4 Identify any local min and max points on the contour diagram below. 1.5 0.1 0.25 0.5 1 1.5 3 2.5 2 2.5 Where is are the global maximum and global minimum of the function on the area shown?
Global Extrema on Unbounded Domains - 1 Global Extrema on Unbounded Domains For problems where the domain of the function is not bounded, proving a local maximum is in fact a global maximum can be very difficult, and requires building arguments for each problem. We will only ask this in relatively simple problems. Example: Does the function f(x, y) = x 2 + y 2 have a global maximum? A global minimum? a) Yes b) No
Global Extrema on Unbounded Domains - 2 Example: Does the function f(x, y) = x 2 y 2 have a global maximum? A global minimum? a) Yes b) No