Lecture 18 - Wednesday, Feb 18 MORE ON OPTIMIZATION (§14.7) Example (Midterm II, Lieblich, Spring 2013, Ex 1) For f(x, y) = sin(x) · cos(y) a) Calulate fx (a, b) and fy(a, b) b) Find all critical points of f and classify them according to their type (max, min, saddle point) For a), fx (a, b) = cos(a) · cos(b) fy(a, b) = − sin(a) · sin(b) Let us first solve b) only for 0 ≤ a, b < π. fx (a, b) = 0 ⇔ cos(a) · cos(b) = 0 ⇔ cos(a) = 0 or cos(b) = 0 fy(a, b) = 0 ⇔ − sin(a) · sin(b) = 0 ⇔ sin(a) = 0 or sin(b) = 0 Observe: There is no a ∈ R where sin(a) = 0 = cos(a). Only options where both derivatives are 0 simultaneuosly are (cos(a) = 0 and sin(b) = 0) or (sin(a) = 0 and cos(b) = 0) π π ⇔ (a, b) = ( , 0) or (a, b) = (0, ) 2 2 134 Example (cont). The 2nd derivatives are fxx = − sin(x) cos(y) fxy = − cos(x) sin(y) − sin( π ) cos(0) π 2 D( , 0) = − cos( π ) sin(0) 2 2 −sin(0) cos( π ) π 2 D(0, ) = π − cos(0) sin( ) 2 2 fyy = − sin(x) cos(y) −1 = 0 π − cos(0) sin( 2 ) 0 = π −1 − sin(0) cos( 2 ) − cos( π2 ) sin(0) − sin( π2 ) cos(0) ⇒ ( π2 , 0) is local maximum, (0, π2 ) is saddle point. 0 =1 −1 −1 = −1 0 Observation: f is periodic, i.e. f(x + 2π, y) = f(x, y) = f(x, y + 2π). Moreover f(x + π, y) = f(x, y + π) = −f(x, y). • {( π2 + π · s, π · t) : s, t ∈ Z, s + t even} are local maxima • {( π2 + π · s, π · t) : s, t ∈ Z, s + t odd} are local minima • {(π · s, π2 + π · t) : s, t ∈ Z} are saddle points 2π π 0 0 π 135 2π Example (Midterm II, Aut. 2012, Bekyel) Find the points on the cone given by z 2 = x 2 + y2 that are closest to the point (4, 2, 0). Goal: Minimize h(x, y, z) = (x −4)2 +(y−2)2 +z 2 over cone. Idea: Better optimize f(x, y) = h(x, y, x 2 + y2) = (x − 4)2 + (y − 2)2 + x 2 + y2 = 2x 2 − 8x + 2y2 − 4y + 20 over (x, y) ∈ R2. Take partial derivatives ! fx (x, y) = 4x − 8 = 0 ⇒ x = 2 ! fy(x, y) = 4y − 4 = 0 ⇒ y = 1 Hence (x, y) = (2, 1) is a critical point. fxx = 4, fxy = 0, fyy = 4 Then 4 0 D(2, 1) = = 16 > 0 0 4 √ √ hence (2, 1) is minimum for f. Hence (2, 1, 5) and (2, 1, − 5) are points on cone that are closest to (4, 2, 0). Remark: • Instead of minimizing p f(x, y), better minimize f(x, y) 136 Example (Midterm II, Spring 2011, Loveless,1b) Find the absolute maximum and minimum value of f(x, y) = xy2 + x + 2 over the region R = {(x, y) : y ≥ 0, x 2 + y2 ≤ 8}. • Step 1: Draw the region R y√ 8 √ x 8 √ − 8 • Step 2: Find critical points in R. fx = y2 + 1, fy = 2xy But y2 + 1 > 0 ⇒ no critical point in the interior of R. • Step 3: Optimize √ √ g(x) = f(x, 0) = x + 2 for − 8 ≤ x ≤ 8. Since g′(x) = 2, the only candidate extrema are the √ √ √ interval boundaries x = ± 8 (i.e. (− 8, 0) and ( 8, 0)). 137 Example (cont) • Step 4: Optimize f(x, y) over x 2 + y2 = 8. Equivalently, optimize h(x) = x(8 − x 2) + x + 2 = −x 3 + 9x + 2. √ ′ 2 2 h (x) = −3x + 9 = 0 ⇒ x = 3 ⇒ x = ± 3. √ √ √ √ Candidate points ( 3, 5) and (− 3, 5) • Step 5: Compare candidates point √ (− 8, 0) √ ( 8, 0) √ √ (− 3, 5) √ √ ( 3, 5) Thus value √ 2 − 2 2 ≈ −0.828 √ 2 + 2 2 ≈ 4.828 √ 2 − 6 3 ≈ −8.392 √ 2 + 6 3 ≈ 12.392 √ abs. maximum = 2 + 6 3, 138 √ abs. mininum = 2 − 6 3 Optimization Summary: Task: Find and classify critical points of f(x, y). (1) Find critical points (a, b) with fx (a, b) = 0 = fy(a, b) (2) Apply 2nd derivative test < 0 ⇒ saddle point f (a, b) f (a, b) xy xx < 0 local max D(a, b) = fxy(a, b) fyy(a, b) > 0 ⇒ fxx (a, b) > 0 local min Task: Maximize f(x, y, z) on some 2D surface z = z(x, y) (1) Eliminate one variable and write g(x, y) := f(x, y, z(x, y)) (2) Compute gx , gy, find critical points (3) Classify using 2nd derivative test Task: Maximize f(x, y) on a region R ⊆ R2 (1) Find critical points of f over R2 (2) Write boundary of R as 1-dim function, say g(x). (3) Find critical points of g WARNING: one might need to split boundary into several segments (4) Compare candidates 139