# Evaluating $\int_0^1\int_0^1\cdots\int_0^1\frac{n\max\{x_1,x_2,\cdots,x_n\}}{x_1+x_2+\cdots+x_n}dx_1dx_2\cdots dx_n$

I was trying to compute the following integral: $$I=\int_0^1\int_0^1\cdots \int_0^1 \frac{n \max\{x_1,x_2,\ldots,x_n\}}{x_1+x_2+\ldots+x_n}dx_1dx_2\ldots dx_n.$$ My attempt was: Let $$X_1,X_2, \ldots, X_n$$ be a collection of i.i.d. uniform random variables on $$(0,1)$$. Then, $$I= n\mathbb{E}\left[\frac{\max\{X_1,X_2,\ldots,X_n\}}{X_1+X_2+\ldots+X_n} \right] = n\mathbb{E}\left[\max_{1\leqslant i \leqslant n}\frac{X_i}{X_1+X_2+\ldots+X_n} \right].$$ Now, I understand that $$\left\{\frac{X_i}{X_1+X_2+\ldots+X_n}\right\}_{1\leqslant i \leqslant n}$$ is an identically distributed sequence of random variables but I don't know how to proceed further. Any further help using either probability or general integral calculus is much appreciated. Thank you very much for your time and attention.

Let $$n\geq 2$$. First, note that $$x_1,x_2,\cdots,x_n$$ are equally distributed, and each has a $$1/n$$ chance of being the largest element, so your integral is equal to $$n$$ times the integral over the region of $$[0,1]^n$$ where $$x_n$$ is the largest element of $$x_1,x_2,\cdots, x_n$$. More explicitly, we have that

$$$$\begin{split} I&=n\int_0^1\int_0^1\cdots\int_0^1\frac{\max\{x_1,x_2,\cdots,x_n\}}{x_1+x_2+\cdots+x_n}dx_1dx_2\cdots dx_n\\ &=n^2\int_0^1\int_0^{x_n}\cdots\int_0^{x_n}\frac{x_n}{x_1+x_2+\cdots+x_n}dx_1dx_2\cdots dx_n\\ &=n^2\int_0^1\int_0^{x_n}\cdots\int_0^{x_n}\frac{1}{x_1/x_n+x_2/x_n+\cdots+1}dx_1dx_2\cdots dx_n\\ &=n^2\int_0^1\int_0^1\cdots\int_0^1\frac{x_n^{n-1}}{x_1+x_2+\cdots+1}dx_1dx_2\cdots dx_n\\ &=n^2\left[\int_0^1 x_n^{n-1}dx_n\right]\left[\int_0^1\cdots\int_0^1\frac{1}{x_1+x_2+\cdots+1}dx_1dx_2\cdots dx_{n-1}\right]\\ &=n\int_0^1\cdots\int_0^1\frac{1}{x_1+x_2+\cdots+1}dx_1dx_2\cdots dx_{n-1}\\ \end{split}$$$$

Letting $$A_k(u)$$ be the PDF of the distribution for the sum $$X_1+X_2+\cdots+X_k$$ of $$k$$ uniform variables on $$[0,1]$$ (known as the Irwin-Hall distribution), we may simplify

$$I=n\int_0^{n-1} \frac{A_{n-1}(u)}{u+1}du$$

In fact, $$A_{n-1}(u)$$ has the explicit closed form $$A_{n-1}(u)=\frac{1}{(n-2)!}\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}(u-k)^{n-2}H(u-k)$$

where

$$H(x)= \begin{cases} 1,&x\geq 0\\ 0,&x<0\\ \end{cases}$$

is the Heavside step function.

$$$$\begin{split} I&=\frac{n}{(n-2)!}\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}\int_0^{n-1}\frac{(u-k)^{n-2}}{u+1}H(u-k)du\\ &=\frac{n}{(n-2)!}\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}\int_k^{n-1}\frac{(u-k)^{n-2}}{u+1}du\\ &=\frac{n}{(n-2)!}\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}\int_k^{n-1}\sum_{m=0}^{n-2}(-1)^m(u+1)^{n-3-m}(k+1)^mdu\\ &=\frac{n}{(n-2)!}\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}\left[(-1)^n(k+1)^{n-2} \log(u+1)+\sum_{m=0}^{n-3}(-1)^m\frac{(u+1)^{n-2-m}}{n-2-m}(k+1)^m\right]_{u=k}^{n-1}\\ &=\frac{n}{(n-2)!}\sum_{k=0}^{n-1}(-1)^k{n-1\choose k}[(-1)^{n+1}(k+1)^{n-2}\log(k+1)+P_n(k)]\\ \end{split}$$$$

Where $$P_n(k)$$ is a polynomial in $$k$$ of degree $$n-2$$. It is well known that for any function $$f(x)$$, the $$p$$-th forward difference of $$f(x)$$ at $$0$$ is given by

$$\Delta^p[f](0)=\sum_{k=0}^p(-1)^{p-k}{p\choose k}f(k)$$

so since $$P_n(k)$$ has degree $$n-2$$, then

$$0=\Delta^{n-1}[P_n](0)=\sum_{k=0}^{n-1}(-1)^{n-k-1}{n-1\choose k}P_n(k)$$

We may therefore simplify to get

$$I=\frac{n}{(n-2)!}\sum_{k=0}^{n-1}(-1)^{n-k-1}{n-1\choose k}(k+1)^{n-2}\log(k+1)$$

Some reindexing and algebraic manipulation brings us to our final closed form

$$\boxed{I=\frac{1}{(n-2)!}\sum_{k=2}^n(-1)^{n-k}{n\choose k}k^{n-1}\log(k)}$$

for $$n\geq 2$$, and $$I=1$$ for $$n=1$$.

• Are you sure that the factor $1/2$ is correct? I guess it is should be removed. Look at the french wiki page: fr.wikipedia.org/wiki/Loi_d%27Irwin-Hall Nov 27, 2022 at 10:40
• @RobertZ You're right on both accounts. There should be no factor of $1/2$ in the original PDF, and that $u-1$ is indeed a dumb typo. Nov 27, 2022 at 10:57
• It looks like possibly someone added the 1/2 and the signum function. Then someone removed the signum and replaced it with the positive part, without removing the half... that wiki history is a mess... Nov 27, 2022 at 10:57
• @BrianMoehring Thank you for spotting my goof with $H(x)$. On the to topic of the Irwin-Hall Wiki page, thanks for easing my doubts; I thought I would have to go hunting for a mistake. That $1/2$ factor looked odd from the start, and a quick sanity check with $n=1$ confirms the factor should not be there. Nov 27, 2022 at 11:11
• Just for the record, considering the above comments were heavily involved in looking at them, I've changed both the English and French wiki sites to come into agreement with one another as well as becoming correct for small $n$. Oddly enough, the corrections are opposite from one another: the English wiki needed the factor of $1/2$ removed, and the French wiki needed the factor of $1/2$ added back in (both errors earlier this year, in Sept and July, resp.). Here's hoping the French wiki doesn't immediately get reverted since I can't speak French to explain it... Nov 27, 2022 at 11:38

Here's a start, which reduces the problem to a one-variable integral of a simple function, and may be of interest even though I don't know how to finish it yet.

For $$n=1$$, the integral is clearly $$1$$. Now, let $$c_n=\mathbb E[1/(X_1+\cdots+X_n)]$$ where $$X_1,\dots,X_n\sim\operatorname{Unif}([0,1])$$ independently. Write $$X=X_1+\cdots+X_n$$ for notational simplicity. We have $$I_n=n\mathbb E\left[\frac{\max X_i}X\right]=nc_n-n\mathbb E\left[\frac{1-\max X_i}X\right].$$ Note that $$1-\max X_i$$ is the probability that, if $$T\sim\operatorname{Unif}([0,1])$$, $$T>X_1,\dots,X_n$$. This means that \begin{align*} I_n&=nc_n-n\int_0^1\mathbb E\left[\frac{[t>X_1][t>X_2]\cdots[t>X_n]}X\right]dt\\&=nc_n-n\int_0^1t^n\mathbb E\left[\frac1X\bigg|X_1,\dots,X_n Conditioned on being less than $$t$$, each $$X_i$$ follows the distribution $$\operatorname{Unif}([0,1])$$, and so $$\mathbb E[1/X\mid X_1,\dots,X_n, giving $$I_n=nc_n-n\int_0^1 t^{n-1}c_ndt=(n-1)c_n.$$ So, it suffices to compute $$c_n$$, i.e. $$c_n=\int_{[0,1]^n}\frac1{x_1+\cdots+x_n}d\mathbf x.$$ We once again do this by way of an additional variable: \begin{align*} c_n&=\int_{[0,1]^n}\frac1{x_1+\cdots+x_n}d\mathbf x\\ &=\int_{[0,1]^n}\int_0^1 t^{x_1+\cdots+x_n}\frac{dt}td\mathbf x\\ &=\int_0^1 \left(\int_0^1 t^x dx\right)^n\frac{dt}t=\int_0^1 \left(\frac{t-1}{\log t}\right)^n\frac{dt}t=\int_0^1 \frac{(1-t)^n}{t\log(1/t)^n}dt. \end{align*} Substituting $$u=\log(1/t)$$, so that $$du=-dt/t$$, we have $$c_n=\int_0^\infty \left(\frac{1-e^{-u}}u\right)^ndu.$$ So $$\boxed{I=(n-1)\int_0^\infty\left(\frac{1-e^{-u}}u\right)^ndu}.$$

• @ Carl Schildkraut As far as I can see your integral expression $I$ is in agreement with the expression of user @C-RAM Dec 1, 2022 at 1:23

Two answers have already given explicit formulas for $$I$$. It may be of interest to see the behaviour of $$I$$ for large $$n$$, which is not immediate from the expression given by C-RAM. An asymptotic expansion for large $$n$$ may be derived via Laplace's method applied to the integral representation given by Carl Schildkraut: \begin{align*} I &= (n - 1)\int_0^{ + \infty } {\left( {\frac{{1 - {\rm e}^{ - u} }}{u}} \right)^n {\rm d}u} = (n - 1)\int_0^{ + \infty } {\exp \left( { - n\log \left( {\frac{u}{{1 - {\rm e}^{ - u} }}} \right)} \right){\rm d}u} \\ & \sim \frac{{n - 1}}{n}\sum\limits_{k = 0}^\infty {\frac{{a_k }}{{n^k }}} = 2 + \sum\limits_{k = 1}^\infty {\frac{{b_k }}{{n^k }}} = 2 - \frac{4}{{3n}} + \frac{8}{{45n^3 }} + \frac{{56}}{{135n^4 }} + \frac{{152}}{{189n^5 }} + \frac{{1256}}{{945n^6 }} + \ldots , \end{align*} where $$b_k = a_k - a_{k - 1}$$ and $$a_k = \left[ {\frac{{{\rm d}^k }}{{{\rm d}u^k }}\left( {\frac{u}{{\log \left( {\frac{u}{{1 - {\rm e}^{ - u} }}} \right)}}} \right)^{k + 1} } \right]_{u = 0} = \left[ {\frac{{{\rm d}^k }}{{{\rm d}u^k }}\left( {\frac{u}{{\frac{u}{2} - \log \left( {\frac{{\sinh (u/2)}}{{u/2}}} \right)}}} \right)^{k + 1} } \right]_{u = 0}.$$ Using the known power series of $$\log(\sinh (z)/z)$$, it may be shown that $$a_k = \sum\limits_{m = 0}^k 2^{m + k + 1} \frac{{(m + k)!}}{{m!}}B_{k,m} \!\left( {\frac{1}{{24}},0, - \frac{1}{{2880}}, \ldots ,\frac{{B_{k - m + 2} }}{{(k - m + 2)(k - m + 2)!}}} \right) ,$$ where $$B_{k,m}$$ are the ordinary Bell polynomials and $$B_m$$ are the Bernoulli numbers.

This is a partial answer on the basis of a partial analysis which might nevertheless be interesting.

Mathematica algorithm

Apart from the first few values of $$n$$ which I have calculated "by hand" I took the problem to calculate the integral we call here $$i(n)$$ as a nice exercise in Mathematica:

Writing

$$\frac{1}{\sum_{i=1}^{n} x_i} =\frac{1}{p}\int_{0}^{1} p^{\sum_{i=1}^{n} {x_i}}\;dp$$

we have to calculate the kernel integral

$$\kappa(p)= n \int_{[0,1]^n}\max(x_1, ..., x_n) \prod_{i=1}^{n} dx_i p^{x_i}$$

which, for reasons of symmetry, can be written as

$$\kappa(p)=n! n \int_{[0,1]^n}x_n\; \text{Boole}(0\le x_1\le...\le x_n) \prod_{i=1}^{n} dx_i p^{x_i}$$

Here $$\text{Boole}(True)=1$$ and $$\text{Boole}(False)=0$$.

Finally we have to calculate

$$i(n) = \frac{1}{p}\int_{0}^{1} \kappa(p)\;dp$$

I implemented this for $$n=1..10$$ in the following Mathematica code

Table[x[0] = 0;
i1 = n! n Integrate[
x[n] p^(Sum[x[i], {i, 1, n}] - 1) Boole[
Less @@ Table[x[i - 1], {i, 1, n + 1}]],
Sequence @@ Table[{x[i], 0, 1}, {i, 1, n}]];
{n, Integrate[i1, {p, 0, 1}]}, {n, 1, 10}]


which gives

$$\begin{array}{c} \{1,1\} \\ \{2,2\log (2)\} \\ \left\{3,3\log \left(\frac{27}{16}\right)\right\} \\ \left\{4,4(11 \log (4)-\frac{27 \log (3)}{2})\right\} \\ \left\{5,5(-\frac{1}{3} 272 \log (2)+27 \log (3)+\frac{125 \log (5)}{6})\right\} \\ \left\{6,\frac{6}{24} (6496 \log (2)+486 \log (3)-3125 \log (5))\right\} \\ \left\{7,\frac{7}{120} (-87808 \log (2)-43011 \log (3)+46875 \log (5)+16807 \log (7))\right\} \\ \left\{8,\frac{8}{720} (2053376 \log (2)+964467 \log (3)-546875 \log (5)-823543 \log (7))\right\} \\ \left\{9,9(\frac{-33922048 \log (2)-3024621 \log (3)+2734375 \log (5)+11529602 \log (7)}{2520})\right\} \\ \left\{10,10(\frac{1067291648 \log (2)-281722779 \log (3)+25390625 \log (5)-242121642 \log (7)}{20160})\right\} \\ \end{array}$$

Starting at $$n=6$$ we observe a factor $$\frac{1}{(n-2)!}$$.

• Your calculations are fine. It seems you may have just missed the fact that TRUSKI placed a sneaky factor of $n$ inside the integral. Our answers only differ by that factor of $n$. Dec 1, 2022 at 2:07
• @ C-RAM I don't think that the difference is just a common factor. Your values increase with increasing $n$ while mine decrease. Dec 1, 2022 at 2:16
• Just check: n*(your values)=(my values)$\tag*{}$I have checked for $n\leq 5$ . Aside from that, the coefficient of $2$ that I mentioned is indeed missing in your calculation of $i(2)$. Correcting for that does give $2\log(2)$. Dec 1, 2022 at 2:20
• @ C-RAM You are right. I missed the overall factor $n$ in my definition of $i(n)$. Thank you very much for patiently pointing this out to me. I have corrected my error. Now all results agree. Dec 1, 2022 at 2:54
• No problem; happy to help. This sort of mistake is something I make embarrassingly often. Dec 1, 2022 at 3:09