Box in a Box algebra

One can circumscribe a cubical box around the unit cube, in such a way that each of the box's faces is touched by a unit cube vertex, by making the two boxes share a main diagonal, rotating the circumscribing box around that diagonal, and scaling it by the appropriate amount.  The largest such box is rotated by 60° (or 180°) from the original, and is a factor of 5/3 larger.  The question is, are these the only ways of circumscribing a cube by another cube?

Wesolve this by setting up equations relating the coordinates of the cubes' vertices. These equations will determine certain necessary conditions of a solution (like, an inner cube vertex is on the plane of an outer cube face; the vertices really form a cube) but ignore certain other conditions (like, the coordinates must be real numbers rather than complex, and the inner cube must be contained in the outer cube). We then perform a Gröbner basis computation which replaces these polynomial equations by others with the same space of solutions but for which the structure of that space is more clear. We use that basis to analyze the solution space and prove that it doesn't contain any additional solutions to our original problem.

Initial formulation

We start by fixing the outer box to have vertex coordinates (±1,±1,±1). Note that no matter how the inner box is placed, its maximum extent in each coordinate direction is determined by one of the long diagonals. Therefore, each pair of opposite outer box faces must be spanned by a long diagonal of the inner box. The midpoint of the inner box, at the center of each long diagonal, must therefore be halfway between each pair of outer box faces, which forces it to be placed at the origin.  We then parametrize the inner box's shape by three of its vertices: (1,a,b), (c,1,d), (e,f,1). If each of these three vectors has the same length, and the three pairs of vectors each form the correct angle for a pair of cube long diagonals, we indeed have a cube with long diagonals spanning the three pairs of outer cube faces, but it must still be checked whether the cube is actually inscribed in the outer cube. We solve the length equality constraints and angle constraints using Gröbner bases and check for each of the solutions whether the coordinates are within the outer cube.

Factor[
      GroebnerBasis[{{1, a, b}.{1, a, b} - {c, 1, d}.{c, 1, d}, {1, a, b}.{1, 
                a, b} - {e, f, 1}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{c, 1, d}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {c, 1, d}.{e, f, 1}}, {a, b, c, d, e, f}]]

What a mess. But at least we can make some simplifications. If the first polynomial in the basis is to be zero, one of its three factors must be zero. We can split the solutions into cases according to which factor we assume to be zero; in each case, we simply throw one of the factors into the basis and try again.  Note that (1+e\(\^2\)+(f^2)) can not be zero, because e and f are both supposed to be real numbers, so we can get rid of that factor.

Case 1:  1 - 3 e + (e^2) - 3 f - 3 e f + (f^2) = 0

Initial solution to case 1

Let's look at the next factor:

Factor[
      GroebnerBasis[{{1, a, b}.{1, a, b} - {c, 1, d}.{c, 1, d}, {1, a, b}.{1, 
                a, b} - {e, f, 1}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{c, 1, d}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {c, 1, d}.{e, f, 1}, 1 - 3 e + (e^2) - 3 f - 3 e f + (f^2)}, {
          a, b, c, d, e, f}]]

It's still a mess, but less of one. We can again subdivide into cases according to the factorization. Note that 1 + f + (f^2) has only complex roots,  
      so we can ignore that factor. The same is true for the factor 1 + 6 f + 6 (f^2) - 10 (f^3) + 5 (f^4).

Case 1A: d - e= 0

Factor[
      GroebnerBasis[{{1, a, b}.{1, a, b} - {c, 1, d}.{c, 1, d}, {1, a, b}.{1, 
                a, b} - {e, f, 1}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{c, 1, d}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {c, 1, d}.{e, f, 1}, 1 - 3 e + (e^2) - 3 f - 3 e f + (f^2), 
          d - e}, {a, b, c, d, e, f}]]

Again we divide into cases according to the factorization. We can ignore the factor 1 + f + (f^2) since it has no real roots.

Case 1A.1: b-f = 0

Factor[
      GroebnerBasis[{{1, a, b}.{1, a, b} - {c, 1, d}.{c, 1, d}, {1, a, b}.{1, 
                a, b} - {e, f, 1}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{c, 1, d}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {c, 1, d}.{e, f, 1}, 1 - 3 e + (e^2) - 3 f - 3 e f + (f^2), 
          d - e, b - f}, {a, b, c, d, e, f}]]

This case is completely symmetric and describes the solutions we already expected, in which the two cubes share a main diagonal.

Case 1A.2: 1 - 4 f + (f^2)  =  0

Factor[
      GroebnerBasis[{{1, a, b}.{1, a, b} - {c, 1, d}.{c, 1, d}, {1, a, b}.{1, 
                a, b} - {e, f, 1}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{c, 1, d}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {c, 1, d}.{e, f, 1}, 1 - 3 e + (e^2) - 3 f - 3 e f + (f^2), 
          d - e, 1 - 4  f + (f^2)}, {a, b, c, d, e, f}]]

NSolve[{1 - 4 f + (f^2) == 0, -3 e + (e^2) + f - 3 e f == 0, 
        d - e == 0, c - f == 0, 1 - 4 b + b e + b f - e f == 0, 
        3 - 5 b + 2 (b^2) - 7 f + b f == 0, 
        -1 + a + 4 b - e - b f == 0}, {a, b, c, d, e, f}]

So, these solutions to our equations do not solve the original inscribed cube problem.

Case 1B: 1 - 4 f + (f^2) = 0

Now, we try throwing in the other factor to our Gröbner basis.

Factor[
      GroebnerBasis[{{1, a, b}.{1, a, b} - {c, 1, d}.{c, 1, d}, {1, a, b}.{1, 
                a, b} - {e, f, 1}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{c, 1, d}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {c, 1, d}.{e, f, 1}, 1 - 3 e + (e^2) - 3 f - 3 e f + (f^2), 
          1 - 4  f + (f^2)}, {a, b, c, d, e, f}]]

We didn't get any factorized terms, so we can't immediately continue splitting into cases. But, the Gröbner basis above is in “triangular form” meaning that the first term only depends on one variable, the second depends only on two, the third on three, and so on.  We can find the solutions of such a basis by solving for one variable at a time. We do this numerically to get a rough idea of where the solutions are.

NSolve[{1 - 4 f + (f^2), -3 e + (e^2) + f - 3 e f, 
          -4 d + e + d e + f + d f - 4 e f, 
          -d + 2 (d^2) - 5 e + 2 f - d f - 5 e f, 
          c - f + d f - e f, 1 - 4 b + b e + b f - e f, 
          1 - 4 b + b d + b f - d f, 3 - 5 b + 2 (b^2) - 7 f + b f, 
          -1 + a + 4 b - e - b f} == {0, 0, 0, 0, 0, 0, 0, 0, 0}, {a, 
        b, c, d, e, f}]

The second solution here is bogus; NSolve only uses six of the equations and doesn't double-check that the other three are close to zero. The first solution is in range to describe an inscribed cube but looks very symmetric. How to test this? Note that the second polynomial is linear in f. We can factor out f if only we know that 3  e - 1 ≠ 0. (If not, this would involve a division by zero.) So, let's again separate into cases, starting with 3  e - 1 = 0.

Case 1B.1: 3  e - 1 = 0

Factor[
      GroebnerBasis[{{1, a, b}.{1, a, b} - {c, 1, d}.{c, 1, d}, {1, a, b}.{1, 
                a, b} - {e, f, 1}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{c, 1, d}, {1, a, b}.{1, a, b} - 
            3 {1, a, b}.{e, f, 1}, {1, a, b}.{1, a, b} - 
            3 {c, 1, d}.{e, f, 1}, 1 - 3 e + (e^2) - 3 f - 3 e f + (f^2), 
          1 - 4  f + (f^2), 3  e - 1}, {a, b, c, d, e, f}]]

This verifies that in any solution, 3  e - 1 ≠ 0 and means it's safe to substitute for f. No surprise, since this expression was nonzero in the three numerical solutions to case 1B.

Case 1B.1: 3  e - 1 ≠ 0

We solve for f...

Solve[-3 e + (e^2) + f - 3 e f == 0, f]

...plug that solution in, and cancel the nonzero denominators. Note that this may lead to some extra solutions to the new set of equations, that don't solve the original equations. If we do end up with plausible-looking solutions, we still need to check them against the original formulation.

Factor[
      Expand[({{1, a, b}.{1, a, b} - {c, 1, d}.{c, 1, d}, {1, a, b}.{1, a, 
                      b} - {e, f, 1}.{e, f, 1}, {1, a, b}.{1, a, b} - 
                  3 {1, a, b}.{c, 1, d}, {1, a, b}.{1, a, b} - 
                  3 {1, a, b}.{e, f, 1}, {1, a, b}.{1, a, b} - 
                  3 {c, 1, d}.{e, f, 1}, 
                1 - 3 e + (e^2) - 3 f - 3 e f + (f^2), 1 - 4  f + (f^2)} 
               /. {f -> -((3 e - (e^2))/(-1 + 3 e))}) 
          (((3  e - 1))^2)]]

Let's take out the extra factors of 3  e - 1 and recompute the basis.

Factor[
      GroebnerBasis[{(a^2) + (b^2) - (c^2) - (d^2), 
          (a^2) + (b^2) - 6 (a^2) e - 6 (b^2) e - 10 (e^2) + 9 (a^2) (e^2) + 
            9 (b^2) (e^2) + 12 (e^3) - 10 (e^4), 
          1 - 3 a + (a^2) + (b^2) - 3 c - 3 b d, 
          -1 - (a^2) + 3 b - (b^2) + 6 e + 9 a e + 3 (a^2) e - 
            9 b e + 3 (b^2) e - 9 (e^2) - 3 a (e^2), 
          -1 - (a^2) - (b^2) + 3 d + 12 e + 3 (a^2) e + 3 (b^2) e + 
            3 c e - 9 d e - 3 (e^2) - 9 c (e^2), 
          (1 - 14 e + (e^2)) (1 - 4 e + (e^2)), 
          (1 - 14 e + (e^2)) (1 - 4 e + (e^2))}, {a, b, c, d, e}]]

We can now ignore the factors of d - e since we tried them already in case 1A.

Factor[
      GroebnerBasis[{(1 - 14 e + (e^2)) (1 - 4 e + (e^2)), 
          1 - 4 e + (e^2), -5 + 2 d + 3 e, 
          9 + 8 c + 32 d - 191 e - 8 d e + 61 (e^2) - 3 (e^3), 
          (-1 + 4 b - e) (1 - 4 e + (e^2)), -4 + b + e, 
          19 - 2 b + 4 (b^2) - 267 e - 2 b e + 89 (e^2) - 5 (e^3), 
          3 + 8 a - 53 e + 8 b e + 15 (e^2) - (e^3)}, {a, b, c, d, e}]]

We've gotten this case down to a very simple basis, again in triangular form. In fact, after the first quadratic equation, everything is linear. I think we can trust NSolve to find the correct two solutions (one for each root of the quadratic).

NSolve[{1 - 4 e + (e^2), -5 + 2 d + 3 e, 7 + 2 c - 3 e, 
          -4 + b + e, a - e} == {0, 0, 0, 0, 0}, {a, b, c, d, e}]

Note that neither of these is close to describing an inscribed cube.

Case 2: 5 + 57 (e^2) - ... + 6 e (f^5) + 2 (f^6)  =  0

Just what is this extra equation anyway?

eq  =  
      5 + 57 (a^2) - 72 (a^3) + 54 (a^4) - 18 (a^5) + 2 (a^6) - 66 a b + 
        72 (a^2) b + 48 (a^3) b - 36 (a^4) b + 6 (a^5) b + 57 (b^2) + 
        72 a (b^2) - 99 (a^2) (b^2) + 54 (a^3) (b^2) - 12 (a^4) (b^2) - 
        72 (b^3) + 48 a (b^3) + 54 (a^2) (b^3) - 42 (a^3) (b^3) + 54 (b^4) - 
        36 a (b^4) - 12 (a^2) (b^4) - 18 (b^5) + 6 a (b^5) + 2 (b^6);

Let's first find any solutions on the boundary of the feasible region -1 ≤ a,b ≤ 1. Plugging in one of these values gives a quintic polynomial which NSolve should find the five roots of.

NSolve[0  ==  eq  /.  {a  ->  1}, b]

NSolve[0  ==  eq  /.  {a  ->  -1}, b]

Hmm...none of these is a feasible solution. Does it have any feasible solutions at all? Let's plot it and get an idea. This is not a proof but hopefully it will lead to an idea for a proof.

ParametricPlot3D[{a, b, eq/200}, {a, -1, 1}, {b, -1, 1}, 
      Axes -> Automatic]

Ok, it looks completely positive within the appropriate range of a,b. And we have the solutions above for a,b=±1 to show that it does never go zero there. If it were zero anywhere inside this region, it would have to have a local minimum, at which the partials with respect to both a and b are zero, with a nonpositive value of eq. Can this happen? Note that there is (as may be seen above) a local minimum at a=b=0, since neither partial derivative has a constant term, but the value of eq at this point is 5.

Factor[GroebnerBasis[{D[eq, a], D[eq, b]}, {a, b}]]

The Gröbner basis is again a mess, but as usual we can extract useful information from its factors. The first factor, b-2, obviously doesn't give us anything within the region, and the third factor, b+1, only has roots on the boundary. The fifth, 5  (b^2) - 8, has real roots outside the feasible region, and the sixth, 5  (b^2) + 1, only has complex roots. That leaves three cases: the second term (b=0), the fourth term (a quadratic with one root in range), and the seventh term (an eighth degree polynomial with two roots in range).

Case 2a: b

Factor[GroebnerBasis[{D[eq, a], D[eq, b], b}, {a, b}]]

So, the only local minimum of eq from this case is the one we already knew about, a = b = 0 which does not have a negative value of eq.

Case 2b: 1 - 4  b + (b^2)

Factor[GroebnerBasis[{D[eq, a], D[eq, b], 1 - 4  b + (b^2)}, {a, b}]]

So, if -1 ≤ b ≤ 1, 3 ≤ a ≤ 5 and this case does not lead to feasible local minima.

Case 2c: \(TraditionalForm
      \`\(-600\) + 300  b + 3982  b\^2 - 7046  b\^3 + 5549  b\^4 - 
        6284  b\^5 + 7943  b\^6 - 4832  b\^7 + 1024  b\^8\)

By symmetry (and since we have exhausted other cases) we can assume that both a and b both fall into this last case.

Factor[
      GroebnerBasis[
        Join[GroebnerBasis[{D[eq, a], D[eq, b]}, {a, b}], {
            -600 + 300  b + 3982 (b^2) - 7046 (b^3) + 5549 (b^4) - 
              6284 (b^5) + 7943 (b^6) - 4832 (b^7) + 1024 (b^8), 
            -600 + 300 a + 3982 (a^2) - 7046 (a^3) + 5549 (a^4) - 
              6284 (a^5) + 7943 (a^6) - 4832 (a^7) + 1024 (a^8)}], {a, b}]]

Another Gröbner basis in triangular form: an eighth-degree polynomial and a linear one. So there should be eight roots, critical points of eq, which NSolve can find for us.

NSolve[% == {0, 0}, {a, b}]

So, there are no solutions in the appropriate range, so no negative local minima of eq, so no zeros of eq within the appropriate range, so no extra inscriptions of the cube.