# Tossing a biased coin until heads comes up, Find $P(X=n)$ and $P(X\leq n)$

A biased coin that comes up heads with probability p, is tossed until the first head appears. Let random variable X be the number of tosses. For a fixed $n \in N$ find $P(X=n)$ and $P(X\leq n)$.

My attempt:

Completely stuck on finding $P(X=n)$ but i have a vague idea of $P(X\leq n)$:

So i know that the probability of not getting heads (getting tails) is $p-1$ thus $$P(X\leq n)=(1-p)^{n+1}$$

so $E(x)=\sum_{n=1}^{\infty}P(X\leq n)=\sum_{n=1}^{\infty}(1-p)^{n+1}=\frac{1}{1-(1-p)}=\frac{1}{p}$

so the expected number of tosses until a head appears on a biased coin is $\frac{1}{p}$

Is this answer correct or have i gone wrong?

Many thanks

The probability that $X=n$ is the probability of $n-1$ tails followed by a head. This is $(1-p)^{n-1}p$.
The probability that $X\le n$ is $1$ minus the probability that $X\gt n$. The probability that $X\gt n$ is the probability of $n$ tails in a row, which is $(1-p)^n$.
Remark: The expectation of $X$ is indeed $\frac{1}{p}$. But that was not one of the questions asked. The calculation that led to the correct result was not right.
• Thank you! i have the same answer for X=n which i just worked out! for the next part, does that give $1-(1-p)^n$? I wasnt sure if it meant expectation or not, just relearning all of this so a bit confused. Thanks for your answer. – Bernard.Mathews Oct 23 '13 at 2:59
• You are welcome. Yes, the probability that $X\le n$ is $1-(1-p)^n$. It did not mean expectation, though one can use the result to find the expectation. But it was only accidental that you got the right expectation, it came from wrong formula followed by wrong summation. – André Nicolas Oct 23 '13 at 3:06