Statistics Calculator - Step-by-Step Solutions

Enter the numbers separated by commas, spaces or new lines. You can also paste a column or a row from a spreadsheet.


Count ($n$):
Mode:
Median:
Mean (Average):
Geometric Mean:
Standard Deviation, sample ($s$):
Standard Deviation, population ($\sigma$):
Variance, sample ($s^2$):
Variance, population ($\sigma^2$):
Sum:
Largest:
Smallest:
Range:
First quartile ($Q_1$):
Third quartile ($Q_3$):
Interquartile range (IQR):
Outliers:
Sorted data:

Use $s$ and $s^2$ when your numbers are a sample from a larger group: the sum of the squared deviations from the mean is divided by $n-1$. Use $\sigma$ and $\sigma^2$ when your numbers are the whole population: the sum is divided by $n$.

$Q_1$ and $Q_3$ are the medians of the lower and the upper half of the sorted numbers; when $n$ is odd, the median itself is left out of both halves. This is how TI calculators and many textbooks find the quartiles; Excel's QUARTILE.INC and some other methods can give slightly different values. Outliers are the numbers below $Q_1 - 1.5 \cdot \text{IQR}$ or above $Q_3 + 1.5 \cdot \text{IQR}$.

Formulas

Given a set of $n$ numbers $\{x_1, x_2, \ldots, x_n\}$:

Mean

The mean (average) is the sum of the numbers divided by how many numbers there are:

$\bar{x} = \dfrac{x_1 + x_2 + \ldots + x_n}{n} = \dfrac{1}{n}\sum_{i=1}^{n} x_i$

Median

Sort the numbers from smallest to largest. If $n$ is odd, the median is the number in the middle. If $n$ is even, the median is the mean of the two numbers in the middle. For example, the median of $1, 3, 3, 6, 7, 8, 9$ is $6$, and the median of $1, 2, 3, 4, 5, 6, 8, 9$ is $\dfrac{4 + 5}{2} = 4.5$.

The median of 1, 3, 3, 6, 7, 8, 9 is 6, and the median of 1, 2, 3, 4, 5, 6, 8, 9 is (4 + 5) ÷ 2 = 4.5.

Mode

The mode is the value that appears most often. A set can have several modes, like $1, 1, 2, 2, 3$ with the modes $1$ and $2$, and when no value repeats, there is no mode.

Variance

The variance measures how far the numbers are spread around their mean: it is the average of the squared deviations $(x_i - \bar{x})^2$. For a sample taken from a larger group, divide by $n - 1$; for the whole population, divide by $n$:

$s^2 = \dfrac{\sum_{i=1}^{n} (x_i - \bar{x})^2}{n - 1} \qquad \sigma^2 = \dfrac{\sum_{i=1}^{n} (x_i - \bar{x})^2}{n}$

Standard deviation

The standard deviation is the square root of the variance, so it is measured in the same units as the numbers:

$s = \sqrt{s^2} = \sqrt{\dfrac{\sum_{i=1}^{n} (x_i - \bar{x})^2}{n - 1}} \qquad \sigma = \sqrt{\sigma^2} = \sqrt{\dfrac{\sum_{i=1}^{n} (x_i - \bar{x})^2}{n}}$

Quartiles and outliers

The first quartile $Q_1$ is the median of the lower half of the sorted numbers, and the third quartile $Q_3$ is the median of the upper half; when $n$ is odd, the median is left out of both halves. The interquartile range is $\text{IQR} = Q_3 - Q_1$. A number below $Q_1 - 1.5 \cdot \text{IQR}$ or above $Q_3 + 1.5 \cdot \text{IQR}$ is called an outlier.

Example

Let $X = \{1, -2, 3, 0, 2, 3, 1, -1, 3, 5\}$.

There are $n = 10$ numbers and their sum is $\sum x_i = 15$, so the mean is $\bar{x} = \dfrac{15}{10} = \dfrac{3}{2} = 1.5$.

Sorted: $-2, -1, 0, 1, 1, 2, 3, 3, 3, 5$. Since $n$ is even, the median is $\dfrac{1 + 2}{2} = 1.5$. The mode is $3$ (it appears 3 times), and the range is $5 - (-2) = 7$.

The deviations from the mean and their squares:
$x_i - \bar{x} = -\frac{1}{2}, -\frac{7}{2}, \frac{3}{2}, -\frac{3}{2}, \frac{1}{2}, \frac{3}{2}, -\frac{1}{2}, -\frac{5}{2}, \frac{3}{2}, \frac{7}{2}$

$(x_i - \bar{x})^2 = \frac{1}{4}, \frac{49}{4}, \frac{9}{4}, \frac{9}{4}, \frac{1}{4}, \frac{9}{4}, \frac{1}{4}, \frac{25}{4}, \frac{9}{4}, \frac{49}{4}$

$\sum_{i=1}^{10} (x_i - \bar{x})^2 = \dfrac{81}{2}$

The sample variance and standard deviation (divide by $n - 1 = 9$):
$s^2 = \dfrac{81}{2 \cdot 9} = \dfrac{81}{18} = \dfrac{9}{2} = 4.5 \qquad s = \sqrt{\dfrac{9}{2}} = \dfrac{3}{2}\sqrt{2} \approx 2.1213$

The population variance and standard deviation (divide by $n = 10$):
$\sigma^2 = \dfrac{81}{2 \cdot 10} = \dfrac{81}{20} = 4.05 \qquad \sigma = \sqrt{\dfrac{81}{20}} = \dfrac{9}{10}\sqrt{5} \approx 2.0125$

Quartiles: the lower half is $-2, -1, 0, 1, 1$, so $Q_1 = 0$; the upper half is $2, 3, 3, 3, 5$, so $Q_3 = 3$ and $\text{IQR} = 3$. The fences are $0 - 1.5 \cdot 3 = -4.5$ and $3 + 1.5 \cdot 3 = 7.5$, and all the numbers lie between them, so there are no outliers.

Which average should I use?

The mean uses every number, so it is the best summary when the numbers are spread evenly. One very large or very small number pulls it away from the rest, though. The median depends only on the middle of the sorted numbers, so a few extreme values hardly move it. The mode is the only average that also works for data that are not numbers at all, such as the most popular color.

For example, nine people in a small company earn, in thousands a month, $2, 2, 2, 2.5, 3, 3.5, 4, 4.5$ and $20$. The mean is $\dfrac{43.5}{9} \approx 4.83$, more than eight of the nine people earn. The median, $3$, describes a typical salary much better, and the mode, $2$, is the most common salary. When data are as lopsided as this, give the median.

Why divide by $n - 1$?

When the numbers are a sample, their mean $\bar{x}$ is calculated from the same sample, and the numbers of a sample are on average closer to $\bar{x}$ than to the true mean of the whole population. So $\sum (x_i - \bar{x})^2$ comes out a little too small, and dividing it by $n - 1$ instead of $n$ makes up for that: on average, $s^2$ then equals the variance of the population. This is called Bessel's correction.

Another way to see it: the deviations $x_i - \bar{x}$ always add up to $0$, so once $n - 1$ of them are known, the last one is fixed. Only $n - 1$ deviations are free, and we say that the sample has $n - 1$ degrees of freedom. For a whole population there is nothing to estimate, so you divide by $n$.

Practice problems

  1. Find the mean, the median and the mode of $3, 7, 7, 2, 9, 7, 4$.
    Solution Sorted: $2, 3, 4, 7, 7, 7, 9$. The mean is $\dfrac{39}{7} \approx 5.57$, the median is the 4th number, $7$, and the mode is $7$ (it appears 3 times).
  2. The mean of five numbers is $12$. Four of them are $10$, $15$, $8$ and $14$. Find the fifth number.
    Solution The five numbers add up to $5 \cdot 12 = 60$ and the four known ones to $10 + 15 + 8 + 14 = 47$, so the fifth number is $60 - 47 = 13$.
  3. Find the sample and the population standard deviation of $4, 8, 6, 2$.
    Solution $\bar{x} = \dfrac{20}{4} = 5$. The deviations are $-1, 3, 1, -3$, and their squares add up to $1 + 9 + 1 + 9 = 20$. So $s = \sqrt{\dfrac{20}{3}} \approx 2.58$ and $\sigma = \sqrt{\dfrac{20}{4}} = \sqrt{5} \approx 2.24$.
  4. Find the quartiles and the interquartile range of $1, 3, 4, 6, 7, 8, 10, 12, 15$. Are there any outliers?
    Solution $n = 9$ is odd, so leave out the median, $7$. The lower half $1, 3, 4, 6$ gives $Q_1 = \dfrac{3 + 4}{2} = 3.5$ and the upper half $8, 10, 12, 15$ gives $Q_3 = \dfrac{10 + 12}{2} = 11$, so $\text{IQR} = 7.5$. The fences are $3.5 - 1.5 \cdot 7.5 = -7.75$ and $11 + 1.5 \cdot 7.5 = 22.25$; no number is outside them, so there are no outliers.
  5. Five students needed $12$, $14$, $13$, $15$ and $61$ minutes to finish a test. Which describes a typical time better, the mean or the median?
    Solution The mean is $\dfrac{115}{5} = 23$ minutes, longer than four of the five times, because of the one slow student. The median, $14$ minutes, describes a typical time better.

Check your answers with the calculator at the top of the page.

Feedback   Contact email:
Follow us on   Twitter   Facebook
  Math10 Banners   Math History  
Copyright © 2005 - 2026