# MLE of the Uniform Distribution

In a uniform distribution where $$0\leq X \leq \theta$$, the pdf is represented as $$f(X|\theta) = \frac{1}{\theta}I(0\leq X \leq \theta)$$, and the likelihood is $$L(\theta) = \prod\frac{1}{\theta}I(0\leq X \leq \theta) = \frac{1}{\theta^n}I(\max \ x_i < \theta, \min \ x_i > 0)$$. This makes logical sense to me, as the $$x_i$$ must be smaller than $$\theta$$ and larger than 0.

What I don't understand is that I'm supposed to be able to logically conclude from this information that the MLE of $$\theta$$ is therefore the MAXIMUM of $$x_i$$. I am reading that the correct answer to the question of "what is the MLE of $$\theta$$?" for this question is that it is the MAXIMUM of $$X$$.

That doesn't make sense. Say that $$x_1 = 1, x_2 = 2, x_3 = 3$$, and these values are plugged in as $$\theta$$ in the likelihood function to see which of them maximizes our likelihood function. Then clearly 1 is the maximizer here, since for X=1, $$\frac{1}{1^n}*I(true)=1$$, whereas for X=3, $$\frac{1}{3^n}*I(true)=0.333$$ at MOST and is even smaller when n > 1, and that is all smaller than what we got for x = 1, so since x = 3 has a smaller likelihood, it wouldn't be the maximum likelihood estimator.

Explain where my logic here is wrong?

In your example $$n=3$$, $$\min x_i = 1$$, & $$\max x_i = 3$$. When $$\theta=1$$, $$I(\max x_i \leq \theta, \min x_i \geq 0)=I(3\leq 1,1\geq 0)=I(\mathit{false})=0$$ This factor, & therefore the likelihood, will be zero for any $$\theta<\max x_i$$.