Unit 7 Partial Derivatives and Optimization We have learned some important applications of the ordinary derivative in finding maxima and minima. We now move on to a topic called partial derivatives which may be used to find local maxima and minima of surfaces ( functions of two variables). Definition 7.1. Given some function y = f(x) thenwehavetwowaysof interpreting the derivative dy dx (1) Intuitively, dy measures the rate of change of the variable y with respect dx to the variable x (2) Geometrically, dy can be interpreted as the equation for the slope of the dx tangent line to the curve y = f(x). Similarily, if we have z = f(x, y), a function of two variables we can define what is called a partial derivative: f x = z x and f y = z y :ThePartial derivative of z with respect to x. :ThePartial derivative of z with respect to y. Partial derivatives ( or simply partials ) can be interpreted geometrically as well as intuitively. More on that later, now let s learn how to calculate partials. To calculate f we simply treat y as if it were a constant and then take x the usual derivative of f(x,y) with respect to x. Similarily, to calculate f we y simply treat x as if it were a constant and then take the usual derivative of f(x,y) with respect to y. Recalling that x and y are just dummy variables, the generalization of this process is transparent. 1
Example 1. Given the function z =2xy 3 +3x 2 +2y 3, calculate each of its partials. Solution: To find z we treat y as if it were a constant and then differentiate x so: x (2xy3 +3x 2 +2y 3 )=2y 3 +6x +0=2y 3 +6x To find z we treat x as if it were a constant and then differentiate ( with y respect to y) so: y (2xy3 +3x 2 +2y 3 )=2x(3y 2 )+0+6y 2 =6xy 2 +6y 2 =6y 2 (x +1) Example 2. given the function f(x, y, z) =e xy + xyz, calculate each of its partials. Solution: To find f x differentiate so: x (exy + xyz) =e xy ( x (xy)) + yz = exy y + yz Similarily, in finding f y we treat y and z as if they were constant and then we treat x and z as if they were constant and then differentiate ( with respect to y) so: y (exy + xyz) =e xy ( y (xy)) + xz = exy x + xz And, in finding f we treat x and y as if they were constant and then differentiate ( with respect to z) so: z z (exy + xyz) =e xy ( z (xy)) + xy = exy (0) + xz = xz Along with these new definitions comes some new notation which parallels that used for functions of single variables: Functions of one variable, say f(x) Functions of 2variables, say f(x,y) f (x) or df dx f x or f x or f x (x, y) f (a) or ( df dx )] x=a ( f x )] x=a or f x (a, y) ( f x )] x=a,y=b or f x (a, b) 2
The following example is very important, it illustrates and adds to the previous points and should be read carefully. Example 3. Suppose f(x, y) =x 2 y + xe xy + x3 4, find (a) f y (b)f x (x, 0) (c)f x (0, 1) (d)f y (1, 1) Solution: (a) To calculate f y we simply hold x as constant and differentiate with respect to y: f y = y (x2 y + xe xy + x3 4 ) = 2xy + xe xy y (xy)+ y (x3 4 ) = 2xy + xe xy (x)+0 = 2xy + x 2 e xy So we have f y =2xy + x 2 e xy (b) To calculate f x (x, 0) we must hold y constant and since we are going to plug in y = 0 in the result (we are asked to find the partial at (x, 0))we might as well plug in y = 0 initially, as this will yield calculations simpler to make. This can be done in general, in fact we say formally that f x (x, a) = f(x, a) x Using this fact we have: f x (x, 0) = f(x, 0) x = x (x0 + x 2 e 0 + x3 4 ) = x (1 + x2 + x3 4 ) = 2x + 3 4 x2 3
So we have f x (x, 0) = 2x + 3 4 x2 (c) To calculate f x (0, 1) we use the same argument as in (b) to see that With this in mind we have f x (a, b) = x f(x, b)] x=a f x (0, 1) = x f(x, 1)] x=0 = x (x2 + xe x + x3 4 )] x=0 = (2x + e x + xe x + 3 4 x2 )] x=0 = 1 So we have f x (0, 1) = 1 (d)to calculate f y (1, 1) we use once again the argument in (b) to see that With this in mind we have f y (a, b) = y f(a, y)] y=b f y (1, 1) = y f(1,y)] y=1 = x (y + ey + 3 4 )] y=1 = (1+e y +0)] y=1 = 1+e So we have f y (1, 1) = 1 + e. This example leads us naturally to the next topic. 4
Interpreting Partials at a Specific Point Intuitive interpretation: We may interpret a partial derivative as a rate of change. For example suppose we have a function f(x, y) andf x (2, 3) = 10 and f y (2, 3) = 2. This can then be interpreted as saying that at the point (2,3), a unit increase in x will result in an approximate increase of 10 units in the function, f, whereas a unit increase in y at the same point will result in an approximate increase of only 2units for the function, f. Geometric Interpretation: As with the ordinary derivative, partial derivatives can be interpreted as slopes of tangent lines. The partial derivative of a function f(x, y) with respect to x at the point where (x, y) =(a, b) (i.e. at the point (a,b,f(a,b)) on the surface) for example, (see diagram) will be the slope of the tangent line to the curve obtained by holding y constant at b, at x = a. We are in effect intersecting the surface z = f(x,y) with the plane y = b which is a curve, and then finding the slope of the usual tangent line at the point where x = a. Figure 1: The Geometric Interpretation of Partials Both of the above interpretations have their use, the intuitive is the easiest to see in applications whereas the geometric interpretation often provides the reasoning behind results. 5
Example 4. Suppose p = f(l, K) =90L 2 3 K 1 3 is the production function for a certain manufacturing process where: P = the number of units produced L = the number of units of labour used K = the number of units of capital required Calculate P L (8, 27) and P K (8, 27) note: P L andp K are known as marginal productivity of labour and marginal productivity of capital respectively. Solution: As with the previous examples we have: P L (L, K) =60L 1 3 K 1 3 and P K (L, K) =30L 2 3 K 2 3 therefore P L (8, 27) = (60)8 1 3 27 1 3 = 90, andp K (8, 27) = (30)8 2 3 27 2 3 13.3 Interpretation: If labour and capital are currently at 8 and 27 respectively, then an increase in labour of one unit ( from 8 to 9 ) will result in an approximate increase in production of 90 units. An increase in capital however, from 27 to 28 units will result in an approximate increase in production of only 13.3 units. Higher Order Partial Derivatives Definition 7.2. As we did with the ordinary derivative, we now define higher order partials. There are no surprizes here as far as the mechanics of the processes are concerned. We define the: Second partial of f with respect to x as: 2 f = ( f ) or f x 2 x x xx =(f x ) x Second partial of f with respect to y as: 2 f = ( f ) or f y 2 y y yy =(f y ) y Mixed partials of f as: 2 f = ( f ) or f xy x y xy =(f x ) y and 2 f = ( f ) or f yx y x yx =(f y ) x The third, fourth, and n th partials are defined in the natural way. One surprizing fact is the following. Theorem 7.3. For any continuous function f(x, y), f xy = f yx So we may take mixed partials in any order we please as long as our function is continuous. As almost every function encountered in this course is continuous this is a very handy theorem. 6
Example 5. Suppose f(x, y) =x 2 y 3 + ye y, find (a) f xx (b) f yy (c) f yx (d) f xy Solution: (a) f xx = x (f x ) = x (2xy3 +0) = 2y 3 (b)f yy = y (f y ) = y (3x2 y 2 + e y + ye y ) = 6x 2 y + e y + e y + ye y ) = 6x 2 y + e y (2+ y) (c)f xy = y (f x ) = y (2xy3 ) = 6xy 3 (d)f yx = f xy since f is continuous = 6xy 3 by(c) Optimization Just as with the ordinary derivative, we may use partials to find extreme values of functions. Definition 7.4. Let D be the domain of a function f(x, y) and(a, b) D. Then we say that 7
(i) f(a, b) isthemaximum value of f(x, y) ond if f(a, b) f(x, y) for every (x, y) D (ii)f(a, b) istheminimum value of f(x, y) ond if f(a, b) f(x, y) for every (x, y) D If the inequalities above hold in some neighbourhood of (a, b) then the above definitions become those for local maximum and local minimum values. Example 6. Figure 2shows part of the surface f(x, y) =x 2 + y 2 which is easily seen to have both a local minimum and a minimum value ( of 0 ) at the point (0, 0). Figure 2: f(x, y) =x 2 + y 2 8
Example 7. The following figure shows a surface which demonstrates the previous definitions. Figure 3: Maximal and Minimal Points of a Surface Definition 7.5. By an extreme value of a function, we mean a point where either a (local) maximum or a (local) minimum occurs. Definition 7.6. By a critical point of a function f, we will mean (1) A point where all partials are zero, or (2) A boundary point of the domain, or (3) A point where the graph has some type of pathalogical behaviour. For example a point where the graph is ripped or has a corner, or fluctuates wildly. 9
Our main concern is with condition (1) and we will not talk about condition (3) at all. We need to define critical point in this way so that we may state the following theorem. Theorem 7.7. An extreme value may only occur at a critical point. Finding Extreme Values Unlike the situation with the regular derivative, it is not enough to require that all first derivatives be zero to guarantee an extreme value. For example the saddle surface ( named for the obvious reason) shown in figure 4 will have f x =0andf y = 0 at the point P, but by observation we see that P is neither a maximum nor a minimum point of the surface. Figure 4: Saddle Surface Since there are creatures such as this lurking about in 3-space we turn to a new test to find extreme values, namely the second partials test. 10
Theorem 7.8. The Second Partials Test Suppose f(x, y) has continuous second partials in a neighbourhood of (a, b) and that f x (a, b) =0=f y (a, b) (so (a, b) is a critical point of f).define: then: T (a, b) =f xx (a, b)f yy (a, b) [f xy (a, b)] 2 (1) If T (a, b) > 0 and f xx (a, b) < 0 then f(a, b) is a local maximum value. (2) If T (a, b) > 0 and f xx (a, b) > 0 then f(a, b) is a local minimum value. (3) If T (a, b) < 0 then f(a, b) is a saddle point of f. (like P in fig3) (4) If T (a, b) =0then this test yields no information. Example 8. Find the local extrema of f(x, y) =x 2 +3y 2 +4x 9y +10 Solution: We shall use the second partials test so we should first find our partials: f x =2x +4,f y =9y 2 9, f xx =2, f yy =18y, f xy =0 We now set both first partials to zero to solve for our critical points: f x =0 x = 2 f y =0 y = ±1 Therefore our critical points are ( 2, 1)and( 2, 1) We now test the critical points using the second partials test: ( 2, 1) : T (a, b) =f xx (a, b)f yy (a, b) [f xy (a, b)] 2 so T ( 2, 1) = f xx ( 2, 1)f yy ( 2, 1) [f xy ( 2, 1)] 2 =36 11
Therefore, by the second partials test, f( 2, 1) = 0 is a local minimum. ( 2, 1) : T (a, b) =f xx (a, b)f yy (a, b) [f xy (a, b)] 2 so T ( 2, 1) = f xx ( 2, 1)f yy ( 2, 1) [f xy ( 2, 1)] 2 = 36 < 0 Therefore, by the second partials test, f( 2, 1) = 18 is a saddle point. Example 9. Determine the dimensions of an open rectangular box (with dimensions shown) with volume 32m 2, and the least (outer) surface area. Figure 5: Solution: We wish to minimize the area given by: A = xy +2xz +2yz subject to volume = xyz =32,whichistosayz = 32. Substituting into the xy area function we see that we wish to minimize: A = xy + 64 y + 64 xy 12
Find Critical points: A x = 0 y 64 x 2 = 0 y = 64 x 2 A y = 0 x 64 y 2 = 0 x = 64 y 2 (a) (b) Substituting (b) into (a) we get: y = 1 64 y4 y 4 64y = 0 y(y 3 64) = 0 y =4or y = 0 Substituting y=4 into (b) we get x=4, so a critical point is (4,4). The value y=0 is of no interest as it gives a flat box. So all we must do is check with the second partials test that the point (4,4) is indeed a minimum for the area function: A xx (4, 4) = 128 4 3 =2> 0 So, A yy (4, 4) = 128 4 3 =2 A xy (4, 4) = 0 T (4, 4) = (2)(2) 0=4> 0 Therefore, by the second partials test (4,4) is indeed a local minimum for A, and so x =4,y = 4 are the dimensions requested. 13