# Sum of squares

In mathematics, the sum of squares is a quantity that measures the variation or dispersion of a set of values. It is often used in statistics to describe the spread of a data set around its mean.

To calculate the sum of squares, we first need to find the mean (average) of a set of values. Then, we subtract the mean from each value, square the difference, and add up the resulting values. This gives us the sum of squares.

The formula for sum of squares can be written as:

SS = Σ(xi – x̄)²

where:

• SS is the sum of squares
• xi is the ith value in the data set
• x̄ is the mean of the data set
• Σ represents the sum of the values

For example, let’s say we have the following data set of five values:

{2, 4, 6, 8, 10}

The mean of this data set is (2+4+6+8+10)/5 = 6. We can then calculate the sum of squares as follows:

SS = (2-6)² + (4-6)² + (6-6)² + (8-6)² + (10-6)² = 16 + 4 + 0 + 4 + 16 = 40

So the sum of squares for this data set is 40.

The sum of squares is used in various statistical calculations, such as calculating variance and standard deviation, and in regression analysis to measure the goodness of fit of a regression model.