[Math] Binomial distribution with random parameter uniformly distributed

binomial distributionprobability distributionsprobability theoryuniform distribution

I have a problem with the following exercise from Geoffrey G. Grimmett, David R. Stirzaker, Probability and Random Processes, Oxford University Press 2001 (page 155, ex. 6):

Let $X$ have the binomial distribution bin($n$, $U$), where $U$ is uniform on $(0,1)$. Show that $X$ is uniformly distributed on $\{0,1,\ldots,n\}$.

So far, what I have is this:
$$P(X=k | U) = {n \choose k} U^k (1-U)^{n-k}$$
$$P(X=k) = \int_0^1 {n \choose k} u^k (1-u)^{n-k} f_U(u) \text{ d}u$$

where $f_U(u)$ is density function of random variable $X$. Of course, $f_U(u) = 1$ on $u\in (0,1)$.

$$P(X=k) = {n \choose k} \int_0^1 u^k (1-u)^{n-k} \text{d}u$$
And I don't know what to do next… How to calculate this integral? Am I solving it right so far?

Best Answer

A way to avoid using pre-knowledge about Beta integrals (for a more conceptual explanation, see the second part of this post) is to compute the generating function of $X$, that is, $$ \mathbb E(s^X)=\sum_{k=0}^ns^k\mathbb P(X=k)=\int_0^1\sum_{k=0}^n\binom{n}ku^k(1-u)^{n-k}s^k\mathrm du. $$ By the binomial theorem, $$ \sum_{k=0}^n\binom{n}k(su)^k(1-u)^{n-k}=(1-(1-s)u)^n, $$ hence $$ \mathbb E(s^X)=\int_0^1(1-(1-s)u)^n\mathrm du\stackrel{[v=1-(1-s)u]}{=}\frac1{1-s}\int_s^1v^n\mathrm dv=\frac{1-s^{n+1}}{(n+1)(1-s)}, $$ that is, $$ \mathbb E(s^X)=\frac1{n+1}\sum_{k=0}^ns^k. $$ This formula should make apparent the fact that $X$ is uniform on $\{0,1,2,\ldots,n\}$...


...But the "real" reason why $X$ is uniform might be the following.

First, the distribution of a sum of i.i.d. Bernoulli random variables is binomial. Second, if $V$ is uniform on $[0,1]$, the random variable $\mathbf 1_{V\leqslant u}$ is Bernoulli with parameter $u$. Hence, if $(U_i)_{1\leqslant i\leqslant n}$ is i.i.d. uniform on $[0,1]$, the random variable $\sum\limits_{i=1}^n\mathbf 1_{U_i\leqslant u}$ is binomial with parameter $(n,u)$.

Thus, $X$ may be realized as $X=\sum\limits_{i=1}^n\mathbf 1_{U_i\leqslant U_{n+1}}$ where $(U_i)_{1\leqslant i\leqslant n+1}$ is i.i.d. uniform on $[0,1]$. The event $[X=k]$ occurs when $U_{n+1}$ is the $(k+1)$th value in the ordered sample $(U_{(i)})_{1\leqslant i\leqslant n+1}$. By exchangeability of the distribution of $(U_i)_{1\leqslant i\leqslant n+1}$, $U_{n+1}$ has as much chances to be at each rank from $1$ to $n+1$. This fact means exactly that $X$ is indeed uniform on $\{0,1,2,\ldots,n\}$.

Related Question