A line in three-dimensional space has a direction, and any two parallel lines share that direction. We capture direction quantitatively by the angles the line makes with the three coordinate axes , the direction cosines , or by any triple proportional to them , the direction ratios.
Direction cosines
If a directed line makes angles α,β,γ with the positive x-, y-, z-axes, its direction cosines are
l=cosα,m=cosβ,n=cosγ.
These satisfy
l2+m2+n2=1.
For an undirected line, the direction cosines are defined up to a simultaneous sign change , (l,m,n) and (−l,−m,−n) describe the same line, just two opposite orientations.
Direction ratios
Any triple (a,b,c) proportional to (l,m,n) , i.e. a=kl, b=km, c=kn for some k=0 , is called a set of direction ratios of the line. Direction ratios are not unique; you can multiply by any non-zero scalar.
Given direction ratios (a,b,c), direction cosines are recovered by
l=a2+b2+c2a,m=a2+b2+c2b,n=a2+b2+c2c.
From two points
A line through points P=(x1,y1,z1) and Q=(x2,y2,z2) has direction PQ=(x2−x1,y2−y1,z2−z1). So direction ratios are simply (x2−x1,y2−y1,z2−z1) , coordinate differences.
Why l2+m2+n2=1
If u is the unit vector along the line, u=(l,m,n). Then ∣u∣2=l2+m2+n2=1. This identity replaces a key piece of two-dimensional intuition: in 2D the angle of a line was a single number θ with cos2θ+sin2θ=1; in 3D you need three direction cosines satisfying one constraint.
Conditions for special lines
Line parallel to x-axis: (l,m,n)=(±1,0,0).
Line in the xy-plane: n=0, so l2+m2=1.
Line through origin and (a,b,c): direction ratios (a,b,c).
Two lines: angle and special positions
If two lines have direction ratios (a1,b1,c1) and (a2,b2,c2), the angle between them is given by
cosθ=a12+b12+c12a22+b22+c22∣a1a2+b1b2+c1c2∣.
(The absolute value forces θ∈[0,π/2].)
Perpendicular: a1a2+b1b2+c1c2=0.
Parallel: a2a1=b2b1=c2c1.
Worked examples
Example 1. Find the direction cosines of the line joining (1,2,3) and (4,6,3).
Direction ratios (3,4,0). Magnitude 9+16+0=5. Direction cosines (3/5,4/5,0).
Example 2. Show that the line making equal angles with all three positive coordinate axes has direction cosines (1/3,1/3,1/3).
l=m=n, so 3l2=1, l=±1/3.
Example 3. Find the angle between the lines with direction ratios (1,2,1) and (2,3,1).
cosθ=6⋅14∣2+6+1∣=849=2219.
Example 4. Find λ if the lines with direction ratios (1,λ,3) and (2,1,−1) are perpendicular.
2+λ−3=0, so λ=1.
Example 5. A line makes angles 60∘,60∘,γ with the axes. Find γ.
cos260∘+cos260∘+cos2γ=1⇒1/4+1/4+cos2γ=1, so cos2γ=1/2, γ=45∘ or 135∘.
Example 6. Are the lines through (1,1,1)→(4,4,4) and through (2,0,0)→(8,6,6) parallel?
Direction ratios: (3,3,3)∝(1,1,1); (6,6,6)∝(1,1,1). Same direction. Yes, parallel.
Try it yourself
Direction cosines of a line with direction ratios (2,3,6).
Find the angle between lines with direction ratios (1,1,2) and (2,1,1).
Show that lines with direction ratios (2,3,−1) and (1,−2,−4) are perpendicular.
Find λ if lines with direction ratios (3,2,λ) and (1,1,−2) are perpendicular.
A line makes angles 45∘ and 60∘ with the x- and y-axes. Find the angle with the z-axis.
Show that the line joining (0,0,0) and (1,1,1) makes equal angles with all coordinate axes.
Find direction cosines for the z-axis.
Find direction ratios for the line joining (2,−3,1) to (5,1,−2).
Two lines have direction cosines (l1,m1,n1) and (l2,m2,n2). Show cosθ=l1l2+m1m2+n1n2.
Are the lines through (1,0,0),(2,1,0) and through (0,0,0),(1,1,0) parallel?
Find direction ratios for the line that is equally inclined to the coordinate axes.
A line lies in the xy-plane and makes a 30∘ angle with the x-axis. Find its direction cosines.
Find μ if lines with direction ratios (1,2,3) and (−1,μ,1) are parallel.
Find the angle between the body diagonal of a cube and one of its edges.
Pitfalls and tricks
l2+m2+n2=1 for direction cosines, not for direction ratios.
Direction ratios are not unique , they scale.
For perpendicularity, the dot product of direction ratios is zero.
For parallelism, direction ratios are proportional (same up to scaling).
Angle between lines is in [0,π/2] by convention. Always take absolute value of cos.
Practice quiz
Quick check on this topic.
Quiz
Quick check : Direction cosines and ratios
6 questions · pick the best answer
Q1
Direction cosines satisfy
Q2
Direction ratios of line from (1,2,3) to (4,7,5)
Q3
If (2,3,4) are direction ratios, the direction cosines are
Q4
Perpendicular condition: lines with d.r. (a1,b1,c1) and (a2,b2,c2)
Q5
Parallel condition
Q6
A line equally inclined to all 3 axes has direction cosines