Lets say I have a [geometric distribution](http://en.wikipedia.org/wiki/Geometric_distribution) (of the number X of Bernoulli trials needed to get a success) with parameter `p` (success probability of a trial).


Assume I randomly sample `n` elements from this distribution.


My problem is: what is the expected *maximum* element of such a sample (it should depend on `n` I guess)? Hopefully it makes sense...


For `n=1`, e.g. if I only pick a single element from the distribution, the answer would be the mean `1 / p` of the distribution. For samples of larger cardinalities?



What is the expected maximum out of a sample (size N) from a geometric distribution?
Here's an answer: $\sum\_{i=1}^n \binom{n}{i} (-1)^{i+1} \frac{1}{1-q^i}$, where $q = 1-p$. Maybe someone else can help you simplify that further. 


The argument: Let $Y = \max\{X\_1, X\_2, \ldots, X\_n\}$, where the $X\_i$ are $n$ sampled values from the geometric distribution.


Then $E[Y] = \sum\_{k=0}^{\infty} P(Y>k) = \sum\_{k=0}^{\infty} P(X\_1 > k \text{ or } X\_2 > k \text{ or } \cdots \text{ or } X\_n > k)$.


Applying the principle of inclusion-exclusion and the fact that the $X\_i$ are iid, we have 


$P(X\_1 > k \text{ or } X\_2 > k \text{ or } \cdots X\_n > k)=$


$=\binom{n}{1} P(X\_1 > k) - \binom{n}{2} P(X\_1 > k)^2 \pm \cdots (-1)^{n+1} \binom{n}{n} P(X\_1 > k)^n$. 


Since $P(X\_1 > k) = q^k$, this sum becomes
$\sum\_{i=1}^n \binom{n}{i} (-1)^{i+1} q^{ki}$.


Thus 


$E[Y] = \sum\_{k=0}^{\infty} \sum\_{i=1}^n \binom{n}{i} (-1)^{i+1} q^{ki} = \sum\_{i=1}^n \binom{n}{i} (-1)^{i+1} \sum\_{k=0}^{\infty} (q^i)^k$


$= \sum\_{i=1}^n \binom{n}{i} (-1)^{i+1} \frac{1}{1-q^i}.$


