## Marginal pmf of Hierarchical model

Suppose X|p~binomial(n,p) and p~beta(1,2). Find the marginal pmf of X $(f_X(x))$ and verify that it is a valid pmf.

I set this up as $f_{X,P}(x,p) = f_{X|P}(x|p)f_X(x) = \int_0^1 {{n}\choose{x}}p^x (1-p)^{n-x}\frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma (\beta)}p^{\alpha-1}(1-p)^{\beta-1}dp$.

I simplify this and simplify a Beta($x+\alpha, n-x+\beta$) pdf to 1 and am just left with ${{n}\choose{x}}\frac{\Gamma(\alpha+\beta)}{\Gamma (\alpha)\Gamma(\beta)}\frac{\Gamma(x+\alpha)\Gamma (n-x+\beta)}{\Gamma(\alpha+n+\beta)}.$

When I plug in my given beta values I get

${{n}\choose{x}}\frac{\Gamma(1+2)}{\Gamma(1)\Gamma (2)}\frac{\Gamma(x+1)\Gamma(n-x+2)}{\Gamma(1+n+2)}$=${{n}\choose{x}}2\frac{\Gamm a(x+1)\Gamma(n-x+2)}{\Gamma(n+3)}$

=$2\frac{n!}{x!(n-x)!}\frac{x!(n-x+1)!}{(n+2)!}$

=$2\frac{(n-x+1)}{(n+1)(n+2)}$. I'm guessing I should have left the variables and tried to simplify a different way. Any help is greatly appreciated