St · Statistics & Probability

How to Find the MLE of a Uniform Distribution

Updated 13 October 2026

At a glance

  1. 1. Choose the model

    Specify which endpoint or endpoints of the uniform distribution are unknown.

  2. 2. Write the likelihood

    Multiply the sample densities and include the parameter values that make every observation possible.

  3. 3. Maximize over parameters

    For Uniform(0, θ), the likelihood decreases with θ, so choose the smallest feasible value.

  4. 4. Check the estimate

    Substitute the estimate into the support constraints and distinguish a maximum from a supremum.

The maximum-likelihood estimate (MLE) depends on how the uniform distribution is parameterized. The most common textbook problem assumes independent observations from Uniform(0, θ), where the lower endpoint is 0 and the upper endpoint θ is unknown. In that model, the MLE is the largest observation in the sample.

If both endpoints are unknown, the usual MLEs are instead the sample minimum and sample maximum. The likelihood makes clear why these answers differ.

The common case: Uniform(0, θ)

Let X1,…,XnX_1,\ldots,X_n be independent observations from a uniform distribution on [0,θ][0,\theta], where θ>0\theta>0. The density of one observation is

f(x∣θ)={1/θ,0≤x≤θ,0,otherwise.f(x\mid\theta)=\begin{cases} 1/\theta, & 0\le x\le\theta,\\ 0, & \text{otherwise}. \end{cases}

Write X(n)=max⁡(X1,…,Xn)X_{(n)}=\max(X_1,\ldots,X_n) for the sample maximum. Independence gives the likelihood

L(θ)=∏i=1nf(Xi∣θ)=θ−n 1{θ≥X(n)},L(\theta)=\prod_{i=1}^n f(X_i\mid\theta) =\theta^{-n}\,\mathbf{1}\{\theta\ge X_{(n)}\},

assuming all observed values are nonnegative. The indicator is 1 when the parameter makes every observation possible and 0 otherwise. Thus, values of θ\theta below the sample maximum have zero likelihood. For all feasible values θ≥X(n)\theta\ge X_{(n)}, the likelihood θ−n\theta^{-n} decreases as θ\theta increases. If X(n)>0X_{(n)}>0, its largest value is therefore attained at the smallest feasible parameter:

θ^MLE=X(n)=max⁡iXi.\widehat{\theta}_{\mathrm{MLE}}=X_{(n)}=\max_i X_i.

This is a boundary maximum: the fitted upper endpoint is exactly the largest observed value. In the edge case X(n)=0X_{(n)}=0, the likelihood is unbounded as θ↓0\theta\downarrow 0, so no MLE exists; this event has probability zero under the continuous model.

Worked example

Suppose the observations are 1.2, 2.7, 3.1, 4.01.2,\ 2.7,\ 3.1,\ 4.0. For the model Xi∼Uniform⁡(0,θ)X_i\sim\operatorname{Uniform}(0,\theta), the likelihood is

L(θ)={θ−4,θ≥4.0,0,θ<4.0.L(\theta)=\begin{cases} \theta^{-4}, & \theta\ge 4.0,\\ 0, & \theta<4.0. \end{cases}

Among feasible values, this is largest when θ\theta is as small as possible. Hence θ^MLE=4.0\widehat{\theta}_{\mathrm{MLE}}=4.0. The maximum likelihood is 4−4=1/2564^{-4}=1/256.

If both endpoints are unknown

Now suppose Xi∼Uniform⁡(a,b)X_i\sim\operatorname{Uniform}(a,b), with both aa and bb unknown and a<ba<b. The likelihood is

L(a,b)=(b−a)−n 1{a≤X(1), b≥X(n)},L(a,b)=(b-a)^{-n}\,\mathbf{1}\{a\le X_{(1)},\ b\ge X_{(n)}\},

where X(1)=min⁡iXiX_{(1)}=\min_i X_i. To maximize the likelihood, make the interval as short as possible while still containing every observation. Under the usual closed-support convention, this gives

a^=X(1),b^=X(n).\widehat a=X_{(1)},\qquad \widehat b=X_{(n)}.

For the example above, the estimates are a^=1.2\widehat a=1.2 and b^=4.0\widehat b=4.0. If the model requires observations to lie strictly between the endpoints, these values may not be allowed: the likelihood then has a supremum as the endpoints approach the sample minimum and maximum, but no attained maximum. Textbooks commonly use the closed-support convention, under which the estimates above are MLEs.

What if the lower endpoint is known but not zero?

For Xi∼Uniform⁡(c,θ)X_i\sim\operatorname{Uniform}(c,\theta) with known lower endpoint cc and unknown upper endpoint, the same reasoning gives θ^=X(n)\widehat\theta=X_{(n)}, provided all observations are at least cc and X(n)>cX_{(n)}>c. If all observations equal cc, the likelihood is unbounded as θ↓c\theta\downarrow c, so no MLE exists. If instead the upper endpoint dd is known and the lower endpoint is unknown, the MLE of the lower endpoint is the sample minimum, provided all observations are at most dd and X(1)<dX_{(1)}<d. If all observations equal dd, no MLE exists.

A different model can produce a different result. For example, if the interval has known width 1 and unknown location, Xi∼Uniform⁡(θ,θ+1)X_i\sim\operatorname{Uniform}(\theta,\theta+1), the likelihood is constant over all θ\theta values for which the interval contains the data. Every feasible value is then an MLE; there need not be a unique one.

Common mistakes

  • Using the sample mean as the MLE. For Uniform(0, θ), the sample mean is not the MLE; the sample maximum is. The mean is a different estimator.
  • Ignoring the support constraint. The likelihood is zero if even one observation falls outside the proposed interval. The indicator in the likelihood is essential.
  • Assuming there is one answer for every uniform model. The result changes when the lower endpoint, upper endpoint, width, or location is known or unknown.
  • Confusing MLE with unbiased estimation. For Uniform(0, θ), the MLE is generally biased downward: its expected value is nθ/(n+1)n\theta/(n+1). An unbiased estimator is n+1nX(n)\frac{n+1}{n}X_{(n)}, but it is not the MLE.
  • Overlooking degenerate samples. With both endpoints unknown, a sample whose observations are all identical would require an interval of zero width. Such a sample has probability zero under a continuous uniform model, but for that data the ordinary positive-width likelihood has no finite maximum.

For the standard Uniform(0, θ) model, the key operation is simple: find the largest observation. Before applying it, check that zero is the known lower endpoint and that θ is the unknown upper endpoint.

References

  1. Statistical Inference, George Casella and Roger L. Berger
  2. Introduction to Mathematical Statistics, Robert V. Hogg, Joseph W. McKean, and Allen T. Craig

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.