11.3 Angle between Two Lines and Shortest Distance
Two lines in space may meet, run parallel, or pass each other without ever meeting. A dot product gives the angle between them; a cross product followed by a dot product gives the shortest distance between them.
In a factory, a hospital or a metro station, the ceiling space is crowded with straight runs of ducts, cables, sprinkler pipes and conveyor rails. Designers must answer two questions about every pair of them. At what angle do they cross? โ a pipe joint or a support bracket is made for one particular angle. And how close do they come? โ a hot-water pipe must keep a minimum distance from an electric cable. On a flat drawing two straight lines that are not parallel always meet. In a building they usually do not: one runs higher than the other, and they pass each other without touching. Such lines are called skew lines.
With the equations of Section 11.2 both questions have short answers. The angle between two lines is the angle between their direction vectors, found with a scalar product; it gives quick tests for perpendicular and parallel lines. The shortest distance between two lines is measured along their common perpendicular; for skew lines it comes from the vector product $\vec b_1\times\vec b_2$ followed by a scalar product, and for parallel lines from a single vector product. A shortest distance of zero tells you that two non-parallel lines intersect.
The Angle between Two Lines
Two lines through a common point form two pairs of opposite angles, $\phi$ and $180^\circ-\phi$. By convention we report the one that is not obtuse. If the lines do not meet, we first slide one of them, without turning it, until it meets the other; sliding does not change directions.
Proof. By the scalar product (Section 10.3), $\vec b_1\cdot\vec b_2=|\vec b_1|\,|\vec b_2|\cos\phi$, where $\phi\in[0,\pi]$ is the angle between the vectors. By Definition 11.4, $\theta=\phi$ or $\theta=\pi-\phi$, and in both cases $\cos\theta=|\cos\phi|$ because $\cos(\pi-\phi)=-\cos\phi$ and $\cos\theta\ge0$. So $\cos\theta=\dfrac{|\vec b_1\cdot\vec b_2|}{|\vec b_1||\vec b_2|}$. Writing the vectors in components gives the second form; with direction cosines both lengths are $1$. $\square$
(a) perpendicular if and only if $a_1a_2+b_1b_2+c_1c_2=0$;
(b) parallel (or the same line) if and only if their direction ratios are proportional, $\dfrac{a_1}{a_2}=\dfrac{b_1}{b_2}=\dfrac{c_1}{c_2}$ (with the usual reading when a ratio is $0$).
(a) is the case $\cos\theta=0$ of Theorem 11.8. For (b), the lines are parallel exactly when $\theta=0$, i.e. when $\vec b_1$ and $\vec b_2$ are collinear vectors: $\vec b_2=t\vec b_1$ for some $t\ne0$. Note that โperpendicular linesโ in space need not meet โ they only have perpendicular directions.
Intersecting, Parallel and Skew Lines
In a plane, two different lines either meet in one point or are parallel. In space there is a third possibility. Think of the edge where the floor of a room meets the front wall, and the edge where the ceiling meets a side wall: they are not parallel, yet they never meet.
For $L_1:\ \vec r=\vec a_1+\lambda\vec b_1$ and $L_2:\ \vec r=\vec a_2+\mu\vec b_2$:
- Compare directions. If $\vec b_1$ and $\vec b_2$ are proportional, the lines are parallel โ and they are the same line if, in addition, a point of $L_2$ lies on $L_1$.
- Otherwise, look for a common point. Equate the general points: three equations in the two unknowns $\lambda,\mu$. Solve two of them.
- Test the third equation. If it holds, the lines intersect, and substituting $\lambda$ gives the point of intersection. If it fails, the lines are skew.
Shortest Distance between Two Lines
For skew lines the natural question is how close they come. Among all segments joining a point of $L_1$ to a point of $L_2$ there is a shortest one, and it meets both lines at right angles (if it were not perpendicular to $L_1$, say, sliding its end along $L_1$ would shorten it, as in the foot-of-perpendicular argument of Section 11.2).
Proof. Let $A_1$ and $A_2$ be the points with position vectors $\vec a_1$ and $\vec a_2$, and let $PQ$ be the common perpendicular ($P$ on $L_1$, $Q$ on $L_2$). The vector $\vec b_1\times\vec b_2$ is perpendicular to both $\vec b_1$ and $\vec b_2$ (Section 10.4), and so is $\overrightarrow{PQ}$; hence $\overrightarrow{PQ}$ is parallel to the unit vector $\hat n=\dfrac{\vec b_1\times\vec b_2}{|\vec b_1\times\vec b_2|}$, and $\overrightarrow{PQ}\cdot\hat n=\pm PQ$. Now go from $A_1$ to $A_2$ the long way round: $$\overrightarrow{A_1A_2}=\overrightarrow{A_1P}+\overrightarrow{PQ}+\overrightarrow{QA_2}.$$ Here $\overrightarrow{A_1P}$ is a multiple of $\vec b_1$ and $\overrightarrow{QA_2}$ a multiple of $\vec b_2$, so both have scalar product $0$ with $\hat n$. Taking the scalar product of the equation with $\hat n$ leaves $(\vec a_2-\vec a_1)\cdot\hat n=\overrightarrow{PQ}\cdot\hat n=\pm PQ$. Taking absolute values gives the formula. Finally, the lines meet exactly when the shortest distance is $0$. $\square$
The quantity on top is an ordinary scalar product of two vectors: first find the vector $\vec b_1\times\vec b_2$, then take its scalar product with $\vec a_2-\vec a_1$. In Cartesian form, with $L_1$ through $(x_1,y_1,z_1)$ with ratios $a_1,b_1,c_1$ and $L_2$ through $(x_2,y_2,z_2)$ with ratios $a_2,b_2,c_2$, the same arithmetic can be laid out as a $3\times3$ determinant (expand it as in Section 4.1):
$$d=\frac{\left|\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}\right|}{\sqrt{D}},$$ $$\begin{aligned}D&=(b_1c_2-b_2c_1)^2+(c_1a_2-c_2a_1)^2\\&\quad+(a_1b_2-a_2b_1)^2.\end{aligned}$$When the lines are parallel, $\vec b_1\times\vec b_2=\vec 0$ and Theorem 11.10 cannot be used. Instead, every point of $L_2$ is at the same distance from $L_1$, so we measure from one point.
Proof. Let $A_1$, $A_2$ be the points with position vectors $\vec a_1$, $\vec a_2$, let $T$ be the foot of the perpendicular from $A_2$ to $L_1$, and let $\theta$ be the angle between $\overrightarrow{A_1A_2}$ and $\vec b$. In the right triangle $A_1TA_2$, $d=A_2T=A_1A_2\sin\theta$. Since $|\vec b\times(\vec a_2-\vec a_1)|=|\vec b|\,A_1A_2\sin\theta$ (Section 10.4), dividing by $|\vec b|$ gives the formula. $\square$
1. Forgetting the absolute value. The angle between two lines is never obtuse, and a distance is never negative. Write $|\ldots|$ in both formulas.
2. Using points instead of directions. In $\cos\theta$ use the direction ratios (the denominators of the Cartesian form), not the points (the numbers in the numerators).
3. The skew-lines formula on parallel lines. If $\vec b_1\times\vec b_2=\vec 0$ the formula gives $\tfrac00$. Check for parallel directions first and use Theorem 11.11.
4. Wrong sign in the cross product. The middle component of $\vec b_1\times\vec b_2$ is $c_1a_2-a_1c_2$ (note the order). A slip here changes the answer completely; check that your $\vec b_1\times\vec b_2$ has scalar product $0$ with both $\vec b_1$ and $\vec b_2$.
5. โNot parallel, so they meet.โ That is true in two dimensions but false in space. Two equations may give $\lambda$ and $\mu$; always test the third.
In JEE Advanced 2026; not in the CBSE Class 12 syllabus or JEE Main. The ๐ box of Section 11.2 described the plane $ax+by+cz+d=0$ with normal $\vec n=a\hat i+b\hat j+c\hat k$. The perpendicular distance of a point $P(x_1,y_1,z_1)$ from it is $$\frac{|ax_1+by_1+cz_1+d|}{\sqrt{a^2+b^2+c^2}}.$$ Why: the perpendicular from $P$ runs along $\vec n$, so its foot is $P+t\vec n$ for the $t$ that puts it on the plane: $ax_1+by_1+cz_1+d+t(a^2+b^2+c^2)=0$. The distance is $|t|\,|\vec n|$, which simplifies to the formula. Worked example. The distance of $(2,1,-1)$ from $x+2y-2z+6=0$ is $\dfrac{|2+2+2+6|}{\sqrt{1+4+4}}=\dfrac{12}3=4$ units. Check: $t=-\tfrac{12}{9}=-\tfrac43$, and $|t|\,|\vec n|=\tfrac43\cdot3=4$ โ.
Exercises
- 1 Find the angle between the lines with direction ratios $2,2,1$ and $4,1,8$.
- 2 Find the angle between the lines with direction ratios $1,-1,0$ and $1,0,-1$.
- 3 Find the angle between $\vec r=(2\hat i-\hat j)+\lambda(3\hat i+2\hat j+6\hat k)$ and $\vec r=(\hat i+\hat k)+\mu(2\hat i-6\hat j+3\hat k)$.
- 4 Find the angle between $\dfrac{x-1}{2}=\dfrac{y+2}{-1}=\dfrac z2$ and the line $\dfrac{x+3}{1}=\dfrac{y-1}{2},\ z=4$.
- 5 Show that the lines with direction ratios $1,-2,3$ and $4,5,2$ are perpendicular.
- 6 Find $k$ so that the lines with direction ratios $k,1,-2$ and $3,k,4$ are perpendicular.
- 7 Find $k$ so that the lines with direction ratios $2,k,-1$ and $-4,6,2$ are parallel.
- 8 In a cube, find the angle between a body diagonal and a face diagonal starting at the same corner, and the angle between two body diagonals.
- 1 Decide how $L_1$ and $\vec r=(4\hat i+\hat j+2\hat k)+\mu(2\hat i+\hat j+\hat k)$ lie; find any common point.
- 2 The same for $L_1$ and $\vec r=(2\hat j+3\hat k)+\mu(-2\hat i+2\hat j-2\hat k)$.
- 3 The same for $L_1$ and $\vec r=\hat k+\mu(\hat i+\hat j)$.
- 4 Show that $\dfrac{x-1}{2}=\dfrac{y-2}{3}=\dfrac{z-3}{4}$ and $\dfrac{x-4}{5}=\dfrac{y-1}{2}=\dfrac z1$ intersect, and find the point of intersection.
- 5 For which $k$ do $\vec r=(\hat i+2\hat j+3\hat k)+\lambda(\hat i+\hat k)$ and $\vec r=k\hat i+\mu(\hat j+\hat k)$ intersect? Find the point.
- 6 Two different lines are both perpendicular to the $z$-axis. Must they be parallel? Give an example.
- 1 Find the shortest distance between the $x$-axis and the line $\vec r=2\hat k+\mu(\hat i+\hat j)$.
- 2 Find the shortest distance between $\vec r=(\hat i+\hat j+\hat k)+\lambda(2\hat i-\hat j+\hat k)$ and $\vec r=(2\hat i+\hat j-\hat k)+\mu(3\hat i-5\hat j+2\hat k)$.
- 3 Find the shortest distance between $\dfrac{x-1}{2}=\dfrac{y+1}{1}=\dfrac{z}{-1}$ and $\dfrac{x-2}{1}=\dfrac{y}{-1}=\dfrac{z-3}{2}$.
- 4 Find the distance between $\vec r=(\hat i+\hat j)+\lambda(2\hat i-\hat j+2\hat k)$ and $\vec r=(2\hat i+\hat j-\hat k)+\mu(4\hat i-2\hat j+4\hat k)$.
- 5 Find the distance between $\dfrac{x-1}{1}=\dfrac{y-2}{2}=\dfrac{z-3}{2}$ and $\dfrac{x+1}{1}=\dfrac{y}{2}=\dfrac{z-1}{2}$.
- 6 Use Theorem 11.10 to confirm that the lines of Exercise II.4 intersect.
- 7 In a cube of side $1$ with a corner at $O$ and edges along the axes, find the shortest distance between the body diagonal $x=y=z$ and the edge $x=1,\ z=0$.
- 8 Ducts. In an illustrative factory plan (metres), one duct runs along $\vec r=3\hat k+\lambda\hat i$ and another along $\vec r=4\hat j+5\hat k+\mu(\hat j+\hat k)$. A safety rule needs at least $1.5$ m between them. Is it met?
Whole numbers from โ99 to 99. For a Cartesian equation, $\vec a$ is the point and $\vec b$ the direction ratios.
- 1 Show directly that if $L_1:\ \vec r=\vec a_1+\lambda\vec b_1$ and $L_2:\ \vec r=\vec a_2+\mu\vec b_2$ have a common point, then $(\vec b_1\times\vec b_2)\cdot(\vec a_2-\vec a_1)=0$.
- 2 Find $k$ so that $\dfrac{x-1}{1}=\dfrac{y-2}{2}=\dfrac{z-3}{3}$ and $\dfrac{x-2}{1}=\dfrac{y-k}{1}=\dfrac{z-4}{2}$ intersect, and find the point of intersection.
- 3 Show that the line through $(0,0,0)$ and $(1,1,1)$ and the line through $(1,0,0)$ and $(0,1,0)$ are perpendicular but do not meet, and find the shortest distance between them.
- 4 Two non-parallel lines have direction cosines $l_1,m_1,n_1$ and $l_2,m_2,n_2$. Show that a line with direction ratios $m_1n_2-m_2n_1,\ n_1l_2-n_2l_1,\ l_1m_2-l_2m_1$ is perpendicular to both.
How this is examined: the angle between two lines and the perpendicular/parallel conditions appear as 1- and 2-mark questions (often โfind $k$โ); the shortest distance between two skew or parallel lines is a regular 3- or 5-mark question, frequently combined with writing the equation of a line through two points. JEE adds the feet of the common perpendicular and intersection conditions.
E1. Board ยท 1 mark If $\theta$ is the angle between the lines with direction ratios $1,-1,2$ and $2,1,-1$, then $\cos\theta$ equals (A) $\tfrac16$ (B) $-\tfrac16$ (C) $\tfrac1{\sqrt6}$ (D) $\tfrac56$
E2. Board ยท 2 marks Find $k$ so that the lines $\dfrac{x-2}{k}=\dfrac{y+1}{2}=\dfrac{z}{-3}$ and $\dfrac{x}{1}=\dfrac{y-3}{k}=\dfrac{z+1}{2}$ are perpendicular.
E3. Board ยท 3 marks Find the distance between the lines $\vec r=(2\hat i-\hat j+\hat k)+\lambda(\hat i-2\hat j+2\hat k)$ and $\vec r=(\hat i+\hat j+3\hat k)+\mu(-2\hat i+4\hat j-4\hat k)$.
E4. Board ยท 5 marks (i) Find the vector and Cartesian equations of the line $L_1$ through $A(1,-1,2)$ and $B(2,1,1)$. (ii) Find the shortest distance between $L_1$ and $L_2:\ \dfrac x2=\dfrac{y-1}{1}=\dfrac{z+2}{-2}$. (iii) Do $L_1$ and $L_2$ intersect?
E5. JEE Main The shortest distance between the lines $\vec r=(\hat i-\hat j)+\lambda(2\hat i+\hat k)$ and $\vec r=(2\hat i-\hat j)+\mu(\hat i+\hat j-\hat k)$ is (A) $\tfrac1{\sqrt{14}}$ (B) $\tfrac2{\sqrt5}$ (C) $\tfrac3{\sqrt{14}}$ (D) $0$
E6. JEE Advanced (One or more correct options.) For $L_1:\ \vec r=(\hat i+2\hat k)+\lambda(\hat i+2\hat j+\hat k)$ and $L_2:\ \vec r=(2\hat i+3\hat j+\hat k)+\mu(2\hat i+\hat j-\hat k)$ (Example 4), let $PQ$ be the common perpendicular, $P$ on $L_1$, $Q$ on $L_2$. Then (A) $PQ=\sqrt3$ (B) $P=\left(\tfrac53,\tfrac43,\tfrac83\right)$ (C) $PQ$ has direction ratios $1,-1,1$ (D) $Q=(2,3,1)$
Research question. Two aircraft cruising near a busy airport follow nearly straight paths. How close do their paths come โ and is that the same as how close the aircraft come?
Why it matters. Air-traffic control keeps aircraft apart by fixed separation standards (a minimum vertical gap or a minimum horizontal gap). The shortest distance between two straight flight paths is a first, purely geometric, safety check; the actual closest approach also depends on when each aircraft reaches each point.
What to do.
- From a public flight-tracking website, record two positions (latitude, longitude, altitude), about one minute apart, for each of two aircraft in the same area. (If you cannot get live data, invent realistic positions and label them as illustrative.)
- Convert to local coordinates in km: $x=\Delta(\text{longitude})\times111.3\cos(\text{latitude})$, $y=\Delta(\text{latitude})\times110.6$, $z=$ altitude in km, measured from a reference point near both aircraft.
- Write the vector equation of each path, decide whether the paths are parallel, intersecting or skew, and compute the shortest distance between them with Theorem 11.10 or 11.11.
- Now use time as the parameter: position $=$ first point $+\,t\times$(displacement per minute). Find, with a spreadsheet, the time at which the two aircraft are closest, and that distance.
Tools: A flight-tracking website, spreadsheet (RADIANS, COS, SQRT), a calculator for the cross product.
Hand in: Your data table, both equations, the shortest distance between the paths, the closest approach of the aircraft, and a paragraph explaining why the two numbers differ.
Going further. Find out what the vertical and horizontal separation standards are for aircraft near an airport, and whether your pair would have needed an instruction from the controller.
๐งช Self-check quiz
Q1. The angle between the lines with direction ratios $1,0,0$ and $0,1,1$ is
Q2. Two different lines in space that do not intersect must be
Q3. Two non-parallel lines satisfy $(\vec b_1\times\vec b_2)\cdot(\vec a_2-\vec a_1)=0$. Then the lines
Q4. The distance between the parallel lines $\vec r=\vec a_1+\lambda\vec b$ and $\vec r=\vec a_2+\mu\vec b$ is
Q5. Lines with direction ratios $2,-1,3$ and $-4,2,-6$ are