Distribution Variance Calculator

Enter the values and their probabilities to find the variance.

How it is calculated

Enter the possible values of the random variable and their probabilities as two comma-separated lists of equal length, in the same order. Use a dot for decimals, because the comma separates the items. The tool computes the mean μ = Σ p·x, the variance σ² = Σ p·(x − μ)² straight from the definition, and the standard deviation σ = √σ², all shown to four decimals.

Inputs it rejects, showing no result: lists of different length, entries that are not numbers, any probability below 0 or above 1, and probabilities whose sum is not within 0.001 of 1. The tolerance lets rounded values like 0.3333, 0.3333, 0.3333 through, but they are used as typed, not rescaled, so the mean comes out as 0.9999 rather than 1. Values themselves can be any real numbers.

Worked example

A discrete variable takes the values 0, 1, 2, 3 with probabilities 0.1, 0.3, 0.4, 0.2, which add up to 1. Mean: 0×0.1 + 1×0.3 + 2×0.4 + 3×0.2 = 0.3 + 0.8 + 0.6 = 1.7. Squared deviations from 1.7 are 2.89, 0.49, 0.09, 1.69. Weighted by the probabilities: 0.289 + 0.147 + 0.036 + 0.338 = 0.81. So the variance is 0.8100, the standard deviation is √0.81 = 0.9000, and the mean is 1.7000. A typical outcome is therefore about 0.9 away from the expected value of 1.7.

Try this example →

Common mistakes

  • Giving counts or percentages as probabilities. Counts like 10, 30, 40, 20 or percentages like 50, 50 are above 1 and the tool returns nothing; divide by the total first (0.1, 0.3, 0.4, 0.2).
  • Using a decimal comma, as in 0,3. The comma is the separator, so write 0.3. Separating items with spaces or semicolons instead of commas gives no result either.
  • Lists of different lengths, such as five values and four probabilities, or a missing probability for one outcome.
  • Confusing this with sample variance. The values here are the whole distribution with its probabilities, so there is no n − 1 correction, and it is not calculated from a list of observed data points.
  • Rounding probabilities so they no longer add up. 0.33, 0.33, 0.33 sum to 0.99, which is outside the 0.001 tolerance and gives no result; use 0.3333 or fractions that really sum to 1.

About this calculator

For a discrete random variable X with possible values x_i and probabilities p_i, the expected value (mean) is μ = Σ x_i·p_i, and the variance is Var(X) = Σ p_i·(x_i − μ)² — equivalently E[X²] − μ² using the shortcut formula. The standard deviation is simply the square root of the variance, expressed in the same units as X.

These three numbers describe both the center and the spread of a distribution: variance and standard deviation quantify how much outcomes typically deviate from the expected value, which is central to risk analysis, insurance pricing, quality control, and any statistics or probability coursework covering random variables.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    There is a handy cross-check: the variance also equals the mean of the squares minus the square of the mean. For values 1, 2, 3 with probabilities 0.2, 0.5, 0.3 the mean of squares is 4.9, the mean is 2.1, and 4.9 minus 4.41 gives the 0.4900 shown. What kind of distribution are you working with, a die, a survey or a payoff?

Popular calculators

All Calculators