Key Points
- For : , , .
- are the parts of the unit vector pointing the same way as .
- always: Pythagoras in 3D, and a quick check.
- Direction ratios are any three numbers in the same proportion; direction cosines are the one set that squares to 1.
The Three Numbers That Pin Down a Spacecraft's Tilt
A spacecraft's guidance computer can record the craft's tilt in a small table of cosines. Each row holds the cosines of the angles one of the craft's axes makes with three fixed directions. Those numbers are direction cosines.
- Take . Its length is .
- Divide each part by 7: . These are its direction cosines.
- They say how steeply leans towards each axis, and nothing about how long it is.
- The angles are real ones you could measure with a protractor: about , and . The smallest is with the z-axis, matching the biggest part, 6.

What Is a Direction Cosine?
A direction cosine is the cosine of the angle between a vector and one of the positive coordinate axes. A vector in 3D makes three such angles, its direction angles:
- α with the positive x-axis, and
- β with the positive y-axis, and
- γ with the positive z-axis, and
- Each angle is between and . Under gives a positive cosine; over a negative one.
- Two vectors pointing the same way share direction cosines, whatever their lengths: they describe direction only.
How Do You Calculate Direction Cosines of a Vector?
Divide each component by the length of the vector. For :
- , , are the components (the parts along each axis), and is the length.
- Dividing by the length strips the size away, so is the unit vector (length 1) along :
Why l = x / |v|: two ways to see it
With a right triangle:
- Put the tail of at the origin and call its tip . Drop a perpendicular from to the x-axis, landing at .
- The angle at is a right angle. Next to α is ; the hypotenuse is .
- Adjacent over hypotenuse: . For our example, , so .

With the dot product:
- The dot product gives .
- In components it is . Set them equal: .
- So each component is the vector's projection onto an axis.
What Are the Direction Cosines of the x, y, and z Axes?
Each axis makes with itself and with the other two, so its direction cosines are one 1 and two zeros.
| Direction | Angles | Direction cosines |
|---|---|---|
| positive x-axis | ||
| positive y-axis | ||
| positive z-axis | ||
| negative x-axis |
The first three rows are the unit vectors , and , and each row squares to 1 at a glance.
Why Does l² + m² + n² = 1?
Because the direction cosines are the parts of a unit vector, and a unit vector has length 1. Square and add:
- The last step uses , which is Pythagoras used twice.
- In a 2 by 3 by 6 box, the floor diagonal is , and with the height 6 the long diagonal is .
- A fast self-check: if the squares do not add to 1, a cosine is wrong.

On a flat page it is a fact you know: , so . For , .

In the tool below:
- Press the "(2, 4, 4): length 6" preset. The cosines read , and .
- Drag the orange head. The length and cosines change, but the identity holds.
Try It Yourself
Use the vector lab to see Direction Cosines at work: drag, change the numbers and watch what happens.
What Is the Difference Between Direction Cosines and Direction Ratios?
Direction ratios are any three numbers proportional to the direction cosines; direction cosines are the one set that also squares to 1. The components of a vector are one set of direction ratios, and so is any non-zero multiple.
| Direction ratios | Direction cosines | |
|---|---|---|
| Notation | ||
| Example for one direction | , , | |
| How many sets | infinitely many | one for a vector |
| Condition | none | |
| From the other | multiply by any non-zero | divide by |

A vector or a line?
- A vector has one set of direction cosines.
- A line has no arrow, so it has two: and .
- That is why direction ratios are enough for the vector form of a line. The page on the direction ratio works from the ratio side.
The payoff: the angle between two lines
Direction cosines are unit vectors, so the angle θ between two directions comes straight from the dot product:
- Two directions are perpendicular exactly when this sum is 0.
- It runs from the angle between two vectors to the angle between a line and a plane.
Edge Cases: Not Every Three Angles Work
You cannot choose α, β and γ freely: the identity limits them.
- Equal angles. If , then , so (or ). Three angles are impossible: .
- Two small angles. No vector makes with both the x- and y-axes: , already over 1.
- A flat vector. In the xy-plane, and , so .
- The zero vector. It has no direction, so no direction cosines: the formula would divide by 0.
Examples of Direction Cosines
Six examples, from a plain vector to recovering a missing cosine.
Example 1
Find the direction cosines of v = 2i + 3j + 6k.
- Length: .
- Divide each component: , , .
- Check: . ✓
The direction cosines are .
Example 2
A student gives the direction cosines of v = 4i + 3k as (4, 0, 3). Find the error.
- Test with the identity: , not 1. Those are direction ratios.
- Length: .
- Divide: . Check: . ✓
Direction cosines are the normalised version, never the raw components.
Example 3
A line has direction ratios (2, −1, 2). Find its direction cosines.
- Length: .
- Divide: . The minus sign stays.
A line has no arrow, so is the same line read the other way.
Example 4
A vector makes 60° with the x-axis and 45° with the y-axis. Find the angle it makes with the z-axis.
- , , so .
- , so .
Two answers: (pointing up) or (pointing down), mirror images in the xy-plane.

Example 5
Find the direction cosines of the vector from A(1, 2, 3) to B(4, 6, 3).
- , length .
- Divide: .
The zero says is level: it makes with the z-axis.
Example 6
Can (1/2, 1/2, 1/2) be the direction cosines of a vector?
- , so no.
- They are valid direction ratios. Divide by their length, .
The direction cosines are , the equal-angle direction.
Why Direction Cosines Matter: Direction Without Length
Direction cosines answer one question cleanly: which way is this pointing, ignoring how far?
- A common scale for direction. is the unit vector along , so every direction is named on the same scale.
- Splitting a force. A 140 N guy rope runs from a tent pole top at m to a peg at m. Its direction has length 7.
- So the pull is N. The pole is pressed down by 120 N.
- Orientation. A direction cosine matrix is a 3 × 3 table whose rows are the direction cosines of a craft's own axes. Each row must square to 1, which keeps the computed tilt physically possible.

What Are the Most Common Mistakes With Direction Cosines?
Most wrong answers come from skipping the divide step or losing a sign.
Mistake 1: Using the components as the direction cosines
Where it slips in: Reading and writing .
Don't do this: Skip the division by the length.
The correct way: Divide every component by , then check the squares add to 1. squares to 49.
Mistake 2: Mixing up ratios and cosines
Where it slips in: A question gives direction ratios and asks for direction cosines, or the other way round.
Don't do this: Hand back the ratios when the question wants cosines.
The correct way: Read which one is wanted. Cosines are the one scaled set with .
Mistake 3: Dropping a minus sign
Where it slips in: Squaring inside the square root, then forgetting a component's sign.
Don't do this: Write for a vector whose y-part is .
The correct way: The length is positive, but each cosine keeps its component's sign. A negative cosine means an angle over .
Mistake 4: Taking only one root
Where it slips in: Finding the third cosine from the other two, as in Example 4.
Don't do this: Write and stop.
The correct way: gives . Both are answers unless the question says up or down.
Conclusion
- Direction cosines , , describe direction without size.
- Each is a component over the length, so together they form the unit vector.
- They always satisfy ; in 2D this is .
- Direction ratios are any proportional triple; a line has two sets of cosines, .
- Keep the signs and take both roots when solving for a missing cosine.
Practice These to Solidify Your Understanding
Practice these to solidify your understanding, and check each answer with the identity:
- Find the direction cosines of .
- A line has direction ratios . Find its direction cosines.
- A vector makes with the x-axis and with the y-axis. Find .
Answer to Question 1: , since the length is 3.
Answer to Question 2: , since the length is 7.
Answer to Question 3: and , so and , giving or .
To take vectors and 3D geometry further with a teacher, explore Bhanzu's geometry tutor, a high school math tutor, math tutoring or math classes online.
Want a live Bhanzu trainer to walk your child through 3D vectors? Book a free demo class, online globally, or in person at our McKinney, TX center.
Read More
Research Behind This Article
- OpenStax, Calculus Volume 3, Section 2.3: The Dot Product (direction angles and direction cosines, the identity cos²α + cos²β + cos²γ = 1). openstax.org
- OpenStax, Calculus Volume 3, Section 2.2: Vectors in Three Dimensions (components, length and unit vectors in 3D). openstax.org
- OpenStax, University Physics Volume 1, Section 2.2: Coordinate Systems and Components of a Vector (direction angles and resolving a vector along axes). openstax.org
- OpenStax, Calculus Volume 3, Section 2.5: Equations of Lines and Planes in Space (direction vectors of lines and the angle between them). openstax.org
- Euclid, Elements, Book I, Proposition 47 (the Pythagorean theorem, used twice for the length of a 3D vector), D. E. Joyce, Clark University. mathcs.clarku.edu
Quick Quiz: Check Yourself
Three levels, questions with figures, instant feedback with the reason.
Was this article helpful?
Your feedback helps us write better content
Frequently Asked Questions
How do you find the direction cosines of a vector?
Why is l² + m² + n² always 1?
Can a direction cosine be negative?
What is the difference between direction cosines and direction ratios?
How many direction cosines does a vector have?
Can a vector make 60° with all three axes?
