Chapter 4: Partial Differentiation
Section 4.9: Constrained Optimization
Find the extreme values of fx,y=x y2 subject to the constraint 3 x+4 y=12.
The black curves in Figure 4.9.2(a) are the level curves of f, whereas the red line is the graph of the constraint g=0. The constraint is tangent to a level curve as a single point, yet there are two extrema.
First, the existence of two extrema has to be detailed, then an explanation has to be forthcoming for why the constraint is tangent to a level curve just once.
With f=x y2 and g=3 x+4 y−12, solve ∇f=λ ∇g, and g=0, for x,y,λ. The equations to be solved are
use plots in
Figure 4.9.2(a) Level curves of f and g=0
and they have the two solutions x,y=4,0 (when λ=0), and x,y=4/3,2 (when λ=4/3). Thus, f4,0=0 is a local minimum, and f4/3,2=16/3 is a local maximum.
The constraint line is tangent to the level curve f=16/3 at x,y=4/3,2. At the local minimum, the Lagrange multiplier is zero, implying that the constraint is inoperative at that point. That point is a critical point for the unconstrained optimization problem because ∇f=0 all along the line y=0.
Maple Solution - Interactive
Student Multivariate Calculus
Context Panel: Assign Name
g=3 x+4 y−12→assign
Apply the LagrangeMultipliers command in the Student MultivariateCalculus package, captured in the
task template. See Table 4.9.2(a).
Calculus - Multivariate≻Optimization≻Lagrange Multiplier Method
Method of Lagrange Multipliers
Enter objective function f
Enter constraints gk=0,k=1,…,entered as functions g1,g2,…
Enter coordinate variables, separated by commas:
Table 4.9.2(a) The Lagrange Multiplier Method task template
Implement the Lagrange multiplier method via first principles
Write F and press the Enter key.
Context Panel: Student Multivariate Calculus≻
Context Panel: Conversions≻To List
Context Panel: Solve≻Solve
The Optimization Assistant is no longer listed in Tools≻Assistants. It is now found in Tools≻Tutors≻Optimization
A numeric solution and some useful graphics are available via the
, launched from the Context Panel on the sequence f,g=0.
Figures 4.9.2(b, c) respectively show the Optimization Assistant finding the minimum of zero at 4,0, and the maximum of 16/3 at 4/3,2.
Figure 4.9.2(b) Constrained minimum
Figure 4.9.2(c) Constrained maximum
Figures 4.9.2(d, e) are generated with the Plot option in the Optimization Assistant. In Figure 4.9.2(c), the constraint line is lifted to the surface, whereas in Figure 4.9.2(e), the constraint is represented as a cutting plane (gray) intersecting the surface generated by the objective function.
Figure 4.9.2(d) Constraint lifted to surface
Figure 4.9.2(e) Constraint as cutting plane
Maple Solution - Coded
Install the Student MultivariateCalculus package.
Define f, the objective function.
Define g, the constraint function.
g≔3 x+4 y−12:
Implement the Lagrange multiplier method
Invoke the LagrangeMultipliers command from the Student MultivariateCalculus package.
Add the "detailed" option to the LagrangeMultipliers command.
Implement the Lagrange multiplier method from first principles
F≔f− λ g:
Use the Gradient command to obtain ∇f−λ ∇g.
Use the Equate command to equate each component of ∇f−λ ∇g to zero.
Use the solve command to obtain the solutions of the equations in ∇f−λ ∇g=0.
<< Previous Example Section 4.9
Next Example >>
© Maplesoft, a division of Waterloo Maple Inc., 2023. 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