Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

Variance Calculator

How to use
  1. Choose A set of data or A probability distribution with the two buttons. Learn more about the two cases
  2. For data, type the numbers in the box x=x =, separated by commas: 2, 4, 4, 5, 7, 9.
  3. For a distribution, type the values in x=x = and their probabilities in p=p =, in the same order. Probabilities may be decimals or fractions such as 1/6, and must add up to 1.
  4. Read the mean, the variance and the standard deviation. Learn more about reading the answer
  5. On the chart the amber line is the mean and the shaded band reaches one standard deviation each way.
  6. How it was found shows every step.

Mean
xˉ=316=5.1667\displaystyle \bar{x} = \frac{31}{6} = 5.1667
Population variance
σ2=30.83336=5.1389\displaystyle \sigma^2 = \frac{30.8333}{6} = 5.1389
Sample variance
s2=30.83335=6.1667\displaystyle s^2 = \frac{30.8333}{5} = 6.1667
Standard deviations
σ=2.2669,s=2.4833\displaystyle \sigma = 2.2669, \qquad s = 2.4833
Count and sum of squares
n=6,∑(x−xˉ)2=30.8333\displaystyle n = 6, \qquad \sum (x - \bar{x})^2 = 30.8333
How it was found

Mean. Add the 6 numbers and divide by 6: xˉ=316=5.1667\bar{x} = \dfrac{31}{6} = 5.1667.

Deviations. Subtract the mean from each number and square the result: (2−5.1667)2=10.0278(2 - 5.1667)^2 = 10.0278, (4−5.1667)2=1.3611(4 - 5.1667)^2 = 1.3611, (4−5.1667)2=1.3611(4 - 5.1667)^2 = 1.3611, (5−5.1667)2=0.0278(5 - 5.1667)^2 = 0.0278, (7−5.1667)2=3.3611(7 - 5.1667)^2 = 3.3611, (9−5.1667)2=14.6944(9 - 5.1667)^2 = 14.6944.

Sum of squares. Add them: 30.833330.8333.

Population variance. If the numbers are the whole population, divide by n=6n = 6: σ2=5.1389\sigma^2 = 5.1389.

Sample variance. If they are a sample from a larger population, divide by n−1=5n - 1 = 5: s2=6.1667s^2 = 6.1667. Dividing by one less corrects for measuring the spread around the sample's own mean.

Standard deviation is the square root of the variance, back in the units of the data: σ=2.2669\sigma = 2.2669, s=2.4833s = 2.4833.



Variance of a data set

DemoVariance of a data set
Step 0 of 3
Choose A set of data and type the numbers. The calculator finds the mean, then measures how far the numbers lie from it:

σ2=∑(x−xˉ)2ns2=∑(x−xˉ)2n−1\sigma^2 = \dfrac{\sum (x - \bar{x})^2}{n} \qquad s^2 = \dfrac{\sum (x - \bar{x})^2}{n - 1}


The first is the population variance, the second the sample variance. Both are given, because which one you need depends on where the numbers come from.

Reading the answer

    For data:

  • Mean is the sum divided by the count.
  • Population variance σ2\sigma^2 divides the sum of squared deviations by nn.
  • Sample variance s2s^2 divides it by n−1n - 1.
  • Standard deviations are the square roots of the two.

  • For a distribution:

  • Expected value is E[X]E[X], the mean of the variable.
  • Expected square is E[X2]E[X^2].
  • Variance is E[X2]−(E[X])2E[X^2] - (E[X])^2 and Standard deviation its square root.
  • Check confirms that the probabilities add up to 11.

What variance measures

Variance is the average squared distance from the mean. It is 00 when all the numbers are equal and grows as they spread out.

The distances are squared so that deviations below the mean do not cancel those above it, and so that far-off values count more than near ones. The price is that variance is in squared units; the standard deviation, its square root, is back in the units of the data.
Numbers close to the mean: a small variance.

Population or sample

  • If the numbers are every member of the group you care about, use the population variance and divide by nn.
  • If they are a sample taken to learn about a larger group, use the sample variance and divide by n−1n - 1.

  • A sample tends to sit closer to its own mean than to the true mean of the population, so dividing by nn would give too small a value on average. Dividing by n−1n - 1 corrects for this. With many numbers the two results are almost the same.
The same mean, numbers spread wide: a large variance.

Variance of a probability distribution

DemoVariance of a probability distribution
Step 0 of 3
Choose A probability distribution and type the values of a random variable with their probabilities. Now the average is weighted by probability:

E[X]=∑x p(x)Var⁡(X)=∑(x−μ)2p(x)=E[X2]−(E[X])2E[X] = \sum x\,p(x) \qquad \operatorname{Var}(X) = \sum (x - \mu)^2 p(x) = E[X^2] - (E[X])^2


The second form is quicker by hand: work out E[X]E[X] and E[X2]E[X^2], then subtract the square of the first from the second.

For a fair die, E[X]=3.5E[X] = 3.5 and E[X2]=916E[X^2] = \dfrac{91}{6}, so the variance is 916−3.52=3512≈2.9167\dfrac{91}{6} - 3.5^2 = \dfrac{35}{12} \approx 2.9167.

Common mistakes

  • Forgetting to square. The plain deviations always add up to 00.
  • Dividing by nn for a sample, or by n−1n - 1 for a whole population.
  • Reporting the variance as the spread. It is in squared units; the standard deviation is the one to compare with the data.
  • Writing E[X2]E[X^2] as (E[X])2(E[X])^2. They differ, and their difference is the variance.
  • Probabilities that do not add up to 1. Then the list is not a distribution.