# Volume of a cube in spherical polars

Let us calculate the volume of the cube using spherical coordinates. The cube has side-length $a$, and we will centre it on the origin of the coordinates. Denote elevation angle by $\theta$, and the azimuthal angle by $\phi$. Split the cube into 6 identical square based pyramids, by the planes $x = y, x = -y, x = z$ etc. Take the square-based pyramid with the base on the plane $x = \frac{a}{2}$. Then this pyramid is described by the following set of inequalities; $\frac{\pi}{4} < \theta < \frac{3\pi}{4}, \;-\frac{\pi}{4} < \phi < \frac{\pi}{4}, \;0 < x < \frac{a}{2}$

Rewriting the last inequality in polar coordinates gives $0 < r < \frac{a}{2 \cos(\phi)\sin(\theta)}$ and now we are in a position to write down the integral.

$V_\mathrm{cube} = 6 V_\mathrm{pyramid} = 6\iiint_\mathrm{pyramid} r^2 \sin(\theta) \mathrm{d}r \mathrm{d}\theta \mathrm{d}\phi$

Solve first the r integral, which gives

$\int_0^\frac{a}{2 \cos(\phi)\sin(\theta)} r^2 dr = \frac{1}{24}\frac{a^3}{ \cos(\phi)^3\sin(\theta)^3}$

and so

$V_\mathrm{cube} = \frac{a^3}{4} \int_{-\frac{\pi}{4}}^\frac{\pi}{4} \frac{\mathrm{d}\phi}{\cos(\phi)^3} \int_{\frac{\pi}{4}}^\frac{3\pi}{4} \frac{\mathrm{d}\theta}{\sin(\theta)^2}$

The antiderivative of $\sin^{-2} \theta$ is $-\cot \theta$, so the $\theta$ integral evaluates to 2, giving

$V_\mathrm{cube} = \frac{a^3}{2} \int_{-\frac{\pi}{4}}^\frac{\pi}{4} \frac{\mathrm{d}\phi}{\cos(\phi)^3}$

Mathematica tells me the remaining integral is not equal to 2, so I must've messed up somewhere. I can't see where though, can anyone else see what I've done wrong?

• +1 for matter-of-factly beginning a post with "Let us calculate the volume of the cube using spherical coordinates" :-) – joriki Jul 17 '15 at 21:21

The surfaces $\theta=\pi/4$ and $\theta=3\pi/4$ are cones, but your pyramid is bounded by planes that touch these cones, not by the cones.

• Great, thanks very much! – Joe Jul 17 '15 at 21:50

As noted already, part of the boundary of your region of integration is formed by the cones $\theta=\frac\pi4$ and $\theta=\frac{3\pi}4$ (curved surfaces), whereas the boundary should be completely composed of planar polygons. Your region of integration includes regions outside the desired pyramid.

The limits of $\theta$ are indeed $\frac\pi4 \leq \theta \leq \frac{3\pi}4$ when $\phi = 0$, but when $\phi = \pm\frac\pi4$ (on the edges of the pyramid's base parallel to the $z$ axis), the correct limits are $\arctan\left(\sqrt2\right) \leq \theta \leq \pi - \arctan\left(\sqrt2\right)$. More generally, consider the point $\left(\frac a2, y, \frac a2 \right)$ along the top edge of the pyramid's base. The polar angle of that point is $$\theta = \arctan\left( \frac{\sqrt{\left( \frac a2 \right)^2 + y^2}} {\left( \frac a2 \right)} \right) = \arctan\left( \sqrt{1 + \frac{4y^2}{a^2}}\right)$$ The azimuthal angle at that point is $$\phi = \arctan\left(\frac{y}{\left( \frac a2 \right)} \right) = \arctan\left(\frac{2y}{a} \right)$$ which gives us $\frac{2y}{a} = \tan\phi$ and therefore $\theta = \arctan\left( \sqrt{1 + \tan^2 \phi}\right) = \arctan(\sec\phi).$

So if you want to give the integration of the pyramid another shot, try it with the limits $\arctan(\sec\phi) \leq \theta \leq \pi - \arctan(\sec\phi).$

• Thanks but I've got it already now from Joriki's help. I took $-\frac{\pi}{4} < \phi < \frac{\pi}{4}$ still, and substituted in the polar coordinate transformation into the planes which bound the pyramid; $z = \pm y$ to give $\tan\theta = \pm \mathrm{cosec} \phi$ This is what happens when you don't actually think about a problem and just plug in what looks like it should be the right answer! – Joe Jul 18 '15 at 8:08
• Whoops, that cosec should be sec – Joe Jul 18 '15 at 8:22
• @Joe Thanks for alerting me to the fact that I inadvertently swapped the symbols $\phi$ and $\theta$ about halfway through my answer. There are conventions in which $\phi$ is the polar angle and apparently I slipped into one of them. I have edited the answer to correct that mistake. – David K Jul 18 '15 at 12:52
• So we in fact both found that the bounds of $\theta$ occur when $\tan\theta = \sec\phi$. (Note that $\tan(\pi - \arctan(\sec\phi)) = -\sec\phi$, so we agree on the upper limit as well as the lower limit.) – David K Jul 18 '15 at 13:09