LECTURE 10: LAGRANGE MULTIPLIERS MINGFENG ZHAO January 26, 2015 Lagrange multipliers Consider the optimization problem: max / min f (x, y) −→ g(x, y) = 0 objective function −→ constraint. Method of Lagrange Multipliers: If ∇g(x, y) 6= 0 for all (x, y) such that g(x, y) = 0, to find the maximum and minimum values of f (x, y) subject to the constraint g(x, y) = 0, we have two steps: Step 1. Find the values of x, y and λ such that ∇f (x, y) = λ∇g(x, y), and g(x, y) = 0. Step 2. Among the points (x, y) found in Step 1, select the largest and smallest corresponding function values. These values are the maximum and minimum values of f (x, y) subject to the constraint g(x, y) = 0. 1 2 Example 1. Find the maximum value of the utility function U = f (`, g) = ` 3 g 3 , subject to the constraint G(`, g) = 3` + 2g − 12 = 0, where ` ≥ 0 and g ≥ 0. Find the gradients of U and G, we have ∇U = 1 −2 2 2 1 −1 ` 3 g3 , `3 g 3 3 3 , and ∇G = h3, 2i. Let’s solve the system: ∇U = λ∇G, and G(`, g) = 0. 1 2 MINGFENG ZHAO That is, 1 −2 2 ` 3 g 3 = 3λ 3 2 1 −1 ` 3 g 3 = 2λ 3 (1) (2) 3` + 2g − 12 = 0 (3) In our case, we know that ` > 0 and g > 0, so λ > 0. By (1) and (2), we have 2 1 1 1 −2 2 ` 3 g 3 · 2λ = 3λ · ` 3 g − 3 . 3 3 Since λ 6= 0, then 1 −2 2 2 1 1 ` 3 g 3 · 2 = 3 · ` 3 g− 3 . 3 3 That is, we get 2 −2 2 6 1 1 ` 3 g 3 = ` 3 g− 3 . 3 3 So we get g = 3`. Plug g = 3` into (3), we get g + 2g − 12 = 0, that is, 3g − 12 = 0. Then g = 4. Since g = 3`, then ` = 34 . So the 1 2 4 maximum value of the utility function U , subject to the constraint G(`, g) = 0 is U (4/3, 3) = (4/3) 3 3 3 = √ ≈ 2.8. 3 3 Implicit differentiation Example 2. If the function f (x, y) obeys f (x, y) + sin(f (x, y)) = 2x + 4xy, and f (0, 0) = 0. Find fx (0, 0) and fxy (0, 0). Since f (x, y) + sin(f (x, y)) = 3x + 4xy, take the partial derivative with respect to x on the both sides, by using the chain rule, we have fx (x, y) + cos(f (x, y)) · fx (x, y) = 2 + 4y. Plug (x, y) = (0, 0) into the above equation, since f (0, 0) = 0, then fx (0, 0) + cos(0) · fx (0, 0) = 2 + 4 · 0. LECTURE 10: LAGRANGE MULTIPLIERS 3 That is, 2fx (0, 0) = 2. So we get fx (0, 0) = 1. Since fx (x, y) + cos(f (x, y)) · fx (x, y) = 2 + 4y, take the partial derivative with respect to y on the both sides, by using the chain rule and the product rule, we have fxy (x, y) − sin(f (x, y)) · fy (x, y) · fx (x, y) + cos(f (x, y)) · fxy (x, y) = 4. Plug (x, y) = (0, 0) into the above equation, since f (0, 0) = 0, then fxy (0, 0) − sin(0) · fy (0, 0) · fx (0, 0) + cos(0) · fxy (0, 0) = 4. That is, 2fxy (0, 0) = 4. So we get fxy (0, 0) = 2. Remark 1. During the computation of fxy (0, 0), we find that fx (0, 0) and fy (0, 0), in general, we can use the equation that f (x, y) satisfies to compute these two terms. In Example 2, we are lucky to have sin(0) · fy (0, 0) · fx (0, 0) = 0, so we do not need to compute fy (0, 0), but in general, we should compute it just as the computation of fx (0, 0). Example 3. Find an equation of the plane that passes through the (noncollinear) points P (2, −1, 3), Q(1, 4, 0) and R(0, −1, 5). Let n = ha, b, ci be a normal vector for this plane. Since P , Q and R are three points in the plane, by the definition −−→ −→ of the normal vector of the plane, we have n is orthogonal to P Q and P R. Notice that −−→ P Q = h−1, 5, −3i, −→ and P R = h−2, 0, 2i. So we get 0 0 = −−→ n · PQ = ha, b, ci · h−1, 5, −3i = −a + 5b − 3c −→ = n · PR = ha, b, ci · h−2, 0, 2i = −2a + 2c 4 MINGFENG ZHAO So we get (4) −a + 5b − 3c = 0 (5) −2a + 2c = 0 By (5), we have c = a. Plug c = a into (5), we have −a + 5b − 3a = 0, that is, 5b = 4a. So b = 45 a. Hence we get 5 5 n = a, a, a = a 1, , 1 . 4 4 5 So we know that 1, , 1 is a normal vector for this plane. Since P (2, −1, 3) is on the plane, then the equation of 4 the plane is: 5 1 · (x − 2) + (y + 1) + 1 · (z − 3) = 0. 4 That is, we get 5 21 x+ y+z = . 4 4 Department of Mathematics, The University of British Columbia, Room 121, 1984 Mathematics Road, Vancouver, B.C. Canada V6T 1Z2 E-mail address: mingfeng@math.ubc.ca