Question 3. (10pts) The Binomial distribution counts the number of successes in a fixed number of Bernoulli trials. Suppose that, instead, we count the number of Bernoulli trials required to get a fixed number of successes. This later formulation leads to the negative binomial distribution. In a sequence of independent Bernoulli ($p$) trials, let $X$ be a random variable that denotes the number of trials needed in order to get $r$ successes, then $X$ follows Negative Binomal($r$, $p$). The probability density function (pdf) of $X$ is given by
$f(x) = P(X = x) = \binom{r + x - 1}{x} p^r (1 - p)^x$
Let $X_1, X_2,...X_n$ be independent and identically distributed random sample from a Negative Binomal($r$, $p$) distribution, find the maximum likelihood for $p$.