# Tossing a biased coin

We toss a biased coin $k$ times with the probability of tossing a head being $1/m$. We know that in the first two attempts there was at least one tail. What the probability that we tossed exactly $n$ heads?

Well, the tosses are independent so getting at least one tail in the first two attempts is the sum of $2\cdot (\tfrac{m-1}{m})^1 \cdot (\tfrac{1}{m})^2 = \tfrac{2m-2}{m^3}$ and $1\cdot (\tfrac{m-1}{m})^2 \cdot (\tfrac{1}{m})^0 = \tfrac{(m-1)^2}{m^2}$, which is $\tfrac{(m-1)(m^2-m+2)}{m^3}$. Thus getting at least on head in the first two attempts is $1-\tfrac{(m-1)(m^2-m+2)}{m^3}$.

Now we are left with $k-2$ tosses so we want to hit $n-1$ heads. The chance is $${k-2 \choose n-1}\tfrac{1}{m^{n-1}}\cdot (\tfrac{m-1}{m})^{k-2 - n +1}.$$ So the answer should be

$$1-\tfrac{(m-1)(m^2-m+2)}{m^3} + {k-2 \choose n-1}\tfrac{1}{m^{n-1}}\cdot (\tfrac{m-1}{m})^{k-1 - n}$$ Is this right?

• Why do you write $2(\frac{m-1}{m})(\frac{1}{m}^{2})$?. You only have two tries. – Aritro Pathak Oct 23 '17 at 14:58

The probability that we tossed exactly n heads, given there was exactly 1 tail in the first two tries, is $Q_{1}={{k-2}\choose{n-1}}(\frac{m-1}{m})^{n-1}(\frac{1}{m})^{k-n-1}$, and the probability that we tossed exactly n heads, given there was exactly 2 tails in the first two tries, is $Q_{2}={{k-2}\choose{n}}(\frac{m-1}{m})^{n}(\frac{1}{m})^{k-n-2}$.
The probability that we had exactly $1$ tail in the first two tries, given that we know there was at least $1$ tail, is the conditional probability given by $P_{1}=\frac{P((exactly \ one \ tail)\cap(at \ least \ one \ tail))}{P(at \ least \ one \ tail)}=\frac{P(exactly \ one \ tail) }{P(at \ least \ one \ tail)}=\frac{2(\frac{1}{m})(\frac{m-1}{m})}{2(\frac{1}{m})(\frac{m-1}{m})+(\frac{m-1}{m})^{2}}$.
Similarly, the probability that we had exactly $2$ tails in the first two tries, given that we know there was at least $1$ tail, is given by $P_{2}=\frac{(\frac{m-1}{m})^{2}}{2(\frac{1}{m})(\frac{m-1}{m})+(\frac{m-1}{m})^{2}}$.
The total probability is $P_{1}Q_{1}+P_{2}Q_{2}$.