11.2 Skew Lines, Angles and Shortest Distance
In space two lines can meet, run parallel, or pass each other without meeting and without being parallel. The angle between them comes from $\cos\theta=|l_1l_2+m_1m_2+n_1n_2|$, and the gap between skew lines — measured along their common perpendicular — is one determinant divided by one length.
Stand under a flyover. The road above runs east–west; the road you are on runs north–south underneath. Seen from an aircraft, the two roads cross. In space they never meet — and they are not parallel either. Such pairs of lines, impossible in a plane, are everywhere in three dimensions: two straight flight paths at different heights, a cable-car rope and a power line, two pipes in a factory, two edges of a room that neither meet nor run the same way. For each pair an engineer asks two questions: at what angle do they run, and how close do they come? The second question has a beautiful answer: there is exactly one segment that meets both lines at right angles, and it is the shortest bridge between them.
This section answers both questions with the tools of Section 11.1. We first find the angle between two lines from their direction cosines, then the perpendicular from a point to a line. Next we classify a pair of lines as intersecting, parallel or skew, and find the direction perpendicular to both. Finally we prove the shortest-distance formula, the condition for two lines to meet, and how to find the equation of the line of shortest distance. JEE Main asks about these in almost every session: a shortest distance (often with a parameter to find), the angle between two lines, the foot of a perpendicular or an image of a point, or the point where two lines meet.
The Angle between Two Lines
The projection of a segment $PQ$ on a directed line $L$ is the signed length $P'Q'$, where $P'$, $Q'$ are the feet of the perpendiculars from $P$, $Q$ to $L$ (positive if $P'\to Q'$ runs in the direction of $L$). The angle between two lines $L_1$, $L_2$ — whether or not they meet — is the angle $\theta$ between the lines through $O$ parallel to them, taken so that $0\le\theta\le\tfrac\pi2$.
If $L$ has DCs $l,m,n$, the projection of the segment from $P(x_1,y_1,z_1)$ to $Q(x_2,y_2,z_2)$ on $L$ is
$$l(x_2-x_1)+m(y_2-y_1)+n(z_2-z_1),$$and it equals $PQ\cos\varphi$, where $\varphi$ is the angle between the directions $P\to Q$ and $L$.
Proof. A segment of length $s$ making angle $\varphi$ with $L$ projects to $s\cos\varphi$: in the plane containing the segment and a line parallel to $L$, this is right-triangle trigonometry. Projections add along a broken path, because the feet simply follow each other along $L$. Go from $P$ to $Q$ in three steps parallel to the axes: $P\to(x_2,y_1,z_1)\to(x_2,y_2,z_1)\to Q$. The first step has signed length $x_2-x_1$ along the $x$-axis, which makes angle $\alpha$ with $L$, so it projects to $(x_2-x_1)\cos\alpha=l(x_2-x_1)$. The other two steps give $m(y_2-y_1)$ and $n(z_2-z_1)$. $\blacksquare$
If $L_1$, $L_2$ have DCs $(l_1,m_1,n_1)$, $(l_2,m_2,n_2)$ and DRs $(a_1,b_1,c_1)$, $(a_2,b_2,c_2)$, the angle $\theta$ between them satisfies
$$\cos\theta=|l_1l_2+m_1m_2+n_1n_2|=\frac{|a_1a_2+b_1b_2+c_1c_2|}{\sqrt{a_1^2+b_1^2+c_1^2}\,\sqrt{a_2^2+b_2^2+c_2^2}}.$$In particular $L_1\perp L_2\iff a_1a_2+b_1b_2+c_1c_2=0$, and $L_1\parallel L_2\iff\dfrac{a_1}{a_2}=\dfrac{b_1}{b_2}=\dfrac{c_1}{c_2}$. Also, by Lagrange's identity
$$\left(\textstyle\sum a_1^2\right)\left(\textstyle\sum a_2^2\right)-\left(\textstyle\sum a_1a_2\right)^2=(b_1c_2-b_2c_1)^2+(c_1a_2-c_2a_1)^2+(a_1b_2-a_2b_1)^2,$$so $\sin\theta=\dfrac{\sqrt{(b_1c_2-b_2c_1)^2+(c_1a_2-c_2a_1)^2+(a_1b_2-a_2b_1)^2}}{\sqrt{\sum a_1^2}\,\sqrt{\sum a_2^2}}$.
Proof. Let $P=(l_1,m_1,n_1)$ and $Q=(l_2,m_2,n_2)$: by Theorem 11.4 these are the points at distance $1$ from $O$ along the two directions, and $\varphi=\angle POQ$ is the angle between the directed lines. By the distance formula $PQ^2=\sum(l_1-l_2)^2$, which expands to $1+1-2(l_1l_2+m_1m_2+n_1n_2)$, while the cosine rule in triangle $OPQ$ gives $PQ^2=1+1-2\cos\varphi$. So $\cos\varphi=l_1l_2+m_1m_2+n_1n_2$. (Equivalently: project $OQ$, of length $1$, on $L_1$ with Theorem 11.7.) The angle between the lines is $\varphi$ or $\pi-\varphi$, whichever is not obtuse, hence the modulus. Dividing DRs by their lengths gives the second form. Lagrange's identity is checked by expanding both sides: on the left the terms $a_1^2a_2^2$, $b_1^2b_2^2$, $c_1^2c_2^2$ cancel, and the terms that remain (in groups such as $a_1^2b_2^2+a_2^2b_1^2-2a_1a_2b_1b_2$) regroup into the three squares on the right. Then $\sin^2\theta=1-\cos^2\theta$ gives the last formula. $\blacksquare$
Two lines have DRs $(1,-1,2)$ and $(2,4,1)$ and we know no point of either line. What can we say?
The Perpendicular from a Point to a Line
To drop a perpendicular from a point $P$ to a line $L$, slide a point $N$ along $L$ until $PN$ is perpendicular to $L$. Writing $N$ as the general point of $L$ turns this into one linear equation for $\lambda$.
Let $L$ pass through $A(x_1,y_1,z_1)$ with DRs $a,b,c$, and let $P(\alpha,\beta,\gamma)$. The foot of the perpendicular from $P$ to $L$ is $N=(x_1+a\lambda,\ y_1+b\lambda,\ z_1+c\lambda)$ with
$$\lambda=\frac{a(\alpha-x_1)+b(\beta-y_1)+c(\gamma-z_1)}{a^2+b^2+c^2}.$$The distance of $P$ from $L$ is $PN=\sqrt{AP^2-p^2}$, where $p=\dfrac{a(\alpha-x_1)+b(\beta-y_1)+c(\gamma-z_1)}{\sqrt{a^2+b^2+c^2}}$ is the projection of $AP$ on $L$. The image (mirror point) of $P$ in $L$ is $P'=2N-P$.
Proof. $PN$ has DRs $(x_1+a\lambda-\alpha,\ y_1+b\lambda-\beta,\ z_1+c\lambda-\gamma)$; perpendicularity to $L$ (Theorem 11.8) is $a(x_1+a\lambda-\alpha)+b(\dots)+c(\dots)=0$, which solves to the stated $\lambda$. Triangle $ANP$ has a right angle at $N$, and $AN$ is the projection $p$ of $AP$ on $L$ (Theorem 11.7), so Pythagoras gives $PN$. The image is the point with $N$ as the midpoint of $PP'$. $\blacksquare$
The foot of the perpendicular from $P(1,2,3)$ to a line $L$ is $N(2,0,1)$. The image of $P$ in $L$ is
Intersecting, Parallel and Skew Lines
Two lines are coplanar if some plane contains both. Two coplanar lines either intersect (in exactly one point), are parallel (distinct, with proportional DRs) or coincide. Two lines that are not coplanar are called skew: they neither meet nor are parallel.
In a plane "not parallel" means "intersecting"; in space it does not. The edges of a room show all three cases: two edges of the floor that meet at a corner intersect; opposite edges of the floor are parallel; an edge of the floor and a non-parallel edge of the ceiling are skew.
- Write both lines in parametric form: $L_1:\ (x_1+a_1\lambda,\ y_1+b_1\lambda,\ z_1+c_1\lambda)$ and $L_2:\ (x_2+a_2\mu,\ y_2+b_2\mu,\ z_2+c_2\mu)$.
- If the DRs are proportional, the lines are parallel — or the same line, if a point of one lies on the other.
- Otherwise equate the coordinates. Solve two of the three equations for $\lambda,\mu$ and test the third. If it holds, the lines intersect (substitute $\lambda$ to get the point); if not, they are skew.
- For a quick yes/no answer use the determinant test of Theorem 11.11 below.
For skew lines we want the bridge between them that meets both at right angles. Its direction must be perpendicular to two given directions, and there is a neat formula for it.
For DRs $(a_1,b_1,c_1)$ and $(a_2,b_2,c_2)$ put
$$p=b_1c_2-b_2c_1,\qquad q=c_1a_2-c_2a_1,\qquad r=a_1b_2-a_2b_1.$$Then $a_1p+b_1q+c_1r=0$ and $a_2p+b_2q+c_2r=0$, so $(p,q,r)$, if not all zero, are DRs of a direction perpendicular to both lines. And $p=q=r=0$ exactly when the lines are parallel.
Proof. $a_1(b_1c_2-b_2c_1)+b_1(c_1a_2-c_2a_1)+c_1(a_1b_2-a_2b_1)$: the six products cancel in pairs ($a_1b_1c_2$ with $-b_1c_2a_1$, and so on), giving $0$; the same for the second line. By Lagrange's identity (Theorem 11.8), $p^2+q^2+r^2=\left(\sum a_1^2\right)\left(\sum a_2^2\right)\sin^2\theta$, which is $0$ exactly when $\theta=0$. $\blacksquare$ To remember $(p,q,r)$, expand the "determinant" $\begin{vmatrix}\hat i&\hat j&\hat k\\a_1&b_1&c_1\\a_2&b_2&c_2\end{vmatrix}$ along its first row; in Chapter 12 this is the cross product of the two direction vectors.
Let $L_1$, $L_2$ be skew. A line meeting both of them at right angles is a common perpendicular; if it meets them at $P\in L_1$ and $Q\in L_2$, the length $PQ$ is the shortest distance (SD) between the lines.
Why there is exactly one, and why it is shortest. Let $\nu$ be the direction $(p,q,r)$ of Theorem 11.10. For points $X=A+\lambda(a_1,b_1,c_1)$ on $L_1$ and $Y=B+\mu(a_2,b_2,c_2)$ on $L_2$, requiring $XY\perp L_1$ and $XY\perp L_2$ gives two linear equations in $\lambda,\mu$ whose determinant is $\left(\sum a_1^2\right)\left(\sum a_2^2\right)-\left(\sum a_1a_2\right)^2=p^2+q^2+r^2\ne0$ — so they have exactly one solution, the feet $P$, $Q$. Now project any segment $XY$ on $\nu$ (Theorem 11.7). Moving along $L_1$ or $L_2$ does not change the projection, because both lines are perpendicular to $\nu$; so every $XY$ has the same projection as $PQ$, namely $\pm PQ$. A projection is never longer than the segment, so $XY\ge PQ$, with equality only when $XY$ is parallel to $\nu$, i.e. $X=P$, $Y=Q$.
The lines $L_1$ and $L$ of Example 4(c) are skew. Suppose we slide $L$ parallel to itself along the common perpendicular, towards $L_1$. How far must it move before the two lines meet?
$L_1$ passes through $(0,0,0)$ and $L_2$ through $(1,0,0)$; their DRs are $(1,2,3)$ and $(2,4,6)$. The lines are
The Shortest Distance and its Equation
Let $L_1$ pass through $A(x_1,y_1,z_1)$ with DRs $(a_1,b_1,c_1)$, and $L_2$ through $B(x_2,y_2,z_2)$ with DRs $(a_2,b_2,c_2)$, not parallel. With $p,q,r$ as in Theorem 11.10 and
$$D=\begin{vmatrix}x_2-x_1&y_2-y_1&z_2-z_1\\a_1&b_1&c_1\\a_2&b_2&c_2\end{vmatrix},$$the shortest distance between $L_1$ and $L_2$ is
$$d=\frac{|D|}{\sqrt{p^2+q^2+r^2}}.$$Consequently two non-parallel lines intersect (are coplanar) if and only if $D=0$.
Proof. By the argument above, $d$ is the length of the projection of $AB$ (a segment from $L_1$ to $L_2$) on the common normal direction $\nu$, whose DCs are $\tfrac{(p,q,r)}{\sqrt{p^2+q^2+r^2}}$. Theorem 11.7 gives $d=\dfrac{|p(x_2-x_1)+q(y_2-y_1)+r(z_2-z_1)|}{\sqrt{p^2+q^2+r^2}}$, and expanding $D$ along its first row gives exactly $p(x_2-x_1)+q(y_2-y_1)+r(z_2-z_1)$. Lines that are not parallel meet exactly when $d=0$, i.e. $D=0$. $\blacksquare$ (Parallel lines also have $D=0$, since two rows are proportional; they are coplanar too.)
In vector language (Chapter 12): for direction vectors $\vec b_1$, $\vec b_2$ and points with position vectors $\vec a_1$, $\vec a_2$, the sum $a_1a_2+b_1b_2+c_1c_2$ is the dot product $\vec b_1\cdot\vec b_2=|\vec b_1||\vec b_2|\cos\varphi$, and $(p,q,r)$ are the components of the cross product $\vec b_1\times\vec b_2$, perpendicular to both with length $|\vec b_1||\vec b_2|\sin\varphi$. Theorem 11.11 then reads $d=\dfrac{|(\vec a_2-\vec a_1)\cdot(\vec b_1\times\vec b_2)|}{|\vec b_1\times\vec b_2|}$. We have proved every one of these facts directly, so nothing here depends on Chapter 12.
If $L_1$ through $A$ and $L_2$ through $B$ are parallel with common DRs $(a,b,c)$, and $AB$ has components $(u,v,w)=(x_2-x_1,y_2-y_1,z_2-z_1)$, the distance between them is
$$d=\frac{\sqrt{(bw-cv)^2+(cu-aw)^2+(av-bu)^2}}{\sqrt{a^2+b^2+c^2}}=\sqrt{AB^2-\left(\frac{au+bv+cw}{\sqrt{a^2+b^2+c^2}}\right)^2}.$$Proof. The distance between parallel lines is the distance of $B$ from $L_1$, which is the second form by Theorem 11.9; Lagrange's identity turns it into the first. $\blacksquare$ The formula of Theorem 11.11 cannot be used here: $p=q=r=0$ and $D=0$, so it reads $\tfrac00$.
- Take general points $X=A+\lambda(a_1,b_1,c_1)$ on $L_1$ and $Y=B+\mu(a_2,b_2,c_2)$ on $L_2$, and write the DRs of $XY$.
- Impose $XY\perp L_1$ and $XY\perp L_2$ (Theorem 11.8): two linear equations in $\lambda,\mu$.
- Solve; the feet are $P=X(\lambda)$, $Q=Y(\mu)$. Then SD $=PQ$, and the line of shortest distance is the line through $P$ and $Q$ (its DRs must be proportional to $(p,q,r)$ — a free check).
- If only the distance is asked, Theorem 11.11 is faster: one determinant and one square root.
Take the lines of Example 5 with $X$ at $\lambda=-2$ on $L_1$ and $Y$ at $\mu=3$ on $L_2$. Now repeat: drop a perpendicular from $Y$ to $L_1$ (that moves $X$), then from the new $X$ to $L_2$ (that moves $Y$), and so on. What happens?
1. The angle between lines is never obtuse. Take $|a_1a_2+b_1b_2+c_1c_2|$. Without the modulus you get the angle between two directed lines, which may be the supplement.
2. "Not parallel" does not mean "intersecting". In space check the third equation (or $D=0$) before announcing a point of intersection. And "perpendicular" is about directions only: the $x$-axis and the line through $(0,0,1)$ parallel to the $y$-axis are perpendicular and skew.
3. Parallel lines need Theorem 11.12. For them $p=q=r=0$ and $D=0$; the skew-line formula becomes $\tfrac00$, not $0$.
4. The first row of $D$ is a difference of points. It is $(x_2-x_1,\,y_2-y_1,\,z_2-z_1)$ for a point of each line; the other rows are DRs. Read both from the standard form — $\dfrac{2x-1}{3}$ and $\dfrac{1-y}{2}$ hide their points and signs.
5. Distances come with a modulus and a square root. SD $=\tfrac{|D|}{\sqrt{p^2+q^2+r^2}}$, not $\tfrac{D}{p^2+q^2+r^2}$. When a question gives the SD and asks for a parameter, $|D|=d\sqrt{p^2+q^2+r^2}$ usually gives two values.
Planes are listed in the JEE Advanced syllabus; the JEE Main 2026 list for this unit names only points and lines. This box is for interest only; nothing in it is used in the exercises, the Exam corner or the quiz.
A first-degree equation $ax+by+cz+d=0$ describes a plane, and $(a,b,c)$ are DRs of every line perpendicular to it (its normal). Two intersecting lines lie in one plane, and its normal is perpendicular to both, so it is $(p,q,r)$ from Theorem 11.10. For Example 6(a) ($k=3$): $(p,q,r)=(3,-3,-3)\propto(1,-1,-1)$ and the plane through $(5,2,-1)$ is $(x-5)-(y-2)-(z+1)=0$, i.e. $x-y-z=4$; both lines lie in it. The distance of a point $(x_0,y_0,z_0)$ from the plane is $\dfrac{|ax_0+by_0+cz_0+d|}{\sqrt{a^2+b^2+c^2}}$, and for skew lines the shortest distance is the gap between the two parallel planes, with normal $(p,q,r)$, through $L_1$ and $L_2$ — another view of Theorem 11.11.
The $x$-axis and the line through $(0,0,1)$ parallel to the $y$-axis are
Exercises
- 1 Find the angle between lines with DRs $(1,1,0)$ and $(1,0,1)$.
- 2 Find the angle between lines with DRs $(2,2,1)$ and $(6,3,2)$.
- 3 Find $k$ if the lines with DRs $(k,2,3)$ and $(2,k,-4)$ are perpendicular.
- 4 Show that the lines with DRs $(1,2,2)$, $(2,1,-2)$ and $(2,-2,1)$ are mutually perpendicular.
- 5 Find the DCs of a line perpendicular to both of the lines with DRs $(1,2,2)$ and $(2,-2,1)$.
- 6 If $(l_1,m_1,n_1)$ and $(l_2,m_2,n_2)$ are DCs of two perpendicular lines, show that $(m_1n_2-m_2n_1,\ n_1l_2-n_2l_1,\ l_1m_2-l_2m_1)$ are DCs of a line perpendicular to both.
- 7 The DCs of two lines satisfy $2l+2m-n=0$ and $mn+nl+lm=0$. Find the angle between the lines.
- 8 In a cube, find the angle between (a) a diagonal of the cube and an edge, (b) two diagonals of the cube, (c) a diagonal of the cube and a diagonal of a face that it meets.
- 1 Find the foot of the perpendicular from $P(5,1,4)$ to $\dfrac{x-1}1=\dfrac{y+2}2=\dfrac z2$, the distance of $P$ from the line and the image of $P$ in it.
- 2 Find the foot of the perpendicular from the origin to $\dfrac{x-4}2=\dfrac{y-1}{-1}=\dfrac{z-1}2$ and the distance of the origin from the line.
- 3 Find the image of $P(1,2,6)$ in the line $x=y=z$, and the distance of $P$ from that line.
- 4 Find the distance of $P(2,-1,5)$ from the line through $A(1,1,1)$ and $B(3,0,3)$, and hence the area of triangle $PAB$.
- 5 Show that the points of the line in part 1 at distance $\sqrt{30}$ from $P$ are the two points with $\lambda=2\pm\tfrac53$.
- 6 Find the equations of the perpendicular from $P(5,1,4)$ to the line in part 1.
- 7 A straight pipeline runs from $A(0,0,0)$ in the direction with DRs $2,1,2$ (metres). A pump at $P(30,30,0)$ is to be joined to it by the shortest possible straight pipe. Find the junction point and the length of the pipe.
- 1 Show that $L_1$ meets $\dfrac{x-1}1=\dfrac{y-5}{-1}=\dfrac{z+2}2$ and find the point.
- 2 Show that $L_1$ is parallel to $\dfrac{x-3}{-4}=\dfrac y{-2}=\dfrac{z+1}2$ and find the distance between them.
- 3 Show that $L_1$ and $\dfrac x1=\dfrac{y+1}1=\dfrac{z-1}{-2}$ are skew and find the shortest distance.
- 4 Find $k$ so that $\dfrac{x+1}3=\dfrac{y-2}1=\dfrac{z-k}2$ and $\dfrac{x-1}1=\dfrac y{-1}=\dfrac z1$ intersect, and find the point.
- 5 Find the shortest distance between the $z$-axis and the line through $(3,0,4)$ parallel to the $y$-axis.
- 6 A room is $6$ m long, $4$ m wide and $3$ m high, with one corner at the origin and edges along the axes. Find the shortest distance between the diagonal of the room from $(0,0,0)$ to $(6,4,3)$ and the floor edge from $(0,4,0)$ to $(6,4,0)$.
- 7 For the lines $x+1=y,\ z=1$ and $x=1,\ y-1=z-3$, find the feet of the common perpendicular, the shortest distance and the equation of the line of shortest distance.
- 8 For which $k$ do the lines $x=2+t,\ y=1-t,\ z=3t$ and $x=s,\ y=k+s,\ z=1+2s$ intersect? Can they ever be parallel?
- 1 Show that $\dfrac{x-2}1=\dfrac{y+1}2=\dfrac{z-1}2$ and $\dfrac{x+1}2=\dfrac{y-1}{-2}=\dfrac z1$ are perpendicular and skew, and find the shortest distance between them.
- 2 The lines $\dfrac{x-k}1=\dfrac{y-2}2=\dfrac{z+1}2$ and $\dfrac{x-1}2=\dfrac{y-2}4=\dfrac{z+1}4$ are at distance $2\sqrt2$. Find the sum of all possible values of $k$.
- 3 Find the line through $(1,2,-1)$ perpendicular to both $\dfrac{x-1}1=\dfrac{y+2}2=\dfrac z2$ and $\dfrac{x+1}2=\dfrac{y-1}{-2}=\dfrac z1$.
- 4 Do the lines $x=y=z$ and $\dfrac{x-1}1=\dfrac{y+1}{-1}=\dfrac z0$ meet? If so, where?
- 5 An airliner cruises along the line through $(0,0,9)$ with DRs $4,3,0$; a second aircraft climbs along the line through $(10,0,6)$ with DRs $0,3,1$ (km, $z$ = height). How close do the two flight paths come?
E1. JEE Main · MCQ Let $\theta$ be the acute angle between the lines $x=y=z$ and $\dfrac{x-1}2=\dfrac{y-1}{-1}=\dfrac{z-2}2$. Then $\sin\theta$ equals (A) $\tfrac13$ (B) $\sqrt{\tfrac23}$ (C) $\tfrac1{\sqrt3}$ (D) $\tfrac23$
E2. JEE Main · Numerical Let $d$ be the shortest distance between $\dfrac{x+1}2=\dfrac{y-1}1=\dfrac{z-1}2$ and $\dfrac{x+2}4=\dfrac{y-5}{-1}=\dfrac z1$. Find $d^2$. Give the answer to the nearest integer.
E3. JEE Main · MCQ The image of $P(3,3,2)$ in the line $\dfrac x2=\dfrac{y-3}{-2}=\dfrac{z+1}1$ is $(a,b,c)$. Then $a+b+c$ equals (A) $0$ (B) $3$ (C) $-2$ (D) $8$
E4. JEE Main · Numerical The lines $\dfrac{x-1}2=\dfrac{y+1}3=\dfrac{z-2}1$ and $\dfrac{x-4}1=\dfrac{y-k}2=\dfrac{z+1}{-1}$ intersect at $(\alpha,\beta,\gamma)$. Find $k+\alpha+\beta+\gamma$. Give the answer to the nearest integer.
E5. JEE Main · MCQ The shortest distance between the $z$-axis and the line $x+y=2,\ z=3$ is (A) $2$ (B) $3$ (C) $2\sqrt2$ (D) $\sqrt2$
E6. JEE Main · Numerical A cuboid has edges of lengths $1$, $1$ and $\sqrt2$. Among the angles between pairs of its four body diagonals, the smallest is $\theta$. Find $\theta$ in degrees. Give the answer to the nearest integer.
Research question. Robot arms, pipes in a chemical plant and the bones in a computer-animated character are modelled as capsules: a straight segment with a radius around it. Two capsules collide exactly when the distance between their segments is less than the sum of the radii. How do you compute the distance between two segments — not infinite lines — and when does the shortest-distance formula of Theorem 11.11 give the wrong answer?
Why it matters. Collision checks run thousands of times per second in robot motion planners and video-game physics engines. The common perpendicular gives the answer only when both of its feet lie inside the segments; otherwise the closest points sit at an end of a segment.
What to do.
- Write the segments as $X=A+\lambda(B-A)$, $0\le\lambda\le1$, and $Y=C+\mu(D-C)$, $0\le\mu\le1$. Use the strategy box of this section to find $\lambda^*,\mu^*$ for the infinite lines.
- Test three pairs of your own: one where $0\le\lambda^*,\mu^*\le1$, one where only $\lambda^*$ is outside $[0,1]$, and one where both are outside. For each, sketch the situation (Interactive 2's map helps: the allowed pairs form the square $0\le\lambda,\mu\le1$).
- When a foot lies outside, clamp it to the nearer end of its segment, then drop a perpendicular from that end to the other segment (Theorem 11.9), clamping again if needed. Compare the result with a brute-force search over a $100\times100$ grid of $(\lambda,\mu)$.
- Two robot links of radius $0.05$ m run along the segments from $(0,0,0)$ to $(1,0,0)$ and from $(0.5,0.3,-0.4)$ to $(0.5,0.3,0.4)$ (metres). Do they collide? What if the second link is shifted to start at $(1.4,0.3,-0.4)$?
Tools: Paper, a calculator or spreadsheet; optionally a short Python script for the grid search.
Hand in: Your three test cases with sketches, the clamping rule written as a short algorithm, and the two collision verdicts with the distances.
Going further. The function $|XY|^2$ is a quadratic in $(\lambda,\mu)$ whose contours are ellipses (the "bowl" of Interactive 2). Why does its minimum over the square always lie either at the bottom of the bowl or on an edge of the square? What changes for parallel segments, where the bowl becomes a valley?
🧪 Self-check quiz
Q1. Two lines in space that are not parallel
Q2. The angle between lines with DRs $(1,-2,2)$ and $(2,2,1)$ is
Q3. The shortest distance between the $x$-axis and the line $x=0,\ z=5$ is
Q4. Direction ratios of a line perpendicular to both lines with DRs $(1,0,0)$ and $(0,1,1)$ are
Q5. Two lines have non-proportional DRs and the determinant $D$ of Theorem 11.11 is $0$. The lines