Chapter 4: Partial Differentiation
Section 4.9: Constrained Optimization
Example 4.9.9
Find the distance from the point 1,2,3 to the line of intersection of the planes 5 x+4 y−3 z=11 and 7 x−2 y+6 z=9.
Use the Lagrange multiplier technique adapted for two constraints.
Solve for the line of intersection and minimize the distance from the given point to this line.
Solution
Mathematical Solution
The distance from 1,2,3 to the line of intersection of the two given planes is
d=x−12+y−22+z−32
but the objective function is taken as f=d2, which simplifies the algebra significantly.
The sphere in Figure 4.9.9(a) is the level surface of f that is tangent to the line of intersection of the two given planes.
The red and green vectors are respective normals to the given planes, and the black arrow is ∇f at the critical point on the line of intersection.
use plots, plottools, Student:-VectorCalculus in module() local p1,p2,p3,p4,V,Gf,Gg,Gh,P; P:=[199/257,764/257,408/257]; V:=RootedVector(root=[-0.209933623,5.761478599,3.665415427],.4*<18,-51,-38>): Gf:=RootedVector(root=P,<-116/257,500/257,-726/257>); Gg:=RootedVector(root=P,<5,4,-3>); Gh:=RootedVector(root=P,-<7,-2,6>); p1:=sphere([1,2,3],sqrt(769/257)); p2:=PlotVector(V,color=black,width=.3); p3:=PlotVector([Gf,Gg,Gh],color=[black,red,green],width=.3); p4:=display([p1,p2,p3],scaling=constrained,axes=frame,labels=[x,y,z],lightmodel=none,view=[-6..6,0..7,-4.2..5],tickmarks=[4,5,5],orientation=[25,80,0]); print(p4); end module: end use:
Figure 4.9.9(a) ∇f, ∇g,∇h and level surface of f
The Lagrange multiplier method finds the point of tangency of the level surfaces of f with the set of points common to the two constraints. Since the constraints are planes, this set of common points is the line of intersection of the planes. The point of tangency is found by making ∇f a linear combination of the gradients of the two constraints, that is, by solving the equations in ∇f=λ ∇g+μ ∇h, along with the two constraint equations g=h=0. This is the set of five equations
−5 x−4 y+3 z+11
= 0
−7 x+2 y−6 z+9
−5 λ−7 μ+2 x−2
−4 λ+2 μ+2 y−4
3 λ−6 μ+2 z−6
in the five unknowns x,y,z,λ,μ. The solution of these equations (which are fortunately linear) is then
λ=86257,μ=−78257,x=199257,y=764257,z=408257
Hence, f199257,764257,408257=769257, and the minimum distance is d=769257≐1.7298.
Maple Solution - Interactive
Initialize
Tools≻Load Package: Student Multivariate Calculus
Loading Student:-MultivariateCalculus
Context Panel: Assign Name
f=x−12+y−22+z−32→assign
g=5 x+4 y−3 z−11→assign
Context Panel: Assign name
h=7 x−2 y+6 z− 9→assign
Apply the LagrangeMultipliers command in the Student MultivariateCalculus package, captured in the task template. See Table 4.9.9(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.9(a) The Lagrange Multiplier Method task template
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,h=0.
Figure 4.9.9(b) shows the Optimization Assistant finding the minimum of 2.99 at approximately
0.77,2.97,1.59
Figure 4.9.9(b) Constrained maximum
Implement the Lagrange multiplier method via first principles
F=f−λ g−μ h→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+4⁢y−3⁢z−11⁢λ−7⁢x−2⁢y+6⁢z−9⁢μ+x−12+y−22+z−32
→gradient
→to list
−5⁢x−4⁢y+3⁢z+11,−7⁢x+2⁢y−6⁢z+9,−5⁢λ−7⁢μ+2⁢x−2,−4⁢λ+2⁢μ+2⁢y−4,3⁢λ−6⁢μ+2⁢z−6
→solve
λ=86257,μ=−78257,x=199257,y=764257,z=408257
A solution without the Lagrange multiplier technique begins with an explicit representation of the line of intersection of the planes.
Define the two constraint planes
Set the constraint function equal to zero. Context Panel: Evaluate and Display Inline
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Plane Context Panel: Assign to a Name≻P (and then Q)
g=0 = 5⁢x+4⁢y−3⁢z−11=0→make plane<< Plane 2 >>→assign to a nameP
h=0 = 7⁢x−2⁢y+6⁢z−9=0→make plane<< Plane 3 >>→assign to a nameQ
Obtain the line of intersection of the planes
Write a sequence of the names of the two planes. Context Panel: Evaluate and Display Inline
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Intersection
Context Panel: Assign to a Name≻L
P,Q = << Plane 2 >>,<< Plane 3 >>→intersection<< Line 1 >>→assign to a nameL
Obtain the distance from 1,2,3 to line L
Write a sequence of the point and the name of the line of intersection. Context Panel: Evaluate and Display Inline
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Distance
Context Panel: Simplify≻Simplify
1,2,3,L = 1,2,3,<< Line 1 >>→distance14369⁢13073⁢4369= simplify 1257⁢769⁢257
Obtain the parametric equations for the line of intersection
Write the name of the line of intersection. Context Panel: Evaluate and Display Inline
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Representation≻parametric
Context Panel: Assign to a Name≻R
L = << Line 1 >>→representationx=69474369+18⁢t,y=170257−51⁢t,z=−5884369−38⁢t→assign to a nameR
Obtain fxt,yt,zt and minimize via elementary calculus
Expression palette: Evaluation template Evaluate f along line R Press the Enter key.
Context Panel: Differentiate≻With Respect To≻t
Context Panel: Assign to a Name≻T
fx=a|f(x)R
25784369+18⁢t2+−344257−51⁢t2+−136954369−38⁢t2
= simplify
522774369+396⁢t+4369⁢t2
→differentiate w.r.t. t
396+8738⁢t
t=−1984369
→assign to a name
T
Evaluate line L at the critical number found for t
Expression palette: Evaluation template
Context Panel: Evaluate and Display Inline
Lx=a|f(x)T = 199257,764257,408257
Maple Solution - Coded
Install the Student MultivariateCalculus package.
withStudent:-MultivariateCalculus:
Define f, the objective function.
f≔x−12+y−22+z−32:
Define g, the first constraint function.
g≔5 x+4 y−3 z−11:
Define h, the second constraint function.
h≔7 x−2 y+6 z− 9:
Implement the Lagrange multiplier method
Invoke the LagrangeMultipliers command from the Student MultivariateCalculus package.
LagrangeMultipliersf,g,h,x,y,z
199257,764257,408257
Add the "detailed" option to the LagrangeMultipliers command.
LagrangeMultipliersf,g,h,x,y,z,output=detailed
x=199257,y=764257,z=408257,λ1=86257,λ2=−78257,x−12+y−22+z−32=769257
Implement the Lagrange multiplier method from first principles
Define F.
F≔f− λ g−μ h:
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 real solution of the equations in ∇f−λ ∇g=0.
solveEquateGradientF,x,y,z,λ,μ,0,0,0,0,0,x,y,z,λ,μ
<< 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