### Geometric Distribution MLE

For geometric distribution, the pmf is given by$$f (x, p) = p(1 − p)^{x−1} , 0 ≤ p ≤ 1, x = 1, 2, 3, \cdots$$Hence, the likelihood function is$$\mathcal{L}(p)=\prod_{i=1}^nf(x_i,p)=p^n(1-p)^{-n+\sum_{i=1}^nx_i}$$Taking the natural logarithm of $\mathcal{L}(p)$,$$\ln \mathcal{L}=n\ln p+\left(-n+\sum_{i=1}^nx_i\right)\ln(1-p).$$Taking the derivative with respect to $p$, we have$$\frac{d\ln \mathcal{L}}{dp}=\frac{n}{p}-\frac{\left(-n+\displaystyle\sum_{i=1}^nx_i\right)}{1-p}$$Equating this to zero, we have$$\frac{n}{p}-\frac{\left(-n+\displaystyle\sum_{i=1}^nx_i\right)}{1-p}=0$$Solving for $p$,$$p=\frac{n}{\sum_{i=1}^nx_i}=\frac{1}{\bar{x}}$$Thus, we obtain a maximum likelihood estimator of $p$ as$$\widehat{p}=\frac{n}{\displaystyle\sum_{i=1}^nX_i}=\frac{1}{\bar{X}}$$

wxMaxima Programming: Geometric Distribution Maximum Likelihood Estimation

### Exponential Distribution MLE

The probability density function of the exponential distribution is defined as$$f(x;\lambda)=\begin{cases} \lambda e^{-\lambda x} &\text{if } x \geq 0 \\ 0 & \text{if } x<0 \end{cases}$$Now, the likelihood function of it is$$\mathcal{L}(\lambda,x_1,\dots,x_n)=\prod_{i=1}^n f(x_i,\lambda)=\prod_{i=1}^n \lambda e^{-\lambda x}=\lambda^ne^{-\lambda\sum_{i=1}^nx_i}$$To calculate for the maximum likelihood estimation we first take the natural logarithm of $\mathcal{L}(\lambda,x_1,\dots,x_n)=0$, and take the first derivative with respect to $\lambda$, then simplify. That is,\begin{align} \frac{d\ln\left(\mathcal{L}(\lambda,x_1,\dots,x_n)\right)}{d\lambda} &= \frac{d\ln\left(\lambda^ne^{-\lambda\sum_{i=1}^nx_i}\right)}{d\lambda} \nonumber\\ &= \frac{d\ln\left(n\ln(\lambda)-\lambda\sum_{i=1}^n x_i\right)}{d\lambda} \nonumber\\ &= \frac{n}{\lambda}-\sum_{i=1}^n x_i \nonumber\end{align}Simplifying, we arrive at$$\lambda = \frac{n}{\sum_{i=1}^n x_i}$$

wxMaxima Programming: Exponential Distribution Maximum Likelihood Estimation