Chabot Mathematics §7.3 2Var Optimization Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu Chabot College Mathematics 1 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Review § 7.2 Any QUESTIONS About • §7.2 → Partial Derivatives Any QUESTIONS About HomeWork • §7.2 → HW-05 Chabot College Mathematics 2 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx §7.3 Learning Goals Locate and classify relative extrema for a function of two variables using the second partials test Examine applied problems involving optimization of functions of two variables Discuss and apply the extreme value property for functions of two variables to find absolute extrema on a closed, bounded region Chabot College Mathematics 3 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Local Maximum & Minimum DEFINITION A function of two variables has a local maximum at (a,b) if f(x y) ≤ f(a,b) when (x,y) is near (a,b). [This means that f(x,y) ≤ f(a,b) for all points (x,y) in some DISK with center (a,b).] The number f(a,b) is called a local maximum value. If f(x,y) ≥ f(a,b) when (x,y) is near (a,b), then f(a,b) is a local minimum value. Chabot College Mathematics 4 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Local MaxMin Illustrated The DISK centered at (x,y)=(a,b) produces a “Hill” with peak at f(a,b) Local (and Absolute) max/min for z = f(x,y) f a, b z f x, y a, b Chabot College Mathematics 5 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Quick Example The function of x,y below has a maximum of about 0.5 at approximately (0.6, 0) Relative Maximum Chabot College Mathematics 6 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx CriticalPoints and Extrema DEFINITION: A point (a,b) in the domain of f(x,y), for which the first order partial derivatives of f(x,y) exist, the point (a,b) is a CRITICAL POINT if: f f x a, b x x a y b 0 & f y xa 0 f y a, b y b That is, BOTH Partials must equal Zero at the Same Time Chabot College Mathematics 7 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx CriticalPoints and Extrema THEOREM: If f has a local maximum or minimum at (a,b) then point (a,b) MUST be a Critical Point at which both Partials Simultaneously equal Zero. While ALL max/min (Extrema) occur at Critical Points (CPs), NOT all CPs are Extrema Points • A Surface that contains a CP that is NOT an Extremum is called a Saddle Surface Chabot College Mathematics 8 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Find Critical Points 4 2 Find All Critical Points for f ( x, y ) xy x y Critical points occur for a function of two variables wherever both 1st Partials = 0 f 4 • For the given y 2 2-Variable function x x f 2 & x 2 y y Setting BOTH partials to Zero Generates 2-Eqns in 2-Unknwns f 4 0 y 2 x x Chabot College Mathematics 9 f 2 & 0x 2 y y Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Find Critical Points 4 Using the x-Partial: 0 y 2 x Now SubStitute into the y-Partial 2 0 x 2 y 0 x 2 4 Or x 4 2 x 4 x x 1 3 3 4 BackSubbing: y 2 x Chabot College Mathematics 10 2 22 0 x 2 x 4 2 2 2 41 x x 16 x Then x 8 3 2 8 1 3 4 y 2 x 1 3 1 x 8 x 2 4 y 2 2 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx y 1 Example Find Critical Points SOLUTION Thus the only relative extremum of the function occurs at (2,1) MTH16 • Bruce Mayer, PE Whether this extremum is a maximum, minimum, or neither is not yet known. Its graph suggests a minimum: 12 z = f(x,y) 11 10 9 8 7 6 0.5 1 1.5 1 2 2.5 3 3.5 0.5 MTH15 3Var 3D Plot.m x Chabot College Mathematics 11 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx y 1.5 Saddle Surface At the “Saddle Point” (0,0,0) z z 0 x 00 y 0 0 But, the Curve is a • MINIMUM in the xz plane • MAXIMUM in the yz plane Chabot College Mathematics 12 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Critical Point Condition A Critical Point ALWAYS marks the location of a “Flat” Tangent Plane, and can be one of • A MAXimum • A MIMimum • NEITHER – i.e.; a SADDLE point Chabot College Mathematics 13 The Nature of a CP can (usually) Be determined by the Second Partials Test Assume for f(x,y) that all needed Partials exist then let 2 2 2 2 f f f D x, y 2 2 x y x y Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 2nd Partials Test Procedure Find a Critical Point (a,b) such that f f x a, b x xa y b 0 & f y xa y b 0 f y a, b Evaluate the “Discriminant” fcn, D(x,y) from last slide, at the CP. That is, find 2 f Da, b 2 x Chabot College Mathematics 14 2 f 2 x a y y b 2 f xa xy y b xa y b Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 2 2nd Partials Test Procedure If D(a,b) is NEGATIVE, then (a,b) is a SADDLE POINT 2 f If D(a,b) POSITIVE, f xx a, b 2 x x a Then Calculate → y b • If fxx(a,b) is POSITIVE, then (a,b) is a MIN • If fxx(a,b) is NEGATIVE, then (a,b) is a MAX • If D(a,b) = 0 then the test is Inconclusive • The pt (a,b) can be of ANY of the Three forms; max, min, saddle Chabot College Mathematics 15 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Quick Example For the Previous Example Calc Then D 2 f f f D x, y 2 2 x y 4 8 xy f xx y 2 3 8 4 2 x x x D2,1 3 3 1 2 1 2 4 f yy x 2 3 D2,1 8 4 1 4 1 3 y y y 8 1 8 And f xx 2,1 3 1 2 f xy x 2 1 2 x y Now D>0 & fxx>0 so 2 2 (2,1) is a MAX Chabot College Mathematics 16 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 2 Example Find Max Revenue The Gladiator Goodies Company sells Jumbo Cashews and the popular “Trial by Trail” RaisinNut mix. Then GG Industrial Engineering develops Regression models for the products qC 8 0.5x 0.05 y ; qC in kCans qR 6 0.2 x 0.2 y ; qR in kBags • x ≡ Cashew Price in $ per Can • y ≡ RaisinNut Price in $ per Bag Chabot College Mathematics 17 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Find Max Revenue For this Financial Model • Find a revenue function, • determine at what prices revenue is maximized, and • find the maximum revenue from the sale of these two products. Chabot College Mathematics 18 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Find Max Revenue SOLUTION The Company Revenue is the sum of revenue from the Two products, so R( x, y) pC qC pR qR = x (8- 0.5x + 0.05y) + y ( 6 + 0.2x - 0.2y) 8x 6 y 0.25xy 0.5x 2 0.2 y 2 To Maximize R, take the Partials and set them to Zero Chabot College Mathematics 19 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Find Max Revenue The Partial Derivatives R x 8 0.25 y x & R y 6 0.25x 0.4 y 0 8 0.25 y x & 0 6 0.25x 0.4 y x 8 0.25 y & 1.6 y 24 x Combine the Two Equations x 1.6 y 24 8 0.25 y x 1.6 y 0.25 y 8 24 y 32 / 1.35 23.70 BackSub to find: x 8 0.25(23.70) 13.93 So have ONE Critical Point at About (13.93 $/can, 23.70 $/bag) Chabot College Mathematics 20 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Discriminant Prep → 2nd Partials From Last Slide R x 8 0.25 y x & R y 6 0.25x 0.4 y Thus 2 R R 8 0.25 y x 1 2 x x x x R R 6 0.25 x 0.4 y 0.4 2 y y y y 2 2R R 6 0.25 x 0.4 y 0.25 xy x y x Chabot College Mathematics 21 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Find Max Revenue Next Find the Discriminant Function 2 2 2 2 f f f D x, y 2 2 x y xy 1 0.4 0.25 0.3375 0 2 The above calculation along with the fact that ∂2R/∂x2 = −1 (<0) shows that the critical point is a maximum Then the Revenue at max Rmax $13.93,$23.7 813.93 623.7 0.2513.9323.7 0.513.93 0.223.7 2 Rmax $13.93 can , $23.7 bag $126 815 Total Revenue Chabot College Mathematics 22 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 2 Constrained Domain Extrema DOMAIN of many RealWorld 2Var Math Models are Constrained For Various Practical Reasons; Call This Domain, R In a finite Constrained-Domain an ABSOLUTE Max or Min is Present • The Absolute Extrema exists at ONE of – The EDGES, or BOUNDARY, of the Domain Region, R – The INTERIOR of the Domain Region, R, at a CRITICAL POINT of the 2Var Function Chabot College Mathematics 23 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Constrained Domain Illustrated Consider a 2Var MathModel, z = f(x,y) with x & y constrained in the XY-Plane by the 2D function g(x,y)=k (k a const) as Illustrated below. • For this example BOTH the Max & Min are on the EDGES of R Chabot College Mathematics 24 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Production Constraints Gladiator Goodies Company (GGC) Factory does NOT have Unlimited Production Capacity. The Factory has been Engineered to this Design Constraint: [No. RaisinNut Bags] ≥ 2·[ No. Cashew Cans] • e.g., if the factory produces 2300 Cashew Cans per week, then at least 4600 RaisinNut Bags also come off the Line Chabot College Mathematics 25 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Production Constraints Recall the GGC Revenue MathModel as developed by the Industrial Engineer $x $ y 2 2 R( , ) 8 x 6 y 0.25 xy 0.5 x 0.2 y can bag Given the Factory-Production Constraint, Find the Maximum Revenue that may be realized using the Cashew and RaisinNut Production Line Chabot College Mathematics 26 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Production Constraints The Goal is the as in the Previous example; to Maximize Revenue. Stated Mathematically → qR 2qC (6 + 0.2x - 0.2y) ³ 2(8- 0.5x + 0.05y) -10 +1.2x ³ 0.3y y 4 x 100 3 A further constraint is that GGC will NOT Give Away their products; thus x $0 can & Chabot College Mathematics 27 y $0 bag Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Production Constraints Then the THREE Constraints: x 0 & y 0 & y 4x 100 3 45 y = RaisinNut Price ($/Bag) The Constrained Domain Region Graphically MTH16 • Bruce Mayer, PE 40 35 30 25 20 15 10 • Practical Price Region 5 0 in Dark Blue 0 Chabot College Mathematics 28 MTH15 Quick Plot BlueGreenBkGnd 130911.m 5 10 15 20 x = Cashew Price ($/Can) Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Chabot College Mathematics 29 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx MATLAB Code % Bruce Mayer, PE % MTH-15 • 01Aug13 • Rev 11Sep13 % MTH15_Quick_Plot_BlueGreenBkGnd_130911.m % clear; clc; clf; % clf clears figure window % % The Domain Limits xmin = 0; xmax = 20; % The FUNCTION ************************************** x = linspace(xmin,xmax,10000); y1 = 4*x-100/3; yFilter = (y1>0); y=y1.*yFilter; % *************************************************** % the Plotting Range = 1.05*FcnRange ymin = min(y); ymax = max(y); % the Range Limits R = ymax - ymin; ymid = (ymax + ymin)/2; ypmin = ymid - 1.025*R/2; ypmax = ymid + 1.025*R/2 % % The ZERO Lines zxh = [xmin xmax]; zyh = [0 0]; zxv = [0 0]; zyv = [ypmin*1.05 ypmax*1.05]; % vxR = [xmax,xmax]; vyR = [0,ymax]; % close the constraint line at Right % the 6x6 Plot axes; set(gca,'FontSize',12); whitebg([0.8 1 1]); % Chg Plot BackGround to Blue-Green area(x,y, 'LineWidth', 4),grid, axis([xmin 1.05*xmax ypmin ypmax]),... xlabel('\fontsize{14}x = Cashew Price ($/Can)'), ylabel('\fontsize{14}y = RaisinNut Price ($/Bag)'),... title(['\fontsize{16}MTH16 • Bruce Mayer, PE',]),... annotation('textbox',[.53 .05 .0 .1], 'FitBoxToText', 'on', 'EdgeColor', 'none', 'String', 'MTH15 Quick Plot BlueGreenBkGnd 130911.m','FontSize',7) hold on plot(zxv,zyv, 'k', zxh,zyh, 'k', vxR,vyR, 'k', 'LineWidth', 2) hold off Example Production Constraints Now consider all boundary points at which critical values can occur. First, consider the vertical line at x = 0: Rx, y 8x 6 y 0.25xy 0.5x 2 0.2 y 2 R0, y 6 y 0.2 y 2 Taking dR(0,y)/dy = 0 produces a Maximum at d R0, y d 0.2 y 2 6 y 0.4 y 6 dy dy d 6 Then R0, y 0 0 0.4 y 6 ymax 15 dy 0.4 Chabot College Mathematics 30 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Production Constraints Next consider the horizontal line y = 0: Rx, y 8 x 6 y 0.25xy 0.5x 2 0.2 y 2 R x,0 8 x 0.5 x 2 d R x,0 dx 8 0.52 x Taking dR(x,0)/dx = 0 0 8 x 0 x 8 8 1 Results in an x-maximum 100 Lastly examine the Slanted Line: y 4 x 3 Sub the Slanted Line Constraint into the Revenue Function R( x, y) 8x 6 y 0.25xy 0.5x 0.2 y 2 Chabot College Mathematics 31 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 2 Example Production Constraints 100 With y 4 x 3 100 R x, 4 x Rx,4 x 33.33 3 100 100 100 2 8 x 6 4 x 0.25 x 4 x 0.5 x 0.2 4 x 3 3 3 2 = -2.7x + 77x - 422.22 2 Taking dR(x,4x−33.33)/dx = 0 produces a Maximum at d 77 2.7 x 2 77 x 422.22 5.4 x 77 0 5.4 xmax 77 xmax 14.26 dx 5.4 Chabot College Mathematics 32 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Production Constraints SUMMARY: • Have 3 boundary critical points to consider: – (0,15), (8 0), and (14.26, 23.71) • We would normally also consider the only critical point on the interior (found in the previous Example 2). However, this point does not satisfy the condition that there be at least twice as many TrailMix as Cashews, so it is omitted. • We then compare revenue for each of those three boundary points and identify the largest revenue. Chabot College Mathematics 33 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Example Production Constraints SUMMARY: • We then compare revenue for each of those three boundary points and identify the largest revenue • Tabulating the Results: (Cashews, T-Mix) (x,y) (0,15) (8,0) (13.93, 23.71) R 45 32 126.76 Pricing the Jumbos at $13.93 and Trialby-Trail at $23.71 provides maximum revenue, given the constraints. Chabot College Mathematics 34 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx WhiteBoard Work Problems From §7.3 • P13 → Critical Point Practice • P51 → Box Design Optimization Chabot College Mathematics 35 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx All Done for Today Saddle Point City Chabot College Mathematics 36 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Chabot Mathematics Appendix r s r s r s 2 2 Bruce Mayer, PE Licensed Electrical & Mechanical Engineer 2a – Chabot College Mathematics 37 BMayer@ChabotCollege.edu 2b Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx P7.3.-13 → Find Critical Points Chabot College Mathematics 38 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx z = f(x,y) P7.3-13 2 1.5 1 0.5 0 2 1 0 -1 MTH16 • Bruce Mayer, PE y -2 -2 -1 x 0 1 39 MTH15 3Var 3D Plot.m Chabot College Mathematics Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx 2 Bottom View MTH16 • Bruce Mayer, PE z = f(x,y) 2 1 0 -2 2 -1 1 0 0 1 y Chabot College Mathematics 40 -1 2 -2 MTH15 3Var 3D Plot.m x Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx % Bruce Mayer, PE % MTH-15 • 16Feb14 % MTH15_Quick_3Var_3D_Plot_BlueGreenBkGnd_140113.m % clear; clc; clf; % clf clears figure window % % The Domain Limits xmin = -2; xmax = 2; % BASE max & min2 ymin = -2; ymax = 2; NumPts = 51 % The GRID ************************************** xx = linspace(xmin,xmax,NumPts); yy = linspace(ymin,ymax,NumPts); [x,y]= meshgrid(xx,yy); % The FUNCTION*********************************** zp = (x.^2 + 2*y.^2).*exp(1 - x.^2 - y.^2); % z =f(x,y) % the Plotting Range = 1.05*FcnRange zmin = min(min(zp)); zmax = max(max(zp)); % the Range Limits R = zmax - zmin; zmid = (zmax + zmin)/2; zpmin = zmid - 1.025*R/2; zpmax = zmid + 1.025*R/2; % % the Domain Plot axes; set(gca,'FontSize',12); mesh(x,y,zp, 'LineWidth', 2),grid, axis([xmin xmax ymin ymax zpmin zpmax]), grid, box, ... xlabel('\fontsize{14}x'), ylabel('\fontsize{14}y'), zlabel('\fontsize{14}z = f(x,y)'),... title(['\fontsize{16}MTH16 • Bruce Mayer, PE',]),... annotation('textbox',[.73 .05 .0 .1 ], 'FitBoxToText', 'on', 'EdgeColor', 'none', 'String', 'MTH15 3Var 3D Plot.m','FontSize',7) % Chabot College Mathematics 41 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Chabot College Mathematics 42 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Chabot College Mathematics 43 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Chabot College Mathematics 44 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Chabot College Mathematics 45 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Chabot College Mathematics 46 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Chabot College Mathematics 47 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Chabot College Mathematics 48 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx Chabot College Mathematics 49 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-01_sec_6-1_Integration_by_Parts.pptx