Tutorials › Calculus III › Angles Between Diagonals of Rectangular Boxes

Dot Products and Projections · Tutorial 67 of 999

Angles Between Diagonals of Rectangular Boxes

Use coordinates and dot products to calculate angles between body diagonals of a rectangular box and between a body diagonal and an edge.

Beginner 10 min read

What You'll Learn

  • Represent a rectangular box’s edges and body diagonals with component vectors.
  • Calculate the angle between two body diagonals using their dot product.
  • Find the smaller angle between diagonal lines by accounting for vector orientation.
  • Identify when two body diagonals are perpendicular.
  • Calculate the angle between a body diagonal and an edge.
  • Avoid confusing a directed-vector angle with the angle between unoriented lines.

Representing a Rectangular Box with Vectors

A rectangular box has three positive edge lengths. Call them \(a\), \(b\), and \(c\), and place one corner at the origin. Choose the coordinate axes along the three edges meeting at that corner. The box’s vertices then have coordinates of the form \((0\text{ or }a,\;0\text{ or }b,\;0\text{ or }c)\).

The vector from the origin to the opposite corner is \(\mathbf{u}=(a,b,c)\). It represents one of the box’s four body diagonals: diagonals joining pairs of opposite vertices. Other body diagonals have direction vectors with the same component magnitudes, but different signs. For example, \((a,b,-c)\) points from a vertex on one face to its opposite vertex.

Definition: A body diagonal of a rectangular box joins two opposite vertices. With edge lengths \(a,b,c>0\), a direction vector for any body diagonal has the form \((\pm a,\pm b,\pm c)\). Reversing all three signs reverses the vector but leaves the diagonal line unchanged.

The vector from the origin along an edge of length \(a\) is \((a,0,0)\). Edges parallel to the other coordinate axes have direction vectors \((0,b,0)\) and \((0,0,c)\). These component vectors make it possible to use the dot product to compare diagonals and edges.

The Angle Formula and Line Orientation

For nonzero vectors \(\mathbf{u}\) and \(\mathbf{v}\), the angle \(\theta\) between the directed vectors is determined by \(\cos\theta=\frac{\mathbf{u}\cdot\mathbf{v}}{\|\mathbf{u}\|\|\mathbf{v}\|}\), with \(0\leq\theta\leq\pi\). The denominator is the product of their lengths, so the formula requires both vectors to be nonzero.

A diagonal is a line segment, and a line has no preferred direction. If its direction vector is reversed, it still represents the same line. Therefore, the smaller angle between two lines is between \(0\) and \(\frac{\pi}{2}\), and its cosine is \(\frac{|\mathbf{u}\cdot\mathbf{v}|}{\|\mathbf{u}\|\|\mathbf{v}\|}\). The absolute value makes the result independent of which way the diagonal vectors point.

Key distinction: Use the signed dot product to find the angle between directed vectors. Use its absolute value to find the smaller angle between unoriented diagonal lines.

Every body diagonal has length \(L=\sqrt{a^2+b^2+c^2}\), since the squared length of \((\pm a,\pm b,\pm c)\) is \(a^2+b^2+c^2\). This shared length simplifies the formulas for angles between diagonals.

Why the Sign Pattern Determines the Angle

Here is a direct justification for the formula. Choose one body diagonal with direction vector \(\mathbf{u}=(a,b,c)\); if necessary, reverse the vector so all its components are positive. Any other body diagonal has a direction vector whose components are \(\pm a,\pm b,\pm c\). Reversing that vector, if needed, does not change its line. For a distinct diagonal, we can therefore choose its direction vector to have exactly one negative component. For example, it might be \(\mathbf{v}=(a,b,-c)\).

$$ \mathbf{u}\cdot\mathbf{v} =a^2+b^2-c^2, \qquad \|\mathbf{u}\|=\|\mathbf{v}\|=L. $$

Consequently, the smaller angle \(\phi\) between these diagonal lines satisfies \(\cos\phi=\frac{|a^2+b^2-c^2|}{a^2+b^2+c^2}\). The same reasoning applies if the negative component is instead the \(a\)- or \(b\)-component. Thus, for any pair of distinct body diagonals, the numerator is the absolute value of the sum of two squared edge lengths minus the third squared edge length. The denominator is always \(a^2+b^2+c^2\).

Result: For two distinct body diagonals, choose the edge length \(r\) corresponding to the component whose sign differs after orienting the vectors as above. Then the smaller angle \(\phi\) between the diagonal lines satisfies $$ \cos\phi=\frac{|a^2+b^2+c^2-2r^2|}{a^2+b^2+c^2}. $$ This formula applies to a nondegenerate box, with \(a,b,c>0\).

The expression inside the absolute value can be positive, zero, or negative. A negative result means the chosen directed vectors form an obtuse angle; it does not mean the smaller angle between the lines is obtuse. A zero result means that the diagonals are perpendicular.

Worked Examples

Worked Example: Two Body Diagonals of a Cube

A cube has edge length \(2\). Find the smaller angle between the diagonals with direction vectors \(\mathbf{u}=(2,2,2)\) and \(\mathbf{v}=(2,2,-2)\).

First calculate the dot product:

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

Each vector has length \(\sqrt{2^2+2^2+2^2}=\sqrt{12}=2\sqrt{3}\). Thus, the product of the lengths is \((2\sqrt{3})(2\sqrt{3})=12\). The cosine of the angle is therefore \(4/12=1/3\), so the smaller angle is \(\phi=\arccos(1/3)\), approximately \(70.5^\circ\) to the nearest tenth of a degree.

Check the calculation by substituting the angle’s cosine into the dot-product formula: \((2\sqrt{3})(2\sqrt{3})(1/3)=12/3=4\), which equals the dot product. The vectors point in directions that form an acute angle, so this is also the angle between the diagonal lines.

Worked Example: Perpendicular Diagonals in a 3-by-4-by-5 Box

A box has edge lengths \(3\), \(4\), and \(5\). Find the angle between the body diagonals represented by \(\mathbf{u}=(3,4,5)\) and \(\mathbf{v}=(3,4,-5)\).

The dot product is

$$ \mathbf{u}\cdot\mathbf{v} =(3)(3)+(4)(4)+(5)(-5) =9+16-25 =0. $$

The squared length of each vector is \(3^2+4^2+5^2=9+16+25=50\), so each length is \(\sqrt{50}=5\sqrt{2}\). The angle formula gives \(\cos\theta=0/((5\sqrt{2})(5\sqrt{2}))=0\), hence \(\theta=90^\circ\).

Check: the dot product of two nonzero vectors is zero precisely when they are perpendicular. The vectors are nonzero, and their dot product is zero, confirming the result.

Worked Example: A Body Diagonal and an Edge

A box has edge lengths \(2\), \(3\), and \(6\). Find the angle between its body diagonal from the origin and an edge of length \(2\) along the \(x\)-axis.

Use \(\mathbf{u}=(2,3,6)\) for the body diagonal and \(\mathbf{e}=(2,0,0)\) for the edge. Their dot product is \((2)(2)+(3)(0)+(6)(0)=4\). Their lengths are \(\|\mathbf{u}\|=\sqrt{2^2+3^2+6^2}=\sqrt{49}=7\) and \(\|\mathbf{e}\|=\sqrt{2^2}=2\). Therefore, \(\cos\theta=4/(7\cdot2)=2/7\), and \(\theta=\arccos(2/7)\), approximately \(73.4^\circ\) to the nearest tenth of a degree.

Check by substituting: \(7\cdot2\cdot(2/7)=4\), exactly the dot product. The edge points in the positive \(x\)-direction, as does the \(x\)-component of the diagonal, so this is also the smaller angle between the diagonal and the edge line.

Angles Between a Body Diagonal and an Edge

The same dot-product method gives a compact formula for a body diagonal and an edge. Let \(\mathbf{u}=(a,b,c)\), and take an edge parallel to the \(x\)-axis. A direction vector for that edge is \((1,0,0)\), or \((a,0,0)\) if using the edge from the origin. Using \((a,0,0)\), the dot product is \(a^2\), the diagonal length is \(L=\sqrt{a^2+b^2+c^2}\), and the edge length is \(a\). Thus the cosine of the angle is \(a/L\).

$$ \cos\theta_x=\frac{a}{\sqrt{a^2+b^2+c^2}}, \qquad \cos\theta_y=\frac{b}{\sqrt{a^2+b^2+c^2}}, \qquad \cos\theta_z=\frac{c}{\sqrt{a^2+b^2+c^2}}. $$

These formulas give the smaller angle between the body diagonal and an edge line parallel to the indicated axis. If the directed edge vector points opposite to the corresponding component of the diagonal vector, the directed-vector angle is the supplement of that smaller angle. The line angle itself is unchanged by reversing the edge’s direction.

A Common Mistake: Forgetting That a Diagonal Is Unoriented

Consider a box with edge lengths \(1,1,2\), and the vectors \(\mathbf{u}=(1,1,2)\) and \(\mathbf{v}=(1,1,-2)\). Their dot product is \(1+1-4=-2\), and each vector has length \(\sqrt{1+1+4}=\sqrt{6}\). The directed-vector formula gives \(\cos\theta=-2/6=-1/3\), so the directed angle is about \(109.5^\circ\).

A common error is to report \(109.5^\circ\) as the angle between the diagonal lines. That answer depends on the chosen direction for \(\mathbf{v}\): reversing \(\mathbf{v}\) produces the same line but changes the directed angle to about \(70.5^\circ\). For the angle between lines, use the absolute value: \(\cos\phi=|-2|/6=1/3\), so \(\phi=\arccos(1/3)\), about \(70.5^\circ\). Substitution checks the line-angle formula: \((\sqrt{6})(\sqrt{6})(1/3)=2=|\mathbf{u}\cdot\mathbf{v}|\).

Why These Calculations Matter

Rectangular boxes provide a useful setting for connecting geometry to component vectors. The edge lengths determine the vector components; the dot product records how those components align. The resulting calculations answer questions that a sketch alone may not settle, such as whether two body diagonals are perpendicular or what angle a space diagonal makes with a particular edge.

When solving a problem, identify whether it asks for an angle between directed vectors or between lines. Then write a direction vector for each object, calculate the dot product and both lengths, and apply the appropriate angle formula. For diagonal lines, include the absolute value. For an edge parallel to an axis, only the matching component contributes to the dot product.

Check Your Understanding

Use vector components and the dot-product angle formula. Give angles in degrees where requested.

  1. For a box with edge lengths \(2,3,4\), write a direction vector for a body diagonal and find its length.
  2. For a cube of edge length \(1\), calculate the smaller angle between \((1,1,1)\) and \((1,-1,1)\).
  3. For a box with edge lengths \(3,4,5\), which pair of body-diagonal direction vectors from the worked example has dot product zero?
  4. For a box with edge lengths \(2,3,6\), find the cosine of the smaller angle between a body diagonal and an edge parallel to the \(z\)-axis.
  5. Why can a directed angle between two chosen diagonal vectors differ from the smaller angle between the diagonal lines?