Skip to content

Mathematics · Ch 11 — Three-Dimensional Geometry

Direction Cosines of a Line Passing Through Two Points

11.2.1

Direction Cosines of a Line Passing Through Two Points

Direction Cosines of a Line Through Two Points

Through two distinct points in space passes exactly one line, and we can find its direction cosines directly from the coordinates of the two points.

The Geometric Setup

Consider P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2), and let line PQPQ have direction cosines l,m,nl, m, n, making angles α,β,γ\alpha, \beta, \gamma with the xx, yy, zz axes. Drop perpendiculars from PP and QQ to the XYXY-plane, meeting at RR and SS, and from PP draw a perpendicular to QSQS meeting it at NN. This creates right triangle PNQPNQ with ∠PQN=γ\angle PQN = \gamma, where the vertical side NQNQ equals z2−z1z_2 - z_1.

Deriving the Direction Cosines

In right triangle PNQPNQ, NQNQ is opposite γ\gamma and PQPQ is the hypotenuse, so:

cos⁡γ=NQPQ=z2−z1PQ\cos \gamma = \frac{NQ}{PQ} = \frac{z_2 - z_1}{PQ}

By constructing analogous right triangles for the other axes:

cos⁡α=x2−x1PQandcos⁡β=y2−y1PQ\cos \alpha = \frac{x_2 - x_1}{PQ} \quad \text{and} \quad \cos \beta = \frac{y_2 - y_1}{PQ}

Direction Cosines of Line Through Two Points

l=x2−x1PQ,m=y2−y1PQ,n=z2−z1PQl = \frac{x_2 - x_1}{PQ}, \quad m = \frac{y_2 - y_1}{PQ}, \quad n = \frac{z_2 - z_1}{PQ}

where PQ=(x2−x1)2+(y2−y1)2+(z2−z1)2PQ = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}

Direction Ratios: A Simpler Alternative

While direction cosines require division by PQPQ, we often use direction ratios — any three numbers proportional to the direction cosines.

Important

For the line joining P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2), the direction ratios can be taken as:

x2−x1,y2−y1,z2−z1x_2 - x_1, \quad y_2 - y_1, \quad z_2 - z_1

or equivalently:

x1−x2,y1−y2,z1−z2x_1 - x_2, \quad y_1 - y_2, \quad z_1 - z_2

The two sets differ only by a factor of −1-1, which reverses the direction of the line; both are valid. …

Figure 11.2Two-panel construction relating the direction cosines of a segment PQ to its projections, with perpendiculars to the XY-plane in panel (a) and the right-angled triangle PQN carrying angle gamma in panel (b).
Fig. 11.2 — Two-panel construction relating the direction cosines of a segment PQ to its projections, with perpendiculars to the XY-plane in panel (a) and the right-angled triangle PQN carrying angle gamma in panel (b).

Drawn by us to help you understand the concept clearly, and verified to make sure it's accurate. For exams, practice from your textbook's own diagram.

The figure is built around a single geometric idea: to find the direction cosines of a line segment in space, drop perpendiculars to the coordinate planes and use the right triangles that appear.

Panel (a) shows the actual 3‑D setup. Points P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2) are joined by the segment PQPQ (often drawn in indigo). From each point a perpendicular is dropped to the XYXY-plane: PRPR from PP meets the plane at RR, and QSQS from QQ meets it at SS. Because RR and SS lie in the XYXY-plane, the segment RSRS is horizontal — it lies parallel to the XYXY-plane. A line PNPN is drawn parallel to RSRS, meeting QSQS at NN. This construction creates a right triangle PQNPQN with the right angle at NN: PNPN is horizontal (parallel to RSRS), QNQN is vertical (since QSQS is perpendicular to the XYXY-plane), so PN⊥QNPN \perp QN.

Panel (b) isolates that right triangle PQNPQN and places it in a clean coordinate frame with axes XX, YY, ZZ meeting at the origin OO. The hypotenuse is PQPQ. The angle at QQ in this triangle is labelled γ\gamma, and by alternate angles the same γ\gamma appears at PP. The side QNQN is the vertical separation between PP and QQ — that is, QN=z2−z1QN = z_2 - z_1 (taking z2>z1z_2 > z_1). The side PNPN equals RSRS, which is the horizontal distance between the feet of the perpendiculars; but more directly, PNPN is the length of the projection of PQPQ onto the XYXY-plane.

From the right triangle PQNPQN we get the fundamental relation:

cos⁡γ=QNPQ=z2−z1PQ\cos\gamma = \frac{QN}{PQ} = \frac{z_2 - z_1}{PQ}

The same reasoning applied to the other two coordinate planes gives:

cos⁡α=x2−x1PQ,cos⁡β=y2−y1PQ\cos\alpha = \frac{x_2 - x_1}{PQ}, \qquad \cos\beta = \frac{y_2 - y_1}{PQ}

where α\alpha, β\beta, γ\gamma are the angles PQPQ makes with the positive xx, yy, zz axes respectively.

Direction cosines of the line joining P(x1,y1,z1)P(x_1,y_1,z_1) and Q(x2,y2,z2)Q(x_2,y_2,z_2)

l=x2−x1PQ,m=y2−y1PQ,n=z2−z1PQl = \frac{x_2 - x_1}{PQ},\quad m = \frac{y_2 - y_1}{PQ},\quad n = \frac{z_2 - z_1}{PQ}

where PQ=(x2−x1)2+(y2−y1)2+(z2−z1)2PQ = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2 + (z_2-z_1)^2}.

The figure’s real teaching point is that direction cosines are simply the ratios of the coordinate differences to the length of the segment — they are not abstract numbers but come directly from the geometry of a right triangle. The perpendiculars to the XYXY-plane and the parallel line PNPN are the visual trick that turns a 3‑D problem into a familiar 2‑D right‑triangle calculation. …