In the case A is the center of the unit
square and B is the point opposite to A on
the surface of the cube with respect to the
center of the cube, then the distance along
the surface of the cube between them is at
least 2x. Hence, 2x ≤ d ≤ 2 / 2.
Therefore, x ≤ 2 / 4.
The maximum x = 2 / 4 is attainable can
be seen by considering the following
picture of the unit square