# Average Distance Between Random Points in a Rectangle

My question is similar to this one but for rectangles instead of lines.

Suppose I have a rectangle with sides of length $L_w$ and $L_h$. What is the average distance between two uniformly-distributed random points inside the rectangle, and why?

• Commented Oct 7, 2012 at 14:32
• In the excellent related reference stats.stackexchange.com/q/22488/2970 @cardinal has not only calculated the average but also the distribution function of the distance. (+1) Commented Nov 2, 2022 at 22:08
• For the similar problem in a circle with radius a I obtain for the average distance L between the two random points the expression $\text{<L>} = \frac{128 a}{45 \pi}$, and for the average of the square of the distance I get $\text{<L^2>} = a^2$ Commented Nov 9, 2022 at 21:53
• For the similar problem in the volume of the unit sphere I found for the $k$-th moment of the distance the following simple expression $<D^k>=\frac{72\ 2^k}{(k+3) (k+4) (k+6)}$ Commented Nov 19, 2022 at 15:31
• For the similar problem in the volume of the unit sphere I found, using Fourier transform of the moment generating function, for the PDF of the distance D the surprisingly simple expression $PDF(D) = \frac{3}{16} (D+4) (2-D)^2 D^2$. The problem of the statistics of the distance of two random points in the volume of the unit sphere should thereby be completely solved. Commented Nov 20, 2022 at 14:51

$$\frac1{15} \left( \frac{L_w^3}{L_h^2}+\frac{L_h^3}{L_w^2}+d \left( 3-\frac{L_w^2}{L_h^2}-\frac{L_h^2}{L_w^2} \right) +\frac52 \left( \frac{L_h^2}{L_w}\log\frac{L_w+d}{L_h}+\frac{L_w^2}{L_h}\log\frac{L_h+d}{L_w} \right) \right)\;,$$
where $$d=\sqrt{L_w^2+L_h^2}$$.