Smallest box to fit cuboid in. You have a cuboid with dimensions of $30$ by  $8$ by $4$ inside a box (cube). Every point of the cuboid touches some side of the box. What is the smallest box you can fit this cuboid in? I need the size of the box's edge

 A: I'll suppose the smallest cubic box can be obtained when the cuboid is set as in the diagram below: its smallest face lies on an isosceles triangle $ABC$ and we can arrange a coordinate system such that $A=(a,0,0)$, $B=(0,0,b)$, $C=(0,a,0)$. One of the edges of the face (of length $w$) lies along base $AC$, while the other edge (of length $h$) is perpendicular to $AC$. I'll consider both cases: $w=4$ and $h=8$, or $w=8$ and $h=4$.
Notice that $b$ is a given function of $a$, because altitude $BH=\sqrt{a^2/2+b^2}$ satisfies:
$$
BH:h={a\over\sqrt2}:\left({a\over\sqrt2}-{w\over2}\right),
\quad\text{yielding:}\quad
b^2={a^2\over2}\left({h^2\over({a/\sqrt2}-{w/2})^2}-1\right).
$$
Lateral edges $PP'$, $QQ'$ and so on have length $l=30$ and are perpendicular to plane $ABC$. Unit vector $\hat n={1\over\sqrt{2b^2+a^2}}(b,b,a)$ is normal to plane $ABC$, hence:
$$
P'_z=P_z+{30a\over\sqrt{2b^2+a^2}},
\quad
Q'_x=Q_x+{30b\over\sqrt{2b^2+a^2}},
$$
where $P_z=b\big(1-{w\over\sqrt2 a}\big)$ and $Q_x={1\over2}a+{1\over2\sqrt2}w$.
But $P'$ lies on the upper face of the box, while $Q'$ on the front face, hence the box is a cube of edge $L$ if: $P'_z=Q'_x=L$. This is an equation for $a$ which can then be solved to obtain $L$. With the help of Mathematica I got:


*

*for $w=4$ and $h=8$: $\displaystyle L=\frac{2 \left(19280+96962 \sqrt{2}+209 \sqrt{32454639+10713200 \sqrt{2}}\right)}{135843}\approx 23.5336$;

*for $w=8$ and $h=4$: $\displaystyle L=\frac{2 \left(18320+200164 \sqrt{2}+221 \sqrt{32938311+5615800\sqrt{2}}\right)}{147723}\approx 23.2112$.
The last result should then be the minimum edge of the cubic box.

