This week’s Riddler Express has interested readers solving for the shortest possible distance between two diagonals in a cube. The solution in this post will involve some higher level mathematics toward the end. You’ve been warned.
I’ve changed the coordinates from the original posed problem with the one below. On this cube, there is a diagonal on one face of the cube connecting the points (1,0,0) and (0,0,1). There is also a diagonal of the cube itself connecting the points (0,0,0) with (1,1,1).
Our goal is to find the points p1 on the first diagonal and p2 on the second diagonal for which the distance between p1 and p2 is at a minimum.
Distance Between Two Points
A general point in three dimensional space is given as . The first two coordinates tell you where along the plane the point is, while the third coordinate tells you your height (positive values) or depth (negative values).
The distance between two points on a plane can be solved using Pythagorean’s Theorem. Let’s begin with the two points and in two-dimensions.
Two find the distance between the two points, we construct a right triangle with the segment connecting the two points behaving as the hypotenuse of a right triangle. If you are familiar with Pythagorean’s Theorem, you know that a right triangle with side lengths a and b and hypotenuse c will satisfy the equation .
Using the figure above, if we label the hypotenuse c and use and , then we know that
or better yet, we know the distance between the two points is the length
For three dimensions, it is very similar. The distance between two points and is given as
We will use this in solving the problem.
The Form of p1 and p2
Looking at our original cube, we notice that p1 is a point on the line connecting points (1,0,0) with (0,0,1). Let’s parametrize this point. We do this by letting a variable t (think of it as time) go from 0 to 1, and as it does so, the point p1 will move from (1,0,0) to (0,0,1).
This point can be represented by . When t=0, we are at (1,0,0), and when t=1, we are at (0,0,1).
Doing the same for p2, but using a variable s instead (you can still think of it as time), a point p2 can be represented as as s ranges from 0 to 1.
So, we have the general form of two points p1 and p2 on the two lines. That is,
and for some .
The distance between these two points, using the equation derived previously is
Our goal is to minimize this distance. It turns out that it is much easier to minimize the square of the distance instead (the value underneath the square root).
WARNING! Calculus is about to occur.
Finding the Minimum Distance
As was stated, we will minimize the square of the distance. Notice that this is a function of two variables t and s, and can be written
To minimize this function, we will need to set both partial derivatives equal to zero and solve the resulting equations. These equations are
Solving the first equation will reveal that . Solving the second provides us with .
So, it is when and where the minimum distance occurs. Noticing that , we can compute the minimum distance as
One thought on “Shortest Line Segment”
A pure geometric proof:
The distance between the lines will be also the distance between two parallel planes, each of them containing one of the diagonals. (Since the two diagonals are not on a common plane themselves, these planes are unique.) These two planes are part of a larger family of parallel planes. If we move or copy the cube without rotating it, then the planes required stay within the same family.
Now place three cubes in a ◊◊◊ configuration. If we call the lower end of of the space diagonal A and its upper end B; and the lower end of the space diagonal C and its upper end D; and mark the points in our cubes X, X’, X”; then in this setup B = D’ and B’ = D”. It follows that the parallel planes required for the original construction are those planes that contain the triangles ABC’ and A’B’C”.
The lines of the AC’ and A’C” type run through the point (1,½,0) by your drawing’s coordinates. We can call this point E.
We now rotate the cube and view it symmetrically (in orthogonal projection) facing the (1,0,0) to (1,1,0) edge. From this viewpoint, the cube appears as a rectangle of 1 : √2 proportions, divided in half into two congruent smaller rectangles. Also, the lines CE and ED appear as the diagonal of this large rectangle; but CD is also projected on this same diagonal. The place defined by CED is therefore at a right angle to this projection plane! The distance from this plane to any point is therefore equal to the distance from this diagonal line to the projection of that point.
What happens to the line AB? In this viewpoint/projection, it collapses into a single point, at the center of one of the longer edges of the rectangle. Therefore, the shortest distance line will be projected, without distortion, as the line connecting this point at a right angle to the diagonal.
Let us call F the point of connection along the diagonal that contains plane CED. The triangle BCF (where B and C are now projected on the same plane) has proportions 1 : √2 : √3, and its hypotenuse has length (√2)/2 = √½; the distance we wish to find is the length of the shorter cathetus. The solution is therefore √½/√3 = √⅙.
LikeLiked by 1 person