How do I compute the sum $\sum_{i=0}^N \binom{N}{i} a^i (1-a)^{N-i}$ I got this question for an assignment. "Six dice are thrown 729 times. How many times do you expect at least three dice shows 5 or 6?"
I got a value
$$ a = 1- \sum_{i=0}^2\binom{6}{i}\cdot (\frac{1}{3})^i \cdot(\frac{2}{3})^{6-i} $$
Where $a$ is the probability of getting 5 or 6 on any three dice. Now I got a second equation which i can not solve.
How do I compute the sum $$\sum_{i=0}^N i \binom{N}{i} a^i (1-a)^{N-i}$$
 A: If you have N events with probability a of success for each, the expected is $N\times a$ which is the value of your sum. In this case, 
A: You can compute the sum directly as follows. You consider the summation:
$$f(p,q)=\sum_{i=0}^{N}\binom{N}{i}p^iq^{N-i}\tag{1}$$
where we consider $p$ and $q$ to be independent variables, so we don't put $q = 1-p$. By the binomial theorem, we have:
$$f(p,q) = (p+q)^N$$
To find the desired summation, we need to put in a factor of $i$ in the summand in Eq. (1). We can do that by differentiating both sides of Eq. (1) w.r.t. $p$. This yields:
$$N (p+q)^{N-1}=\sum_{i=0}^{N}\binom{N}{i}ip^{i-1}q^{N-i}$$
Multiplying both sides by $p$ then yields the desired summation:
$$N p (p+q)^{N-1}=\sum_{i=0}^{N}\binom{N}{i}ip^{i}q^{N-i}$$
We can now put $p = a$ and $q = 1-a$ to find that the summation is given by $N a$.
A: $$\sum_{i=0}^n i \frac{n!}{i!(n-i)!} a^i (1-a)^{n-i}=\sum_{i=0}^n \frac{n(n-1)!}{(i-1)!(n-i)!} a^i (1-a)^{n-i}\\
=na\sum_{i=1}^n\binom{n-1}{i-1}a^{i-1} (1-a)^{n-i}=na(1-a+a)^{n-1}=na.$$
