Calculate leftover volume of a drilled out cube

Solution 1:

As suggested by Ted Shifrin in comments, place the center of the cube at the origin with its faces parallel to coordinate planes.

enter image description here

Then the equation of drills' cylindrical surfaces are,

$x^2 + y^2 = r^2$
$y^2 + z^2 = r^2$
$z^2 + x^2 = r^2$

Now take example of the left-out piece of solid on the right bottom corner (corner $2$) -

If you see the face shaded in dark blue and dark grey (corner $2$), that is to the right of $x^2 + z^2 = r^2$. Now at the intersection of other two cylinders,

$x^2 + y^2 = y^2 + z^2 = r^2 \implies x = \pm z$. As it's corner $2$, $x = - z$

So for $x \leq - z$, $y$ is bound below by the surface shaded in dark blue and above by the cylinder $x^2 + y^2 = r^2$.

Now at the intersection of $x = -z$ and $x^2 + z^2 = r^2, z = \pm \frac {r}{\sqrt2}$. As it's corner $2$, $z = - \frac{r}{\sqrt2}$

That leads to the bounds,

$-r \leq y \leq - \sqrt{r^2 - x^2}$
$\sqrt{r^2 - z^2} \leq x \leq - z$
$- r \leq z \leq - \frac{r}{\sqrt2}$

for the order of integration $dy ~ dx ~ dz$.

For $x \geq - z, $ you will have the same volume and then there are $8$ such corners.

So once you evaluate the integral, multiply by $16$.


Given your quest for further clarity on bounds, let me provide a bit more detail. The upper bound of $z$ is $ - \frac {r}{\sqrt2}$ because we divided the volume of corner $2$ into two. We did so because we did not have a single bound of $y$ for the whole face of corner 2 which is in the plane $y = -r$. For $x \leq - z$, $y$ is bound above by the cylinder $x^2 + y^2 = r^2$ and for $x \geq -z$, $y$ is bound above by the cylinder $y^2 + z^2 = r^2$. The bounds that I wrote in my answer above is for the part shaded in dark blue. For the part above plane $x = -z$ (shaded in dark grey), the bounds will be -

$- r \leq y \leq - \sqrt{r^2-z^2}$
$- x \leq z - \sqrt{r^2 - x^2}$
$\frac{r}{\sqrt2} \leq x \leq r$

for the order of integration $dy ~ dz ~ dx$. But the volume is same by symmetry so you can just evaluate the first integral I originally wrote and multiply it by $2$ to find the volume of corner $2$. Then multiply by $8$ for $8$ corners.

To further show what's going on, let me take corner $4$.

The surface marked in yellow is part of cube drilled by $x^2 + z^2 = r^2$; the part marked in light blue is by the drill $x^2 + y^2 = r^2$ and the part marked in green is by the drill $y^2 + z^2 = r^2$. As you can see, the plane $z = x$ is the intersection of drills $x^2 + y^2 = r^2$ and $y^2 + z^2 = r^2$ and should be used to split the volume integral to get right bounds of $y$ for the face of corner $4$, which is in the plane $y = r$.

Solution 2:

From your picture, we can actually break each corner further into half, and multiply the following set up by $16$

$$V = 16\int_{\frac{r}{\sqrt{2}}}^r\int_{\sqrt{r^2-x^2}}^x\int_{-r}^{-\sqrt{r^2-y^2}}dzdydx$$

This integral gives the correct answer, but I can't calculate properly. @Intelligenti has the proper calculation from Mathematica as

$$2(4+4\sqrt{2}-3\pi)r^3$$