Introduction

When I was learning the direction cosines of a vector \(A = (A_x, A_y, A_z)\), I got stuck in two places.

$$ \cos\alpha = \frac{A_x}{|A|}, \quad \cos\beta = \frac{A_y}{|A|}, \quad \cos\gamma = \frac{A_z}{|A|} $$
  1. Why does a "right angle" suddenly appear? Cosine clearly comes from a right triangle, but I don't see any right angle in a vector.
  2. Why are they called "direction" cosines specifically? Does the name actually mean something?

This post works through those two questions without memorizing anything. There are two keys here: orthogonal projection (a shadow) and the "ratio with magnitude erased."

1. Cosine is originally "a ratio in a right triangle"

First, the basics. Cosine is defined in a right triangle.

$$ \cos\theta = \frac{\text{adjacent}}{\text{hypotenuse}} $$

In other words, to use cosine, there has to be a right angle somewhere. So where does that right angle come from in a vector?

2. The right angle comes from a "shadow (orthogonal projection)"

From the tip of vector \(A\)'s arrow, drop a perpendicular shadow onto the x-axis. The length of that shadow (the projection) is exactly \(A_x\). Then three points — the origin, the tip of the arrow, and the spot where the shadow lands — form a right triangle.

  • hypotenuse = the magnitude of the vector \(|A|\)
  • adjacent = the x-axis component \(A_x\)
  • the angle between them = \(\alpha\) (the angle the vector makes with the x-axis)

So \(\cos\alpha = \dfrac{A_x}{|A|}\). The right angle is artificially created by "dropping a perpendicular onto an axis"; it wasn't there to begin with. Do the same for the y-axis and z-axis, and you get \(\beta\) and \(\gamma\).

3. So why "direction" cosines?

This is the heart of it. In \(\cos\alpha = A_x / |A|\), let's double the vector.

  • the numerator \(A_x\) doubles too
  • the denominator \(|A|\) doubles too
  • the ratio stays the same! \(\cos\alpha\) does not change.

So a direction cosine is pure "direction" information, independent of the vector's magnitude. Stretch the length or shrink it — as long as it points the same way, the value is identical. That's why they're direction cosines.

To sum up, \((\cos\alpha, \cos\beta, \cos\gamma)\) is itself the unit vector (a vector of length 1) in the same direction as \(A\).

Try it yourself

Use the sliders to grow and shrink \(A_x, A_y, A_z\). The vector's magnitude changes, but the cos values stay the same — that's what the word "direction" means. In the bar chart below, no matter how the proportions of the three colors shift, check that the total length is always 1.

Direction cosines — try it yourself
Use the component sliders to change the magnitude and watch how cos doesn't change. Use 'rotate view' to spin the 3D scene.

Why do the squared cosines add up to 1?

The last puzzle. The squares of the three direction cosines always add up to 1.

$$ \cos^2\alpha + \cos^2\beta + \cos^2\gamma = 1 $$

No need to memorize it. Plug the definitions straight in and it falls out on its own.

$$ \cos^2\alpha + \cos^2\beta + \cos^2\gamma = \frac{A_x^2 + A_y^2 + A_z^2}{|A|^2} $$

But the numerator \(A_x^2 + A_y^2 + A_z^2\) is exactly \(|A|^2\) by the Pythagorean theorem. So \(\dfrac{|A|^2}{|A|^2} = 1\). In the end, this equation is just the obvious statement "the length of a unit vector is 1" rewritten in terms of cosines.

Wrapping up

  • The right angle wasn't there originally — it's created by dropping a shadow (orthogonal projection) onto an axis.
  • A direction cosine is direction information with magnitude erased — that's why it doesn't change when you grow the vector.
  • The fact that the sum of the squared cosines is 1 is just the Pythagorean theorem rewritten in terms of cosines.

Instead of memorizing the formula, once you follow "why it looks this way" a single time, there's nothing left to memorize when you need to recall it.

Related readingWhy Does Arctangent Come Into It · Check it visually yourself: GeoGebra · Desmos