Skip to content

Standard Deviation Formula and Variance, With Solved Tables

10 formulasCalculatorUpdated 22 Oct 2026

The standard deviation formula for a population is σ=∑(xi−xˉ)2n\sigma = \sqrt{\dfrac{\sum (x_i-\bar{x})^2}{n}}, and for a sample you divide by n−1n-1 instead of nn. Standard deviation tells you roughly how far the values typically sit from their mean. Square it and you get the variance.

Below you get every version you meet from class 10 to college: raw data, the shortcut form, grouped data by the direct, assumed mean and step deviation methods, plus mean deviation, quartile deviation, coefficient of variation and a short note on covariance. Each method has a worked table you can follow line by line, and the statistics calculator below checks your own data.

Standard deviation formula

Key formulas

  • Population standard deviation

    σ=∑(xi−xˉ)2n\sigma = \sqrt{\dfrac{\sum (x_i-\bar{x})^2}{n}}

    n is the number of values; for a whole population the mean is often written μ\mu

  • Sample standard deviation

    s=∑(xi−xˉ)2n−1s = \sqrt{\dfrac{\sum (x_i-\bar{x})^2}{n-1}}

    use when the data is a sample from a larger group

  • Variance formula

    σ2=∑(xi−xˉ)2n\sigma^2 = \dfrac{\sum (x_i-\bar{x})^2}{n}

    variance is the square of SD

  • Shortcut form

    σ2=∑xi2n−xˉ 2\sigma^2 = \dfrac{\sum x_i^2}{n} - \bar{x}^{\,2}
  • Grouped data (direct)

    σ=∑fixi2N−(∑fixiN)2\sigma = \sqrt{\dfrac{\sum f_i x_i^2}{N} - \left(\dfrac{\sum f_i x_i}{N}\right)^2}

    N=∑fiN = \sum f_i

  • Step deviation method

    σ=h∑fiui2N−(∑fiuiN)2\sigma = h\sqrt{\dfrac{\sum f_i u_i^2}{N} - \left(\dfrac{\sum f_i u_i}{N}\right)^2}

    ui=xi−Ahu_i = \dfrac{x_i - A}{h}

  • Mean deviation formula

    M.D.(xˉ)=∑∣xi−xˉ∣n\text{M.D.}(\bar{x}) = \dfrac{\sum |x_i-\bar{x}|}{n}
  • Quartile deviation formula

    Q.D.=Q3−Q12\text{Q.D.} = \dfrac{Q_3 - Q_1}{2}
  • Coefficient of variation

    C.V.=σxˉ×100\text{C.V.} = \dfrac{\sigma}{\bar{x}} \times 100
  • Covariance formula

    cov⁡(x,y)=∑(xi−xˉ)(yi−yˉ)n\operatorname{cov}(x,y) = \dfrac{\sum (x_i-\bar{x})(y_i-\bar{y})}{n}

The standard deviation formula, symbol by symbol

Finding the standard deviation using average formulas in maths is a two-step job: first average the values, then average the squared distances from that average. So the variance formula in maths is the core, and the standard deviation math formula is just its square root. Read the formula from the inside out. Each piece has one job.

  • xix_i is one observation, the i-th value in your list.
  • xˉ\bar{x} (read "x bar") is the arithmetic mean of the data. See the mean, median and mode page if you need a refresher on finding it.
  • xi−xˉx_i-\bar{x} is the deviation of that value from the mean. Some deviations are negative, and the deviations always add up to zero, which is why we square them.
  • ∑\sum means add the squared deviations for all values.
  • nn is the number of values. Dividing by nn gives the variance, the average squared deviation.
  • The square root brings the answer back to the same unit as the data. If the data is in kg, the standard deviation is in kg, and the variance is in kg squared.

The Greek letter σ\sigma (sigma) is used for the population standard deviation and σ2\sigma^2 for its variance. Many books use ss for the sample version. A small standard deviation means the values are packed close to the mean. A large one means they are spread out.

Population vs sample: n or n minus 1

School textbooks in India, including NCERT class 11, divide by nn. They treat the data you are given as the whole group. In college statistics, economics and most exam questions that say "sample", you divide by n−1n-1.

CaseVarianceWhen to use
Population∑(xi−xˉ)2n\dfrac{\sum (x_i-\bar{x})^2}{n}You have every member of the group (all 40 students in a class)
Sample∑(xi−xˉ)2n−1\dfrac{\sum (x_i-\bar{x})^2}{n-1}You picked a few members to estimate the spread of a larger group

Why n−1n-1? A sample's own mean sits closer to its values than the true population mean does, so the squared deviations come out a little too small. Dividing by one less than nn corrects this. Statisticians call n−1n-1 the degrees of freedom. For large nn the two answers are almost the same.

Worked example: standard deviation of ungrouped data

Find the variance and standard deviation of 4, 8, 6, 10, 12

Step 1. Mean: xˉ=4+8+6+10+125=405=8\bar{x} = \dfrac{4+8+6+10+12}{5} = \dfrac{40}{5} = 8.

Step 2. Build the working table.

xix_ixi−xˉx_i-\bar{x}(xi−xˉ)2(x_i-\bar{x})^2xi2x_i^2
4−4-41616
80064
6−2-2436
1024100
12416144
Total 40040360

Step 3. Population variance =405=8= \dfrac{40}{5} = 8, so σ=8≈2.83\sigma = \sqrt{8} \approx 2.83.

Step 4. Sample variance =405−1=10= \dfrac{40}{5-1} = 10, so s=10≈3.16s = \sqrt{10} \approx 3.16.

Check with the shortcut: 3605−82=72−64=8\dfrac{360}{5} - 8^2 = 72 - 64 = 8. Same variance.

Answer: variance 8 and SD about 2.83 (population); variance 10 and SD about 3.16 (sample).

The shortcut formula for variance

Expanding the square in the definition gives a version that skips the deviation column:

σ2=∑xi2n−(∑xin)2\sigma^2 = \dfrac{\sum x_i^2}{n} - \left(\dfrac{\sum x_i}{n}\right)^2

In words: the mean of the squares minus the square of the mean. It is faster when the mean is a messy decimal such as 23.47, because you never subtract it from each value. The sample version of the shortcut is s2=∑xi2−nxˉ2n−1s^2 = \dfrac{\sum x_i^2 - n\bar{x}^2}{n-1}.

Watch out: ∑xi2\sum x_i^2 means square each value first and then add. (∑xi)2(\sum x_i)^2 means add first and then square. Mixing these up is the most common slip in board papers.

Grouped data: direct, assumed mean and step deviation methods

For a frequency table, each class is represented by its mid-value xix_i and every term is weighted by its frequency fif_i. There are three routes, and all give the same answer:

  • Direct method: σ2=∑fixi2N−(∑fixiN)2\sigma^2 = \dfrac{\sum f_i x_i^2}{N} - \left(\dfrac{\sum f_i x_i}{N}\right)^2.
  • Assumed mean method: pick a convenient middle value AA, let di=xi−Ad_i = x_i - A, then σ2=∑fidi2N−(∑fidiN)2\sigma^2 = \dfrac{\sum f_i d_i^2}{N} - \left(\dfrac{\sum f_i d_i}{N}\right)^2. Shifting all values by AA does not change the spread.
  • Step deviation method: also divide by the class width hh: ui=xi−Ahu_i = \dfrac{x_i - A}{h}, then σ2=h2[∑fiui2N−(∑fiuiN)2]\sigma^2 = h^2\left[\dfrac{\sum f_i u_i^2}{N} - \left(\dfrac{\sum f_i u_i}{N}\right)^2\right].

The step deviation method formula is the same idea as the one used for the mean in class 10, where xˉ=A+h⋅∑fiuiN\bar{x} = A + h\cdot\dfrac{\sum f_i u_i}{N}. Here you also need the fiui2f_i u_i^2 column, and you multiply by h2h^2 at the end because variance is in squared units.

Standard deviation of a frequency distribution

Marks of 40 students: 0 to 10 (5 students), 10 to 20 (8), 20 to 30 (15), 30 to 40 (10), 40 to 50 (2). Take A=25A = 25 and h=10h = 10.

xix_ifif_iuiu_ifiuif_i u_ifiui2f_i u_i^2
55−2-2−10-1020
158−1-1−8-88
2515000
351011010
452248
Total40−4-446

Mean: xˉ=25+10×−440=25−1=24\bar{x} = 25 + 10 \times \dfrac{-4}{40} = 25 - 1 = 24.

Variance: σ2=102[4640−(−440)2]=100 (1.15−0.01)=114\sigma^2 = 10^2\left[\dfrac{46}{40} - \left(\dfrac{-4}{40}\right)^2\right] = 100\,(1.15 - 0.01) = 114.

By the direct method you would find ∑fixi=960\sum f_i x_i = 960 and ∑fixi2=27600\sum f_i x_i^2 = 27600, so σ2=690−242=114\sigma^2 = 690 - 24^2 = 114. With A=25A = 25 alone, ∑fidi=−40\sum f_i d_i = -40 and ∑fidi2=4600\sum f_i d_i^2 = 4600, giving 115−1=114115 - 1 = 114. All three agree.

Answer: mean 24 marks, variance 114, standard deviation 114≈10.68\sqrt{114} \approx 10.68 marks.

Mean deviation formula

Mean deviation uses absolute values instead of squares. It is the average distance of the values from a central value, usually the mean or the median:

M.D.(a)=∑∣xi−a∣n,M.D.(a)=∑fi∣xi−a∣N for grouped data\text{M.D.}(a) = \dfrac{\sum |x_i - a|}{n}, \qquad \text{M.D.}(a) = \dfrac{\sum f_i |x_i - a|}{N} \text{ for grouped data}

For the data 4, 8, 6, 10, 12 with mean 8, the absolute deviations are 4, 0, 2, 2, 4. Their total is 12, so M.D. about the mean =125=2.4= \dfrac{12}{5} = 2.4. The median here is also 8, so the mean deviation about the median is the same. Notice that 2.4 is smaller than the SD of 2.83. Mean deviation is never larger than the population standard deviation.

Quartile deviation and coefficient of variation

Quartile deviation (also called the semi-interquartile range) looks only at the middle half of the data, so a few extreme values do not disturb it. For n sorted values, take Q1Q_1 as the n+14\tfrac{n+1}{4}-th value and Q3Q_3 as the 3(n+1)4\tfrac{3(n+1)}{4}-th value.

Quartile deviation of eleven values

Data: 3, 5, 7, 8, 10, 12, 13, 15, 18, 20, 22. Here n=11n = 11, so Q1Q_1 is the 3rd value, 7, and Q3Q_3 is the 9th value, 18.

Q.D.=18−72=5.5\text{Q.D.} = \dfrac{18-7}{2} = 5.5 and the coefficient of quartile deviation =18−718+7=0.44= \dfrac{18-7}{18+7} = 0.44.

Answer: Q.D. is 5.5.

Coefficient of variation compares spread across data sets with different means or units. A lower C.V. means more consistent data.

Which batter is more consistent

Batter P: mean score 50, SD 15. Batter Q: mean score 40, SD 8.

C.V. of P =1550×100=30%= \dfrac{15}{50}\times 100 = 30\%. C.V. of Q =840×100=20%= \dfrac{8}{40}\times 100 = 20\%.

Answer: Q is more consistent, even though P scores more on average.

Covariance in brief

Variance measures how one variable spreads. Covariance measures how two variables move together. A positive value means that when x is above its mean, y also tends to be above its mean.

cov⁡(x,y)=∑(xi−xˉ)(yi−yˉ)n=∑xiyin−xˉ yˉ\operatorname{cov}(x,y) = \dfrac{\sum (x_i-\bar{x})(y_i-\bar{y})}{n} = \dfrac{\sum x_i y_i}{n} - \bar{x}\,\bar{y}

Example: x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5. Here xˉ=3\bar{x} = 3, yˉ=4\bar{y} = 4 and ∑xiyi=66\sum x_i y_i = 66, so cov⁡=665−12=1.2\operatorname{cov} = \dfrac{66}{5} - 12 = 1.2. Divide by n−1n-1 for sample covariance, which gives 1.5. Dividing covariance by σxσy\sigma_x \sigma_y gives the correlation coefficient, which you meet in statistics for economics.

Common mistakes and exam tips

  • Forgetting the square root. Variance and SD are different answers; read which one the question wants.
  • Using class limits instead of mid-values in grouped data. Always use xi=lower+upper2x_i = \tfrac{\text{lower}+\text{upper}}{2}.
  • Dividing by the number of classes instead of N=∑fiN = \sum f_i.
  • In the step deviation method, forgetting to multiply the bracket by h2h^2 (or the root by hh).
  • Rounding the mean early. Keep fractions until the last step, or use the shortcut form.
  • Using n−1n-1 in a class 11 board answer where NCERT expects nn, or the reverse in a college sample question.

A useful property for MCQs: adding a constant to every value leaves the SD unchanged, while multiplying every value by k multiplies the SD by ∣k∣|k| and the variance by k2k^2. For other topics in the same revision session, the all maths formulas page lists the key results chapter by chapter, and the percentage formula page helps when the C.V. needs to be written as a percent.

Download the PDF

Questions students ask

What is the formula of standard deviation?

For n values with mean xˉ\bar{x}, σ=∑(xi−xˉ)2n\sigma = \sqrt{\tfrac{\sum (x_i-\bar{x})^2}{n}}. For a sample, replace n with n−1n-1. For grouped data, weight each squared deviation by its frequency and divide by N=∑fiN = \sum f_i.

What is the difference between variance and standard deviation?

Variance is the mean of the squared deviations; standard deviation is its square root. SD has the same unit as the data, so it is easier to interpret. If the variance is 25, the SD is 5.

Which class teaches the standard deviation formula?

NCERT introduces mean deviation, variance and standard deviation in class 11 in the Statistics chapter. Class 10 works only with averages of frequency tables, and the step deviation method first appears there for the mean.

Can standard deviation be negative or zero?

It cannot be negative, because it is a square root of a sum of squares. It is zero only when every value is the same, for example 7, 7, 7, 7.

When should I use the step deviation method?

Use it for grouped data with equal class widths and large mid-values. Dividing xi−Ax_i - A by h turns the numbers into small integers like −2,−1,0,1,2-2, -1, 0, 1, 2, which keeps the arithmetic short and the mistakes few.

Is mean deviation the same as standard deviation?

No. Mean deviation averages the absolute deviations, while SD squares them, averages and takes a root. For 4, 8, 6, 10, 12 the mean deviation is 2.4 and the SD is about 2.83.