Hello,

It's just basic use of the method of moments oO

Let X ~ NBinom(r,p). Then (you can compute that yourself, or find that on the wikipedia).

Then we approximate by taking the empirical mean instead of the expectation and consider the estimator of p instead of p. Which gives

Hence

and that's all...