s2vunov

2022-09-30

A random sphere containing the center of the unit cube
Inspired by a Putnam problem, I came up with the following question:
A point in randomly chosen in the unit cube, a sphere is then created using the random point as the center such that the sphere must be contained inside the cube (In other words, the largest sphere that fits). What is the probability that the center of the cube is contained inside the sphere created?
No real idea how to approach this one but thought some of you might find this interesting.

Marshall Horne

Step 1
As the probability is the same in all cubes, we can calculate it in the cube $\left[-1,1{\right]}^{3}$.
We can limit ourselves to the sixth of the cube where z is positive and has the greatest absolute value of the three coordinates. Then the radius of the sphere is $1-z$, and the centre of the cube is in the sphere if ${x}^{2}+{y}^{2}+{z}^{2}\le \left(1-z{\right)}^{2}$. Thus the admissible area of (x,y) is the intersection of the square $\left[-z,z{\right]}^{2}$ with the circle ${x}^{2}+{y}^{2}=1-2z$. A corner of the square lies on the circle if $3{z}^{2}=\left(1-z{\right)}^{2}$, that is, $z=\frac{\sqrt{3}-1}{2}$, and a midpoint of the square lies on the circle if $2{z}^{2}=\left(1-z{\right)}^{2}$, that is, $z=\sqrt{2}-1$
Thus, for $0\le z\le \frac{\sqrt{3}-1}{2}$, the entire square lies within the circle, so the area is $4{z}^{2}$.
For $\frac{\sqrt{3}-1}{2}\le z\le \sqrt{2}-1$ the circle and square intersect. The four segments of the circle that extend beyond the square each have area $\left(1-2z\right)\mathrm{arccos}\frac{z}{\sqrt{1-2z}}-z\sqrt{1-2z-{z}^{2}}$, so the area is $\pi \left(1-2z\right)-4\left(\left(1-2z\right)\mathrm{arccos}\frac{z}{\sqrt{1-2z}}-z\sqrt{1-2z-{z}^{2}}\right)$
For $\sqrt{2}-1\le z\le \frac{1}{2}$ the entire circle lies within the square, so the area is $\pi \left(1-2z\right)$; and for $z>\frac{1}{2}$ the area is 0.
Thus the desired probability is $\frac{6}{8}\left({\int }_{0}^{\frac{\sqrt{3}-1}{2}}4{z}^{2}\mathrm{d}z+{\int }_{\frac{\sqrt{3}-1}{2}}^{\sqrt{2}-1}\left(\left(1-2z\right)\left(\pi -4\mathrm{arccos}\frac{z}{\sqrt{1-2z}}\right)+4z\sqrt{1-2z-{z}^{2}}\right)\mathrm{d}z+{\int }_{\sqrt{2}-1}^{\frac{1}{2}}\pi \left(1-2z\right)\mathrm{d}z\right)\phantom{\rule{thickmathspace}{0ex}}.$
Step 2
The first and last integral evaluate to $\frac{4}{3}{\left(\frac{\sqrt{3}-1}{2}\right)}^{3}=\sqrt{3}-\frac{5}{3}$ and $\frac{\pi }{4}{\left(1-2\left(\sqrt{2}-1\right)\right)}^{2}=\pi \left(\frac{17}{4}-3\sqrt{2}\right)$, respectively. Wolfram|Alpha evaluates the indefinite form of the second integral to
$-\pi {z}^{2}+\pi z+4\sqrt{1-2z-{z}^{2}}\left(\frac{{z}^{2}}{3}+\frac{z}{6}-\frac{5}{6}\right)+\left(6-z\right)\sqrt{1-2z-{z}^{2}}+\frac{15}{2}\mathrm{arctan}\frac{1+z}{\sqrt{1-2z-{z}^{2}}}+\frac{1}{2}\mathrm{arctan}\frac{1-3z}{\sqrt{1-2z-{z}^{2}}}-4\mathrm{arcsin}\frac{1+z}{\sqrt{2}}+4\left(z-1\right)z\mathrm{arccos}\frac{z}{\sqrt{1-2z}}$
but refuses to evaluate it with limits. Substituting the limits by hand yields
$-\pi \left(3-2\sqrt{2}\right)+\pi \left(\sqrt{2}-1\right)+\frac{15}{2}\cdot \frac{\pi }{2}-\frac{1}{2}\cdot \frac{\pi }{2}-4\cdot \frac{\pi }{2}=\left(3\sqrt{2}-\frac{5}{2}\right)\pi$
at the upper limit and
$-\pi \left(1-\frac{\sqrt{3}}{2}\right)+\pi \cdot \frac{\sqrt{3}-1}{2}+\frac{2}{3}-\sqrt{3}+\frac{7}{2}\sqrt{3}-4+\frac{15}{2}\cdot \frac{5\pi }{12}+\frac{1}{2}\left(-\frac{\pi }{12}\right)-4\cdot \frac{5\pi }{12}+4\cdot \frac{\sqrt{3}-3}{2}\cdot \frac{\sqrt{3}-1}{2}\cdot \frac{\pi }{4}=-\frac{10}{3}+\frac{5}{2}\sqrt{3}+\frac{17}{12}\pi$
at the lower limit, so the second integral evaluates to
$\frac{10}{3}-\frac{5}{2}\sqrt{3}+\left(3\sqrt{2}-\frac{47}{12}\right)\pi \phantom{\rule{thickmathspace}{0ex}}.$
Thus, the desired probability is
$\frac{3}{4}\left(\sqrt{3}-\frac{5}{3}+\frac{10}{3}-\frac{5}{2}\sqrt{3}+\left(3\sqrt{2}-\frac{47}{12}\right)\pi +\pi \left(\frac{17}{4}-3\sqrt{2}\right)\right)\phantom{\rule{0ex}{0ex}}=\overline{)\frac{\pi }{4}+\frac{5}{4}-\frac{9}{8}\sqrt{3}\approx 0.086841}\phantom{\rule{thickmathspace}{0ex}},$
in agreement with Aaron’s calculation and simulation.

gsragator9

Step 1
So we're going to consider the cube $\left[-1,1{\right]}^{3}$ and restrict to centers of the sphere in the pyramid $0\le x\le y\le z\le 1$. This means that the face $z=1$ will be the closest. The origin will be (on or) inside such a sphere if and only if ${x}^{2}+{y}^{2}+{z}^{2}\le \left(1-z{\right)}^{2}$, i.e., $2z\le 1-\left({x}^{2}+{y}^{2}\right)$.
Over what region in the xy-plane does our region project? Since $x\le y\le z$, or ${x}^{2}+\left(y+1{\right)}^{2}\le 2$. This results in the portion of $0\le x\le y$ lying inside the circle ${x}^{2}+\left(y+1{\right)}^{2}\le 2$. Note that $0\le x\le \frac{\sqrt{3}-1}{2}$.
Setting up the triple integral, the volume we desire is
${\int }_{0}^{\frac{\sqrt{3}-1}{2}}{\int }_{x}^{\sqrt{2-{x}^{2}}-1}{\int }_{y}^{\frac{1}{2}\left(1-{x}^{2}-{y}^{2}\right)}dz\phantom{\rule{thinmathspace}{0ex}}dy\phantom{\rule{thinmathspace}{0ex}}dx,$
and since we're comparing to the volume of the full pyramid, which is 1/6, we take 6 times this answer.
Step 2
(We can also set this up nicely in polar coordinates:
${\int }_{0}^{\pi /4}{\int }_{0}^{\sqrt{{\mathrm{cos}}^{2}\theta +1}-\mathrm{cos}\theta }{\int }_{r\mathrm{sin}\theta }^{\frac{1}{2}\left(1-{r}^{2}\right)}\phantom{\rule{thinmathspace}{0ex}}r\phantom{\rule{thinmathspace}{0ex}}dz\phantom{\rule{thinmathspace}{0ex}}dr\phantom{\rule{thinmathspace}{0ex}}d\theta .\right)$
The integral, multiplied by 6, turns into
$\begin{array}{rl}{\int }_{0}& {}^{\frac{\sqrt{3}-1}{2}}\left(-5+4\sqrt{2-{x}^{2}}+3{x}^{2}-2{x}^{2}\sqrt{2-{x}^{2}}-\left(3x-3{x}^{2}-4{x}^{3}\right)\right)dx\\ & ={\int }_{0}^{\frac{\sqrt{3}-1}{2}}\left(-5-3x+4{x}^{3}+4\sqrt{2-{x}^{2}}+6{x}^{2}-2{x}^{2}\sqrt{2-{x}^{2}}\right)dx\\ & =\frac{5}{4}-\frac{9}{8}\sqrt{3}+\frac{\pi }{4}.\end{array}$

Do you have a similar question?