# Can we prove box A fits in box B only by comparing volumes and diagonals?

This question arised to me last week, following a question with similar subject I found here. Since I am learning math on my own, I've been unsuccessful in looking for geometry references to provide me an answer and proof on checking if a Box A fits in Box B.

So I came up with:

Given a box $B_A$ with dimensions $(x_A, y_A, z_A)$, such that $x_A, y_A, z_A \geq 0$ and a box $B_B$ with dimensions $(x_B, y_B, z_B)$ and $x_B, y_B, z_B \geq 0$; we can say that $B_A$ fits in $B_B$ iff:

$i)$ The volume $V_A$ of box $B_A$ is less than or equal to the volume $V_B$ of $B_B$, thus: $V_A \leq V_B$;

$ii)$ The main diagonal $D_A$ of $B_A$ is no greater than the main diagonal $D_B$ of $B_B$, thus: $D_A \leq D_B$;

It is obvious that $i$ holds true, for any volume $V_i$ contained in a volume $V_j$, either $V_i < V_j$ or $V_i = V_j$.

We can see that $ii$ also holds since the greater diameter of any box $B_i$ is that of its main diagonal $D_i$, such that no box $B_j$ with main diagonal $D_j$ is contained in it if its diameter $D_j > D_i$.

With these in mind, I came up with an equation considering only these two conditions to check if a box fits another box:

$|(V_B - V_A)|(\sqrt{x_B^2 + y_B^2 + z_B^2} - \sqrt{x_A^2 + y_A^2 + z_A^2}) \geq 0$

How can we prove this? I am not acquainted to proofs yet, but for every example I've used it, it worked.

• I don't think your two conditions are sufficient. eg $7\times 7\times 1$ and $9\times 3\times 3$ (pizza box vs shoe box) – Joffan Oct 1 '17 at 15:32
• Indeed. I've checked it for many 2-D cases $(x_A, y_A, 0)$ and $(x_B, y_B, 0)$ and it holds. Maybe we should check for $n-1$ diagonals in an $n$-dimensional Box? – Matheus Lima Oct 1 '17 at 15:43
• The pizza box has the longer max face diagonal, but these two still won't fit in each other (even if we increase the pizza box dimensions slightly). It's an interesting challenge. – Joffan Oct 1 '17 at 15:47
• True. We can even consider extreme cases using $(x_A, y_A, 0) | x_A, y_A = 7$ and $(x_B, y_B, z_B) | x_B = 9, y_B, z_B = 3$ (i.e. the pizza box is a plane 7x7 long). – Matheus Lima Oct 1 '17 at 15:59

The first thing that comes to my mind is that each $(x,y,z)$ of a box $B_A$ has to be smaller than or even to the corresponding $(x,y,z)$ of $B_B$ that it is contained within.
Your conditions can't be enough because we will always be able to find extreme cases where the volume and the diagonal will be large, and will mainly depend on $2$ sides; but the remaining side will be small and won't be able to contain anything.
An example is $B_A = (10,10,10)$ and $B_B = (1000,1000,1)$. We want to contain $B_A$ within $B_B$, both of your conditions are satisfied. But obviously we can't contain $B_A$ within $B_B$ because of the $z$ value for both boxes.
• I think it must include this factor but it doesn't suffice either: "The first thing that comes to my mind is that each side of a box BABA has to be smaller than or even to the box BBBBs sides that it is contained within." Suppose $B_A = (5, 1, 0)$ and $B_B = (4, 4, 0)$, it is false that each side of $B_A$ is smaller than or even to $B_B$s sides, and it still fits. – Matheus Lima Oct 1 '17 at 16:44
• Well your example doesn't follow my conditions, because $5 > 4$. So yes it won't be contained, but that's expected. If we would have $B_A = (4,1,0)$ and $B_B = (4,4,0)$, then $B_A$ would be contained within $B_B$ – Sam Anderson Oct 1 '17 at 16:51
• My bad, I meant $B_A = (4.50*, 1, 0)$ fits in $B_B = (4, 4, 0)$, and the relationship between sides of $B_A$ and $B_B$: $x_A > x_B$, $y_A < y_B$, $z_A = z_B$. Your conditions are true for $y_AB, z_AB$ but not for $x_AB$. * - Edited the value for $x_A$ to 4.50. P.S.: Maybe I should add that any rotations are allowed. – Matheus Lima Oct 1 '17 at 16:59
• In your above comment, your $B_A$ does not fit inside of your $B_B$ yes, which is also expected. Because $x_A > x_B$. As I said in my answer, apparently not too clearly, if we want $B_A$ to fit inside of $B_B$, then the following must hold: $x_A \le x_B$ and $y_A \le y_B$ and $z_A \le z_B$. – Sam Anderson Oct 1 '17 at 17:06
• $B_A (4.5, 1, 0)$ fits in $B_B (4, 4, 0)$ link – Matheus Lima Oct 1 '17 at 17:55