Sum of Squares: Formula, Examples, and Calculator
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
The sum of squares calculator adds the squares of a set of numbers and returns their total. Enter the values you want to analyze as a comma-separated list; the result is a single nonnegative number, useful in algebra, statistics, and data analysis.
Formula
For values x1, x2, …, xn, the sum of squares is:
SS = x12 + x22 + … + xn2 = Σxi2
Here, xi is each input value, in its original unit, and n is the number of values. The calculator’s first output, SS, is the sum of the squared values; its second output, n, reports how many values were entered. Squaring doubles the unit’s exponent: if inputs are measured in centimeters, the sum is in square centimeters; if the inputs are unitless, the result is unitless.
Worked Example
Using the calculator’s default values, 1, 2, 3, and 4:
- Square each value: 1² = 1, 2² = 4, 3² = 9, and 4² = 16.
- Add the squares: 1 + 4 + 9 + 16 = 30.
- Count the inputs: there are 4 values.
The sum of squares is 30, and the count is 4. These match the calculator’s outputs, with the sum displayed to zero decimal places.
What the Sum of Squares Measures
The sum of squares describes the total squared magnitude of a list of values. Because each value is squared before addition, positive and negative values both contribute a nonnegative amount. For example, the values −3 and 3 have the same squared contribution: 9. This property makes the sum useful when direction or sign should not cancel out.
However, it is not the same as the sum of the original values, the average, or the variance. For −3 and 3, the ordinary sum is 0, while the sum of squares is 18. A large input can also have a disproportionate effect: 10 contributes 100, which is more than the squared contributions of 1, 2, 3, and 4 combined.
Where It Is Used
In statistics, sums of squares help describe variation and appear in calculations of variance, standard deviation, and regression. A common related quantity is the sum of squared deviations from the mean:
SSdeviations = Σ(xi − x̄)²
This is different from the raw sum of squares, Σxi², because each value is first centered by subtracting the mean, x̄. The distinction matters: statistical formulas often use squared deviations, but a request simply asking for the sum of squares usually means square the values as entered.
In algebra, the expression Σxi² is a compact way to write repeated squaring and addition. In geometry and physics, sums of squared components can also appear when measuring squared lengths or energy-like quantities. The interpretation depends on what the values represent; the arithmetic operation alone does not establish a physical meaning.
How to Enter Values and Read the Result
Type a comma-separated list of numbers, such as −2, 0, 5. The calculator squares each entry individually, adds those squares, and displays the total. Negative numbers and zero are valid: a negative number becomes positive when squared, and zero adds nothing.
- Include each observation once unless the data genuinely contain repeated observations.
- Use consistent units for measurements. Adding squared values in different units, such as centimeters and inches, is not meaningful until the units are converted.
- Keep enough precision in the inputs. Rounding values before squaring can change the total, especially for many observations.
- Check that the list contains the intended values and that separators are unambiguous.
The total cannot be negative for real-number inputs, since every square is zero or positive. If a displayed result is unexpectedly large, check for an extra digit or a value entered in a larger unit; squaring magnifies large inputs.
Common Confusions and Limits
A frequent mistake is to add the values first and then square the result. In general, that gives a different answer: for 1 and 2, the sum of squares is 1² + 2² = 5, whereas squaring their sum gives (1 + 2)² = 9. The two operations are not interchangeable.
Another misconception is that the raw sum of squares alone measures spread. It also depends on the scale and location of the values. For example, adding the same constant to every observation can change Σxi² even if the spacing between observations stays the same. To measure spread around a center, use squared deviations from the mean or a suitable variance calculation instead.
The basic formula applies to a finite list of real numbers. It does not choose which values belong in a data set, correct measurement errors, convert units, or decide whether a statistical sample or population formula is appropriate. Those choices depend on the data and the question being studied.
Frequently Asked Questions
How do you calculate the sum of squares?
Square every value in the list, then add the squared results. In symbols, SS = Σxi².
Can the sum of squares be negative?
No, not for real-number inputs. Each real number squared is nonnegative, so their total is also nonnegative.
Is sum of squares the same as variance?
No. Variance is based on squared deviations from the mean and includes a divisor that depends on whether the data are treated as a population or a sample. The raw sum of squares simply adds the squared values.
What is the sum of squares of 1, 2, 3, and 4?
It is 1² + 2² + 3² + 4² = 1 + 4 + 9 + 16 = 30.
Do negative numbers count as negative in the total?
No. Each negative input is squared first, so its contribution is positive. For instance, (−5)² = 25.
Related
Formula used
list values | Values to square | 1, 2, 3, 4 out ss | Sum of squares | - | sum(values ^ 2) | 0 out n | Number of values | - | count(values) | 0
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.