I.g Maximum and Minimum. Lagrange Multipliers Recall: Suppose we are given y = f(x). We recall that the maximum/minimum points occur at the following points: (1) where f = 0; (2) where f does not exist; (3) on the frontier (if any) of the domain of f. Not all points x 0 which satisfy one of the above three conditions are maximum or minimum. To distinguish among points of type (1), we have the second derivative test: f (x 0 ) = 0 and f (x 0 ) < 0, then x 0 is a maximum; f (x 0 ) = 0 and f (x 0 ) > 0 imply x 0 is a minimum; f (x 0 ) = 0 means the test fails. Example 1. Let f(x) = x 2. Then f has a single minimum at x = 0, where f (x) = 0. Note f (x) = 2 > 0. Example 2. Let f(x) = x. Then f has a single minimum at x = 0. Here f does not exist. y y = f (x) x Example 3. Let f(x) = x, but the domain of f is the interval 0 x 1. Note f (x) = 1, and yet f has a maximum at x = 1 and at minimum at x = 0. These 61
are points on the frontier of the domain. y 0 y = f (x) 1 x We now pass to consider the case w = f(x, y, z). situations corresponding to the earlier cases (1) and (3). We shall only consider Case (2) will not be considered in this course. Suppose w has a maximum (or a minimum) at a point P 0 = (x 0, y 0, z 0 ) properly inside the domain of w. Then, fixing y = y 0 and z = z 0 gives a function of the single variable x, namely f(x, y 0, z 0 ). This will have a maximum (or a minimum) when x = x 0 and so x (x 0, y 0, z 0 ) = 0. In the same way, y (x 0, y 0, z 0 ) = 0, (x 0, y 0, z 0 ) = 0. w = f ( x 0, y 0, z 0 ) ( x 0, y 0, z 0 ) So, maximum (or minimum) inside the domain of f occur at the points where / x = / y = / = 0 (or f = 0). We term all points, where f = 0, critical points and note that as in the one dimensional case, not all such points need be maximum or minimum. 62
To find which points (x, y, z) amongst those satisfying f(x, y, z) = 0 are maximum, which are minimum and which are neither, we have a second derivative test, analogous to the one for the one dimensional case. We give this test only for the case w = f(x, y), and remark that it depends on the second partial derivative matrix being definite. For the purposes of this course it suffices to know: Suppose (x 0, y 0 ) satisfies f(x 0, y 0 ) = 0. Then calculate f xx f yy fxy 2 at (x 0, y 0 ). If a) f xx f yy fxy 2 > 0 and f xx < 0, then (x 0, y 0 ) is a maximum; b) f xx f yy fxy 2 > 0 and f xx > 0, then (x 0, y 0 ) is a minimum; c) f xx f yy fxy 2 < 0, then (x 0, y 0 ) is a saddle point (see below); d) f xx f yy fxy 2 = 0, test fails: (x 0, y 0 ) could be anything. Remark. A saddle point P is, as its name indicates, related to what a cowboy sits on. It is neither a maximum nor a minimum, even though f(p ) = 0. P Remark. Suppose we have w = f(x, y, z), and we only wish to find either the absolute maximum or the absolute minimum. One very simple way, often quite useful in practice is to calculate all points where f = 0, and then use physical intuition and/or evaluation of f at all these points. Choose the point(s) where f is largest or smallest, as needed. In such a situation, you need not calculate second derivatives of f. However, note that if f = 0 at just one point and physical 63
intuition fails, it will be impossible to tell in this way whether it is a maximum, minimum or nothing. Example 1. Find all critical points of w = x 2 2x + y 2 and classify them as maximum, minimum or saddle points. Answer. (1) w x critical point. = 2x 2, w y = 2y, so w = 0 iff x = 1, y = 0. This is the only (2) We now use the second derivative test: 2 w x 2 = 2, 2 w y = 2, 2 w 2 x y = 0 and so 2 w x 2 2 w y 2 2 w x y > 0, and since 2 w/ x 2 > 0 we conclude that x = 1, y = 0 is a minimum. Example 2. Same as Example 1, except now w = x 4 xy + y 4. Answer. Now: w x = 4x3 y, w y = 4y3 x and so we need 4x 3 y = 0 4y 3 x = 0 64
and so (4x 3 ) 3 = y 3 = x 4, i.e., 4 4 x 9 = x and either x = 0, or 4 4 x 8 = 1, whence x = ±1/2. We thus have three critical points: (0, 0), (1/2, 1/2), ( 1/2, 1/2). To see what they are, use the second derivative test: 2 w x 2 = 12x2, 2 w y 2 = 12y2, 2 w x y = 1. Hence at (0, 0) and (0, 0) is a saddle point. At (1/2, 1/2): 2 ( w x 2 w 2 ) 2 2 y w = 12 2 x y so (1/2, 1/2) is a minimum. At ( 1/2, 1/2): 2 ( w x 2 w 2 ) 2 2 y w = 1 < 0 2 x y ( ) 1 12 4 ( ) 1 ( 1) 2 > 0 4 and 2 w x 2 > 0 2 ( w x 2 w 2 ) 2 2 y w > 0 and 2 x y 2 w x 2 > 0, so ( 1/2, 1/2) is also a minimum. In the above examples, the domain of f had no frontier, so max./min. (if any) had to occur inside the domain. We now consider the case where the domain has a frontier where maximum/minimum could also occur. To find these new possible 65
points, we note that in practice the boundary of a domain is given by a surface which constrains the domain, i.e., on the boundary of the domain the variables satisfy some relationship of the form g(x, y, z) = 0 (see below). We are thus led to the problem: Given: w = f(x, y, z) and a constraint g(x, y, z) = 0 find all max./min. We solve this problem by the method of Lagrange Multipliers. Suppose we could solve g(x, y, z) = 0 for z = z(x, y), say, and substituted this expression for z into w = f(x, y, z). We now have w = f(x, y, z) just as a function of (x, y), and we can proceed as before to find points where the gradient is zero! Note that since z is a function of (x, y) from g, we seek those (x, y) such that x + y + x = 0 (1) y How do we find / x, / y? We use g(x, y, z) = 0! So g x + g x = 0, g y + g y = 0 and, substituting into (1), (2) we get x = ( g/ x)/( g/) y = ( g/ y)/( g/) x + y + = 0. (2) and we have [ ] ( g/ x) = 0 ( g/) [ ] ( g/ y) = 0. ( g/) Put λ = (/)/( g/). λ is called a Lagrange Multiplier. 66 We then have at
max./min. for the constrained problem plus the constraint x λ g x = 0 y λ g y = 0 λ g = 0, g(x, y, z) = 0. Summary: Given w = f(x, y, z), with the constraint g(x, y, z) = 0, set H = f λg. The maximum/minimum are amongst those points (x, y, z) where x = y = = λ = 0. (3) Note that / λ = 0 is simply g(x, y, z) = 0, i.e., the constraint. We remark that if (x, y) satisfy (3), then it does not mean they are max./min. For the purposes of this course, we shall use (3) only to find the absolute maximum/minimum (see below). Remark. Suppose we have a problem with more constraints, e.g., w = f(x, y, z) with g(x, y, z) = 0 and h(x, y, z) = 0. The same procedure gives: H = f λg µh, with 2 Lagrange Multipliers λ, µ, and we need to solve the equations x = y = = λ = µ = 0. Remark. It is very difficult, in general, to solve for x, y, z (and if need be λ) 67
in the equations x = y = = λ = 0. Observe however, that since we seek the absolute max./min. of f, it does not matter if we solve these equations exactly, in the following sense: Make sure you do not miss points, but it is OK to include extra points (x, y, z) which may not satisfy all of the above equations, as long as such points satisfy the constraint. We just evaluate f at all of the points we have found, and choose those points where f is biggest or smallest. This may make the situation a little simpler, at expense of a bit of extra work: namely evaluating f at more points! See the examples below. Remark. There is another way to note that an absolute maximum of w = f(x, y) on the constraint g(x, y) = 0 we must have / x = λ g/ x, / y = λ g/ y and of course g(x, y) = 0. Specifically, consider the figure shown, where the constraint g(x, y) = 0 (a curve in this case!) is plotted. f (x, y) = c 2 g (x, y) = 0 f (x, y) = c 1 f (x, y) = c* We also plot curves f(x, y) = c, for various values of c, in the same figure. Now suppose f(x, y) = c 1 properly intersects the curve g(x, y) = c 1. Then c 1 cannot be the maximum of f(x, y) on g(x, y) = 0, since the cuve f(x, y) = c 2 will also 68
intersect g(x, y) = 0 for some c 2 bigger than c 1 and very close to c 1. It follows that at c, the largest value of c for which f(x, y) = c intersects g(x, y) = 0, the curves f(x, y) = c and g(x, y) = 0 must be tangential to each other, i.e., their normals must point in the same (or opposite) direction and this f = λ g for some λ. We now consider the following examples. Example 1. Find the absolute maximum and the absolute minimum of f = xy on x 2 + y 2 + z 2 = 1. Answer. Here H = f λg where g = x 2 + y 2 + z 2 1, so H = xy λ(x 2 + y 2 + z 2 1), then x = y λ(2x) = 0 y = x λ(2y) = 0 = λ2z = 0 λ = (x2 + y 2 + z 2 1) = 0. We focus on the 3rd equation: 2λz = 0. Thus either λ = 0 or z = 0. If λ = 0, then x = y = 0 from the first two equations. But x 2 + y 2 + z 2 = 1 and thus z = ±1. On the other hand, if z = 0, then y = 2λx, x = 2λy. Observe that if λ = 0, then x = 0, y = 0. So it looks like we found the point λ = 0 and (0, 0, 0). We cannot keep this point, since it is off the constraint surface 69
x 2 + y 2 + z 2 = 1. Note that if f(0, 0, 0) were smaller or bigger than f at the other points we found (this is not the case for this specific problem), then we would conclude that (0, 0, 0) would be a min or a max, and this would be wrong. On the other hand, if (0, 0, 0) had actually satisfied the constraint we could simply keep it and evaluate f there at the end. After all this, we conclude that λ 0 and so xy = 2λx 2 xy = 2λy 2 and thus x 2 = y 2. We have from the constraint 2x 2 = 1 or x = ±1/ 2. Since also 2y 2 = 1 then y = ±1/ 2. We conclude that a max./min. must be among the points (1/ 2, 1/ 2, 0), (1/ 2, 1/ 2, 0), ( 1/ 2, 1/ 2, 0), ( 1/ 2, 1/ 2, 0). We had earlier found the points (0, 0, 1), (0, 0, 1). All of these 6 points satisfy the constraint, and the easiest thing is just to evaluate f at all of them. We find f has the absolute maximum of 1/2 at (1/ 2, 1/ 2, 0) and ( 1/ 2, 1/ 2, 0); the absolute minimum of 1/2 at (1/ 2, 1/ 2, 0), ( 1/ 2, 1/ 2, 0). Example 2. Find the points on the surface x 2 = yz + 2 that are nearest to the origin. Answer. Let (x, y, z) be a given point. Its distance to the origin is x 2 + y 2 + z 2. To avoid arguments, it s easiest to work with D(x, y, z) = distance 2 = x 2 + y 2 + z 2. So we wish to minimize D(x, y, z) if (x, y, z) must satisfy the constraint x 2 = yz + 2 or g(x, y, z) = x 2 yz 2 = 0. We set H = D λg. Then x = y = = λ = 0 give 2x λ2x = 0 70
2y + λz = 0 2z + λy = 0 x 2 yz 2 = 0. The first equation gives two possibilities: either x = 0 or x 0. Suppose first x 0. Then λ = 1 and so 2y + z = 0 2z + y = 0 4y y = 0, i.e., y = 0 and then z = 0. We get from the last equation x 2 = 2 or x = ± 2. So we have found two possible points: ( 2, 0, 0), ( 2, 0, 0). Next, suppose x = 0. Then 2y + λz = 0 2z + λy = 0 yz = 2. Multiplying the first equation by z, the second by y: 2zy = λz 2 λz 2 = λy 2. 2zy = λy 2 Now λ 0 (otherwise y = 0, z = 0 contradicting the 3rd equation) and so z 2 = y 2, i.e., z = ±y. But the 3rd equation gives that z and y have opposite sign. We thus conclude z = y and y 2 = 2 or y = ± 2. So we have 2 more points: (0, 2, 2), (0, 2, 2). We now note from the nature of the problem that there are points on the 71
surface where D is smallest and evaluate D at the four candidates: D( 2, 0, 0) = 2, D( 2, 0, 0) = 2 D(0, 2, 2) = 4, D(0, 2, 2) = 4. Consequently, the points nearest the origin are (± 2, 0, 0), and their distance = D = 2. Remark. It is possible to do this problem in a different way, which removes the constraint. We have D = x 2 + y 2 + z 2, but x 2 = yz + 2 and so D = y 2 + z 2 + yz + 2. Note that (y, z) are not constrained except for the fact that x 2 = yz + 2 0, i.e., yz 2 and D is now D(x, y). We then have D y = 2y + z, D = 2z + y. So D = 0 at 2y + z = 0 2z + y = 0 = y = 0 (and so z = 0). But D yy = 2, D yz = 1, D zz = 2, i.e., D yy D zz D 2 yz > 0 and so y = 0, z = 0 gives a minimum where D = 2. In the previous example, we had the luxury of two different methods! Example 3. A flat plate has the shape of the unit disc: x 2 + y 2 1. The plate is heated, so that the temperature T (x, y) is given by T (x, y) = 2x 2 + y 2 y. Find the hottest and coldest points of the plate. Answer. We first seek maximum/minimum points properly inside the disc (i.e., 72
x 2 + y 2 < 1). Here T = 2x 2 + y 2 y gives T x = 4x, 2 T x 2 = 4 T y = 2y 1 2 T x y = 0, 2 T y 2 = 2. So, T = 0 at 4x = 0, 2y 1 = 0 or x = 0, y = 1/2. This point is properly inside 2 ( T the disc, so we proceed: x 2 T 2 ) 2 2 y T > 0 and at (x = 0, y = 1/2) T has 2 x y a minimum. We now check for max./min. on the frontier of the domain: x 2 + y 2 = 1. So we seek max./min. T = 2x 2 + y 2 y subject to the constraint x 2 + y 2 = 1 or x 2 + y 2 1 = 0. Put H = T λg = (2x 2 + y 2 y) λ(x 2 + y 2 1) So / x = / y = / λ = 0 give: 4x 2λx = 0 2y 1 2λy = 0 x 2 + y 2 = 1. Now λ 0, for otherwise x = 0, y = 1/2 and the 3rd equation fails. Now 2x(2 λ) = 0 2y(1 λ) = 1. The first equation gives either x = 0 or λ = 2. If x = 0, then y = ±1 (3rd equation). If λ = 2, then y = 1/2 and so x 2 = 3/4 (3rd equation). I.e., x = ± 3/2. We have 73
thus found the possible points: (0, 1), (0, 1), ( ) 3 2, 1, 2 ( ) 3 2, 1 2 and the earlier point (a minimum): (0, 1/2). We evaluate T at all of them: ( T (0, 1) = 0, T (0, 1) = 2, T 0, 1 ) = 1 2 4 ( ) ( 3 T 2, 1 = 32 2 + 34 ) 3, T 2, 1 = 3 2 2 + 3 4. So we have: absolute minimum at (0, 1/2), absolute maxima at ( 3/2, 1/2), ( 3/2, 1/2). y ( 0, 1 2 ) x ( - 3 2, 1 2 ) ( 3 2, - 1 2 ) Example 4. Find the absolute max./min. of f = x + y + z on the surface x 4 + y 4 + z 4 = 1. Answer. We have H = (x + y + z) λ(x 4 + y 4 + z 4 1). 74
So x = 1 4λx3 = 0 y = 1 4λy3 = 0 = 1 4λz3 = 0 λ = (x4 + y 4 + z 4 1). We note from the first three equations that λ 0. Thus x 3 = y 3 = z 3 and so x = y = z. Now from the constraint equation, 3x 4 = 1 or x = ±1/3 1 4. In the same way, y = ±1/3 1 4 and z = ±1/3 1 4. We can now check f at the 8 possible points (±1/3 1 4, ±1/3 1 4, ±1/3 1 4 ). This is silly here, since it is extra work, but it is not wrong due to the fact that all 8 points satisfy the constraint. Note that we actually know x = y = z so there are only two points to really check: ( ) 1 3, 1 1/4 3, 1 1/4 3 1/4 and ( 1 3, 1 1/4 3, 1 ). 1/4 3 1/4 We clearly have the maximum of f at the first point, and the mimimum at the second point. Observe that actually the point (1/3 1 4, 1/3 1 4, 1/3 1 4 ) does not satisfy the first two equations, but keeping it and the other extra points only leads to extra work, not to the wrong answer since (1) all the points found satisfy the constraint and (2) only the absolute max./min. are sought. The constraint equation is more important than the others. 75
Further Exercises: Find the local maximum, minimum and saddle points of the given function. Identify each point you find. 1) f(x, y) = 2x x 2 + 4y y 2 2) f(x, y) = x 2 y 2 3) f(x, y) = e y sin x 4) f(x, y) = x + y x 2 + y 2 + 1 5) f(x, y) = xy x y + 1 Use Lagrange Multipliers to find the absolute maximum and minimum values of the given functions f subject to the given constraints. 6) f = x 2 4y 2 + 6z 2 on x 2 + y 2 + z 2 = 1 7) f = x on x 2 + 4y 2 + 9z 2 = 100 8) f = x + y on x 2 + 4y 2 + 9z 2 = 100 9) f = xy on x 2 + 4y 2 + 9z 2 = 1 and x = z 10) Use Lagrange Multipliers to find the box of maximum values V if the product of the length of the sides must be 120. 11) Use Lagrange Multipliers to find the volume of the largest box that can be placed inside the sphere x 2 + y 2 + z 2 = 4. 12) Find the absolute maximum and minimum of the function f(x, y) = x 2 + y 2 on the region composed of the ellipsoidal disc x 2 + 4y 2 1. 76