# Distribution of number of heads, when we keep tossing a coin until we have 4 tails

We toss a fair coin until we've tossed tails exactly 4 times. Let $$X$$ be the number of tossed heads. What is the distribution of $$X$$?

My attempt:

We keep tossing the coin until we have registered 4 tails. Suppose that we needed $$n$$ tosses. The last toss has to be tails, and exactly three of the preceding tosses had to be tails as well:

$$P(\text{4 tails}|n \text{ tosses})=\frac12\cdot \binom{n-1}{3}\left(\frac 12\right)^3\left(\frac 12\right)^{n-4}=\frac{(n-1)(n-2)(n-3)}{6\cdot 2^n}.$$ This is also the probability of tossing $$n-4$$ heads, knowing that we needed $$n$$ tosses to stop the game.

Is this the answer to the question? How do I find 'the distribution' of $$X$$?

Thanks.

The distribution of discrete random variable is completely described by the set of its possible values and the probabilities corresponding to each value. If $$X$$ is the number of tossed heads if the coin is tossed until $$4$$ tails appeared, then $$X$$ can take values $$0,1,2,\ldots$$.
For any $$k=0,1,2,\ldots$$ the event $$\{X=k\}$$ occures if there are $$k+4$$ tosses, and the last toss is tail, and exactly three of the preceding $$k+3$$ tosses are tails as well: $$\mathbb P(X=k) = \binom{k+3}{3} \cdot\frac{1}{2^{k+4}}.$$ This is Negative binomial distribution.