How to Calculate the Sum of Squares?

••• arthobbit/iStock/GettyImages

The sum of squares is a tool statisticians and scientists use to evaluate the overall variance of a data set from its mean. A large sum of squares denotes a large variance, which means that individual readings fluctuate widely from the mean.

This information is useful in many situations. For example, a large variance in blood pressure readings over a specific period of time could point to an instability in the cardiovascular system that needs medical attention. For financial advisors, a large variance in daily stock values signifies market instability and higher risks for investors. When you take the square root of the sum of squares, you get the standard deviation, an even more useful number.

Finding the Sum of Squares

  1. Count the Number of Measurements

  2. The number of measurements is the sample size. Denote it by the letter "​n​."

  3. Calculate the Mean

  4. The mean is the arithmetic average of all the measurements. To find it, you add all the measurements and divide by the sample size, ​n​.

  5. Subtract Each Measurement From the Mean

  6. Numbers larger than the mean produce a negative number, but this doesn't matter. This step produces a series of n individual deviations from the mean.

  7. Square the Difference of Each Measurement From the Mean

  8. When you square a number, the result is always positive. You now have a series of n positive numbers.

  9. Add the Squares and Divide by (n - 1)

  10. This final step produces the sum of squares. You now have a standard variance for your sample size.

Standard Deviation

Statisticians and scientists usually add one more step to produce a number that has the same units as each of the measurements. The step is to take the square root of the sum of squares. This number is the standard deviation, and it denotes the average amount each measurement deviated from the mean. Numbers outside the standard deviation are either unusually high or unusually low.


Suppose you measure the outside temperature every morning for a week to get an idea of how much the temperature fluctuates in your area. You get a series of temperatures in degrees Fahrenheit that looks like this:

Mon: 55, Tues: 62, Wed: 45, Thurs: 32, Fri: 50, Sat: 57, Sun: 54

To calculate the mean temperature, add the measurements and divide by the number you recorded, which is 7. You find the mean to be 50.7 degrees.

Now calculate the individual deviations from the mean. This series is:

50.7 - 55 = -4.3 \\ 50.7 -62 = −11.3 \\ 50.7 -45 = 5.7 \\ 50.7 - 32 = 18.7 \\ 50.7 -50 = 0.7 \\ 50.7 - 57 = −6.3 \\ 50.7 - 54 = −2.3

Square each number:

-4.3^2 = 18.49 \\ −11.3^2 = 127.69 \\ 5.7^2 = 32.49\\ 18.7^2 = 349.69 \\ 0.7^2 = 0.49\\ −6.3^2 = 39.69 \\ −2.3^2 = 5.29

Add the numbers and divide by (​n​ − 1) = 6 to get 95.64. This is the sum of squares for this series of measurements. The standard deviation is the square root of this number, or 9.78 degrees Fahrenheit.

It's a fairly large number, which tells you that temperatures varied quite a bit over the week. It also tells you that Tuesday was unusually warm while Thursday was unusually cold. You could probably feel that, but now you have statistical proof.


About the Author

Chris Deziel holds a Bachelor's degree in physics and a Master's degree in Humanities, He has taught science, math and English at the university level, both in his native Canada and in Japan. He began writing online in 2010, offering information in scientific, cultural and practical topics. His writing covers science, math and home improvement and design, as well as religion and the oriental healing arts.