# Negative binomial distribution pmf derivative

this is what is in my probability book: Let $X$ be the number of independent Bernoulli trials, each with success probability $p$, up to and including the $r$th success. $X$ is a discrete random variable taking values in $\{ r, r+1,... \}$. Then

$$P(X=k) = P(r-1 \text{ successes in first } k-1 \text{ throws}, 1 \text{ success} \text{ on } k\text{th throw}) = {k-1 \choose r-1}p^{r-1}q^{k-r}\times p = {k-1 \choose r-1} p^rq^{k-r}$$ for $k = r,r+1,...$

I'm not understand how this is derived. I thought the negative binomial is the generalised geometric distribution. The geometric distribution is where $X$ is the number of trials up to and including the $kth$ success, so I'm not really sure what the negative binomial distribution is, and what the author means by $k-1$ "throws". Any explanation please

I dont get the question very well. But I can tell you what

$${k-1 \choose r-1}p^{r-1}q^{k-r}\times p = {k-1 \choose r-1} p^rq^{k-r}$$

means:

You create a stream of Binary numbers, each having a success probability $p$ and failure probability $q=1-p$. The places of $1$s can be configured in $r-1$ different ways out of total $k-1$ binary numbers. For example if $k-1=2$ then

$00$, $01$, $10$ and $11$ are all possible configurations and if there are say $r-1=1$ success then $$\binom{k-1}{r-1}=\binom{2}{1}=2$$

which indicates the bit streams $01$, $10$: one success out of two.

It seems that every stream that is selected has a probability of $p$ to happen and this explains the given formula.