Direction Cosines of a Line Through Two Points in 3D
December 29, 2025
Problem
explain and visualise this
Explanation
We want the direction cosines of the line passing through the two points
1. Direction vector of the line
A line through two points and has a direction vector
For the given points:
Compute :
This vector gives the direction of the line, but not yet the direction cosines.
2. Length of the direction vector
The length (magnitude) of is
Substitute the values:
3. Direction cosines
The direction cosines of a line are the cosines of the angles that the line makes with the positive , , and axes respectively. If is a direction vector, then the unit direction vector is
Its components are exactly the direction cosines:
For our line, and , so
These are the required direction cosines.
4. What the visualization shows
The interactive canvas will display:
- A 3D-like coordinate box ( axes) in perspective.
- The two points and plotted inside this box.
- The vector drawn as an arrow from to (neon cyan).
- A unit direction vector in the same direction (neon yellow), whose components are exactly the direction cosines.
- Projections of the direction vector onto the three coordinate axes, to visually connect the components with the angles and the cosines.
Interactivity
- Rotation: Use the Rotation slider to rotate the viewing angle around the vertical axis, so you can see how the line sits in 3D space.
- Scale: Use the Scale slider to zoom in/out on the 3D box and the points.
- Animate: Use the Auto Rotate toggle to automatically rotate the scene and better perceive the 3D geometry.
As you adjust the view, notice that:
- The direction of the line is fixed by the vector from to .
- The unit vector in this direction has components , which are the direction cosines.
- Even though the drawing is in 2D (on the screen), rotation and projection help you see how this line relates to the three axes and why the cosines describe its orientation.
Interactive Visualization
Parameters
60.00
35.00
20.00