Proove that Var Y=$n\alpha\beta /(\alpha+\beta)^2$ Let $(X_i, P_i)$, with $_i$ being an integer be an independent random variable s.t. $X_i|P_i$ ~ $Bernoulli(P_i)$ and $P_i$ ~ $Beta(\alpha, \beta$.  
Here's what I have so far:
Var Y=Var(E(Y|P)+E(Var(Y|P) is what we know as our formula;
If we break down the two components on the right side we get:
Var(E(Y|P))=$\alpha\beta/(\alpha+\beta)^2 (\alpha+\beta+1)$ and
E(Var(Y|P)=$E(P_i(1-P_i))=\alpha/(\alpha+\beta) (1-\alpha/(\alpha+\beta))$.  
Somehow I'm not getting the right result. 
Is this correct and if not, could you please correct my understanding?
 A: First, we recall the conditional mean and variance of $X_i \mid P_i$:  $$\operatorname{E}[X_i \mid P_i] = P_i,$$ and $$\operatorname{Var}[X_i \mid P_i] = P_i(1-P_i).$$  Consequently, the unconditional variance of $X_i$ is, by the law of total variance, $$\begin{align*} \operatorname{Var}[X_i] &= \operatorname{Var}[\operatorname{E}[X_i \mid P_i]] + \operatorname{E}[\operatorname{Var}[X_i \mid P_i]] \\ &= \operatorname{Var}[P_i] + \operatorname{E}[P_i(1-P_i)] \\ &= \operatorname{E}[P_i^2] - \operatorname{E}[P_i]^2 + \operatorname{E}[P_i] - \operatorname{E}[P_i^2] \\ &= \operatorname{E}[P_i](1  - \operatorname{E}[P_i]) \\ &= \frac{\alpha\beta}{(\alpha+\beta)^2},\end{align*}$$  since $$\operatorname{E}[P_i] = \frac{\alpha}{\alpha+\beta}.$$  Hence 
$$\operatorname{Var}[Y] = \operatorname{Var}\left[\sum_{i=1}^n X_i \right] \overset{\text{ind}}{=} \sum_{i=1}^n \operatorname{Var}[X_i] = \frac{n \alpha \beta}{(\alpha+\beta)^2}.$$ 
A: Hint: The formula is correct, but it is the result for each $X_i$ not for $Y$. The $var(Y) = var \sum_i X_i = \sum_i var(X_i)$ (since the $X_i are i.i.d.).
