# Why is the following not a Negative Binomial distribution?

Find the probability that a person tossing 3 coins will get either all heads or all tails for the 2nd time on the 5th toss.

Typically people solve it like:

\begin{align}P &= (\textrm{Probability of getting HHH or TTT in first four trials}) \times (\textrm{probability of getting HHH or Success in the fifth trial})\\ &= { \binom{4}{1} (0.25)^1 (0.75)^3 } \times {0.25}\\ &= 0.1054\end{align}

But if I do Negative binomial with $$r=2, ~x=5, ~p=0.25 ~= 0.08899.$$

Why this is not treated as negative binomial since we are looking 2nd success on 5 trials? why its different? what understanding am i missing?

It is negative binomial, but the negative binomial variate $$x$$ is the number of failures until the second success rather than the number of tosses:
> dnbinom(x=3, size=2, prob=0.25)

The NB random variable is defined as the number of failures before $$r$$ successes are obtained.
• You set $x$ to be the number of successes plus the number of failures, but it should be just the number of failures. The definition of NB is the number of failures before $r$ successes are obtained. Commented Dec 11, 2022 at 6:07