# Probability of only getting k consecutive successes?

The question I'm trying to solve is the following.

Independent trials, each resulting in success with probability p, are performed until $$k$$ consecutive successful trials have occurred. Let $$X$$ be the total number of successes in these trials, and let $$P_n = P(X = n)$$. Find $$P_k$$.

The way I understand the question is that I need to find the probability that, if we perform $$m$$ trials, there will be $$k$$ successes, and they will be consecutive.

So I did the following:

$$P_k = \sum_{i=0}^{\infty}P(X=k|F=i)P(F=i)$$ F is the number of failures at the beginning. $$P_k = \sum_{i=0}^{\infty}P(X=k)P(F=i)$$ $$P_k = \sum_{i=0}^{\infty}p^k(1-p)^i$$ $$P_k = p^k\sum_{i=0}^{\infty}(1-p)^i$$ $$P_k = \frac{p^k}{1-p}$$

However, the answer is $$p^{k-1}$$ and I'm struggling to understand why.

• Welcome to stackexchange. You seem to describe three different problems here. The title says you want to find the probability of getting only k successes, the next description describes a geometric random variable, and your interpretation introduces a variable $m$ that was not defined or described. You'll need to clarify the problem if you hope to get a good answer. Best of luck!
– jtb
Feb 3 at 21:09
• What is the source of this problem? A very similar problem was asked a few minutes ago.
– lulu
Feb 3 at 21:53

The only way $$X$$ could be $$k$$ is if the string of outcomes had the form $$F^mS^k$$ where $$F$$ denotes Fail, $$S$$ denotes Success, and $$m$$ could be any non-negative number.
Now $$P(F^mS^k)=(1-p)^mp^k$$ so $$P(X=k)=p^k\sum_{m=0}^{\infty} (1-p)^m=p^k\times \frac 1{1-(1-p)}=p^{k-1}$$as desired.
To get $$X=k$$:
• you need to have the first success preceded by any non-negative number of failures (with probability $$1$$ that you reach this state at some stage)
• followed immediately by $$k-1$$ more successes, so with probability $$p^{k-1}$$.