How to tell if two lines in 3D are parallel, intersecting, perpendicular, or skew

Two lines in space can miss each other even when they point in different directions. We’ll compare their directions first, then check whether they share a point.

Compare the direction vectors

Write the lines as L1(t)=P+tu and L2(s)=Q+sv, where u and v are nonzero direction vectors. The directions are parallel when one vector is a scalar multiple of the other. Equivalently, their cross product is the zero vector. This check works when a component is zero too.

If the directions are parallel, check whether Q-P is a scalar multiple of u. If so, the lines coincide. Otherwise, they are distinct parallel lines.

Check whether the lines meet

If the directions aren’t parallel, set the matching x-, y-, and z-coordinates equal and solve for t and s. An intersection requires the same pair of parameter values to satisfy all three equations. If there’s no such pair, the lines are skew.

If the lines meet, compute u·v. A zero dot product means the intersecting lines are perpendicular. The dot product uses their direction vectors. Two nonintersecting lines can have orthogonal directions and still be skew.

Example: Test the two lines

L1(t)=(1+5t,-3+2t,1+t)L2(s)=(2+3s,3+4s,3-2s)

The direction vectors (5,2,1) and (3,4,-2) are not scalar multiples. The x-components would require a factor of 53, while the y-components would require 12.

To test for an intersection, first set the x- and y-coordinates equal. The x-equation gives t=1+3s5. Substitute into the y-equation.

-3+2(1+3s5)=3+4s-285=145ss=-2,t=-1

These are the only values that make both the x- and y-coordinates agree. The first line gives a height of 1-1=0 units. The second gives a height of 3-2(-2)=7 units. So the lines don’t meet. Since they’re also not parallel, they’re skew.

Two lines have different heights where their x and y values agreeA blue line passes through negative four, negative five, zero. A pink line passes through negative four, negative five, seven. A dashed vertical segment joins the two points, which have the same x and y coordinates.(−4, −5, 0)(−4, −5, 7)z gap: 7L₁L₂
The x- and y-coordinates agree, but the z-coordinates differ by 7. The lines miss each other.

Example: Check the angle after the lines meet

The lines (t,0,0) and (0,s,0) meet at the origin. Their direction vectors are (1,0,0) and (0,1,0). Their dot product is 1·0+0·1+0·0=0, so the lines are perpendicular.