Variance Formula
Before learning the variance formula, let us recall what is variance. Variance (σ^{2}) is the squared variation of values (X_{i}) of a random variable (X) from its mean (μ) . The variance formula lets us measure this spread from the mean of the random variable. The variance formula is different for a population and a sample. Let us now look at the variance formula below.
What Is Variance Formula?
There are separate variance formulas for the ungrouped data and the grouped data. The variance formulas are mentioned below.

For ungrouped data, variance can be written as:

Population Variance for population of size N = \(\Sigma\dfrac{(X_i\bar{X})^2}{N}\)

Sample Variance for sample of size N = \(\Sigma\dfrac{(X_i\bar{X})^2}{N1}\)


For grouped data, variance can be written as:

Population Variance, for population of size N = \(\Sigma\dfrac{f(M_i\bar{X})^2}{N}\)

Sample Variance, for sample of size N = \(\Sigma\dfrac{f(M_i\bar{X})^2}{N1}\)

where,
 \(\bar{X}\) is the mean
 \(M_i\) is the midpoint of the i^{th }interval.
Note:
 For ungrouped data, \(\bar{X}\) = \(\dfrac{\Sigma x_i}{N} \)
 For grouped data, \(\bar{X}\) = \( \dfrac{\Sigma M_i f}{\Sigma f} \)
Let us see the applications of the variance formulas in the following solved examples section.
Examples Using Variance Formula
Example 1: Find the variance of the following data using the variance formula: 24, 53, 53, 36, 21, 84, 64, 34, 77, 54
Solution:
Population Size (N) = 10
x_{i}  (x_{i}  x̄)  (x_{i } x̄)^{2} 
24  26  676 
53  3  9 
53  3  9 
36  14  196 
21  29  841 
84  34  1156 
64  14  196 
34  16  256 
77  27  729 
54  4  16 
μ_{x} = \( \frac{\Sigma x_i}{10}= \frac{500}{10} \) = 50 units  σ_{x} = \( \frac{\Sigma (x_i  \bar{x})^2 }{10} = \frac{4084}{10} \) = 408.4 units^{2} 
Answer: The variance of the given data is 408.4 units^{2}
Example 2: Find the mean and variance for the following data.
Class  1020  2030  3040  4050  5060  6070  7080  8090  90100 
frequency (f)  2  3  6  8  5  3  6  1  4 
Solution:
Let d = (M_{i}  Midpoint)/10, it is divided by 10 for simplification. (h =10)
Class  f  Midpoint of i^{th} class interval (M_{i})  M_{i}f  d  d^{2}  d^{2}f  df 
1020  2  15  30  4  16  32  8 
2030  3  25  75  3  9  27  9 
3040  6  35  210  2  4  24  12 
4050  8  45  360  1  1  8  8 
5060  5  55  275  0  0  0  0 
6070  3  65  195  1  1  3  3 
7080  6  75  450  2  4  24  12 
8090  1  85  85  3  9  9  3 
90100  4  95  380  4  16  64  16 
\(\Sigma f = 38\)  Midpoint = 55  \(\Sigma M_i f = 2060 \)  \(\Sigma d^2 f = 191 \)  \(\Sigma df \) = 3 
Mean = \( \dfrac{\Sigma M_i f}{\Sigma f}\) = \(\dfrac{2060}{38}\) = 54.21 units
Using the variance formula,
Variance = \( \dfrac{\Sigma f d^2  ( \frac{\Sigma(fd)^2}{n})}{n} h^2 \) = \( (\dfrac{191  ( \frac{(3)^2}{38})}{38})10^2 \)
= \( (\dfrac{191  0.2368}{38}) 100 \) = 502 units^{2}
Answer: The mean of this data = 54.21 units and the variance of this data = 502 units^{2}
Example 3: Given the following population data, find its population variance.
X  21  42  37  16  31  28  33  41  12 
Solution:
Population Mean = (21+42+37+16+31+28+33+41+12)/9 = 261/9 = 29
Using the population variance formula,
Population Variance = \( \frac{(21  29)^2+(42  29)^2+(37  29)^2+(16  29)^2+(31  29)^2+(28  29)^2+(33  29)^2+(41  29)^2+(12  29)^2}{9} \) = 920/9 = 102.22 units^{2}
Answer: Population variance of the given dataset is 102.22
FAQs on Variance Formula
What Is the Difference Between Standard Deviation Formula and Variance Formula?
Variance is the average squared deviations from the mean, while standard deviation is the square root of the variance. Both measures reflect variability in distribution, but their units differ: Standard deviation is expressed in the same units as the original values (e.g., minutes or meters). The sample standard deviation formula is: \(s=\sqrt{\frac{1}{n1} \sum_{i=1}^{n}\left(x_{i}\bar{x}\right)^{2}}\) and population variance for population of size N = \(\Sigma\dfrac{(X_i\bar{X})^2}{N}\)
How Do I Calculate the Variance using the Variance Formula?
The variance can be calculated as:

Find the mean of the data set. Add all data values and divide by the sample size n.
 Find the squared difference from the mean for each data value. Subtract the mean from each data value and square the result.
 Find the sum of all the squared differences. ...
 Calculate the variance. Population Variance for population of size N = \(\Sigma\dfrac{(X_i\bar{X})^2}{N}\)
What Is MeanVariance and Standard Deviation in Statistics?
Variance is the sum of squares of differences between all numbers and means...where μ is Mean, N is the total number of elements or frequency of distribution. Standard Deviation is the square root of variance. It is a measure of the extent to which data varies from the mean. The sample standard deviation formula is: \(s=\sqrt{\frac{1}{n1} \sum_{i=1}^{n}\left(x_{i}\bar{x}\right)^{2}}\)
Which Is Better to Use Variance Formula or Standard Deviation Formula?
They each have different purposes. The SD is usually more useful to describe the variability of the data while the variance is usually much more useful mathematically. For example, the sum of uncorrelated distributions (random variables) also has a variance that is the sum of the variances of those distributions.