Wednesday, May 18, 2022

Expected values with Bertrand's Paradox

Bertrand's paradox is a neat problem that shows what happens when we take the words 'at random' a bit too casually. In this post, we will be looking at some problems in the same setup and how the different methods yield answers for the 'seemingly' same question.

Bertrand's paradox asks for the probability of a 'random' chord in a unit circle being longer than the side of an inscribed triangle. We are interested in the expected length of such a chord. We now see how the expected length varies if we choose the chord according to the three methods in the paradox.

(1) Circumference method
In this method, we choose two points uniformly randomly on the circumference of the circle and connect those points to create the chord. After the first point is chosen, the second point is uniformly distributed in the circumference.

With this method, if we draw a tangent at the first point, then the angle between the chord and the tangent is uniform in the range $(0,\pi)$. If we let that angle be $\theta$, then the length of the chord is simply $2\sin\theta$. Therefore,

$\displaystyle\mathbb{E}(L)=\int_0^{\pi/2}2\sin\theta\,\frac{d\theta}{\pi/2}=\frac{4}{\pi}\approx 1.2732$

(2) Radial method
In this method, we first choose a random radius. We then choose a point uniformly on this radius and draw a chord perpendicular to this line. If we let $x$ be the length of the point from the origin, then the length of the chord is $2\sqrt{1-x^2}$.

Because $x$ is uniform in $(0,1)$, we have

$\displaystyle \mathbb{E}(L)=\int_0^12\sqrt{1-x^2}dx=\frac{\pi}{2}\approx1.5708$

But here's something interesting. If we use $x=\cos\theta$ in the above integral, the integral becomes,

$\displaystyle \mathbb{E}(L)=\int_0^{\pi/2}2\sin\theta\cdot\sin\theta\,d\theta$

From what we saw in the 'Circumference method', we know that the $2\sin\theta$ denotes the length of the chord. Hence, whatever remains after that must be the PDF of the variable $\theta$.

Therefore, the PDF, $f(\theta)$, for this case is $\displaystyle f(\theta)=\sin\theta$

(3) Midpoint method
Here, a point is chosen randomly in the circle and the unique chord which has this point as the midpoint is drawn. The expected length is slightly tricky here. The trick is to identify the parameter of interest here is the distance of the point from the origin.

If we let $r$ be that distance, then the length of the chord is $2\sqrt{1-r^2}$. But $r$ is not uniform. It is well known that the density of function of $r$ is $2r$ for a unit circle. We then have

$\displaystyle \mathbb{E}(L)=\int_0^12\sqrt{1-r^2}\cdot 2r\,dr=\frac{4}{3}\approx 1.3334$

If we use the substitution $r=\cos\theta$ in the above integral, we can see that the PDF of $\theta$ in this case is $f(\theta)=\sin2\theta$

(4) Random point and line at random angle method
The video also specifies another method of creating a chord which involves choosing a point randomly in the circle and drawing a line at a random angle through this point. To make things clear, let the $r$ be the distance between the point and other centre of the circle.

Now we draw a line perpendicular to the radial line containing this point. The angle, $t$, that the random line (that we draw to create the chord) makes with this perpendicular line is uniformly distributed between $(0,\pi)$.

It can shown then the distance of the random chord and the centre of the circle is then $r\cos t$. Therefore,

$\displaystyle \mathbb{E}(L)=\int_0^{\pi/2}\int_0^12\sqrt{1-(r\cos t)^2}\cdot 2r\,dr\frac{dt}{\pi/2}=\frac{16}{3\pi}\approx 1.69765$

The above integral was solved using Wolfram Alpha.

Here we use the substitutions $u=r\cos t$ and $v=r\sin t$. Then we know that $dudv=rdrdt$. The limits of $r$ and $t$ covers the first quadrant of the unit circle and so should the limits of $u$ and $v$. Therefore,

$\displaystyle \mathbb{E}(L)=\int_0^{1}\int_0^{\sqrt{1-u^2}}2\sqrt{1-u^2}\cdot 2\,\frac{dvdu}{\pi/2}=\int_0^{1}2\sqrt{1-u^2}\cdot 2\sqrt{1-u^2}\,\frac{du}{\pi/2}$

If we now use $u=\cos\theta$, then we see that

$\displaystyle f(\theta)=\frac{2\sin^2\theta}{\pi/2}$

(5) Random point on a radial line and a line at random angle method
Just for the sake of needlessly complicating things, we look at another method where we choose a point randomly in a randomly chosen radial line and draw a at a random angle through this point (the number of randoms in this sentence!). This is almost exactly like the previous case.

$\displaystyle \mathbb{E}(L)=\int_0^{\pi/2}\int_0^12\sqrt{1-(x\cos t)^2}\cdot \,dx\frac{dt}{\pi/2}=\frac{2}{\pi}(2G+1)\approx 1.80286$

where $G$ is the Catalan constant. Note that this integral can be expressed as the integral of the Elliptic integral of the second kind. With that and some known results, this can also be calculated manually.

Again using the subtitution $u=x\cos t$ and $v=x\sin t$ with the Jacobian $dudv=xdxdt$, we see 

$\displaystyle \mathbb{E}(L)=\int_0^{1}\int_0^{\sqrt{1-u^2}}2\sqrt{1-u^2}\cdot \,\frac{dvdu}{x\cdot\pi/2}$

But $x=\sqrt{u^2+v^2}$. Using this, the fact that the integral of the secant function is the inverse hyperbolic sine of the tangent function and the substitution $u=\cos t$, we can see that the PDF in this case as

$\displaystyle f(\theta)=\frac{\sin\theta\sinh^{-1}(\tan\theta)}{\pi/2}$

That sums up the Expected values. But we can do more. There was a recent Numberphile video on similar lines. The question discussed was to find the probability that two points selected at random in a circle is lies on different sides of a 'random' chord. Here's where the PDFs we've found so far will be really useful. We'll see those in the next post.

Hope you enjoyed this.

Until then
Yours Aye
Me

Candles and Cake problem - Probabilities with Bertrand's Paradox

The video I referred to in the earlier post only shows a Monte Carlo solution but we can find the exact values quite easily using the density functions.

Because the two candles (or points) are assumed to be uniformly randomly distributed in the circle (or the cake), an important parameter that keeps repeating in all the cases below is the area of a circular segment which can given in terms of the central angle $t$ as $(t-\sin t)/2$. The probability that a point randomly chosen in a unit circle lies in this segment is then $(t-\sin t)/2/\pi$.

Note that the density we found in the earlier refers are for the random variable $\theta$, the angle the chord makes with the tangent. The angle subtended by the chord is twice this value.

Let $E$ denote the event that two randomly chosen points on the circle lie on the opposite side of the chord chosen according to the following methods.

(1) Circumference method
Like before, if we let $\theta$ be the angle between the tangent and the chord, the central angle becomes $2\theta$. Therefore, the probability that a point randomly chosen in the circle lies in the segment created by this chord is the ratio of the segment's area to that of the circle. Therefore,

$\displaystyle\mathbb{P}(E)=\int_0^{\pi/2}2\left(\frac{2\theta-\sin2\theta}{2\pi}\right)\left(1-\frac{2\theta-\sin2\theta}{2\pi}\right)\,\frac{d\theta}{\pi/2}=\frac{1}{3}-\frac{5}{4\pi^2}\approx 0.20668$

Even though we can solve this easily, Wolfram Alpha does the job perfectly.

(2) Radial line method
We know from our earlier post that the density function of the tangent angle in this case is just $\sin\theta$. Therefore the required probaility

$\displaystyle\mathbb{P}(E)=\int_0^{\pi/2}2\left(\frac{2\theta-\sin2\theta}{2\pi}\right)\left(1-\frac{2\theta-\sin2\theta}{2\pi}\right)\cdot\sin\theta\,d\theta=\frac{128}{45\pi^2}\approx 0.28820$

This can also be simplified manually, but again Wolfram Alpha minimizes our effort and shows

Note that this is $\pi$ times the expected distance between two points chosen at random inside a circle. Coincidence?

(3) Midpoint method
Again, using the density from the previous post, the probability in this case is,

$\displaystyle\mathbb{P}(E)=\int_0^{\pi/2}2\left(\frac{2\theta-\sin2\theta}{2\pi}\right)\left(1-\frac{2\theta-\sin2\theta}{2\pi}\right)\cdot\sin2\theta\,d\theta=\frac{1}{8}+\frac{2}{3\pi^2}\approx 0.19255$

Simple even without Wolfram Alpha.

(4) Random point and line at random angle method
Like the cases above we use the density function for this case that we already found in the previous post.

$\displaystyle\mathbb{P}(E)=\int_0^{\pi/2}2\left(\frac{2\theta-\sin2\theta}{2\pi}\right)\left(1-\frac{2\theta-\sin2\theta}{2\pi}\right)\cdot2\sin^2\theta\,\frac{d\theta}{\pi/2}=\frac{1}{3}\approx 0.33334$

Solved with Wolfram Alpha.

(5) Random point on a radial line and a line at random angle method
Diving right into the probability with the density function at our disposal,

$\displaystyle\mathbb{P}(E)=\int_0^{\pi/2}2\left(\frac{2\theta-\sin2\theta}{2\pi}\right)\left(1-\frac{2\theta-\sin2\theta}{2\pi}\right)\cdot\sin\theta\sinh^{-1}(\tan\theta)\,\frac{d\theta}{\pi/2}\approx 0.386408$

This time Wolfram Alpha only gives us a numerical approximation. But with Mathematica, we can confirm that the exact value is

$\displaystyle \mathbb{P}(E)=\frac{427+60\pi^2-480\log 2}{180\pi^2}$


For the sake of completion, let's finish this post with one more method that was used in the video. Here, the cut is created by choosing two random points on the circumference while the two candles were chosen randomly on a randomly chosen radius.

The first point on the circumference can be chosen to be the 'south pole' of the circle. After the second point is chosen on the circumference, let the chord subtend an angle of $2t$ at the centre. Using the symmetry of the problem, we can limit the range of $t$ to be in $(0,\pi/2)$.

We now calculate the probability that the first candle lies to the right of the chord and the second on the left. Let the radii selected for the first candle make an angle $x$ with the radius perpendicular to the chord. We get a a non-zero probability only if $-t \leq x \leq t$. When $x$ lies in this range, the probability of the first candle landing to the right of the cut is $1-\cos t/\cos x$ and $0$ otherwise.

Similarly, let $y$ be the angle between the radius chosen for the second candle and the radius perpendicular to the cut. When $-t \leq y \leq t$, the probability of the second candle ending up to the left of the cut is $\cos t/\cos y$. Else, the probability is $1$.

Therefore probability in this case depends on the following two integrals.

$\displaystyle \mathcal{I}_1=\int_0^{\pi/2} \int_{-t}^t \int_{-t}^t \frac{\cos t}{\cos y}\left(1-\frac{\cos t}{\cos x}\right)\,dy\,dx\,dt$

$\displaystyle \mathcal{I}_2=\int_0^{\pi/2} \int_{-t}^t \int_{t}^{2\pi-t} \left(1-\frac{\cos t}{\cos x}\right)\,dy\,dx\,dt$

These are very hard to evaluate even with Mathematica. Numerically evaluating these shows,

$\displaystyle \mathbb{P}(E)=2\cdot\frac{\mathcal{I}_1+\mathcal{I}_2}{\pi/2\cdot 2\pi \cdot 2\pi}\approx 0.161612$

Hope you enjoyed this.

Until then
Yours Aye
Me