# Variance Formula

In probability theory and statistics, the variance formula measures how far a set of numbers are spread out. It is a numerical value and is used to indicate how widely individuals in a group vary. If individual observations vary considerably from the group mean, the variance is big and vice versa.

A variance of zero indicates that all the values are identical. It should be noted that variance is always non-negative- a small variance indicates that the data points tend to be very close to the mean and hence to each other while a high variance indicates that the data points are very spread out around the mean and from each other.

## Variance Formulas

Variance can be of either grouped or ungrouped data. To recall, a variance can of two types which are:

• Variance of a population
• Variance of a sample

The variance of a population is denoted by σ2 and the variance of a sample by s2.

## Variance Formulas for Ungrouped Data

 Population variance Sample variance $$\begin{array}{l}\sigma^2=\frac{1}{N}\sum_{i=1}^{N}(x_i-\mu)^2\end{array}$$ Here, σ2 = Variance xi = ith observation of given data μ = Population mean N = Total number of observations (Population size) $$\begin{array}{l}s^2=\frac{1}{n-1}\sum_{i=1}^{n}(x_i-\overline{x})^2\end{array}$$ Here, s2 = Sample variance xi = ith observation of given data x̄ = Sample mean n = Sample size (or Number of data values in sample)

## Variance Formulas for Grouped Data

### Formula for Population Variance

The variance of a population for grouped data is:

• σ2 = ∑ f (m − x̅)2 / n

### Formula for Sample Variance

The variance of a sample for grouped data is:

• s2 = ∑ f (m − x̅)2 / n − 1

Where,

f = frequency of the class

m = midpoint of the class

These two formulas can also be written as:

 Population variance Sample variance $$\begin{array}{l}\sigma^2=\frac{1}{N}[\sum_{i=1}^{N}f_ix_i^2 – (\frac{\sum_{i=1}^{N}f_ix_i}{N})^2]\end{array}$$ Here, σ2 = Variance xi = Midvalue of ith class fi = Frequency of ith class N = Total number of observations (Population size) $$\begin{array}{l}s^2=\frac{1}{n-1}[\sum_{i=1}^{n}f_ix_i^2 – (\frac{\sum_{i=1}^{n}f_ix_i}{n})^2]\end{array}$$   Here, s2 = Sample variance xi = Midvalue of ith class fi = Frequency of ith class n = Sample size (or Number of data values in sample)

Summary:

Variance Type For Ungrouped Data For Grouped Data
Population Variance Formula σ2 = ∑ (x − x̅)2 / n σ2 = ∑ f (m − x̅)2 / n
Sample Variance Formula s2 = ∑ (x − x̅)2 / n − 1 s2 = ∑ f (m − x̅)2 / n − 1

Also Check: Standard Deviation Formula

### Variance Formula Example Question

Question: Find the variance for the following set of data representing trees heights in feet: 3, 21, 98, 203, 17, 9

Solution:

3 + 21 + 98 + 203 + 17 + 9 = 351

351 × 351 = 123201

…and divide by the number of items. We have 6 items in our example so:

123201/6 = 20533.5

Step 3: Take your set of original numbers from Step 1, and square them individually this time:

3 × 3 + 21 × 21 + 98 × 98 + 203 × 203 + 17 × 17 + 9 × 9

9 + 441 + 9604 + 41209 + 289 + 81 = 51,633

Step 4: Subtract the amount in Step 2 from the amount in Step 3.

51633 – 20533.5 = 31,099.5

Set this number aside for a moment.

Step 5: Subtract 1 from the number of items in your data set. For our example:

6 – 1 = 5

Step 6: Divide the number in Step 4 by the number in Step 5. This gives you the variance:

31099.5/5 = 6219.9

Step 7: Take the square root of your answer from Step 6. This gives you the standard deviation:

√6219.9 = 78.86634

Question 2:

Calculate the variance for the following data:

 Class intervals Frequency 200 – 201 13 201 – 202 27 202 – 203 18 203 – 204 10 204 – 205 1 205 – 206 1

Solution:

 CI fi xi fixi fixi2 200 – 201 13 200.5 2606.5 522603.25 201 – 202 27 201.5 5440.5 1096260.75 202 – 203 18 202.5 3645 738112.5 203 – 204 10 203.5 2035 414122.5 204 – 205 1 204.5 204.5 41820.25 205 – 206 1 205.5 205.5 42230.25 ∑fi = 70 ∑fixi = 14137 ∑fixi2 = 2855149.5

$$\begin{array}{l}s^2=\frac{1}{n-1}[\sum_{i=1}^{n}f_ix_i^2 – (\frac{\sum_{i=1}^{n}f_ix_i}{n})^2]\end{array}$$

= [1/(70 – 1)] [2855149.5 – (1/70)(14137)2]

= 1.179

 More topics in Variance Covariance Formula Coefficient of Variation Formula