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$?




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.