Every variance, standard deviation, ANOVA table and regression diagnostic is built from one quantity: the sum of squared deviations from the mean. This sum of squares calculator computes it from your data with both standard formulas — the definitional Σ(x − x̄)² and the computational shortcut Σx² − (Σx)²/n — and shows them agreeing, because the shortcut is where hand calculations quietly go wrong.
Two Formulas, One Quantity
The definitional formula says what the sum of squares is: Σ(x − x̄)², each value's deviation from the mean, squared and summed. The computational formula says how to get it without first finding every deviation: Σx² − (Σx)²/n. The default data — the most famous eight numbers in statistics teaching, 2, 4, 4, 4, 5, 5, 7, 9 — runs both: mean 5, deviations −3, −1, −1, −1, 0, 0, 2, 4, squares 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32; computationally, Σx² = 232 and (Σx)²/n = 1600/8 = 200, and 232 − 200 = 32. Agreement is guaranteed algebraically; showing both is the audit trail.
Why Square the Deviations?
Raw deviations always sum to zero — the mean is defined as the point where they cancel — so a spread measure must destroy the signs first. Absolute values would work (and give the mean absolute deviation), but squares won history for three reasons: they penalise large deviations disproportionately, which matches how errors hurt; they are smooth and differentiable, which makes the mathematics of optimisation (least squares!) tractable; and squared quantities decompose beautifully — total SS splits exactly into explained plus residual in regression and into between plus within in ANOVA. The sum of squares is less a formula than the load-bearing wall of applied statistics.
From SS to Variance and Standard Deviation
The sum of squares becomes a variance by division — and the divisor is the famous fork. Divide by n and you have the population variance σ² (32 ÷ 8 = 4 for the example, σ = 2). Divide by n − 1 and you have the sample variance s² (32 ÷ 7 ≈ 4.571, s ≈ 2.138), Bessel-corrected because a sample's deviations around its own mean understate the spread around the true mean. The calculator reports both divisions so the SS can feed whichever you need; the choice between them belongs to whether your data is the whole population or a sample of something larger.
SS in ANOVA and Regression Clothing
Once you leave one-sample territory, the same quantity gets prefixed: SS_total (deviations from the grand mean), SS_between or SS_explained (group means or model predictions vs the grand mean), SS_within or SS_residual (data vs group means or predictions). The partition identity SS_total = SS_explained + SS_residual is exact, and the F-tests and R² values of those fields are ratios of these sums — R² is literally SS_explained ÷ SS_total. A student who truly owns the single-group computation on this page owns the numerator of half the statistics they will ever meet.
Numerical Honesty: When the Shortcut Bites
The computational formula is algebraically identical and numerically treacherous: with large values and small spread (timestamps, measurements near 10,000 with deviations of 0.1), Σx² and (Σx)²/n are enormous and nearly equal, and floating-point subtraction can annihilate the true SS entirely — the phenomenon behind the definitional formula's survival in serious software, which computes deviations in two passes. This calculator computes the definitional form as primary and shows the shortcut beside it; feed it data clustered around a large offset and watch the shortcut's decimals wobble first. Knowing why is the difference between using a formula and understanding it.
Common Mistakes
Squaring the sum instead of summing the squares (256 ≠ 232 for the example — order is the whole definition). Using the computational formula's (Σx)²/n term with Σx² confused. Dividing by n − 1 inside the SS itself — the correction belongs to the variance step, not the SS. And reporting SS with units forgotten: it is measured in squared units of the data (square dollars, square centimetres), one more reason the field usually divides it down to variance or roots it to standard deviation before interpreting. Finally, never compare raw sums of squares across data sets of different sizes — the SS grows with n even when spread does not; the comparison belongs to the variances built from it.
Related Tools
The spread family continues in the Statistics Calculators hub — the Median Absolute Deviation Calculator offers the robust alternative to squared spread, and the Decile Calculator summarises the same data by ranks.
Frequently Asked Questions
How do you calculate the sum of squares?
Subtract the mean from every value, square each deviation, and add them: Σ(x − x̄)². For 2, 4, 4, 4, 5, 5, 7, 9 (mean 5), the squared deviations 9, 1, 1, 1, 0, 0, 4, 16 sum to 32.
What is the computational formula for sum of squares?
SS = Σx² − (Σx)²/n — the sum of squared values minus the squared sum divided by the count. For the classic example: 232 − 200 = 32, identical to the definitional result.
Is sum of squares the same as variance?
No — variance is the sum of squares divided: by n for a population, by n − 1 for a sample. SS = 32 becomes population variance 4 or sample variance about 4.571, depending on the divisor.
Why square the deviations instead of using absolute values?
Squares penalise large deviations more, are mathematically smooth for optimisation (least squares), and decompose exactly in ANOVA and regression. Absolute deviations give a different, also valid statistic: the mean absolute deviation.
What units is the sum of squares in?
Squared units of the original data — square seconds, square dollars. That awkwardness is why results are usually converted to variance (still squared) or standard deviation (original units) before interpretation.
Why do two formulas exist?
The definitional formula explains the concept; the computational formula once saved labour on hand calculators. Modern software prefers the definitional (two-pass) method for numerical stability with large-offset data.