Why is negative binomial distribution a sum of independent geometric distributions?

I was trying to prove the expected value of $X$ when $X\sim NB(n,p)$, then I came across this proof: for geometric distribution $X_1, X_2,\ldots, X_n$ with the same parameter $p$,

$$E(X)=\sum_{i=1}^n E(X_i)=\frac{n}{p}$$

(At least I think) I get the idea; since NBD is focusing on the number of trials before we get $n$ successes, it would be reasonable to think of it as a combination of $n$ independent GDs.

But we need at least $n$ trials for $n$ successes, whereas only 1 trial is enough for each $X_i$. That is, $X$ prevents $n$th success from occuring before $n$th trial, but it is not the case for $X_i$s (since they are all independent).

Why is it okay to express $X$ as $\sum X_i$?

• I don't really understand your argument that links with independence. For every $i$ we have $X_i\geq1$ so that $\sum_{i=1}^nX_i\geq n$ (as it should). The $X_i$ do not stand for number of failures (in that case they could take value $0$) but for number of trials needed to reach a succes. Commented Feb 7, 2017 at 12:15
• @drhab Oh, now I can see my mistake. Is there any 'rigorous' justification for it, other than intuitive explanations like what I wrote above? Commented Feb 7, 2017 at 12:28

First, we'll take $X\sim NB(n,p)$ to represent the number of trials until we get n successes, and $X_i\sim G(p)$ to represent the number of trials until we get a success (i.e. we're including the last trial in the count).
Lets visualise an example of an experiment ($0$ denotes failure and $1$ denotes success): $$\overbrace{\underbrace{0\ 0\dots0\ 1}_{X_1} \quad \underbrace{0\ 0\dots0\ 1}_{X_2} \quad\dots\quad\underbrace{0\ 0\dots0\ 1}_{X_n}}^{X}$$ All trials are independent, so we can reset the count after every success is reached and start counting until the next success. Thus the overall count of trials needed is the sum of counts of trials needed to reach each success. That way we get $n$ independent variables $X_i\sim G(p)$ such that $X=\sum\limits_{i=1}^{n}X_i$.