# Find the maximum likelihood estimator for $\mu$

## Question

Let $X_1,X_2,...,X_n$ be independent continuous random variables with the probability density function, $f(x)= \frac{1}{\mu}e^{-\frac{x}{\mu}}$, if $x>0$ and $0$ otherwise, where $\mu>0$. Find the maximum likelihood estimator for $\mu$ and compute the variance of the maximum likelihood estimator for $\mu$.

I found the likelihood function to be \begin{equation} l(\mu)=\prod_{i=1}^{n} \frac{1}{\mu}e^{-\frac{X_i}{\mu}}=\frac{1}{\mu^n}e^{-\frac{1}{\mu}\sum_{i=1}^{n}X_i} \end{equation} and thus the log likelihood is \begin{equation} L(\mu)=-n\log_e(\mu)-\frac{1}{\mu}\sum_{i=1}^{n}Xi. \end{equation} So, \begin{equation} \frac{\partial L(\mu)}{\partial \mu}=-\frac{n}{\mu}+\frac{1}{\mu^2}\sum_{i=1}^{n}X_i. \end{equation} Equating this to $0$ gives $\frac{1}{\mu^2}\sum_{i=1}^{n}Xi=\frac{n}{\mu}$ and so $\bar X= \hat \mu$.
However, I am not sure that I wrote out the likelihood function correctly and I don't know how I would find the variance. I know $\text{Var}(X)=E(X^2)-(E(X))^2$ but I don't know how to calculate this using the MLE.
Your work is correct, although personally, I would write the full likelihood as \begin{align*} \mathcal L(\mu \mid \boldsymbol x) &= \prod_{i=1}^n \frac{1}{\mu} e^{-x_i/\mu} \mathbb 1 (x_i \ge 0) \\ &= \mu^{-n} \exp\left(-\frac{1}{\mu} \sum_{i=1}^n x_i\right) \mathbb 1 (x_{(1)} \ge 0) \\ &= \mu^{-n} e^{-n \bar x/\mu} \mathbb 1 (x_{(1)} \ge 0), \end{align*} where $\bar x$ is the sample mean; $$\mathbb 1(x_i \ge 0) = \begin{cases} 1, & x_i \ge 0 \\ 0, & \text{otherwise} \end{cases}$$ is an indicator function, and $x_{(1)} = \min_i x_i$ is the first (minimum) order statistic of the sample $\boldsymbol x = (x_1, x_2, \ldots, x_n)$. This however does not affect the validity of your computation of the MLE, which is indeed $\hat \mu = \bar x$, the sample mean. To calculate the variance of this estimator, we write $$\operatorname{Var}[\hat \mu] = \operatorname{Var}[\bar X] = \operatorname{Var}\left[\frac{1}{n} \sum_{i=1}^n X_i\right] \overset{\text{ind}}{=} \frac{1}{n^2} \sum_{i=1}^n \operatorname{Var}[X_i] \overset{\text{id}}{=} \frac{1}{n^2} \cdot n \operatorname{Var}[X] = \frac{\operatorname{Var}[X]}{n},$$ where "ind" over the equality sign indicates that the equality holds because the observations are independent; "id" over the equality sign indicates that equality holds because the observations are identically distributed; and $\operatorname{Var}[X]$ represents the variance of a single observation from this distribution. What is $\operatorname{Var}[X]$ in terms of the parameter $\mu$?