• Foundation
  • About 16 min
  • 5 practice questions

Direction cosines and direction ratios

Find the direction cosines of a line from its angles with the axes, use l² + m² + n² = 1, find direction ratios through two points, convert ratios to cosines and find the angle between two lines.

If something looks wrong, please tell us.

A line in space has a direction, and we need numbers to describe it. In the plane one angle, the slope angle, was enough. In space we use the three angles a line makes with the three axes. Their cosines, the direction cosines, and any numbers proportional to them, the direction ratios, are the language of every line and plane that follows.

Direction angles and direction cosines

Let a directed line make angles α, β and γ with the positive x-, y- and z-axes. These are its direction angles, each between 0° and 180°. Their cosines l = cos α, m = cos β and n = cos γ are its direction cosines. For example, the positive x-axis makes angles 0°, 90° and 90° with the axes, so its direction cosines are (1, 0, 0); the y-axis has (0, 1, 0) and the z-axis (0, 0, 1). Reversing the direction of a line replaces each angle θ by 180° − θ, so the direction cosines become (−l, −m, −n). A line with no chosen direction therefore has two sets of direction cosines, one the negative of the other.

The identity l² + m² + n² = 1

Take a point P on the line through the origin parallel to the given line, at distance r from O. The projections of OP on the axes are r cos α, r cos β and r cos γ, so P = (lr, mr, nr). By the distance formula r² = l²r² + m²r² + n²r², and dividing by r² gives l² + m² + n² = 1. This is the main test: three numbers whose squares do not add up to 1 cannot be direction cosines.

Direction ratios

Any three numbers a, b, c (not all zero) proportional to l, m, n are called direction ratios. They are easier to work with but not unique: (1, 2, 2), (2, 4, 4) and (−1, −2, −2) all describe the same line. The line through A(x₁, y₁, z₁) and B(x₂, y₂, z₂) has direction ratios (x₂ − x₁, y₂ − y₁, z₂ − z₁). To turn direction ratios into direction cosines, divide each by √(a² + b² + c²).

l = cos α, m = cos β, n = cos γ, and l² + m² + n² = 1. From direction ratios a, b, c: l = a/√(a² + b² + c²), m = b/√(a² + b² + c²), n = c/√(a² + b² + c²), with the opposite signs for the opposite direction. Through two points, the direction ratios are the differences of the coordinates.

Worked example 1: from the angles

A line makes angles 90°, 135° and 45° with the axes. Its direction cosines are (cos 90°, cos 135°, cos 45°) = (0, −1/√2, 1/√2). Check: 0 + 1/2 + 1/2 = 1.

Worked example 2: from two points

Find the direction cosines of the line directed from A(2, −1, 4) to B(4, 1, 5). The direction ratios are (4 − 2, 1 − (−1), 5 − 4) = (2, 2, 1). Their length is √(4 + 4 + 1) = 3, so the direction cosines are (2/3, 2/3, 1/3). Directed from B to A they would be (−2/3, −2/3, −1/3).

Worked example 3: from direction ratios

Direction ratios (6, −2, 3) have length √(36 + 4 + 9) = 7, so the direction cosines are ±(6/7, −2/7, 3/7). For the first choice the angle with the y-axis is cos⁻¹(−2/7), an obtuse angle, because m is negative.

The angle between two lines

If two lines have direction cosines (l₁, m₁, n₁) and (l₂, m₂, n₂), the angle θ between them satisfies cos θ = |l₁l₂ + m₁m₂ + n₁n₂|. With direction ratios, divide by the two lengths: cos θ = |a₁a₂ + b₁b₂ + c₁c₂|/(√(a₁² + b₁² + c₁²) × √(a₂² + b₂² + c₂²)). The modulus gives the acute angle, the usual meaning of the angle between two lines. The lines are perpendicular when a₁a₂ + b₁b₂ + c₁c₂ = 0 and parallel when a₁/a₂ = b₁/b₂ = c₁/c₂.

Worked example 4: angles between lines

Find the angle between lines with direction ratios (1, −1, 0) and (2, −1, 2). The sum of products is 2 + 1 + 0 = 3, and the lengths are √2 and 3. So cos θ = 3/(3√2) = 1/√2 and θ = 45°. By contrast, lines with direction ratios (2, 1, −2) and (1, 2, 2) are perpendicular, because 2 + 2 − 4 = 0.

Key takeaways. Direction cosines are the cosines of the angles with the axes and satisfy l² + m² + n² = 1. Direction ratios are any multiples of them; through two points they are the coordinate differences. Divide by the length to get cosines, and use the sum of products for the angle between two lines.

Check your understanding

  1. 1. What are the direction cosines of the positive y-axis?

    1. (0, 1, 0)
    2. (1, 0, 0)
    3. (0, 0, 1)
    4. (1, 1, 1)
    Show answer

    Answer: A. The positive y-axis makes 90° with the x-axis, 0° with itself and 90° with the z-axis. The cosines are (cos 90°, cos 0°, cos 90°) = (0, 1, 0). (1, 1, 1) is not even possible, since 1 + 1 + 1 ≠ 1.

  2. 2. Which of these are direction cosines of a line with direction ratios (2, −6, 3)?

    1. (2/11, −6/11, 3/11)
    2. (2, −6, 3)
    3. (2/7, 6/7, 3/7)
    4. (2/7, −6/7, 3/7)
    Show answer

    Answer: D. The length is √(4 + 36 + 9) = √49 = 7, so the direction cosines are ±(2/7, −6/7, 3/7). Dividing by 2 + 6 + 3 = 11 is a common slip, and the ratios themselves are not cosines because their squares add up to 49.

  3. 3. Which of these can be the direction cosines of a line?

    1. (1/2, 1/2, 1/2)
    2. (1, 1, 1)
    3. (1/3, 2/3, 2/3)
    4. (2/3, 2/3, 2/3)
    Show answer

    Answer: C. Only (1/3, 2/3, 2/3) passes the test l² + m² + n² = 1: 1/9 + 4/9 + 4/9 = 1. The others give 3/4, 3 and 4/3.

  4. 4. Which are direction ratios of the line through (3, 5, −2) and (1, 2, 4)?

    1. (4, 7, 2)
    2. (2, 3, 6)
    3. (3, 5, −2)
    4. (2, 3, −6)
    Show answer

    Answer: D. The differences are (1 − 3, 2 − 5, 4 − (−2)) = (−2, −3, 6). Any multiple works, and multiplying by −1 gives (2, 3, −6). (4, 7, 2) adds the coordinates, and (3, 5, −2) is just one of the points.

  5. 5. What is the angle between two lines with direction ratios (1, −2, 2) and (2, 2, −1)?

    1. 90°
    2. cos⁻¹(1/9)
    3. cos⁻¹(4/9)
    4. 60°
    Show answer

    Answer: C. Sum of products: 2 − 4 − 2 = −4. Both lengths are 3. So cos θ = |−4|/(3 × 3) = 4/9 and θ = cos⁻¹(4/9). The lines are not perpendicular, because the sum of products is not 0.

Privacy · Terms · Refunds · Delivery