What is the expected number of trials until x successes?

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.

-
The answer is correct but the reasoning is a bit wobbly. If this were what you wrote on an exam or on homework, it would likely not be accepted. – Dilip Sarwate Jan 26 '12 at 17:14
Your intuition is right. Let $W_1$ be the waiting time (total number of trials) up to first success, $W_2$ the waiting time from first success to second, and so on. Each $W_i$ has geometric distribution. So expected waiting time to $x$-th success is $xE(W_1)$. And $E(W_1)=1/p$. This is intuitively very reasonable, but in probability the intuition is all too often wrong. However, the fact that $E(W_1)=1/p$ is not hard to verify. – André Nicolas Jan 26 '12 at 17:21
yes thank you, I was simplifying it. – ovnarian Jan 26 '12 at 17:22

If you know that the expectation of a geometric variable is $1/p$, where $p$ is the success factor for the variable, you can do the following (which seems to be the way you are thinking about it, and is a very nice method for computing expectations of complicated r.v.'s that can be written as a sum of simpler r.v.'s):

Let

$\ \ \ X_1$ be the number of trials to the first success,

$\ \ \ X_2$ be the number of additional trials to the second success,

$\ \ \ X_3$ be the number of additional trials to the third success

$\ \ \ \ \ \ \vdots$

Each $X_i$ is a geometric variable with success factor $p$; so, $\Bbb E(X_i)={1\over p}$ for each $i$.

Now let $Y$ be the number of trials to the $x^{\text{th}}$ success. Note that $Y=\sum\limits_{i=1}^x X_i$. ($Y$ is, as Robert Israel observes, a negative binomial random variable.)

Then, recalling that the expectation of a sum of random variables is the sum of their expectations: $$\Bbb E(Y)= \Bbb E\Bigl(\sum_{i=1}^x X_i\Bigr)=\sum\limits_{i=1}^x \ \Bbb E(X_i)={x\over p}.$$

-

This is correct. You might look up "negative binomial distribution".

-
thank you that is what I thought. – ovnarian Jan 26 '12 at 17:22

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.

-
Whoops, forgot the normalising term in the second pmf. Should have been $f(n;x,p)={n \choose x} p^{x+1}(1-p)^{n-x}$ – conchis Feb 13 '13 at 12:39