Sum of Squares Calculator
The total, within and residual sums of squares — the quantity every variance, regression and ANOVA is built on.
The sum of squares is Σ(xᵢ − x̄)², the total squared distance of the data from its mean.
How the sum of squares calculator works
The sum of squares is Σ(xᵢ − x̄)², the total squared distance of the data from its mean. Divide by n − 1 and you have the variance; take the root and you have the standard deviation.
It matters because it *decomposes*: the total sum of squares splits exactly into the part a model explains and the part it does not, which is what makes R², ANOVA and the whole of regression possible.
Formula: SS = Σ(xᵢ − x̄)² = Σxᵢ² − (Σxᵢ)²/n
Worked examples
| Inputs | Sum of squares about the mean | Note |
|---|---|---|
| 4, 8, 15, 16, 23, 42 | 910 | SS = 910.83 |
| Identical values | 0 | SS = 0 |
| 1, 2, 3 | 2 | SS = 2 |
FAQFrequently asked questions
What is the sum of squares?
The total squared distance of the data from its mean — the raw material of every variance calculation.
Why square the deviations?
Because they sum to exactly zero otherwise. Squaring removes the sign and gives an algebra that decomposes cleanly.
What is the computational formula?
Σx² − (Σx)²/n. It avoids computing the mean first, though it loses precision on large numbers — which is why software rarely uses it now.
How does it relate to variance?
Variance is SS ÷ (n − 1) for a sample, or SS ÷ n for a population.
Why does it matter for regression?
Because total SS splits exactly into explained plus residual. R² is the explained share, and that decomposition is the whole of ANOVA.
Where these figures come from
- NIST Digital Library of Mathematical Functions — reference definitions for elementary and special functions
- Wolfram MathWorld — definitions and formulas for every topic on this page
- NIST/SEMATECH e-Handbook of Statistical Methods — the statistical formulas (mean, variance, z, confidence intervals, sample size)
- National curriculum in England — Mathematics — the terms and methods taught in UK schools
Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.