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?

  • 2
    $\begingroup$ Related: stats.stackexchange.com/q/22488/2970 $\endgroup$
    – cardinal
    Commented Oct 7, 2012 at 14:32
  • 1
    $\begingroup$ 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) $\endgroup$ Commented Nov 2, 2022 at 22:08
  • $\begingroup$ 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$ $\endgroup$ Commented Nov 9, 2022 at 21:53
  • $\begingroup$ 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)}$ $\endgroup$ Commented Nov 19, 2022 at 15:31
  • $\begingroup$ 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. $\endgroup$ Commented Nov 20, 2022 at 14:51

1 Answer 1


The answer, given in (Burgstaller and Pillichshammer 2009; Mathai et al. 1999), is

$$ \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}$.


  • Burgstaller, B. and Pillichshammer, F., "The average distance between two points", Bulletin of the Australian Mathematical Society, 80(3), pp.353-359, 2009.
  • Mathai, A.M., Moschopoulos, P., Pederzoli, G., "Random points associated with Rectangles", Rendiconti del Circolo Matematico di Palermo, II, XLVIII (1999).
  • 1
    $\begingroup$ It seems to be a simple problem. But it's not. Good find. (+1) $\endgroup$
    – JACKY88
    Commented Oct 7, 2012 at 14:18
  • $\begingroup$ The famous book "Integral geometry and geometric probability" of Santalo is available on line at (projecteuclid.org/euclid.bams/1183539854). $\endgroup$
    – Jean Marie
    Commented Oct 27, 2017 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .