Connect via MCP →

Enter Calculation

distribution range a ~ b
a ≤ b

Formula

Advertisement

Results

f(x) at x = 5 (midpoint of [a, b])
0.166667
interval width b - a = 6
x f(x)
0 0
0.1 0
0.2 0
0.3 0
0.4 0
0.5 0
0.6 0
0.7 0
0.8 0
0.9 0
1 0
1.1 0
1.2 0
1.3 0
1.4 0
1.5 0
1.6 0
1.7 0
1.8 0
1.9 0
2 0.166667
2.1 0.166667
2.2 0.166667
2.3 0.166667
2.4 0.166667
2.5 0.166667
2.6 0.166667
2.7 0.166667
2.8 0.166667
2.9 0.166667
3 0.166667
3.1 0.166667
3.2 0.166667
3.3 0.166667
3.4 0.166667
3.5 0.166667
3.6 0.166667
3.7 0.166667
3.8 0.166667
3.9 0.166667
4 0.166667
4.1 0.166667
4.2 0.166667
4.3 0.166667
4.4 0.166667
4.5 0.166667
4.6 0.166667
4.7 0.166667
4.8 0.166667
4.9 0.166667
5 0.166667
5.1 0.166667
5.2 0.166667
5.3 0.166667
5.4 0.166667
5.5 0.166667
5.6 0.166667
5.7 0.166667
5.8 0.166667
5.9 0.166667
6 0.166667
6.1 0.166667
6.2 0.166667
6.3 0.166667
6.4 0.166667
6.5 0.166667
6.6 0.166667
6.7 0.166667
6.8 0.166667
6.9 0.166667
7 0.166667
7.1 0.166667
7.2 0.166667
7.3 0.166667
7.4 0.166667
7.5 0.166667
7.6 0.166667
7.7 0.166667
7.8 0.166667
7.9 0.166667
8 0.166667
8.1 0
8.2 0
8.3 0
8.4 0
8.5 0
8.6 0
8.7 0
8.8 0
8.9 0
9 0
9.1 0
9.2 0
9.3 0
9.4 0
9.5 0
9.6 0
9.7 0
9.8 0
9.9 0
10 0

What is the uniform distribution calculator?

The continuous uniform distribution describes a random variable that is equally likely to take any value within an interval [a, b]. This calculator computes three related functions over that interval: the probability density \(f(x)\), the lower cumulative probability \(P(x)\) (the CDF), and the upper cumulative probability \(Q(x)\) (the survival function). It also produces a table of values across a sweep of x points so you can plot the chosen function.

How to use it

Pick which function to evaluate (density f, lower cumulative P, or upper cumulative Q). Enter the interval boundaries a and b (with \(a < b\)). Then set the sweep: the initial value of x, the increment (step) added each iteration, and the number of repetitions (how many x points to generate). The result box shows the function value at the midpoint of [a, b], and the table lists every (x, value) pair across the sweep.

The formula explained

Let the width be \(w = b - a\). The density is constant inside the support:

$$f(x) = \begin{cases} \dfrac{1}{\text{b} - \text{a}}, & \text{a} \le x \le \text{b} \\[0.6em] 0, & \text{otherwise} \end{cases}$$

for \(a \le x \le b\), and 0 outside. The lower cumulative probability accumulates area from a:

$$P(x) = \begin{cases} 0, & x < \text{a} \\[0.6em] \dfrac{x - \text{a}}{\text{b} - \text{a}}, & \text{a} \le x \le \text{b} \\[0.6em] 1, & x > \text{b} \end{cases}$$

clamped to 0 below a and 1 above b. The upper cumulative probability is the complement,

$$Q(x) = \begin{cases} 1, & x < \text{a} \\[0.6em] \dfrac{\text{b} - x}{\text{b} - \text{a}}, & \text{a} \le x \le \text{b} \\[0.6em] 0, & x > \text{b} \end{cases}$$

clamped to 1 below a and 0 above b. Because they cover the whole density, \(P(x) + Q(x) = 1\) everywhere. The calculator guards against a degenerate case where \(a = b\) (zero width), which would divide by zero.

Advertisement
Lower cumulative probability shown as the shaded left portion of the uniform rectangle from a to a point x.
Lower CDF P(x) is the shaded area from a up to x; upper CDF Q(x) is the remaining area to b.
Flat rectangular probability density function of a continuous uniform distribution on interval a to b at constant height 1 over b minus a.
The uniform PDF is a flat rectangle of constant height 1/(b−a) over [a, b].

Worked example

With \(a = 2\) and \(b = 8\) the width is \(w = 6\). At \(x = 5\) (the midpoint):

$$f(5) = \frac{1}{6} \approx 0.16667, \quad P(5) = \frac{5 - 2}{6} = 0.5, \quad Q(5) = \frac{8 - 5}{6} = 0.5$$

confirming \(P + Q = 1\). At \(x = 0\) (below a) the density is 0, \(P = 0\) and \(Q = 1\). At \(x = 8\) (the upper edge) \(P = 1\) and \(Q = 0\).

FAQ

Why is the density bigger than 1? Density is not a probability; it is probability per unit length. For a narrow interval \(\frac{1}{b - a}\) can exceed 1 while the total area under the curve still equals 1.

What if a equals b? The width is zero, so the density is undefined (infinite) and the cumulative functions become a step. The calculator flags this as invalid input.

Can the step be negative? Yes. A negative increment makes a descending sweep; the formulas still clamp correctly outside [a, b].

Last updated: