Tutorials › Calculus III › Angles Between Lines

Cross Products, Lines, and Planes · Tutorial 92 of 999

Angles Between Lines

Use direction vectors and the dot product to calculate the smaller angle between lines or an angle measured from specified orientations.

Beginner 9 min read

What You'll Learn

  • Extract direction vectors from parametric or symmetric equations of lines
  • Apply the dot-product formula to calculate the acute angle between lines
  • Distinguish the geometric angle between unoriented lines from an oriented angle
  • Account for direction vectors that are reversed or replaced by equivalent vectors
  • Check angle calculations using dot products and cosine values

Why Direction Determines the Angle

A line in space has a position and a direction. Its position tells us where it lies, while its direction tells us how it is oriented through space. The angle between two lines depends on their directions, not on where the lines are located.

This means the angle can be found even when the lines do not intersect. Two lines in space may be skew, but their direction vectors still determine the angle between them. Because a line has no preferred forward direction, the usual geometric angle between two lines is the smaller angle, between \(0^\circ\) and \(90^\circ\). When the problem specifies orientations or directed vectors, the directed angle can instead range from \(0^\circ\) to \(180^\circ\).

Definition: Let two lines have nonzero direction vectors \(\mathbf{u}\) and \(\mathbf{v}\). Their (smaller, unoriented) angle \(\theta\) is defined by
$$ \theta = \cos^{-1}\left( \frac{|\mathbf{u}\cdot\mathbf{v}|} {\|\mathbf{u}\|\,\|\mathbf{v}\|} \right), \qquad 0\leq \theta\leq \frac{\pi}{2}. $$
The absolute value makes the result independent of which of the two opposite directions is chosen to represent either line.

If orientations are specified, use the directed angle \(\phi\) between the chosen direction vectors:

$$ \phi = \cos^{-1}\left( \frac{\mathbf{u}\cdot\mathbf{v}} {\|\mathbf{u}\|\,\|\mathbf{v}\|} \right), \qquad 0\leq \phi\leq \pi. $$

The directed angle may be obtuse. Reversing one direction vector changes an angle \(\phi\) to \(180^\circ-\phi\), while the smaller angle between the underlying lines remains unchanged.

Finding Direction Vectors

A line in parametric form is written as

$$ \mathbf{r}=\mathbf{r}_0+t\mathbf{d}, $$

where \(\mathbf{r}_0\) is a point on the line, \(t\) is a parameter, and the nonzero vector \(\mathbf{d}\) is a direction vector. In component form, \(\mathbf{r}_0\) determines the fixed coordinates and the coefficients of \(t\) give the direction vector.

For a line given by symmetric equations, such as

$$ \frac{x-x_0}{a} = \frac{y-y_0}{b} = \frac{z-z_0}{c}, $$

the direction vector is \(\mathbf{d}=(a,b,c)\), provided that the displayed equation represents a line and the direction vector is nonzero. A direction vector can be multiplied by any nonzero scalar without changing the line’s direction as a geometric line. In particular, \(\mathbf{d}\) and \(-\mathbf{d}\) represent the same unoriented line direction.

Why the Dot-Product Formula Works

For two nonzero vectors \(\mathbf{u}\) and \(\mathbf{v}\), let \(\alpha\) be the angle between them, measured from \(0\) to \(\pi\). The dot product satisfies

$$ \mathbf{u}\cdot\mathbf{v} = \|\mathbf{u}\|\,\|\mathbf{v}\|\cos\alpha. $$

One way to see why is to compare two expressions for the squared length of \(\mathbf{u}-\mathbf{v}\). Expanding with the dot product gives

$$ \|\mathbf{u}-\mathbf{v}\|^2 = (\mathbf{u}-\mathbf{v})\cdot(\mathbf{u}-\mathbf{v}) = \|\mathbf{u}\|^2+\|\mathbf{v}\|^2-2\mathbf{u}\cdot\mathbf{v}. $$

The law of cosines, applied to the triangle formed by \(\mathbf{u}\), \(\mathbf{v}\), and \(\mathbf{u}-\mathbf{v}\), gives

$$ \|\mathbf{u}-\mathbf{v}\|^2 = \|\mathbf{u}\|^2+\|\mathbf{v}\|^2 -2\|\mathbf{u}\|\,\|\mathbf{v}\|\cos\alpha. $$

Equating these expressions and cancelling the shared squared-length terms yields

$$ \mathbf{u}\cdot\mathbf{v} = \|\mathbf{u}\|\,\|\mathbf{v}\|\cos\alpha. $$

Since both vectors are nonzero, their magnitudes are positive, so division by their product is valid. Solving for \(\alpha\) gives the directed-vector formula. For lines, either direction vector may be reversed. Reversing just one changes the sign of the dot product and replaces \(\cos\alpha\) by \(-\cos\alpha\). Taking the absolute value therefore selects the same smaller angle whichever direction representatives are used.

Worked Examples

Worked Example: Angle from Parametric Lines

Find the smaller angle between the lines

$$ \mathbf{r}=(1,0,2)+s(1,0,0), \qquad \mathbf{r}=(0,1,0)+t(1,1,0). $$

The coefficients of the parameters give direction vectors \(\mathbf{u}=(1,0,0)\) and \(\mathbf{v}=(1,1,0)\). Their dot product is

$$ \mathbf{u}\cdot\mathbf{v} = (1)(1)+(0)(1)+(0)(0) = 1. $$

The magnitudes are

$$ \|\mathbf{u}\|=\sqrt{1^2+0^2+0^2}=1, \qquad \|\mathbf{v}\|=\sqrt{1^2+1^2+0^2}=\sqrt{2}. $$

Thus the cosine of the smaller angle is

$$ \cos\theta = \frac{|1|}{(1)(\sqrt{2})} = \frac{1}{\sqrt{2}}. $$

Therefore,

$$ \theta = \cos^{-1}\left(\frac{1}{\sqrt{2}}\right) = 45^\circ. $$

Check: \(\cos 45^\circ=\sqrt{2}/2=1/\sqrt{2}\), which is the computed ratio. The answer is the smaller angle between the lines.

Worked Example: Angle from Symmetric Equations

Find the smaller angle between

$$ \frac{x-1}{1}=\frac{y+2}{2}=\frac{z}{2}, \qquad \frac{x}{-2}=\frac{y-1}{1}=\frac{z+3}{2}. $$

Reading the denominators gives direction vectors \(\mathbf{u}=(1,2,2)\) and \(\mathbf{v}=(-2,1,2)\). Their dot product is

$$ \mathbf{u}\cdot\mathbf{v} = (1)(-2)+(2)(1)+(2)(2) = -2+2+4 = 4. $$

Their magnitudes are

$$ \|\mathbf{u}\| = \sqrt{1^2+2^2+2^2} = \sqrt{9} = 3, \qquad \|\mathbf{v}\| = \sqrt{(-2)^2+1^2+2^2} = \sqrt{9} = 3. $$

The ratio in the angle formula is therefore

$$ \frac{|\mathbf{u}\cdot\mathbf{v}|} {\|\mathbf{u}\|\,\|\mathbf{v}\|} = \frac{4}{(3)(3)} = \frac{4}{9}. $$

So

$$ \theta = \cos^{-1}\left(\frac{4}{9}\right) \approx 63.6^\circ. $$

The approximation is rounded to one decimal place. Check: \(\cos(\cos^{-1}(4/9))=4/9\), matching the dot-product ratio. The points on the lines do not enter the calculation; only the direction vectors determine this angle.

Worked Example: A Specified Directed Angle

Suppose the direction of the first line is specified as \(\mathbf{u}=(1,0,0)\), and the direction of the second as \(\mathbf{v}=(-1,1,0)\). Find the angle between these chosen directions, then find the smaller angle between the lines.

The dot product and magnitudes are

$$ \mathbf{u}\cdot\mathbf{v} = (1)(-1)+(0)(1)+(0)(0) = -1, $$ $$ \|\mathbf{u}\|=1, \qquad \|\mathbf{v}\| = \sqrt{(-1)^2+1^2+0^2} = \sqrt{2}. $$

For the specified directions, retain the sign of the dot product:

$$ \cos\phi = \frac{-1}{(1)(\sqrt{2})} = -\frac{1}{\sqrt{2}}, \qquad \phi = \cos^{-1}\left(-\frac{1}{\sqrt{2}}\right) = 135^\circ. $$

For the angle between the unoriented lines, use the absolute value:

$$ \cos\theta = \frac{|-1|}{(1)(\sqrt{2})} = \frac{1}{\sqrt{2}}, \qquad \theta = \cos^{-1}\left(\frac{1}{\sqrt{2}}\right) = 45^\circ. $$

Check: \(\cos 135^\circ=-1/\sqrt{2}\), as required for the specified directions, while \(\cos 45^\circ=1/\sqrt{2}\), as required for the smaller line angle. The two answers describe different conventions, not a disagreement.

Orientation and Equivalent Direction Choices

A line’s direction vector is not unique. If \(\mathbf{u}\) is a direction vector, then \(k\mathbf{u}\), for any nonzero real number \(k\), is also a direction vector for the same line. In the angle formula, scaling either vector by a positive number multiplies both the relevant dot product and magnitude by that number, so the ratio is unchanged. Scaling by a negative number reverses its orientation; the absolute value in the line-angle formula again leaves the result unchanged.

The two conventions can be summarized as follows:

Question being answered Formula to use Possible angle
Smaller angle between unoriented lines \(\cos\theta=|\mathbf{u}\cdot\mathbf{v}|/(\|\mathbf{u}\|\|\mathbf{v}\|)\) \(0^\circ\) to \(90^\circ\)
Angle between specified direction vectors \(\cos\phi=(\mathbf{u}\cdot\mathbf{v})/(\|\mathbf{u}\|\|\mathbf{v}\|)\) \(0^\circ\) to \(180^\circ\)

If the prompt asks for “the angle between two lines” without specifying orientations, use the smaller angle. If it gives directed vectors, rays, or an explicit orientation and asks for the angle between those directions, retain the sign of the dot product. If the prompt requests an obtuse angle, check that it is asking about oriented directions; the usual smaller angle between unoriented lines cannot be obtuse.

Common Mistake: Keeping the Sign for an Unoriented Line

For the vectors \((1,0,0)\) and \((-1,1,0)\), a common error is to calculate \[ \cos\theta=\frac{-1}{\sqrt{2}} \] and report \(135^\circ\) as the angle between the lines. This calculation gives the angle between the chosen oriented vectors, but a line can equally well use the opposite direction vector.

For the smaller angle between the lines, correct the calculation by using the absolute value:

$$ \cos\theta = \frac{|-1|}{\sqrt{2}} = \frac{1}{\sqrt{2}}, \qquad \theta=45^\circ. $$

Another error is to use the position vectors of points on the lines instead of direction vectors. Position vectors locate points; they do not in general describe how the lines run. First identify a nonzero direction vector for each line, then apply the dot-product formula.

Special Cases and a Reliable Procedure

If the direction vectors are parallel or antiparallel, their dot-product ratio has absolute value \(1\), giving a smaller angle of \(0^\circ\). This includes distinct parallel lines and coincident lines. If the direction vectors are perpendicular, their dot product is \(0\), giving an angle of \(90^\circ\). The formula requires nonzero direction vectors; the zero vector cannot represent the direction of a line and cannot be used in the denominator.

1
Extract the directions.
Read the parameter coefficients or the direction ratios from each line equation.
2
Calculate dot product and magnitudes.
Show the component products and the squared components used in each magnitude.
3
Choose the angle convention.
Use the absolute dot product for the smaller line angle; keep its sign for a specified directed angle.
4
Apply inverse cosine and check.
Report the requested units and precision, then confirm that the cosine of the answer agrees with the appropriate dot-product ratio.

This method separates the geometry from the arithmetic. The line positions may affect whether lines meet, but they do not affect the angle determined by their direction vectors. The absolute value is not an optional convenience: it encodes the fact that an unoriented line has no preferred direction.

Check Your Understanding

For each question, identify whether it concerns an unoriented line angle or an oriented direction angle before calculating.

  1. Find the smaller angle between direction vectors \((1,1,0)\) and \((1,-1,0)\).
  2. For \(\mathbf{u}=(1,0,0)\) and \(\mathbf{v}=(-1,0,0)\), what is the angle between the lines, and what is the angle between the specified directions?
  3. Why can the angle between two skew lines be found without solving for their intersection?
  4. If one direction vector is replaced by its negative, which angle convention can change its answer?
  5. What must be true of each direction vector for the dot-product angle formula to apply?