Calculating angles between lines in space using vectors
Use nonzero direction vectors and the absolute-value dot-product formula, with checked cube diagonal examples.
Content updated: October 22, 2026
To calculate the angle between lines in a solid, choose direction vectors and calculate their dot product. The lines need not intersect, but the edge relations must be known correctly.
Learning goals: use the absolute-value cosine formula, express direction vectors in terms of edges, and check hypotheses and results in a cube.
Prerequisites: line angles and vector angles, the dot product, and the parallelogram and parallelepiped rules.
1. The conventional angle between lines
Choose $\vec u,\vec v\ne\vec0$ as direction vectors of $d_1,d_2$. If their vector angle is $\theta\in[0^\circ;180^\circ]$, the line angle $\varphi$ satisfies $\varphi=\min\{\theta,180^\circ-\theta\}\in[0^\circ;90^\circ]$. The two angles are equal or supplementary.
A line has no preferred orientation. Replacing a direction vector by its negative preserves the line, so the angle formula must remove the effect of sign changes. If a vector is zero, its length makes the denominator $0$ and the angle formula does not apply; always choose two nonzero vectors.
2. Formula and procedure
First choose direction vectors, calculate their dot product, and calculate each length. Simplify the ratio, then find $\varphi$ in the range $0^\circ$–$90^\circ$. The Cauchy–Schwarz inequality ensures that the ratio belongs to $[0;1]$. If the result is negative or greater than $1$, check the calculation before finding an angle.
In a cube of edge length $a>0$, the three edge vectors starting at one vertex are pairwise perpendicular and all have length $a$. These are geometric properties of the cube, not measurements from a perspective sketch. For an arbitrary parallelepiped, edge dot products are not assumed to be $0$.
3. Worked examples
Example 1. The angle between AC and DE in a cube
Let $ABCD.EFGH$ be a cube of edge length $a>0$, with $E,F,G,H$ above $A,B,C,D$, respectively, and corresponding edges $AE,BF,CG,DH$. Calculate the angle between $AC$ and $DE$.
Set $\vec u=\overrightarrow{AB}$, $\vec v=\overrightarrow{AD}$, and $\vec w=\overrightarrow{AE}$. Then $\overrightarrow{AC}=\vec u+\vec v$ and $\overrightarrow{DE}=-\vec v+\vec w$. Also, $\overrightarrow{DE}=\overrightarrow{DA}+\overrightarrow{DH}$ since $\overrightarrow{DH}=\overrightarrow{AE}$.
Since the three edges are pairwise perpendicular and have the same length $a$,
The segments $AC,DE$ are diagonals of square faces, each with length $a\sqrt2$. Thus $\cos\varphi=|-a^2|/(a\sqrt2\,a\sqrt2)=1/2$, so the line angle is $60^\circ$. The chosen direction vectors have angle $120^\circ$; the absolute value produces the line angle.
Example 2. Reversing direction preserves the answer
In the same figure, choose $\overrightarrow{ED}=-\overrightarrow{DE}$ in place of $\overrightarrow{DE}$. Its dot product with $\overrightarrow{AC}$ becomes $a^2$, but the lengths and absolute value remain unchanged. The angle between $AC$ and $ED$ is still $60^\circ$, since $ED$ and $DE$ denote the same line.
Example 3. Another angle in the same solid
Calculate the angle between $AC$ and $AB$. We have $(\vec u+\vec v)\cdot\vec u=a^2$, and the lengths are $a\sqrt2$ and $a$. Thus the cosine is $1/\sqrt2$, and the angle is $45^\circ$. Do not substitute the angle between adjacent edges for the angle between a diagonal and an edge.
4. Practice
- In the cube of Example 1, calculate the angle between $AB$ and $DH$.
- Calculate the angle between $AC$ and $BD$ in the base of the cube.
- Calculate the angle between the space diagonal $AG$ and edge $AB$.
Hints and answers
- The direction vectors $\vec u$ and $\vec w$ are perpendicular, so the angle is $90^\circ$. The lines need not have a common point.
- Direction vectors are $\vec u+\vec v$ and $\vec v-\vec u$. Their dot product is $a^2-a^2=0$, so the angle is $90^\circ$.
- $\overrightarrow{AG}=\vec u+\vec v+\vec w$ has length $a\sqrt3$, and its dot product with $\vec u$ equals $a^2$. Thus $\cos\varphi=1/\sqrt3$, or $\varphi=\arccos(1/\sqrt3)$, approximately $54.74^\circ$.
5. Common mistakes
Use direction vectors; do not call them normal vectors of the lines. Retain the absolute value and distinguish the two angle ranges. Do not apply cube properties to an oblique parallelepiped, and always specify corresponding vertex pairs.
6. Further study and sources
Vector angles and line angles in space (English lesson) · The dot product and its applications (English lesson) · Perpendicular lines (English lesson) · The angle between lines in space (English lesson).
Original resource on Scribd (external link).
Leave a Reply