# How to reading of an integral? Bernoulli trials with variable success rate, p

I have a Bernoulli trial with success rate $p$ and failure rate $1-p$ the odds of $k$ successes is $\binom{N}{k} p^k (1-p)^{N-k}$. I need to evaluate an integral $$\int_0^1 dp p^k (1-p)^{N-k} = \frac{k!(N-k)!}{(N+1)!}$$ This was done with Mathematica, but you can use induction. To avoid mindlessly integrating, can you read this integral as an expectation and evaluate it probabilistically? Maybe after rescaling.

Maybe there's a name for Bernoulli trials where the success rate $p$ uniformly random.

-

Thanks. I suppose this wasn't "research level"... I eventually came up with integrating $\mathbb{E}[\prod (1 + t X_i)]$ where $X_i$ are independent Bernoulli trials. Evaluate it two different ways. –  john mangual Dec 25 '10 at 14:19
Suppose that $Y \sim {\rm Beta}(\alpha,\beta)$, $\alpha,\beta>0$ real; thus $Y$ has density $f_Y{(p)} = p^{\alpha - 1} (1 - p)^{\beta - 1} /{\rm B}(\alpha ,\beta )$, $p \in [0,1]$, where ${\rm B}(x,y) = \Gamma(x)\Gamma(y)/\Gamma(x+y)$ is the Beta function. Further suppose that $X \sim {\rm binomial}(N,Y)$, $N \in \mathbb{N}$ fixed, meaning that given $Y=p$, $X \sim {\rm binomial}(N,p)$. Then, $X$ has a Beta-binomial distribution with parameters $N$, $\alpha$, and $\beta$. By the law of total probability, the probability mass function of $X$ is given, for $k=0,1,\ldots,N$, by $${\rm P}(X=k) = {\rm E}[{\rm P}(X=k|Y)] = \int_0^1 {{N \choose k}p^k (1 - p)^{N - k} f_Y (p)\,{\rm d}p}.$$ Hence, $$\int_0^1 {p^{k + \alpha - 1} (1 - p)^{N - k + \beta - 1} \,{\rm d}p} = \frac{{{\rm B}(\alpha ,\beta )}}{{{N \choose k}}}{\rm P}(X = k).$$ Explicitly, the left-hand side is given by $$\int_0^1 {p^{k + \alpha - 1} (1 - p)^{N - k + \beta - 1} \,{\rm d}p} = {\rm B}(k + \alpha ,N - k + \beta ) = \frac{{\Gamma (k + \alpha )\Gamma (N - k + \beta )}}{{\Gamma (N + \alpha + \beta )}}$$ (say, by definition of the Beta function), but this is, of course, not the point here: the point is the relation to the Beta-binomial distribution. In the special case where $\alpha=\beta=1$, we have $Y \sim {\rm uniform}[0,1]$, and by substitution we find that ${\rm P}(X=k)=1/(N+1)$. Hence the "uniform$[0,1]$-binomial distribution" is simply the discrete uniform distribution on $\lbrace 0,1,\ldots,N \rbrace$.