Finding the shortest path between two points on the surface of a cube A cube with vertices $(0,0,0),(0,0,1),(0,1,0),(0,1,1),(1,0,0),(1,0,1),(1,1,0),$ and $(1,1,1)$ has the point $P_{1}$ with vertices $(\frac{1}{2},0,\frac{1}{4})$ and the point $P_{2}$ with vertices $(0,\frac{3}{4},\frac{3}{4})$. What is the length of the shortest path between $P_{1}$ and $P_{2}$ such that the path lies on the surface of the cube?
Note: $\sqrt{(\frac{1}{2}-0)^2+(0-\frac{3}{4})^2+(\frac{1}{4}-\frac{3}{4})^2}=\frac{\sqrt{17}}{4}\approx1.03078$ is the shortest distance between the two points. However, it is not the correct answer since this path does not lie on the surface of the cube.
For the same cube, can we generalize and give an expression to find the length of the shortest path between $P_{1}(x_{1},y_{1},z_{1})$ and $P_{2}(x_{2},y_{2},z_{2})$, where, clearly, $0\leq x_{i},y_{i},z_{i}\leq1$?
 A: Here's the box:

Clearly the only unfolding that matters is with the two adjacent point-bearing sides adjacent.

Then it is clear the distance is $$d = \sqrt{(5/4)^2 + (1/2)^2}$$
There are only three cases:


*

*Same face (easy)

*Adjacent faces (unfold with separating edge uncut)

*Opposite faces (depends on positions)

A: Possible method: Make an unfolded version of the cube so that there is a straight line segment on the unfolded cube going from one of your points to the other, while staying in your unfolded cube. If there's a gap, unfold a different way.
A: If the two points belong to adjacent faces, you have to check three different possible unfoldings to find the shortest path. In diagram below I represented the first point (red) and the second point (black) in three possible relative positions: middle position occurs when the path goes through the common edge, in the other cases the path traverses one of the faces adjacent to both faces. The other possible positions are clearly longer than these.

If the two points belong to opposite faces, then 12 different possible positions have to be checked: see diagram below.

