# Expected number of failures preceding the first success

I am a beginner in statistics and probability. I have a question that says

What is the expected number of failures preceding the first success in an infinite series of independent trials with the constant probability of success equal to $p$?

I have tried of solution of this and is not quite sure of this:

The probability of failure is $1-p$

The probability of $x$ failures in a row is $(1-p)^x$.

Now, expectation of $x$ is

$E(x) =\sum_0^\infty x (1-p)^x\\ =(1-p) + 2(1-p)^2+3(1-p)^3 +\ldots \infty \\ =\frac{1-p}{p^2}$

-
have you ever heard of the geometric distribution? –  Macro Jun 28 '12 at 13:07
I should check and try if it somehow corresponds to geometric distribution. –  Prakash Gautam Jun 28 '12 at 18:04
what you've described is the expected value of a geometric random variable. –  Macro Jun 28 '12 at 18:05
In a geometric distribution to get the first success in the $x^{th}$ trial we should get $(x-1)$ failures in a row and finally a success in $x^{th}$ trial; so is the required answer something like $\sum_0^\infty x (1-p)^{x-1}p$ –  Prakash Gautam Jun 28 '12 at 18:18
The probability of $x$ failures in a row is not $(1-p)^x$. This is the probability of at least $x$ failures in a row. To get the probability of exactly $x$ failures in a row is the probability of at least $x$ failures in a row, and a success at the $x+1^{th}$ trial, i.e. $(1-p)^xp$.
How is it that $(1-p)^x$ is the probability of at least $x$ failure in a row? There can't be more result than $x$ results and all $x$ are already occupied by failures! –  Prakash Gautam Jun 28 '12 at 18:00
What you say is right. But to know exactly how many failures in a row you get, you need a success. After $x$ failures, either you get a success, in which case you get exactly $x$ failures, or you get a failure, in which case you get at least $x+1$ failure and you have to try again until you get a success. –  gui11aume Jun 29 '12 at 7:16