Variance is calculated as the square of the standard deviation. Hence, we have to calculate the standard deviation first. Its formula is
s = sqrt{[∑(x - X)^2 ]÷ (n-1)]}
where x is the value of each single data, X is the mean, and n is the number of samples. The mean would be
X = (0 + 1 + 2 + 3 + 4)/5 = 2
Then,
∑(x - X)^2 = (0-2)^2 + (1-2)^2 + (2-2)^2 + (3-2)^2 + (4-2)^2 = 10
Thus,
s = sqrt{10÷ (20-1)]} = 0.725
The square of this would be the variance.
Variance = (0.725)^2 = 0.526
Therefore, the sample variance of the data is 0.526.