Chapter 4: Partial Differentiation
Section 4.8: Unconstrained Optimization
Example 4.8.7
Line L1 passes through the point P:1,2,3 and has direction V1=2 i−5 j+4 k. Line L2 passes through the point Q:3,−1,2 and has direction V2=3 i+7 j−6 k. Show that the lines are skew, and find the minimum distance between them. Hint: Parametrize each line with a different parameter and minimize the square of the distance between an arbitrary point on each line.
Solution
Mathematical Solution
Figure 4.8.7(a) shows line L1 in black, line L2 in red, their common normal in green, and the points between which the distance from one line to the other is measured.
Since V1×V2 = 2−54×37−6=22429≠0, the lines are not parallel.
Parametric equations for lines L1 and L2 are, respectively
use plots in module() local p1,p2,p3,p4,p5,A,B; A:=[3287/1421,-1823/1421,7995/1421]; B:=[3093/1421,-593/203, 5182/1421]; p1:=spacecurve([1+2*t,2-5*t,3+4*t],t=-.4..1.6,color=black,numpoints=2,thickness=3): p2:=spacecurve([3+3*s,-1+7*s,2-6*s],s=-.8..0.2,color=red,numpoints=2,thickness=3): p3:=spacecurve([A,B],color=green,numpoints=2): p4:=pointplot3d([A,B],symbol=solidsphere,symbolsize=20,color=gold); p5:=display(p1,p2,p3,p4,scaling=constrained,axes=none,labels=[x,y,z],orientation=[-45,55,-15]); print(p5); end module: end use:
Figure 4.8.7(a) Skew lines and common normal
x1t=1+2 t,y1t=2−5 t,z1t=3+4 t and x2s=3+3 s,y2s=−1+7 s,z2s=2−6 s.
The equations x1t=x2s,y1t=y2s,z1t=z2s are inconsistent, so the lines do not intersect.
Hence, the lines are skew.
The distance between the lines is given by
d
=x1t−x2s2+y1t−y2s2+z1t−z2s2
=94⁢s2+106⁢s⁢t+45⁢t2−18 s−30 t+14
To minimize d, solve the equations
∂d∂t=12⁢188⁢s+106⁢t−1894⁢s2+106⁢s⁢t+45⁢t2−18 s−30 t+14=0
∂d∂s=12⁢106⁢s+90⁢t−3094⁢s2+106⁢s⁢t+45⁢t2−18 s−30 t+14=0
for t^=9331421,s^=−3901421.
The minimum of d is then 9729/203≐2.57.
This minimum distance is measured between the points
x1t^,y1t^,z1t^=32871421,−18231421,79951421≐2.3132,−1.2829,5.6263
and
x2s^,y2s^,z2s^=30931421,−593203,51821421≐2.1766,−2.9212,3.6467
Maple Solution - Interactive
Initialize
Tools≻Load Package: Student Multivariate Calculus
Loading Student:-MultivariateCalculus
Define vectors V1 and V2
Context Panel: Assign Name
V1=2,−5,4→assign
V2=3,7,−6→assign
Define the points P and Q
P=1,2,3→assign
Q=3,−1,2→assign
Form lines L1 and L2
Write the sequence of names for the point and vector determining the line. Context Panel: Evaluate and Display Inline
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Line
Context Panel: Assign to a Name≻L[1] or L[2], as appropriate
P,V1 = 1,2,3,2−54→make line<< Line 1 >>→assign to a nameL1
Q,V2 = 3,−1,2,37−6→make line<< Line 4 >>→assign to a nameL2
Show lines L1 and L2 are skew lines
Write the sequence of names for lines L1 and L2. Context Panel: Evaluate and Display Inline
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Skew
L1,L2 = << Line 10 >>,<< Line 11 >>→skew lines?true
Obtain the distance between lines L1 and L2
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Distance
Context Panel: Approximate≻5 (digits)
L1,L2 = << Line 1 >>,<< Line 2 >>→distance97203⁢29→at 5 digits2.5732
The distance between the lines can also be found from first principles by minimizing the distance between points on each line.
Obtain the general point on each line
Write the name of the line. Context Panel: Evaluate and Display Inline
Context Panel: Student Multivariate Calculus≻Lines & Planes≻Representation≻combined_vector (Use t as the parameter on one line, and s as the parameter on the other. See Figure 4.8.7(b).)
Context Panel: Conversions≻To List
Context Panel: Assign to a Name≻p (first line) and q (second line)
Figure 4.8.7(b) Line representation dialog
L1 = << Line 10 >>→representation1+2⁢t2−5⁢t3+4⁢t→to list1+2⁢t,2−5⁢t,3+4⁢t→assign to a namep
L2 = << Line 11 >>→representation3+3⁢s−1+7⁢s2−6⁢s→to list3+3⁢s,−1+7⁢s,2−6⁢s→assign to a nameq
Obtain the distance between points p and q
Write the sequence of names for the generic points and press the Enter key.
Context Panel: Simplify≻Simplify
Context Panel: Assign to a Name≻d
p,q
1+2⁢t,2−5⁢t,3+4⁢t,3+3⁢s,−1+7⁢s,2−6⁢s
→distance
−2+2⁢t−3⁢s2+3−5⁢t−7⁢s2+1+4⁢t+6⁢s2
= simplify
94⁢s2+106⁢s⁢t+45⁢t2−18⁢s−30⁢t+14
→assign to a name
Determine the values of s and t that minimize the distance d
Write d and press the Enter key.
Context Panel: Student Multivariate Calculus≻Differentiate≻Gradient
Context Panel: Solve≻Solve
Context Panel: Assign to a Name≻S
→gradient
→to list
12⁢188⁢s+106⁢t−1894⁢s2+106⁢s⁢t+45⁢t2−18⁢s−30⁢t+14,12⁢106⁢s+90⁢t−3094⁢s2+106⁢s⁢t+45⁢t2−18⁢s−30⁢t+14
→solve
s=−3901421,t=9331421
S
Evaluate d at the values in S
Expression palette: Evaluation template
Context Panel: Evaluate and Display Inline
dx=a|f(x)S = 11421⁢9409⁢1421= simplify 97203⁢29
Finally, the two points that are closest, are found by substituting into the generic points p and q, the values in S.
px=a|f(x)S = 32871421,−18231421,79951421
qx=a|f(x)S = 30931421,−593203,51821421
Maple Solution - Coded
Install the Student MultivariateCalculus package.
withStudent:-MultivariateCalculus:
Define the directions of the two lines.
V1,V2≔2,−5,4,3,7,−6:
Define the points through which each line passes.
P,Q≔1,2,3,3,−1,2:
Use the Line command to define the two given lines.
L1,L2≔LineP,V1,LineQ,V2:
Show the lines are skew
Use the AreSkew command to test for skewness.
AreSkewL1,L2 = true
Calculate the distance between the lines
Apply the simplify command to the result of the Distance command.
simplifyDistanceL1,L2 = 97203⁢29
Work from first principles
Apply the GetRepresentation command to each line, returning the equations as vectors assigned to the names A and B, respectively. These names then represent generic points on the lines.
A≔GetRepresentationL1,form=combined_vector,parameter=t =
B≔GetRepresentationL2,form=combined_vector,parameter=s =
Obtain an expression for the distance between points A and B
Apply the convert/list command to A and B, and to this, simplify the Distance between them.
d≔simplifyDistanceconvertA,list,convertB,list
Minimize d by forming and solving the equations ∇d=0
Obtain ∇d with the Gradient command, and the Equate command to form the componentwise equations in ∇d=0.
Apply the solve command to obtain the minimizing values of s and t.
Assign the solution to the name S.
S≔solveEquateGradientd,t,s,0,0 = s=−3901421,t=9331421
By substitution, obtain the value of the minimum distance
Use the eval and simplify commands to obtain the exact value of the minimum distance, and the evalf command to obtain this distance as a floating-point number.
MinDist≔simplifyevald,S = 97203⁢29
evalfMinDist = 2.573206829
By substitution, obtain the coordinates of the points between which the minimum distance occurs
Change the vectors A and B to lists with the convert/list command, and make the substitution with the eval command.
convertevalA,S,list
32871421,−18231421,79951421
convertevalB,S,list
30931421,−593203,51821421
<< 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