On this page
A line in space can be handed to you in three ways: as angles with the axes, as direction ratios, or as two points on it. This guide works through each one using the definitions in NCERT's Class 12 Mathematics chapter on three dimensional geometry, and gives you one quick check for your arithmetic.
What are direction cosines of a line?
If a directed line makes angles α, β and γ with the positive x, y and z axes, then cos α, cos β and cos γ are its direction cosines, written l, m and n (NCERT Class 12 Mathematics, Chapter 11). The angles α, β and γ themselves are called direction angles.
The word "directed" matters. A line can be read in two opposite directions. Reversing it replaces each angle by its supplement, so all three signs flip, as the same NCERT chapter notes. That is why answers are often written with ±. If the line does not pass through the origin, imagine a parallel line through the origin: parallel lines have the same direction cosines.
Why does l² + m² + n² = 1?
Take the point P one unit along the line from the origin, as in the diagram above. Its coordinates are exactly (l, m, n), because each coordinate is the unit length times the cosine of the angle with that axis. The distance OP is 1, so l² + m² + n² = 1.
This identity is a quick check on your division. Any three numbers proportional to l, m and n are direction ratios of the line, and NCERT notes that some authors call them direction numbers (chapter PDF). Only the direction cosines have squares that add to 1.
How do you find direction cosines from direction ratios?
If the direction ratios are a, b, c, then l = ±a/√(a² + b² + c²), m = ±b/√(a² + b² + c²) and n = ±c/√(a² + b² + c²), the formula derived in the NCERT chapter. Take the same sign for all three.
Example: direction ratios 6, −2, 3. Then √(36 + 4 + 9) = √49 = 7, so the direction cosines are 6/7, −2/7, 3/7, or all three with the opposite sign. Check: (36 + 4 + 9)/49 = 1.
Ratios can be scaled: 12, −4, 6 describe the same line, so clear fractions before you start.
How do you find direction cosines of a line through two points?
For P(x₁, y₁, z₁) and Q(x₂, y₂, z₂), the differences x₂ − x₁, y₂ − y₁, z₂ − z₁ are direction ratios, and dividing each by the length PQ gives the direction cosines, as set out in section 11.2.1 of the NCERT chapter.
Worked example: A(1, −2, 3) and B(3, 4, 0).
Subtract: 3 − 1 = 2, 4 − (−2) = 6, 0 − 3 = −3. Direction ratios 2, 6, −3.
Length: AB = √(4 + 36 + 9) = √49 = 7.
Divide: l = 2/7, m = 6/7, n = −3/7.
Check: (4 + 36 + 9)/49 = 1.
Going from B to A instead gives −2/7, −6/7, 3/7. Both answers are correct for the line; they describe its two directions.
What angles does the line make with the axes?
Take the inverse cosine of each direction cosine. For the line from A to B above:
α = cos⁻¹(2/7) ≈ 73.4°
β = cos⁻¹(6/7) ≈ 31.0°
γ = cos⁻¹(−3/7) ≈ 115.4°
A negative cosine means an obtuse angle: this line drops in z as it moves forward in x and y.
The identity also works in reverse, which is a common exercise. Can a line make 45°, 60° and 120° with the axes? The squared cosines are 1/2, 1/4 and 1/4, which add to 1, so yes. Can it make 30°, 45° and 60°? The squares are 3/4, 1/2 and 1/4, which add to 3/2, so no such line exists. A line equally inclined to all three axes has l = m = n, so 3l² = 1 and l = ±1/√3.
Where do direction cosines lead next?
The vector l i + m j + n k is simply the unit vector along the line, so direction cosines connect straight to vector algebra and to the equation of a line in space. For the next steps, read our guides to 3D geometry for JEE: lines, planes and distances, the section formula in 3D and dot, cross and triple products in vector algebra.
If your answer keeps coming out wrong and you cannot see where, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. If the gap is the idea itself, the Fermi Concept Library gives each concept in mathematics its own lesson and its place in the map.



