TITLE: What is the expected number of trials until x successes?
QUESTION [11 upvotes]: This is barely a probability question, but I needed to check to make sure the solution is as simple as I believe it to be.
What is the the expected number $n$ of independent trials needed to have $x$ success (not necessary to be consecutive) given probability $p$?
I would assume since each trial is independent the solution would be $n = x/p$, but perhaps I am overlooking something here.

REPLY [5 votes]: I believe the answer to this question actually depends on a slight subtlety in the setup you're considering. 
The answers given above are correct if what you're thinking about is a procedure whereby you plan to continue trials until you achieve $x$ successes, and then stop. In this case, the distribution of $n$ is negative binomial $f(n;x,p)={n-1 \choose n-x} p^x (1-p)^{n-x}$, which, as noted, has mean $\frac{x}{p}$. (The ${n-1 \choose x-1}$ arises because you know that the last trial will be a success, so you only have to choose the placing of the remaining $x-1$ successes from amongst the first $n-1$ trials.)
However, the answer is slightly different if you are considering, say, conducting $n$ trials simultaneously, and want to know what is the expected number trials you need to conduct to get $x$ successes. In this case the pmf is $f(n;x,p) = {n \choose x} p^x (1-p)^{n-x}$, which has expectation $\frac{x+1-p}{p}$. This is higher than $\frac{x}{p}$ because you're now including configurations of $n$ trials that include failures "after" the $x^{th}$ success.