# What is the expected perimeter of the quadrilateral implied by choosing points uniformly on each side of a unit square?

On each side of a square with unit length sides choose a point uniformly. Connect these points to form a quadrilateral. What is the expected perimeter of this quadrilateral?

I am able to simulate and also solve the integral to get the expected area of $$\frac12$$.

$$1-\frac12\int_{d=0}^{1}\int_{c=0}^{1}\int_{b=0}^{1}\int_{a=0}^{1}a(1-b)+b(1-c)+c(1-d)+d(1-a) da db dc dd=\frac12$$

The corresponding integral for the perimeter does not appear to have a straightforward solution but simulation shows the expected value to be somewhere around $$3.06$$.

• The expected area is also solved here in this question. – Goldbug Dec 11 '19 at 15:15

The expected length of a side is $$\int_0^1 \int_0^1 \sqrt{x^2+y^2}\ dx \ dy$$ I was able to get Alpha do do the two integrals, the $$x$$ one giving $$\frac 14 \left(2 (\sqrt{y^2 + 1} + y^2 \log(\sqrt{y^2 + 1} + 1)) - y^2 \log(y^2)\right)$$ and the second giving $$\frac 13 (\sqrt2 + \sinh^{-1}(1))≈0.76520$$ The expected perimeter is $$4$$ times this, or about $$3.0608$$
Your vertices lie on $$(a,0),(1,b),(c,1),(0,d)$$ hence by the Pythagorean Theorem, the perimeter is $$P(a,b,c,d) = \sqrt{(a-1)^2+b^2} + \sqrt{(b-1)^2+(c-1)^2} + \sqrt{c^2+(d-1)^2} + \sqrt{a^2+d^2}$$ and you need to compute $$\mathbb{E}[P]$$ over a joint distribution of 4 independent uniforms, i.e. $$\int_{[0,1]^4} P(a,b,c,d) da\ db\ dc\ dd \approx 3.0676,$$ with the approximation provided by Wolfram Alpha.
To be more precise, note that each of the roots basically yield the same result (since $$1-U$$ and $$U$$ have the same distribution if $$U \sim \mathcal{U}(0,1)$$). So we get $$\mathbb{E}[P] = 4\int_0^1 \int_0^1 \sqrt{a^2 + d^2}\ da\ dd = \frac{4}{3} \left[ \sqrt2 + \sinh^{-1}(1) \right] = \frac{4}{3} \left[ \sqrt2 + \ln \left(1 + \sqrt2 \right) \right]$$
With that approach, area becomes simple as well. Notice that the area of your quadrilateral is exactly the area of the unit square less areas of 4 right triangles, each of which has legs sides, which are uniformly distributed and hence has an expected area of $$\int_0^1 \int_0^1 \frac{ad}{2} \ da\ dd = \frac12 \left(\int_0^1 a\ da\right) \left(\int_0^1 d\ dd\right) = \frac18,$$ so the total area is $$A = 1 - \frac48= \frac12$$ as you computed.