Direction cosines using two points
Most textbook lines are not handed to you as a neat angle with the axes — they are handed to you as two points, say and , and you are expected to find the line's direction on your own. This is the single most common way direction cosines actually appear in Class 12 problems: subtract coordinates to get direction ratios, divide by the distance to get direction cosines, and you have fully described which way the line points. This article builds that one calculation carefully, connects it to the vector you already know from Vector Algebra, and shows its most useful application — proving three points are collinear without drawing a single picture. Once this is automatic, writing the equation of a line through two points becomes a two-line exercise, and later topics such as the angle between two lines or a line and a plane become routine substitutions into a formula you already trust.
The direction cosines of the line through and are the coordinate differences divided by the distance .
The core idea
Let and be two given points, and consider the directed line from to .
Step 1 — direction ratios. Subtract the coordinates of from :
where: are the direction ratios of — they are exactly the components of the vector , telling you how far to move along each axis to travel from to .
Step 2 — normalise. Direction ratios are not unit-length, so divide each by the distance :
where: are the direction cosines, satisfying by construction, since they are the components of the unit vector . A quick but important check: reversing the direction — going from to instead of to — flips the sign of every direction ratio and every direction cosine. This matches the general rule that a line's direction cosines are fixed only up to an overall sign; a line has no built-in "forward," so both and describe the same line. The figure below shows the geometry: the position vectors of and from the origin, and the difference vector whose components are the direction ratios.
There is really only one new computation to learn here — everything else is a direct carry-over from Vector Algebra, where the difference of two position vectors and the unit vector along it are already familiar ideas. Once you have the direction cosines (or even just the direction ratios) of a line through a known point, you can immediately write the vector or Cartesian equation of that line — this construction is the standard first step in most Three-Dimensional Geometry problems.
The goal is to start from nothing but the coordinates of two points and and arrive at a normalised triple satisfying that fully specifies the direction of line , using only the distance formula and basic algebra — no calculus and no assumed angle data.
Step 1. Form the direction ratios by subtracting the coordinates of from those of , in a fixed, consistent order: , , . These three numbers are proportional to the direction cosines but are not themselves unit-length; they are simply the components of .
Step 2. Compute the distance using the three-dimensional distance formula, . This is the length of the vector and is always positive, since .
Step 3. Divide each direction ratio by : , , . Geometrically this rescales to unit length without changing its direction, which is exactly what a direction cosine is meant to capture.
Step 4. Verify the defining identity. Squaring and adding, , confirming is a genuine set of direction cosines. This identity is the standard self-check after every such computation.
Worked example
Problem. Find the direction cosines of the line joining and , and use the same method to check whether , , are collinear.
Step 1. Direction ratios of : subtract coordinates of from , giving , , .
Step 2. Distance .
Step 3. Direction cosines: , , . Check: . ✓
Step 4. For the collinearity check, find direction ratios of and from the common vertex : and . Since , the two sets of direction ratios are proportional, so and are parallel and share point — hence , , are collinear.
Final answer: direction cosines of are , and , , are collinear.
Competitive stretch
Step 5. The same setup lets you find the angle a line makes with the coordinate axes almost for free. If makes angles with the -, -, -axes respectively, then , , — the direction cosines are literally these cosines by definition, so no extra work is needed once is known. Since is negative, is obtuse (between and ), meaning leans away from the positive -axis; and , both from positive cosines, are acute.
Common traps
- Subtracting coordinates in the wrong order. has direction ratios , not — reversing the order flips every sign, which matters when you later use these ratios in the equation of the line.
- Forgetting to normalise. Direction ratios from two points are not direction cosines until divided by ; stopping one step early is a very common half-mark loss.
- Using the collinearity shortcut incorrectly. Three points are collinear only when the direction ratios of two segments sharing a common vertex are proportional — always compute both segments from the same point (e.g. and , not and mixed inconsistently).
- Sign errors with negative coordinates. Always recompute as a check; it must equal exactly.
- Mixing up direction cosines with the angle itself. are the cosines of the angles the line makes with the axes, not the angles themselves — a negative direction cosine simply means that particular angle is obtuse, not that the calculation went wrong.
Ask the tutor: Want a fresh pair of points to find direction cosines for, or a three-point collinearity check to practice on your own?
Why do we divide by PQ instead of just using the direction ratios directly?
Direction ratios alone tell you the line's orientation but not in a standardised form — any scalar multiple of a valid triple works equally well as a direction ratio set. Direction cosines fix this by forcing , so every line has one (up to sign) unique normalised triple. This standard form is what later formulas, such as the angle between two lines or the equation of a line, are built to expect.
Does it matter whether I compute P minus Q or Q minus P?
It changes the sign of every direction ratio and direction cosine, but not the line itself — a line has no inherent forward direction, so and describe the same line equally well. What does matter is staying consistent within a single problem, especially when comparing direction ratios of two different segments for a collinearity or parallelism check.
If the direction ratios of AB and AC are proportional, could A, B, C still fail to be collinear?
No — if and are scalar multiples of each other, they point along the same line through , and since both B and C then lie on that line through the common point A, all three points must be collinear. This is exactly the vector fact that two proportional (parallel) vectors sharing a point define a single line, not two.