[Math] Finding the intersection points of a line with a cube

analytic geometrygeometry

The following is an old high school exercise:

Let $A = (5, 4, 6)$ and $B = (1,0,4)$ be two adjacent vertices of a cube in $\mathbb{R}^3$. The vertex $C$ lies in the $xy$-plane.

a) Compute the coordinates of the other vertices of the cube such that all $x$– and $z$-coordinates are positive.

b) Let $$g: \vec{r} = \begin{pmatrix} 10\\1\\5 \end{pmatrix} + \lambda \begin{pmatrix} 1\\1\\-1 \end{pmatrix}$$
be a line. Compute the coordinates of the intersection points of $g$ and the cube.

Question: What is the most efficient way using high school level maths to compute the intersection points by hand?

The most obvious approach would be to intersect the line with all six planes containing the cube's faces. This requires me to solve six $3 \times 3$ systems of linear equations which will probably take a while. Even worse, I will then have to check if the intersection points really belong to the surface of the cube. These are another six $3 \times 2$ systems of linear equations. Of course, the first six systems of linear equations are much easier to compute using the coordinate form of the planes, but still it will take a while.

A maybe more elegant approach would be to translate and rotate the cube such that one vertex coincides with the origin and the edges lie on the (positive) coordinate axes. Apply the same translation and rotation to $g$ and the intersection points are much easier to compute. It is also much easier to check whether or not the resulting points lie on the surface of the cube. However, in general, the rotation matrix will be very messy and therefore not advisable to do by hand.

Is there a different approach that avoids a lot of (messy) computation? I feel like there has to be some geometric property I am missing which allows for a completely different approach. After all, this is meant to be solved by high schoolers by hand.

Best Answer

Let $C(p,q,0)$. Since $AB^2=BC^2$ and $2AB^2=AC^2$, solving the system $$6^2=(1-p)^2+(0-q)^2+(4-0)^2\quad\text{and}\quad 2\times 6^2=(5-p)^2+(4-q)^2+(6-0)^2$$gives $$(p,q)=(-1,4),(5,-2)$$

Let $D(r,s,t)$. Since the midpoint of the side $AC$ is the same as the midpoint of the side $BD$, we get $$\frac{5+p}{2}=\frac{1+r}{2},\qquad \frac{4+q}{2}=\frac{0+s}{2},\qquad \frac{6+0}{2}=\frac{4+t}{2}$$ i.e. $$r=p+4,\qquad s=q+4,\qquad t=2$$

Therefore, we have either $C(-1,4,0),D(3,8,2)$ or $C(5,-2,0),D(9,2,2)$.

  • Case 1 : $A(5,4,6),B(1,0,4),C(-1,4,0),D(3,8,2)$ which are on the plane $2x-y-2z+6=0$.

    Solving $(2t)^2+(-t)^2+(-2t)^2=6^2$ gives $t=\pm 2$.

    For $t=2$, the other vertics are $A'(9,2,2),B'(5,-2,0),C'(3,2,-4),D'(7,6,-2)$.
    Note here that if a point $(a,b,c)$ is either in or on the cube whose vertices are $P_i(X_i,Y_i,Z_i)\ (i=1,2,\cdots, 8)$ , then $$\min(X_1,X_2,\cdots, X_8)\le a\le \max(X_1,X_2,\cdots, X_8),$$ $$\min(Y_1,Y_2,\cdots, Y_8)\le b\le \max(Y_1,Y_2,\cdots, Y_8),$$ $$\min(Z_1,Z_2,\cdots, Z_8)\le c\le \max(Z_1,Z_2,\cdots, Z_8)$$ Solving the system of inequalities $$-1\le 10+\lambda\le 9\quad \text{and}\quad -2\le 1+\lambda\le 8\quad\text{and}\quad -4\le 5-\lambda\le 6$$gives$$\lambda=-1$$Then, however, $(9,0,6)$ is not on the cube since $A'(9,2,2)$ is the only vertex whose $x$-coordinate is $9$ which is the maximum of $x$.

    For $t=-2$, the other vertices are $A'(1,6,10),B'(-3,2,8),C'(-5,6,4),D'(-1,10,6)$.
    Then, however, there are no $\lambda$ satisfying the system of inequalities $$-5\le 10+\lambda\le 5\quad \text{and}\quad 0\le 1+\lambda\le 10\quad\text{and}\quad 0\le 5-\lambda\le 10$$

  • Case 2 : $A(5,4,6),B(1,0,4),C(5,-2,0),D(9,2,2)$ which are on the plane $x-2y+2z-9=0$.

    Solving $t^2+(-2t)^2+(2t)^2=6^2$ gives $t=\pm 2$.

    For $t=-2$, we get the same vertices as those in the case for $t=2$ in Case 1.
    For $t=2$, the other vertices are $A'(7,0,10),B'(3,-4,8),C'(7,-6,4),D'(11,-2,6)$. Now, solving the system of inequalities $$1\le 10+\lambda\le 11\quad \text{and}\quad -6\le 1+\lambda\le 4\quad\text{and}\quad 0\le 5-\lambda\le 10$$gives$$-5\le\lambda\le 1\tag1$$The four vertices $A',B',C',D'$ are on the plane $x-2y+2z-27=0$. Solving $(10+\lambda)-2(1+\lambda)+2(5-\lambda)-27=0$ gives $\lambda=-3$ which satisfies $(1)$ to have $P(7,-2,8)$ which is on the cube since $\vec{A'P}=\frac 13\vec{A'B'}+\frac 13\vec{A'D'}$.

    The four vertices $A,D,D',A'$ are on the plane $2x+2y+z-24=0$. Solving $2(10+\lambda)+2(1+\lambda)+(5-\lambda)-24=0$ gives $\lambda=-1$ which satisfies $(1)$ to have $Q(9,0,6)$ which is on the cube since $\vec{AQ}=\frac 23\vec{AA'}+\frac 23\vec{AD}$.

    Since three vectors $\vec{AA'}=(2,-4,4),\vec{AB}=(-4,-4,-2)$ and $\vec{AD}=(4,-2,-4)$ are not parallel to $(1,1,-1)$, we see that the number of the intersection points of $g$ and the cube $ABCD$-$A'B'C'D'$ is at most $2$.

Therefore, the intersection points are $$\color{red}{(7,-2,8)\qquad\text{and}\qquad (9,0,6)}$$


Added : I've just noticed that somehow I had skipped the question a). The condition in a) can make the solution above simpler avoiding separating it into cases.

The key point in the solution above is the inequality $(1)$. We can say that for $\lambda$ which does not satisfy $(1)$, the point $(10+\lambda,1+\lambda,5-\lambda)$ is not on the cube. Also, the number of the intersection points is at most $2$. Using these information, we could avoid a lot of computations even if you started to check the planes other than $A'B'C'D'$ and $ADD'A'$ on which the intersection points exist as follows :

  • $ABCD$ whose equation is $x-2y+2z-9=0$. Then, we get $\lambda=3$ which does not satisfy $(1)$.

  • $BCC'B'$ whose equation is $2x+2y+z-6=0$. Then, we get $\lambda=-7$ which does not satisfy $(1)$.

  • $CC'D'D$ whose equation is $2x-y-2z-12=0$. Then, we get $\lambda=1$ to have $(11,2,4)$ which is not on the cube since $D'(11,-2,6)$ is the only vertex whose $x$-coordinate is $11$ which is the maximum of $x$.

  • $ABB'A'$ whose equation is $2x-y-2z+6=0$. Then, we get $\lambda=-5$ to have $(5,-4,10)$ which is not on the cube since $A'(7,0,10)$ is the only vertex whose $z$-coordinate is $10$ which is the maximum of $z$.

Also, after knowing all the coordinates of the eight vertices, you don't need to solve a system of linear equations in order to find the equations of planes. For example, since $\vec{AA'}=(2,-4,4)$, we see that the equation of the plane $A'B'C'D'$is of the form $x-2y+2z+k=0$. Substituting the coordinates of $A'$ gives $k=-27$.