# Distance to random line in Disk [closed]

Consider the model in which we choose two points in the disk uniformly at random. What is the expected distance from the line segment between these two points to the origin? Note that the problem is significantly easier if it were the distance to the line (rather than segment) defined by a and b.

## closed as off-topic by Gibbs, Saad, Namaste, Xander Henderson, jvdhooftJun 9 '18 at 10:11

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Gibbs, Saad, Namaste, Xander Henderson, jvdhooft
If this question can be reworded to fit the rules in the help center, please edit the question.

• Any thoughts yourself? – Henry Jun 8 '18 at 21:12
• I seem to be able to solve it if it's the distance to the infinite line going through a and b, since then I can find a formal equation for the line and the distance is obvious. I'm having difficulty handling the situation and when it is simply a line segment. – JohnKnoxV Jun 8 '18 at 21:17
• Maybe you could give the answer you found (for the distance to the line), and clarify that you mean the line segment (which is not clear the way you wrote the question.) – Lukas Geyer Jun 8 '18 at 21:36
• Indeed, if it were the infinite line through two points instead of the line segment between them, then the answer is $\frac{16}{15\pi}$. For the line segment, though... – Sangchul Lee Jun 8 '18 at 21:41

Let $P_1$ and $P_2$ be uniformly randomly chosen points of the unit disc. Let $O$ denote the origin, and write $R_i = \overline{OP_i} = \|P_i\|$ and $\Theta = \angle P_1 O P_2 = \arccos\left(\frac{\langle P_1, P_2 \rangle}{R_1R_2} \right)$. We know that $R_1, R_2, \Theta$ are independent and have densities

$$f_{R_i}(r) = 2r \mathbf{1}_{[0,1]}(r), \qquad f_{\Theta}(\theta) = \frac{1}{\pi} \mathbf{1}_{[0,\pi]}(\theta).$$

Now the distance $L$ between the line segment $\overline{P_1P_2}$ and $O$ is given explicitly by

$$L = \begin{cases} R_1, & \text{if R_1 < R_2 \cos\Theta}, \\ R_2, & \text{if R_2 < R_1 \cos\Theta}, \\ \operatorname{dist}(\stackrel{\longleftrightarrow}{P_1 P_2}, O), & \text{otherwise} \end{cases}$$

Note, for instance, that $R_1 < R_2 \cos\Theta$ is equivalent to saying that $\angle O P_1 P_2$ is obtuse. So the above formula follows from analyzing the shape of $\triangle OP_1 P_2$. We also notice that

$$\operatorname{dist}(\stackrel{\longleftrightarrow}{P_1 P_2}, O) = \frac{\left| \det(P_1, P_2) \right|}{\| P_1 - P_2 \|} = \frac{R_1 R_2 \sin\Theta}{\sqrt{R_1^2 + R_2^2 - 2R_1 R_2 \cos\Theta}}.$$

Using this, one can find an expression for the conditional expectation $\mathbb{E}[L \mid \Theta = \theta]$:

$$\mathbb{E}[L \mid \Theta = \theta] = \frac{8}{5} \int_{0}^{1} \left( \mathbf{1}_{\{ s \leq \cos\theta\}} + \frac{\sin\theta}{\sqrt{1 + s^2 - 2s\cos\theta}} \mathbf{1}_{\{s>\cos\theta\}} \right) s^2 \, ds.$$

So by the Fubini's theorem,

\begin{align*} \mathbb{E}[L] &= \frac{1}{\pi} \int_{0}^{\pi} \mathbb{E}[L \mid \Theta = \theta] \, d\theta \\ &= \frac{8}{5\pi} \int_{0}^{1} \int_{0}^{\pi} \left( \mathbf{1}_{\{ s \leq \cos\theta\}} + \frac{\sin\theta}{\sqrt{1 + s^2 - 2s\cos\theta}} \mathbf{1}_{\{s>\cos\theta\}} \right) s^2 \, d\theta ds \\ &= \frac{8}{5\pi} \int_{0}^{1} \left( \arccos(s) + \frac{1+s}{s} - \frac{\sqrt{1-s^2}}{s} \right) s^2 \, ds \\ &= \frac{52}{45\pi}, \end{align*}

which is approximately $0.36782475736793588711\cdots$.

Indeed, Monte Carlo simulation with $10^5$ pairs of points shows that

• +1. Interesting that it's just $8\%$ larger than the average distance from the line. – joriki Jun 9 '18 at 6:58