Chapter 4: Partial Differentiation
Section 4.8: Unconstrained Optimization
Example 4.8.2
Find and classify the critical (i.e., stationary) points for fx,y=x y−x2−y2−2 x−2 y+4.
Solution
Mathematical Solution
Critical points are the solution of the equations ∇f=0, that is, of the equations
−2⁢x+y−2=0,x−2⁢y−2=0
There is but the one solution, namely, P:−2,−2. This point, subjected to the Second-Derivative test, proves to be a local (relative) maximum; at this point, f−2,−2=8.
To implement the Second-Derivative test, calculate fxxP= −2, fyyP= −2, and fxyP=1 so that
T=fxxP⋅fyyP−fxy2P=3
Since T>0 but fxxP<0, the critical point P is a local maximum.
To apply Sylvester's criterion, obtain the Hessian H=fxx(P)fxy(P)fxy(P)fyy(P) = −211−2 and the sequence of principal minors with 1 prepended: 1,−2,3. The signs alternate, so the critical point P is a local maximum.
Figure 4.8.2(a) shows that portion of the surface generated by f that is consistent with the claim that the critical point is a local maximum.
Figure 4.8.2(a) Surface generated by f
Maple Solution - Interactive
Initialize
Tools≻Load Package: Student Multivariate Calculus
Loading Student:-MultivariateCalculus
Context Panel: Assign Name
f=x y−x2−y2−2 x−2 y+4→assign
Solution via task template
Tools≻Tasks≻Browse:
Calculus - Multivariate≻Optimization≻
Critical Points and the Second Derivative Test
Objective Function f
f
−x2+x⁢y−y2−2⁢x−2⁢y+4
List of Independent Variables
v≔x,y
v:=x,y
Equations ∇f=0
convertStudentMultivariateCalculusGradient,,list;
−2⁢x+y−2,x−2⁢y−2
Critical Points
temp≔removehas,solve,v,Explicit,I:convertseqevalv,tempk,k=1..nopstemp,list
−2,−2
Second Derivative Test
StudentMultivariateCalculusSecondDerivativeTest,v=;
LocalMin=,LocalMax=−2,−2,Saddle=
Hessians and their Eigenvalues
Temp≔StudentMultivariateCalculusSecondDerivativeTest,v=,output=hessian: for k to nopsTemp do Tempk,convertLinearAlgebraEigenvaluesTempk,list; end do;
The one critical point, namely, −2,−2, is a local (relative) maximum. The Hessian matrix in the last line of the task template is the matrix of second partial derivatives evaluated at the critical point. Since a discussion of eigenvalues is beyond the scope of the typical multivariate calculus course, apply Sylvester's criterion to the Hessian. Since the signs in the sequence 1,Q1,Q2=1,−2,3 alternate, the critical point is a local maximum.
Find critical points via first principles
Calculus palette: Partial derivative operator Press the enter key.
Context Panel: Solve≻Solve
∂∂ x f=0,∂∂ y f=0
→solve
x=−2,y=−2
Alternate calculation of the critical points
Type f and press the Enter key.
Context Panel: Student Multivariate Calculus≻ Differentiate≻Gradient
Context Panel: Conversions≻To List
Context Panel: Conversions≻Equate to 0
→gradient
→to list
→equate to 0
Second-Derivative test
Expression palette: Evaluation template Calculus palette: Partial-derivative operators
Context Panel: Evaluate and Display Inline
∂2∂x2 f⋅∂2∂y2 f−∂2∂ y⁢∂ x f2x=a|f(x)x=−2,y=−2 = 3
∂2∂x2 fx=a|f(x)x=−2,y=−2 = −2
Obtain f−2,−2
Expression palette: Evaluation template
fx=a|f(x)x=−2,y=−2 = 8
Maple Solution - Coded
Install the Student MultivariateCalculus package.
withStudent:-MultivariateCalculus:
Define f.
f≔x,y→x y−x2−y2−2 x−2 y+4:
Obtain critical points
Use the Gradient, Equate, and solve commands to solve the equations resulting from ∇f=0.
solveEquateGradientfx,y,x,y,0,0
Apply the SecondDerivativeTest command to the critical point
SecondDerivativeTestfx,y,x,y=−2,−2
Apply the second-derivative test from first principles
The differential operator D, applied to a function, returns a function. Hence, T=fxxfyy−fxy2 is a function evaluated at the one critical point.
T≔D1,1f⋅D2,2f−D1,2f2−2,−2; D1,1f−2,−2
3
At the critical point, T=3 and fxx<0, so the critical point is a local (relative) maximum; this maximum value is f−2,−2=8 .
Apply Sylvester's criterion
Use the SecondDerivativeTest command to return the Hessian matrix
H≔SecondDerivativeTestfx,y,x,y=−2,−2,output=hessian =
Generate the sequence 1,Q1,…,Qn, where the Qk are the principal minors.
Obtain a principal minor by applying the Determinant command to the appropriate submatrix of H.
Use the seq command to form the sequence of principal minors.
1, seqLinearAlgebra:-DeterminantH1..k,1..k,k=1..2
1,−2,3
An alternative way to obtain the Hessian:
Matrix2,2,i,j→Di,jf−2,−2 =
<< Previous Example Section 4.8 Next Example >>
© Maplesoft, a division of Waterloo Maple Inc., 2024. All rights reserved. This product is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation.
For more information on Maplesoft products and services, visit www.maplesoft.com
Download Help Document