# Probability of circle given by randomly chosen diameter falling inside a square

Two dots are thrown into a square with side length 1 cm. The line ending in these two dots is the diameter of a circle. What is the probability that the circle lies in the square?

-
Are we assuming a uniform probability distribution for the dots? – icurays1 Nov 12 '12 at 18:36
Maybe you can determine the distribution of the centers of the circles, and the distribution of the diameters? Given the center and diameter, determining whether the circle lies in the square is much easier. – TMM Nov 12 '12 at 19:24
I might be inclined to first throw one dot, then look at the area of where the other dot would make the circle contained in the square. – Arthur Nov 12 '12 at 19:30
uniform distribution for dots – Xxx Nov 12 '12 at 19:51
Empirically it seems to be between 0.523 and 0.524, which is less than I was expecting. – Henry Nov 12 '12 at 22:57

The answer is somewhat suprisingly simple – it's $\pi/6$, in agreement with Henry's numerical results.

As Mark pointed out, the approach suggested by Arthur leads to a complicated set of constraints bounding the area in which the second point may lie. A different approach is to parametrize the admissible pairs of points using the circles that they're on and integrate over the Jacobian of their Cartesian coordinates. Thus,

\begin{align} x_1&=x+r\cos\phi\;,\\ y_1&=y+r\sin\phi\;,\\ x_2&=x-r\cos\phi\;,\\ y_2&=y-r\sin\phi\;, \end{align}

where $r$ is the circle's radius, $x,y$ are the coordinates of its centre and $\phi$ is the orientation of the diameter. The Jacobian matrix is

$$\frac{\partial(x_1,y_1,x_2,y_2)}{\partial(x,y,r,\phi)}=\pmatrix{1&0&1&0\\0&1&0&1\\\cos\phi&\sin\phi&-\cos\phi&-\sin\phi\\-r\sin\phi&r\cos\phi&r\sin\phi&-r\cos\phi}\;.$$

The $2\times2$ matrices in the lower half are the Jacobian matrices of polar coordinates with opposite signs of $\phi$; their determinants are $r$, and the overall determinant is $4r$.

Now consider the octant $0\le y\le x\le1$ of the square $[-1,1]^2$. In this region, the radius is bounded by $1-x$. The measure of all pairs of points in the square is $4^2=16$, so the desired probability is

\begin{align} p &= \frac8{16}\int_0^1\mathrm dx\int_0^x\mathrm dy\int_0^{1-x}\mathrm dr\,4r\int_0^{2\pi}\mathrm d\phi \\ &= 2\pi\int_0^1\mathrm dxx(1-x)^2 \\ &= \frac\pi6\;. \end{align}

-

Let $[0,1]^2$ be the given square. For symmetry reasons it is enough to analyze the case where the midpoint of the circle lies in the triangle $\{(x,y)\ |\ 0\leq y\le x\leq{1\over2}\}$. Therefore we have a priori $$y_1+y_2\leq x_1+x_2\leq 1\ .$$ The only extra constraint here is that $$\Bigl({x_2-x_1\over2}\Bigr)^2+\Bigl({y_2-y_1\over2}\Bigr)^2\leq \Bigl({y_2+y_1\over2}\Bigr)^2\ ,$$ or $$|x_2-x_1|\leq 2\sqrt{\mathstrut y_1 y_2}\ .$$ For given $y_1$, $y_2$ the set of admissible $x_1$, $x_2$ is the rectangle $$R:=\{(x_1,x_2)\ |\ y_1+y_2\leq x_1+x_2\leq 1,\ |x_2-x_1|\leq 2\sqrt{\mathstrut y_1 y_2}\}$$ of area $2\sqrt{\mathstrut y_1 y_2}\bigl(1-(y_1+y_2)\bigr)$; see the following figure. Here we have used that $2\sqrt{\mathstrut y_1 y_2}\leq y_1+y_2$.

It follows that the probability we are looking for is $$16\int_0^1\int_0^{1-y_1}\sqrt{\mathstrut y_1 y_2}\bigl(1-(y_1+y_2)\bigr)\ dy_2\ dy_1={\pi\over6}\ .$$

-