18

Let $a,b,c$ be three independent uniformly random real numbers between $0$ and $1$. Given that there exists a triangle with side lengths $a,b,c$, what is the expected area of the triangle?

Using Heron's formula, the area is $\frac14\sqrt{(a+b+c)(-a+b+c)(a-b+c)(a+b-c)}$. The expected area should be a triple integral with respect to $a,b,c$, but I don't know how to set up the limits of integration.

Previously I was able to set up an integral to answer a related question: "What is the expected area of a random triangle with perimeter $1$?" I tried to utilize my approach there, by asking "What is the expected area of a random triangle with perimeter $p$?" and then integrating from $p=0$ to $p=3$. But each value of $p$ has a different "weight", so I think I should somehow take into account the distribution of $p$, but I'm not sure how. Then, for the anti-derivative, I'm not sure what substitution would disengage $a,b,c$ to allow for indefinite integration.

A simulation with $10^7$ trials yields an average area of $0.11600$.

Dan
  • 35,053
  • 6
    This is a nice question, but whatever way I try to parametrize it (three side lengths, two side lengths and their angle, one side length and a third point), I always get ugly elliptic integrals. About "how to set up the limits of integration": Order the side lengths $a\le b\le c$; then you only need one triangle inequality, $a+b\gt c$. – joriki Jan 13 '24 at 13:59
  • 1
    Here is a naive thought that can be right or wrong. Assume $x\leq y \leq z$. Fix $z$ to be anything from $0$ to $1$. Now fix $y$ anything from $0$ to $z$. With both these fixed, $x$ can go from $z - y$ to $z$. – Tony Pizza Jan 13 '24 at 14:12
  • @TonyPizza Did you mean $x$ can go from $z-y$ to $y$ ? – Dan Jan 13 '24 at 14:21
  • @joriki If we assume $a\le b\le c$, then the distribution of each one is not uniform; that seems to complicate things. – Dan Jan 13 '24 at 14:27
  • Oh yeah. But then we can probably drop the assumption $x \leq y$ and let $x$ from $z -y$ to $z$. It's really confusing. I guess you should try some of these limits and see if it comes close to the value you got. I tried on wolfram but it's not showing output. – Tony Pizza Jan 13 '24 at 14:29
  • @Dan: The resulting marginal distributions aren't uniform, but that doesn't matter – the joint density is still constant; you just have to multiply the integral by $6$ in the end (if you manage to solve it, which I'm sceptical about). – joriki Jan 13 '24 at 14:33
  • Just a half-baked idea: Suppose I fix a length $x$ as base, and then look for the other vertex. For a particular value of $y+z$, the vertex moves in an ellipse of the fixed focal sum. Can we average over all such triangles? Then using that average we can extend to all permissible values of $y+z$, and finally average over all possible $x$. – Soham Saha Jan 13 '24 at 14:38
  • @joriki I don't know if this question has a closed form answer, but this random triangle seems to have some interesting properties, for example the probability that the longest side is at least twice the shortest side, seems to be $1/2$. – Dan Jan 13 '24 at 15:00
  • 1
    @Dan: That's because (assuming $a\le b\le c$, with a total volume of $\frac16$), the volume with $c\gt a+b$ is

    $$ \int_0^\frac12\int_a^{1-a}\int_{a+b}^1\mathrm dc,\mathrm db,\mathrm da=\frac1{12} $$

    and the volume with $c\le2a$ (which implies $c\le a+b$) is

    $$ \int_0^\frac12\int_a^{2a}\int_b^{2a}\mathrm dc,\mathrm db,\mathrm da+\int_\frac12^1\int_a^1\int_b^1\mathrm dc,\mathrm db,\mathrm da=\frac1{48}+\frac1{48}=\frac1{24};. $$

    – joriki Jan 13 '24 at 16:04
  • We have to use the fact that if $2p=a+b+c$ then $a,b,c$ are the sides of a triangle if and only if $a,b,c<p.$ If $a,b,c$ are uniform on $(0,1)$ the density of $p$ is computable and is in Feller II page 27. We have to condition with respect to $p$ while separating the cases $i<p<i+1$ for $i=0,1,2.$ – Gérard Letac Jan 13 '24 at 16:09
  • What do you mean by "random"? Imagine $x=0.1$ and $y=0.2$, do you allow your random generator to come up with $z=0.5$ (which is forbidden with regards of the triangle inequality) or do you tell the random generator only to generate random values between $0$ and $0.3$? – Dominique Jan 17 '24 at 13:24
  • @Dominique If $x=0.1$ and $y=0.2$ (or whatever), let the random number generate $z\in(0,1)$. If $x,y,z$ cannot be the lengths of a triangle, then start over. If $x,y,z$ can be the lengths of a triangle, then accept them as a trial. – Dan Jan 17 '24 at 13:32
  • Does it say anything about it being an equilateral triangle or can it be any triangle? –  Jan 18 '24 at 01:38
  • @John It can be any triangle. – Dan Jan 18 '24 at 02:04

2 Answers2

13

This is a partial answer. I only get an integral representation for the expected area.

We will use the fact:

Given $3$ positive numbers $a,b,c$, they are the sides of a non-degenerate triangle if and only if we can find $3$ positive numbers $u,v,w$ such that $$a = v + w,\;b = u + w,\;c = u + v$$

Notice $da \wedge db \wedge dc = 2 du \wedge dv \wedge dw$, the Jacobian is a constant. Uniform distribution for $a,b,c$ over unit-cube is equivalent to uniform distribution for $u,v,w$ over corresponding polyhedron in $(u,v,w)$-space: $$\Omega = \left\{ (u,v,w) \in \mathbb{R}^3 : 0 \le v + w, u + w, u + v \le 1 \right\}$$

Let $\Omega_{+} = \Omega \cap [0,\infty)^3$ and $\Delta = \left\{ (u,v,w) \in \Omega_{+}, u \ge v \ge w \right\}$. In terms of $u,v,w$, the probability of forming a triangle is

$$P_\triangle = 2 \int_{\Omega_{+}} du dv dw = 12\int_{\Delta} du dv dw$$ Change variable to $(u,v,w) = (u,us,ust)$, the condition $u \ge v \ge w$ is equivalent to $s,t \in [0,1]$ and

$$P_\triangle = 12 \int_0^1\int_0^1\left(\int_0^{\frac{1}{1+s}} u^2 du\right) sds dt = 4 \int_0^1 \frac{sds}{(1+s)^3} = \frac12 $$ In terms of $u,v,w$, the area of triangle $A = \sqrt{uvw(u+v+w)}$. Its expected area is given by the formula

$$\begin{align} \verb/E/[A] &= \frac{12}{P_\triangle}\int_\Delta \sqrt{uvw(u+v+w)} du dv dw\\ &=24 \int_0^1\int_0^1 \left(\int_0^{\frac{1}{1+s}} u^4 du\right)\sqrt{t(1+s+st)} s^2ds dt\\ &= \frac{24}{5}\int_0^1\int_0^1 \frac{s^2\sqrt{t(1+s+st)}}{(1+s)^5} ds dt \end{align} $$

I don't know how to evaluate the last integral. However, wolfram alpha and maxima 5.17.1 evaluate the integral in last line numerically as $0.0241652$ and $0.0241651708563157 \pm 2.68\times 10^{-16}$ respectively.

This leads to $\verb/E/[A] \sim 0.11599282\ldots$ matching what you get from simulation.

Update

According to @Max0815 in comment, Mathematica do know how to evaluate the integral in close form. The result is:

$$\verb/E/[A] = \frac1{1920}\left( \small \begin{align} & 1632 - 720\sqrt3 - 576 C \\& + 5\sqrt3\left(\psi^{(1)}\!\!\left(\frac16\right) + \psi^{(1)}\!\!\left(\frac13\right) - \psi^{(1)}\!\!\left(\frac23\right) - \psi^{(1)}\!\!\left(\frac56\right)\right) \end{align} \right)\\ =\frac{1}{80}\left(68 - 30\sqrt3 - 24 C + 15\operatorname{Cl}_2\left(\frac\pi3\right)\right) \phantom{======...} $$ where $C$ is the Catalan's constant and $\psi^{(1)}$ is the $1^{st}$ derivative of digamma function.

I have no idea how to get this analytically. However, WA evaluates this numerically to $$0.1159928201103153651023020463820551827782699626985368352024021543\ldots$$ which does look right.

Max0815
  • 3,584
achille hui
  • 125,323
  • 3
    After some considerable tinkering on Mathematica the closed form of the integral seems to be (1632 - 720 Sqrt[3] - 576 Catalan - 288 Im[PolyLog[2, -I Sqrt[3]] - PolyLog[2, I Sqrt[3]]] - 96 \[Pi] Log[3] + Sqrt[3] PolyGamma[1, 1/6] - 15 Sqrt[3] PolyGamma[1, 1/3] + 15 Sqrt[3] PolyGamma[1, 2/3] - Sqrt[3] PolyGamma[1, 5/6])/9216. This is around 0.0241651708563157010629795929962614964121395755621951740005004. – Max0815 Jan 17 '24 at 04:12
  • 1
    This is the input in wolfram alpha https://www.wolframalpha.com/input?i=%281632-720Sqrt%5B3%5D-576Catalan-288Im%5BPolyLog%5B2%2C-%28I+Sqrt%5B3%5D%29%5D-PolyLog%5B2%2CI+Sqrt%5B3%5D%5D%5D-96Pi+Log%5B3%5D%2BSqrt%5B3%5DPolyGamma%5B1%2C1%2F6%5D-15Sqrt%5B3%5DPolyGamma%5B1%2C1%2F3%5D%2B15Sqrt%5B3%5DPolyGamma%5B1%2C2%2F3%5D-Sqrt%5B3%5DPolyGamma%5B1%2C5%2F6%5D%29%2F9216 – Max0815 Jan 17 '24 at 04:16
  • 2
    @Max0815 thanks, it looks more horrible than I thought what it could be :-p – achille hui Jan 17 '24 at 04:17
  • There is a curious similarity between the closed form given by @Max0815 and the closed form here, which can be simplified as shown here using the Clausen function. – Dan Jan 17 '24 at 04:32
  • 2
    @Dan interesting, it probably means the horrible monster can be expressed in terms of Clausen function and hence some form of elliptic function. this is consistent with what joriki's mention in his comment... – achille hui Jan 17 '24 at 04:52
  • 2
    I revisited this using the Rubi package in mathematica and it gave out a much cleaner answer (without imaginary part functions or dilogarithms): https://www.wolframalpha.com/input?i=%281632+-+720+sqrt%283%29+-+576+Catalan+%2B+5+sqrt%283%29+polygamma%281%2C+1%2F6%29+%2B+5+sqrt%283%29+polygamma%281%2C+1%2F3%29+-+5+sqrt%283%29+polygamma%281%2C+2%2F3%29+-+5+sqrt%283%29+polygamma%281%2C+5%2F6%29%29%2F9216&assumption=%22ClashPrefs%22+-%3E+%7B%22Math%22%7D And since this is done with Rubi, technically you can also do this by hand lol since it gives you the steps it follows. I'll edit this in :p – Max0815 Jan 17 '24 at 08:05
  • 1
    (With this in mind, it seems @Dan 's suspicious are correct that the Clausen function can be used to simplify it, which I have used to simplify it further) – Max0815 Jan 17 '24 at 08:18
  • 1
    $\operatorname{Cl}_2\left(\frac\pi3\right)$ is Gieseking's constant. – Dan Jan 17 '24 at 08:50
  • 3
    @Max0815 thanks again. With the representation of ${\rm Cl}_2$ a integral of $log(2\sin\frac{t}{2})$, it now seems possible to derive the monster by hand.... – achille hui Jan 17 '24 at 08:59
10

Here's a way to show that the integral from achille hui's answer is:

$$\boxed{\verb/E/[A]=\frac{17}{20}-\frac{9}{8\sqrt 3}-\frac{3}{10}C+\frac{3}{16}G}$$

Where $C$ is Catalan's constant and $G$ is Gieseking's constant.
We'll start by evaluating the $t$ integral first, which gives:

$$\verb/E/[A]=\frac{24}{5}\int_0^1 \frac{s^2}{(1+s)^5}\int_0^1 \sqrt t\sqrt{1+s+st}\, dt ds$$

$$=\frac{6}{5}\int_0^1\frac{s^2}{(1+s)^5}\sqrt{1+2s}\left(3+\frac{1}{s}\right)ds-\frac65\int_0^1 \frac{\sqrt s}{(1+s)^3}\operatorname{arcsinh}\sqrt{\frac{s}{1+s}}ds$$

Here we already know from the announced closed form that the answer should produce a cluster term of $\frac{17}{20}-\frac{9}{8\sqrt 3}$, so to split it from the other terms we should remove the powers from $(1+s)^3$. For this we can use:

$$\left(\frac{(1-s)\sqrt s}{4(1+s)^2}\right)'= -\frac{\sqrt s}{(1+s)^3}+\frac{1}{8\sqrt s (1+s)}$$

$$\small \Rightarrow \verb/E/[A]=\frac{6}{5}\int_0^1\frac{s^2}{(1+s)^5}\sqrt{1+2s}\left(3+\frac{1}{s}\right)ds +\frac65\int_0^1 \left(\frac{(1-s)\sqrt s}{4(1+s)^2}\right)'\operatorname{arcsinh}\sqrt{\frac{s}{1+s}}ds$$

$$-\frac{3}{20}\underbrace{\int_0^1 \frac{\operatorname{arcsinh}\sqrt{\frac{s}{1+s}}}{\sqrt s(1+s)}ds}_{=\mathcal J}=\boxed{\frac{17}{20}-\frac{9}{8\sqrt 3}-\frac{3}{20}\mathcal J}$$

Above follows after integrating by parts the second integral followed by evaluating it alongside the first integral. Therefore it only remains to calculate $\mathcal J$.


$$\mathcal J=\int_0^1 \frac{\operatorname{arcsinh}\sqrt{\frac{s}{1+s}}}{\sqrt s(1+s)}ds\overset{\sqrt{\frac{s}{1+s}}=x}=2\int_0^\frac{1}{\sqrt 2} \frac{\operatorname{arcsinh} x}{\sqrt{1-x^2}}dx$$

$$=2\int_0^1\int_0^\frac{1}{\sqrt 2}\frac{x}{\sqrt{1+t^2x^2}\sqrt{1-x^2}}dxdt$$

$$=2\underbrace{\int_0^1 \frac{\arctan t}{t}dt}_{C}-2\underbrace{\int_0^1 \frac{\arctan\frac{t}{\sqrt{2+t^2}}}{t}dt}_{\large \frac58\operatorname{Cl}_2\left(\frac{\pi}{3}\right)}=\boxed{2C-\frac{5}{4}G}$$

The first integral is simply equal to the Catalan's constant $(C)$, which can be shown by expanding the $\arctan$ function into power series. The second integral can be rewritten as:

$$\int_0^1 \frac{\arctan\frac{t}{\sqrt{2+t^2}}}{t}dt\overset{\frac{t}{\sqrt{2+t^2}}=x}=\int_0^\frac{1}{\sqrt 3} \frac{\arctan x}{x(1-x^2)}dx$$ $$\overset{IBP}=\frac12\int_0^\frac{1}{\sqrt 3}\frac{\ln\left(\frac{1-x^2}{2x^2}\right)}{1+x^2}dx\overset{x\to \tan \frac{x}{2}}=\frac14\int_0^\frac{\pi}{3}\ln\left(\frac{\cos x}{1-\cos x}\right)dx=\frac{5}{8}\operatorname{Cl}_2\left(\frac{\pi}{3}\right)$$

Finally, the result from above is found using two Clausen function identities from here. It should also be noted that $\operatorname{Cl}_2\left(\frac{\pi}{3}\right) = G$, where $G$ is Gieseking's constant.

Zacky
  • 30,116