Law of Large Numbers Calculator

Model repeated experiments using probabilities, samples, and tolerance targets. Measure convergence speed and error bounds. See averages stabilize as trial counts rise over time.

Calculator inputs

These values let the page compare an empirical mean against the theoretical mean.

Formula used

Expected value: μ = Σ[xᵢ · pᵢ]

Second moment: E[X²] = Σ[xᵢ² · pᵢ]

Variance: σ² = E[X²] − μ²

Standard error of the sample mean: SE(X̄) = σ / √n

Chebyshev lower bound: P(|X̄ − μ| < ε) ≥ 1 − σ² / (nε²)

Hoeffding lower bound for bounded outcomes: P(|X̄ − μ| < ε) ≥ 1 − 2e−2nε²/(b−a)²

The law of large numbers states that the sample mean converges toward the expected value as the number of independent observations increases.

How to use this calculator

  1. Select either a Bernoulli model or a custom discrete distribution.
  2. Enter the main trial count, tolerance ε, and desired confidence target.
  3. Add comparison sample sizes to inspect how error bounds improve.
  4. For Bernoulli trials, enter p. For custom inputs, enter matching outcomes and probabilities.
  5. Optionally paste observed samples to compare empirical results with theory.
  6. Press Submit to place the result section above this form.
  7. Use the CSV and PDF buttons to save your calculated output.

Example data table

Scenario: fair coin, p = 0.5, ε = 0.1, and bounded outcomes from 0 to 1.

n Expected value μ Variance σ² SE(X̄) Chebyshev within ε Hoeffding within ε
10 0.5 0.25 0.1581 0.00% 0.00%
50 0.5 0.25 0.0707 50.00% 26.42%
100 0.5 0.25 0.0500 75.00% 72.93%
500 0.5 0.25 0.0224 95.00% 99.99%

Frequently asked questions

1. What does this calculator measure?

It estimates how the sample mean approaches the theoretical mean. It also reports variance, standard error, probability bounds, and sample sizes needed for a chosen tolerance target.

2. Why are Chebyshev and Hoeffding bounds included?

They provide conservative guarantees for how close the sample mean can be to the expected value. Hoeffding is usually tighter when outcomes are bounded inside a known range.

3. Can I use custom outcomes instead of Bernoulli trials?

Yes. Enter any discrete outcomes and matching probabilities. The calculator then builds the mean, second moment, variance, and convergence bounds from your supplied distribution.

4. What happens if my probabilities do not sum to one?

The calculator automatically normalizes positive probability values to sum exactly to one. It also displays a note so you know your original probability totals were adjusted.

5. What are observed samples used for?

Observed samples let you compare an actual empirical mean with the theoretical expectation. The page also shows checkpoint running means to reveal how the average settles as more observations accumulate.

6. Does a larger n always reduce error?

For independent observations with finite variance, the standard error shrinks as n grows. That usually improves concentration around the true mean, although any single sample can still fluctuate.

7. Is this a simulation tool?

It is mainly an analytical calculator. You can paste your own sample observations, but the main outputs come from probability formulas and concentration bounds rather than random simulation.

8. When should I trust Hoeffding more than Chebyshev?

Use Hoeffding when outcomes stay within a fixed minimum and maximum. Use Chebyshev when you only know the variance and need a broad, assumption-light probability guarantee.

Related Calculators

negative binomial calculatordistribution curve calculatorgeometric distribution calculatornormal probability calculatorbernoulli distribution calculatormaximum likelihood calculatordiscrete distribution calculatorprobability table calculatorprobability plot calculatorprobability ratio 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.