Shortest Line Segment

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).

Riddle101Box
Inspired by Riddle 101 on FiveThirtyEight

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 (x,y,z). The first two coordinates (x,y) tell you where along the plane the point is, while the third coordinate z 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 (x1, y1) and (x2, y2) in two-dimensions.

DistanceBetweenTwoPoints

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 a^2+b^2=c^2.

Using the figure above, if we label the hypotenuse c and use a=|x2-x1| and b = |y2-y1|, then we know that

\displaystyle c^2 = (x2-x1)^2+(y2-y1)^2,

or better yet, we know the distance between the two points is the length

\displaystyle c = \sqrt{(x2-x1)^2+(y2-y1)^2}.

For three dimensions, it is very similar.  The distance between two points (x_1,y_1,z_1) and (x_2, y_2, z_2) is given as

\displaystyle d = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}.

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 (1-t, 0, t).  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 (s,s,s) 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,

p1 = (1-t,0,t) and p2=(s,s,s) for some t,s \in [0,1].

The distance between these two points, using the equation derived previously is

\displaystyle \sqrt{(1-t-s)^2+(0-s)^2+(t-s)^2}.

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

\displaystyle d(s,t) = (1-t-s)^2+s^2+(t-s)^2.

To minimize this function, we will need to set both partial derivatives equal to zero and solve the resulting equations. These equations are

\displaystyle \frac{\partial d}{\partial s} = -2(1-t-s)+2s-2(t-s) = 0, and

\displaystyle \frac{\partial d}{\partial t} = -2(1-t-s)+2(t-s) = 0.

Solving the first equation will reveal that s=\frac13. Solving the second provides us with t=\frac12.

So, it is when p1 = (1/2, 0, 1/2) and p2=(1/3, 1/3, 1/3) where the minimum distance occurs.  Noticing that \frac12 - \frac13 = \frac16, we can compute the minimum distance as

\displaystyle d = \sqrt{(1/6)^2+(1/3)^2+(1/6)^2} = \sqrt{1/6} \approx 0.408.

 

One thought on “Shortest Line Segment

  1. 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 = √⅙.

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s