[Math] MLE of uniform distribution

statistics

Now before I begin, I know this question has been asked multiple times but all the answers but I had so many questions of my own that I figured I should make a new question as my thoughts are different than previous answers.

Now I will ask the question first then explain my thoughts and troubles 🙂

We have a uniform distribution that has the following PDF: $\frac{1}{b-a}$. So far so good.
So if $n$ observations our Maximum Likelihood Function is: $\mathcal{L}(a,b)=\frac{1}{(b-a)^n}$ if each of these observations are independent and identically (i.i.d.) distributed. Now, after taking the log of the likelihood and taking the derivative once with respect to $b$ and once with respect to $a$ we have the following:

The derivative with respect to $a$ is: $$\frac{n}{b-a}$$
and the derivative with respect to $b$ is:
$$\frac{-n}{b-a}$$

Now if we try to set either of these derivatives to zero and try to maximize the function, it will not yield anything useful. My problem arises here. Lets us just focus on maximizing $b$. I have read on this website as well as other places that to maximize $\frac{-n}{b-a}$ we have to take the maximum observation? How does that make sense, I mean should we not use the lowest observation to maximize this function? Because in this particular case, $n$ and $a$ are constants so we can easily just plug some numbers in and see that as $b$ gets bigger, the function get smaller, so why would we want the maximum observation? Help would be greatly appreciated and please I am not mathematically or statistically inclined so please be gentle! Thanks 🙂

Best Answer

Don't try to take derivatives. Note that the density of the uniform distribution is

$$ \frac{1}{b-a} I(a<X<b),$$

where $I$ is the indicator function. So your likelihood function should be something like

$$\frac{1}{(b-a)^n} \prod_{i=1}^n I(a<X_i<b).$$

Now eyeball that formula and see how it varies with $a,b$. First draw it for $a=0$ as a function of $b$, then the end result will become apparent.