Once lines are written as "point plus direction", every relationship between two of them is governed by their direction vectors $\vec b_1$ and $\vec b_2$. Two questions dominate the exam: what is the angle between the lines, and — if they never meet — how far apart are they?
Angle between two lines
The angle $\theta$ between two lines is the angle between their direction vectors. Using the dot product,
$$\cos\theta=\dfrac{|\vec b_1\cdot\vec b_2|}{|\vec b_1|\,|\vec b_2|}.$$
The absolute value is deliberate: it selects the acute angle, which is the conventional answer for an undirected line. In direction-ratio terms, if $\vec b_1=(a_1,b_1,c_1)$ and $\vec b_2=(a_2,b_2,c_2)$,
$$\cos\theta=\dfrac{|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}}.$$
If the lines are given by direction cosines $(l_1,m_1,n_1)$ and $(l_2,m_2,n_2)$, the denominators are $1$ and the formula simplifies to $\cos\theta=|l_1l_2+m_1m_2+n_1n_2|$.
Parallel and perpendicular conditions
Two special cases fall straight out of the dot and cross products:
| Relation | Vector test | Ratio test |
|---|
| Perpendicular | $\vec b_1\cdot\vec b_2=0$ | $a_1a_2+b_1b_2+c_1c_2=0$ |
| Parallel | $\vec b_1\times\vec b_2=\vec 0$ | $\dfrac{a_1}{a_2}=\dfrac{b_1}{b_2}=\dfrac{c_1}{c_2}$ |
Perpendicular lines need not intersect — in space, "perpendicular" only constrains the directions.
Shortest distance between two skew lines
Two lines in space are skew if they are neither parallel nor intersecting. The shortest distance between them is measured along their common perpendicular. For $\vec r=\vec a_1+\lambda\vec b_1$ and $\vec r=\vec a_2+\mu\vec b_2$,
$$d=\dfrac{\big|(\vec b_1\times\vec b_2)\cdot(\vec a_2-\vec a_1)\big|}{|\vec b_1\times\vec b_2|}.$$
The idea: $\vec b_1\times\vec b_2$ points along the common perpendicular, so projecting the gap vector $\vec a_2-\vec a_1$ onto that unit direction gives the shortest distance. The numerator is the scalar triple product $[\vec b_1\ \vec b_2\ (\vec a_2-\vec a_1)]$.
Intersecting / coplanar lines
If $d=0$ the two lines meet, because the gap vector lies in the plane of the two directions. Hence the coplanarity (intersection) condition is
$$(\vec b_1\times\vec b_2)\cdot(\vec a_2-\vec a_1)=0,$$
equivalently the determinant with rows $\vec a_2-\vec a_1$, $\vec b_1$, $\vec b_2$ vanishes. Non-parallel lines satisfying this actually intersect.
Distance between parallel lines
When the lines are parallel, $\vec b_1\times\vec b_2=\vec 0$ and the skew formula breaks down. Take a single common direction $\vec b$; the distance between $\vec r=\vec a_1+\lambda\vec b$ and $\vec r=\vec a_2+\mu\vec b$ is the perpendicular component of the gap vector:
$$d=\dfrac{|\vec b\times(\vec a_2-\vec a_1)|}{|\vec b|}.$$
Deeper Insight — dot product for angles, cross product for distances. The two tools split the work cleanly. The dot product measures alignment, so it answers every "angle / perpendicular / parallel" question. The cross product produces a vector perpendicular to both directions, which is exactly what a shortest-distance measurement needs. Reading $d=0$ as "the lines are coplanar" turns the intimidating intersection problem into one tidy scalar-triple-product check, and recognising when $\vec b_1\times\vec b_2=\vec 0$ (parallel case) tells you to switch formulas before you ever divide by zero. Decide first whether the lines are parallel; everything else follows.
Find the angle between lines with directions $\vec b_1=\hat i+\hat j+\hat k$ and $\vec b_2=\hat i-\hat j+\hat k$.
Solution- $\vec b_1\cdot\vec b_2=(1)(1)+(1)(-1)+(1)(1)=1$.
- $|\vec b_1|=|\vec b_2|=\sqrt3$.
- $\cos\theta=\dfrac{|1|}{\sqrt3\cdot\sqrt3}=\dfrac13$.
Answer: $\theta=\cos^{-1}\!\left(\tfrac13\right)$.
Show that the lines with directions $\hat i+\hat j$ and $\hat i-\hat j$ are perpendicular.
Solution- Compute the dot product: $(1)(1)+(1)(-1)+0=0$.
- A zero dot product means $\theta=90^\circ$.
Answer: The lines are perpendicular, since $\vec b_1\cdot\vec b_2=0$.
Are the lines with directions $2\hat i+4\hat j+6\hat k$ and $\hat i+2\hat j+3\hat k$ parallel?
Solution- Check proportionality: $\tfrac21=\tfrac42=\tfrac63=2$.
- So $\vec b_1=2\vec b_2$, giving $\vec b_1\times\vec b_2=\vec 0$.
Answer: Yes — one direction is a scalar multiple of the other, so the lines are parallel.
State the shortest-distance formula and the condition for two lines to intersect.
Solution- The shortest distance projects the gap onto the common perpendicular $\vec b_1\times\vec b_2$.
- Intersection is the case where that projection is zero.
Answer: $d=\dfrac{|(\vec b_1\times\vec b_2)\cdot(\vec a_2-\vec a_1)|}{|\vec b_1\times\vec b_2|}$; the lines intersect (are coplanar) when $(\vec b_1\times\vec b_2)\cdot(\vec a_2-\vec a_1)=0$.
Find the angle between the lines with direction ratios $(1,2,2)$ and $(2,2,1)$.
Solution- Dot of ratios: $(1)(2)+(2)(2)+(2)(1)=2+4+2=8$.
- Magnitudes: $\sqrt{1+4+4}=3$ and $\sqrt{4+4+1}=3$.
- $\cos\theta=\dfrac{8}{3\cdot 3}=\dfrac89$.
Answer: $\theta=\cos^{-1}\!\left(\tfrac89\right)$.
Find $\lambda$ so that the lines with direction ratios $(2,\lambda,3)$ and $(1,-1,2)$ are perpendicular.
Solution- Perpendicular $\Rightarrow$ dot product $=0$.
- $(2)(1)+(\lambda)(-1)+(3)(2)=0$.
- $2-\lambda+6=0\Rightarrow \lambda=8$.
Answer: $\lambda=8$.
Find the angle between the lines $\dfrac{x-2}{2}=\dfrac{y-1}{5}=\dfrac{z+3}{-3}$ and $\dfrac{x+2}{-1}=\dfrac{y-4}{8}=\dfrac{z-5}{4}$.
Solution- DRs: $\vec b_1=(2,5,-3)$, $\vec b_2=(-1,8,4)$.
- $\vec b_1\cdot\vec b_2=(2)(-1)+(5)(8)+(-3)(4)=-2+40-12=26$.
- $|\vec b_1|=\sqrt{4+25+9}=\sqrt{38}$, $|\vec b_2|=\sqrt{1+64+16}=\sqrt{81}=9$.
- $\cos\theta=\dfrac{26}{9\sqrt{38}}$.
Answer: $\theta=\cos^{-1}\!\left(\dfrac{26}{9\sqrt{38}}\right)$.
Show that the line through $(1,-1,2)$ and $(3,4,-2)$ is perpendicular to the line through $(0,3,2)$ and $(3,5,6)$.
Solution- First direction: $(3-1,\ 4-(-1),\ -2-2)=(2,5,-4)$.
- Second direction: $(3-0,\ 5-3,\ 6-2)=(3,2,4)$.
- Dot product: $(2)(3)+(5)(2)+(-4)(4)=6+10-16=0$.
Answer: The dot product is $0$, so the two lines are perpendicular.
Find the shortest distance between $\vec r=(\hat i+2\hat j+\hat k)+\lambda(\hat i-\hat j+\hat k)$ and $\vec r=(2\hat i-\hat j-\hat k)+\mu(2\hat i+\hat j+2\hat k)$.
Solution- $\vec a_1=(1,2,1)$, $\vec b_1=(1,-1,1)$; $\vec a_2=(2,-1,-1)$, $\vec b_2=(2,1,2)$.
- $\vec b_1\times\vec b_2=\big((-1)(2)-(1)(1),\ (1)(2)-(1)(2),\ (1)(1)-(-1)(2)\big)=(-3,0,3)$.
- $|\vec b_1\times\vec b_2|=\sqrt{9+0+9}=3\sqrt2$.
- $\vec a_2-\vec a_1=(1,-3,-2)$.
- $(\vec b_1\times\vec b_2)\cdot(\vec a_2-\vec a_1)=(-3)(1)+0+3(-2)=-9$.
- $d=\dfrac{|-9|}{3\sqrt2}=\dfrac{9}{3\sqrt2}=\dfrac{3}{\sqrt2}$.
Answer: $d=\dfrac{3}{\sqrt2}=\dfrac{3\sqrt2}{2}$ units.
Show that the lines $\dfrac{x-1}{2}=\dfrac{y-2}{3}=\dfrac{z-3}{4}$ and $\dfrac{x-4}{5}=\dfrac{y-1}{2}=\dfrac{z}{1}$ intersect (are coplanar).
Solution- $\vec a_1=(1,2,3)$, $\vec b_1=(2,3,4)$; $\vec a_2=(4,1,0)$, $\vec b_2=(5,2,1)$.
- $\vec a_2-\vec a_1=(3,-1,-3)$.
- $\vec b_1\times\vec b_2=\big((3)(1)-(4)(2),\ (4)(5)-(2)(1),\ (2)(2)-(3)(5)\big)=(-5,18,-11)$.
- $(\vec b_1\times\vec b_2)\cdot(\vec a_2-\vec a_1)=(-5)(3)+(18)(-1)+(-11)(-3)=-15-18+33=0$.
- The triple product is zero and the lines are not parallel.
Answer: The shortest distance is $0$, so the lines are coplanar and intersect.
Find the distance between the parallel lines $\vec r=(\hat i+\hat j)+\lambda(2\hat i-\hat j+\hat k)$ and $\vec r=(2\hat i+\hat j-\hat k)+\mu(2\hat i-\hat j+\hat k)$.
Solution- Common direction $\vec b=(2,-1,1)$, $|\vec b|=\sqrt{4+1+1}=\sqrt6$.
- Gap vector $\vec a_2-\vec a_1=(2-1,\ 1-1,\ -1-0)=(1,0,-1)$.
- $\vec b\times(\vec a_2-\vec a_1)=\big((-1)(-1)-(1)(0),\ (1)(1)-(2)(-1),\ (2)(0)-(-1)(1)\big)=(1,3,1)$.
- $|\vec b\times(\vec a_2-\vec a_1)|=\sqrt{1+9+1}=\sqrt{11}$.
- $d=\dfrac{\sqrt{11}}{\sqrt6}$.
Answer: $d=\dfrac{\sqrt{11}}{\sqrt6}=\sqrt{\dfrac{11}{6}}$ units.