Integration of product of functions of "x" with exponents/powers (binomial problem) Original problem:  A point X is randomly chosen from the interval (0,1).  Suppose X=x is observed.  Then a coin with P(Heads) = x is tossed independently n times.  Let Y be the number of heads in n tosses.  Find the unconditional distribution of Y.
I've setup the problem below using total probability and a uniform pdf of x (a confirmation others agree my formulation is correct would be nice), but not sure how to integrate this:
$\int_{0}^{1}$$\begin{pmatrix}n\\y\end{pmatrix}$$x^y(1-x)^{n-y}\,dx$
 A: To approach this, I would apply the binomial theorem, which holds for non-negative integer $c$:
$$
(a+b)^c = \sum_{i=0}^c {c\choose i} a^ib^{c-i}
$$
When you apply this identity to $(1-x)^{n-y}$, the integrand becomes a standard polynomial in $x$:
\begin{align*}
Pr(Y=y) &= {n\choose y}\int_0^1 \sum_{i=0}^{n-y} {n-y\choose i}(-1)^ix^{i+y}~dx \\
&= {n\choose y}\sum_{i=0}^{n-y}{n-y\choose i}(-1)^i\frac{x^{i+y+1}}{i+y+1}\bigg|_0^1 \\
&= {n\choose y}\sum_{i=0}^{n-y}\frac{{n-y\choose i}(-1)^i}{i+y+1}
\end{align*}
A: I just realized that the integral is an archetype of a beta distribution and thus can be manipulated as such...beta distribution
$\int_{0}^{1}\begin{pmatrix}n\\y\end{pmatrix}x^y(1-x)^{n-y}\,dx$ ~ $\frac {\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}x^{\alpha-1}(1-x)^{\beta-1} $$\Rightarrow$ which integrates to 1 over the support (0,1).
Thus, if $\alpha-1=y$ and $\beta-1=n-y$ $\implies$ $\begin{pmatrix}n\\y\end{pmatrix}$$\frac{\Gamma(y+1)\Gamma(n-y+1)}{\Gamma(n+2)} $
I'm sloppy so hope I didn't make an algebra mistake. It should (I hope!) come out to the same thing  @josliber wrote, and he still gets the credit because he managed more creativity IMO.
