Tl;dr: Is the red median in this image the average distance between that corner and the opposite leg?

I'm trying to come up with an approximation for a physical problem which involves calculating average lengths of segments which span opposite sides of a square. I've come up with the following reasoning: because the maximum possible length is the square's diagonal and the minimum length is the side of the square, the problem actually reduces to finding the average distance between one 45 corner of a 45-45-90 triangle (whose hypotenuse is the square's diagonal) and the opposite leg.

Now here's the (porbably very dumb and obvious) question: is it correct to say that the median starting from that corner to the opposite leg is precisely that average distance? And is it safe to say it is also the average distance between random points on opposite sides of a square with sides equal to the triangle's legs?

  • $\begingroup$ It's close to the length of the red line, but not quite. The distances to points below the red line are a bit more clumped together, and the distances to points above the red line are a bit more spread out, which means that the red line (which does represent the median distance) slightly underestimates the true mean. $\endgroup$
    – Arthur
    Aug 16 '17 at 13:54
  • $\begingroup$ Not sure I see the equivalence. Anyway, if $x$ is the height of the first point and $y$ the height of the second then the distance between them is $\sqrt {(x-y)^2+1}$ so you just want to integrate that over the unit square. $\endgroup$
    – lulu
    Aug 16 '17 at 13:55
  • $\begingroup$ If you're looking for the average distance between two random points on opposite sides of a square, you can't do it by fixing one of those random points to a corner. For that particular case, the maximum possible length is the diagonal of the square, but for any other case, it's less than that. If one of your randomly selected points is a side midpoint, for example, you have a much smaller range of possible distances. $\endgroup$ Aug 16 '17 at 15:10

No, it isn't, unless you're being very approximate. If you draw a line from the corner of a square to some point on an opposite edge, you've effectively constructed a right-triangle, of which one leg is equal to the side of the square in length, and you want to find the hypotenuse. This hypotenuse will thus have length $a\sqrt{1+x^{2}}$, where your square has side $a$ and $ax$ is the shorter leg (thus $x \in [0,1]$). This is not linear, so you can't just say the mean length is given by the median. You'd need to evaluate the following integral:

$$ \int_{0}^{1} a\sqrt{1+x^{2}} dx$$ assuming the choice of endpoint is uniformly distributed.

Further, I'm not 100% convinced that your problem can be reduced to fixing one point at a corner. Consider what happens if one endpoint is the midpoint of its side - then the maximum length of any line segment from that point to a point on the opposite side is going to be $a\sqrt{1+\left(\frac{1}{2}\right)^{2}} = a\sqrt{5/4}$, which is less than the diagonal, $a\sqrt{2}$. It's not simply enough to take the arithmetic mean of the maximum and minimum - you need to consider how likely the intermediate values are.


No, but it's close:

The average distance is $$ \frac1a \int_0^a \sqrt{y^2 + a^2} dy = \frac12 (\sqrt{2} + \sinh^{-1}(1))a \approx 1.15a $$

The length of the red line is $$ \frac{\sqrt{5}}{2}a \approx 1.12a $$

The relative error is about $3\%$.

  • $\begingroup$ $\frac{\sqrt{5}}{2} \approx 1.118$ $\endgroup$
    – citronrose
    Aug 16 '17 at 14:22
  • $\begingroup$ @citronrose, oops, sorry. thanks. $\endgroup$
    – lhf
    Aug 16 '17 at 14:23
  • $\begingroup$ Would you say the same holds true for the full square case? I suppose I need to start doing double integrals for complete accuracy. $\endgroup$
    – Axl Vang
    Aug 16 '17 at 14:42
  • $\begingroup$ @AxlVang, I don't know. Just do the integrals... WA can help... $\endgroup$
    – lhf
    Aug 16 '17 at 14:43

Since the two points are moving independently on opposite sides of $[0,1]^2$ we have to compute the integral $$J:=\int_0^1\int_0^1\sqrt{1+(x-y)^2}\>dxdy\ .$$ This can be done in elementary terms; the result is, according to Mathematica, $${2\over3}-{\sqrt{2}\over3}+{\rm arsinh}(1)\doteq1.07664\ .$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.