Direction Cosines from Direction Angles in 3D

December 30, 2025

Problem

If a line makes angles 90°, 135°, 45° with the x, y and z-axes respectively, find its direction cosines.

Explanation

We are given a line in 3D space that makes the following angles with the coordinate axes:

  • With the x-axis: α=90\alpha = 90^\circ
  • With the y-axis: β=135\beta = 135^\circ
  • With the z-axis: γ=45\gamma = 45^\circ

The direction cosines of a line are defined as:

=cosα,m=cosβ,n=cosγ\ell = \cos\alpha, \quad m = \cos\beta, \quad n = \cos\gamma

These form the components of a unit vector in the direction of the line:

u=(,m,n)\mathbf{u} = (\ell, m, n)

and they must satisfy the identity

2+m2+n2=1\ell^2 + m^2 + n^2 = 1

Step 1: Compute each cosine

  1. With the x-axis
α=90=cos90=0\alpha = 90^\circ \Rightarrow \ell = \cos 90^\circ = 0
  1. With the y-axis
β=135m=cos135=cos(18045)=cos45=12\beta = 135^\circ \Rightarrow m = \cos 135^\circ = \cos(180^\circ - 45^\circ) = -\cos 45^\circ = -\frac{1}{\sqrt{2}}
  1. With the z-axis
γ=45n=cos45=12\gamma = 45^\circ \Rightarrow n = \cos 45^\circ = \frac{1}{\sqrt{2}}

So the direction cosines are:

(,m,n)=(0,12,12)(\ell, m, n) = \left(0, -\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}}\right)

Step 2: Verify the identity

Check that they form a unit vector:

2+m2+n2=02+(12)2+(12)2=0+12+12=1\ell^2 + m^2 + n^2 = 0^2 + \left(-\frac{1}{\sqrt{2}}\right)^2 + \left(\frac{1}{\sqrt{2}}\right)^2 = 0 + \frac{1}{2} + \frac{1}{2} = 1

The condition is satisfied, so the direction cosines are consistent.


Final Answer

The direction cosines of the line are:

=0,m=12,n=12\boxed{\ell = 0, \quad m = -\frac{1}{\sqrt{2}}, \quad n = \frac{1}{\sqrt{2}}}

Visualization Idea

The canvas shows the 3D axes (x, y, z projected in perspective) and a unit vector representing the line, with components equal to the direction cosines:

u=(,m,n)=(0,12,12)\mathbf{u} = (\ell, m, n) = (0, -\tfrac{1}{\sqrt{2}}, \tfrac{1}{\sqrt{2}})

You can interactively change the three angles α,β,γ\alpha, \beta, \gamma with sliders. The visualization will:

  • Compute =cosα\ell = \cos \alpha, m=cosβm = \cos \beta, n=cosγn = \cos \gamma
  • Draw a 3D-ish coordinate frame
  • Plot the direction vector with those cosines
  • Draw projections of the vector onto each axis
  • Show a small check of 2+m2+n2\ell^2 + m^2 + n^2 as a bar: if it is 1, the bar is neon cyan; if not, it fades towards pink to hint that the three angles are not consistent with a single line.

Use the toggle to snap to the problem's given angles (90°, 135°, 45°) and see the exact solution vector.

Interactive Visualization

Parameters

90.00
135.00
45.00
1.00
Direction Cosines from Direction Angles in 3D