Discrete Uniform Distribution Moments — Mean & Variance Calculator

Compute moments for a discrete uniform distribution over integers a to b. Instantly get mean, variance, standard deviation, and raw moments. Validate ranges, visualize outputs, and export results. Built for statisticians, engineers, and students who need transparent formulas and reproducible steps. Supports integer endpoints, symbolic formulas, and numerical evaluation with high precision. Includes MGF handling t=0 limits and sample checks.

Inputs

At t = 0 the MGF equals 1.

Formulas

For a discrete uniform distribution on the integers \( \{a, a+1, \dots, b\} \) with support size \( n = b-a+1 \):

  • Mean: \( \displaystyle \mu = \frac{a+b}{2} \)
  • Variance: \( \displaystyle \sigma^2 = \frac{n^2 - 1}{12} \)
  • Standard deviation: \( \displaystyle \sigma = \sqrt{\frac{n^2 - 1}{12}} \)
  • Raw moment of order \(k\): \( \displaystyle \mathbb{E}[X^k] = \frac{1}{n}\sum_{x=a}^{b} x^k \)
  • MGF: \( \displaystyle M_X(t) = \begin{cases} \dfrac{e^{ta}\big(1 - e^{tn}\big)}{n \big(1 - e^{t}\big)}, & t \neq 0 \\[6pt] 1, & t = 0 \end{cases} \)

Results

Enter valid inputs and click Calculate to see results here.

Quality checks

  • When \( a=b \), the variance should be 0 and the mean equals \( a \).
  • For symmetric intervals (e.g., \(-m\) to \(m\)), the mean should be 0.
  • The MGF at \( t=0 \) equals 1.

FAQs

It is the set of equally likely integers from \(a\) to \(b\), inclusive, so there are \(n=b-a+1\) points. Each point has probability \(1/n\).

The points are symmetric around the midpoint of the interval. Pairing the smallest with the largest, each pair averages to \((a+b)/2\), so the overall average equals that midpoint.

Using \( \mathrm{Var}(X)=\mathbb{E}[X^2]-\mu^2 \) and Faulhaber sums for \( \sum x \) and \( \sum x^2 \), one obtains \( \sigma^2=(n^2-1)/12 \) where \( n=b-a+1 \).

The distribution is degenerate at \(a\). The mean is \(a\), the variance is 0, and all raw moments equal \(a^k\).

For small \(t\), both numerator and denominator involve \(1-e^{t}\). Using expm1 avoids catastrophic cancellation and yields stable results close to \(t=0\).

No. This calculator assumes a finite set of integer outcomes with equal probability. The continuous uniform distribution has a continuum of outcomes over an interval and different moment formulas.

Yes. Use the raw moment field for any integer \(k\ge 1\). Central moments follow from raw moments using binomial expansions, e.g., \( \mu_2=\mathrm{Var}(X) \), \( \mu_3=\mathbb{E}[(X-\mu)^3] \), etc.

Related Calculators


Uniform Distribution PDF/PMF Value Calculator
Pareto Distribution Quantile Percent Point Calculator
Cauchy Distribution CDF Value Calculator
Laplace Distribution CDF Value Calculator
Geometric Distribution Moments Mean Variance Calculator
Negative Binomial Distribution PDF/PMF Value Calculator
Square Area Calculator
Rectangle Perimeter Calculator
Rectangle Circumradius Calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.