Chapter 4: Partial Differentiation
Section 4.9: Constrained Optimization
Example 4.9.5
Find the minimum distance from the point 1,−3,2 to the plane 5⁢x−7 y+2 z=3.
Solution
Mathematical Solution
The objective function should be
x−12+y+32+z−22
but taking the objective function f as the square of this leads to much simpler algebra.
The constraint is
gx,y,z≡5⁢x−7 y+2 z−3=0
In Figure 4.9.5(a), the sphere of radius 243/26, the level surface f=243/26, is tangent to the constraint plane g=0, drawn in red.
use plots,plottools in module() local p1,p2,p3; p1:=sphere([1,-3,2],sqrt(243/26)); p2:=plot3d(-(5/2)*x+(7/2)*y+3/2,x=-2..2,y=-2..2,color=red); p3:=display(p1,p2,scaling=constrained,labels=[x,y,z],axes=frame,orientation=[15,75,0],tickmarks=[4,5,5],view=-1..5); print(p3); end module: end use:
Figure 4.9.5(a) Level surface of f and g=0
To implement the Lagrange multiplier technique, solve ∇f=λ ∇g, and the constraint g=0, for the four unknowns x,y,z,λ.
The resulting equations are
−5⁢x+7⁢y−2⁢z+3,−5⁢λ+2⁢x−2,7⁢λ+2⁢y+6,−2⁢λ+2⁢z−4
with solution P:x,y,z=−1926,−1526,1713 when λ=−913, so that fP=24326.
The minimum distance from 1,−3,2 to the plane is therefore 243/26=978/26.
Maple Solution - Interactive
Initialize
Tools≻Load Package: Student Multivariate Calculus
Loading Student:-MultivariateCalculus
Context Panel: Assign Name
f=x−12+y+32+z−22→assign
g=5 x−7 y+2 z−3→assign
Apply the LagrangeMultipliers command in the Student MultivariateCalculus package, captured in the task template. See Table 4.9.3(a).
Tools≻Tasks≻Browse:
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.3(a) The Lagrange Multiplier Method task template
Implement the Lagrange multiplier method via first principles
F=f−λ g→assign
Write F and press the Enter key.
Context Panel: Student Multivariate Calculus≻Differentiate≻Gradient
Context Panel: Conversions≻To List
Context Panel: Solve≻Solve
F
−5⁢x−7⁢y+2⁢z−3⁢λ+x−12+y+32+z−22
→gradient
→to list
−5⁢x+7⁢y−2⁢z+3,−5⁢λ+2⁢x−2,7⁢λ+2⁢y+6,−2⁢λ+2⁢z−4
→solve
λ=−913,x=−1926,y=−1526,z=1713
Optimization Assistant
The Optimization Assistant is no longer listed in Tools≻Assistants. It is now found in Tools≻Tutors≻Optimization
A numeric solution is available via the , launched from the Context Panel on the sequence f,g=0.
Figure 4.9.5(b) shows the Optimization Assistant finding the minimum of 243/26≐9.35 at
−1926,−1526,1713
Figure 4.9.5(b) Constrained maximum
Solution via the Lines & Planes tools in the Student MultivariateCalculus package
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Plane
Context Panel: Assign to a Name≻L
5 x−7 y+2 z=3→make plane<< Plane 1 >>→assign to a nameL
Write a sequence of the point and L, the name of the plane.
Context Panel: Evaluate and Display Inline
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Distance
1,−3,2,L = 1,−3,2,<< Plane 1 >>→distance926⁢78
Maple Solution - Coded
Install the Student MultivariateCalculus package.
withStudent:-MultivariateCalculus:
Define f, the objective function.
f≔x−12+y+32+z−22:
Define g, the constraint function.
g≔5 x−7 y+2 z−3:
Implement the Lagrange multiplier method
Invoke the LagrangeMultipliers command from the Student MultivariateCalculus package.
LagrangeMultipliersf,g,x,y,z
Add the "detailed" option to the LagrangeMultipliers command.
LagrangeMultipliersf,g,x,y,z,output=detailed
x=−1926,y=−1526,z=1713,λ1=−913,x−12+y+32+z−22=24326
Implement the Lagrange multiplier method from first principles
Define F.
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.
solveEquateGradientF,x,y,z,λ,0,0,0,0,x,y,z,λ
x=−1926,y=−1526,z=1713,λ=−913
Define the plane with the Plane command and obtain the distance with the Distance command.
Distance1,−3,2,Planeg = 926⁢78
<< Previous Example Section 4.9 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