Calculator

Uniform Distribution

Calculate density, cumulative probabilities and quantiles for a uniform distribution with bounds a and b.

Settings

Calculator focused on this distribution.

Result and visualization

Calculate PDF/PMF, CDF and percentiles instantly.

Result pending…

Explanation

The continuous uniform distribution assigns exactly the same probability density to every value within the interval [a, b] and zero probability outside of it. It is the model that expresses total ignorance about which value is more likely within that range: if you only know that something will occur between a and b but have no reason to prefer any particular value, the uniform distribution is the natural choice. It is used as the base distribution in random number generators, in Monte Carlo simulation (where it is transformed via the inverse CDF to obtain other distributions), and in robust optimization models. Its mean is (a + b) / 2, its variance is (b − a)² / 12 and its cumulative distribution function is linear: F(x) = (x − a) / (b − a).

Formula

\( f(x)=\frac{1}{b-a},\quad a\le x\le b \)

Parameters

  • a: lower bound of the interval. It can be any real number.
  • b: upper bound of the interval. It must satisfy b > a.
  • x: value at which the PDF or CDF is evaluated, within the interval [a, b].

Worked example

Situation: The temperature of a server room is controlled so that it fluctuates uniformly between \(a = 2\)°C and \(b = 10\)°C. Any temperature within that range is equally likely. Let \(X \sim \text{Uniform}(2, 10)\).

Question 1: What is the probability that the temperature is between 4°C and 7°C, that is, \(P(4 \leq X \leq 7)\)?

Solution: For the uniform distribution, the probability of an interval is proportional to its relative length: \[ P(4 \leq X \leq 7) = \frac{7 - 4}{10 - 2} = \frac{3}{8} = 0.375 \] There is a 37.5% probability that the temperature falls within that range.

Question 2: What is the 75th percentile? That is, what temperature \(x\) satisfies \(P(X \leq x) = 0.75\)?

Solution: We use the closed-form quantile formula of the uniform distribution: \[ x = a + p \cdot (b - a) = 2 + 0.75 \times (10 - 2) = 2 + 0.75 \times 8 = 2 + 6 = 8 \text{ °C} \] The 75th percentile is 8°C: 75% of the time the temperature does not exceed 8°C.

Interpretation: The mean of the distribution is \((a + b)/2 = 6\)°C. The uniform distribution is the distribution of maximum uncertainty within a fixed interval: all values are equally plausible, with no bias toward the center or the extremes.

How to interpret the result

The calculator offers three types of output. The PDF is exactly \( f(x) = \frac{1}{b-a} \) for any \( x \in [a, b] \) and zero outside. This means the density is constant: no subinterval of the same length is more likely than another. A PDF value of, say, 0.05 with \( a = 0 \) and \( b = 20 \) does not mean the probability at that point is 0.05, but rather that any interval of length 1 within \([0, 20]\) has exactly a 5% probability. In the chart, the curve is a horizontal line over the interval \([a, b]\); the green area represents the fraction of the interval that falls within the selected range.

The CDF, \( P(X \leq x) = \frac{x - a}{b - a} \), grows linearly from 0 to 1. This makes it especially intuitive: \( P(X \leq x) \) is directly the fraction of the total interval that lies to the left of \( x \). If \( a = 0 \), \( b = 20 \) and \( x = 5 \), then \( P(X \leq 5) = 0.25 \): 25% of the possible values fall below 5. The right tail \( P(X > x) = \frac{b - x}{b - a} \) is the remaining fraction of the interval.

The percentile or quantile result has a simple closed-form formula: \( x = a + p \cdot (b - a) \). The 75th percentile is the point located 75% of the way through the interval from \( a \) to \( b \). In random number generation and Monte Carlo simulation, the quantile of the uniform distribution is used as the starting point for generating variables of other distributions via the inverse transform.

Frequently asked questions

  • What does the continuous uniform model? A variable that can take any value in an interval [a, b] with the same density: no region is more likely than another. It is used when only the possible limits of the outcome are known.
  • How do I compute the probability of a subinterval? It is proportional to its length: P(c ≤ X ≤ d) = (d − c)/(b − a). Remember that for a continuous variable any single point has probability zero.
  • Why is it so important in simulation? Random number generators produce U(0, 1) values, and every other distribution can be built from them (for instance via the inverse-transform method). It is the basic building block of Monte Carlo methods.

Reference: Continuous uniform distribution — Wikipedia