Both quantities the phrase names, and the condition the textbook identity leaves out.
Which sum of squares do you mean?
The two sums differ by a factor of 5.1 — because the data is far from zero.
n = 6, mean = 13.833333
Σ(x − x̄)² = 278.833333
The raw Σx² is 1,427.000000. Both are called the sum of squares; they differ by n·x̄² = 1,148.166667.
Σ(x − x̄)²
278.833333
corrected — what variance uses
Σx²
1,427.000000
raw — the literal reading
n · x̄²
1,148.166667
the gap between them
Ratio
5.1178×
raw over corrected
Sample variance
55.766667
corrected ÷ 5
Population variance
46.472222
corrected ÷ 6
Sample std deviation
7.467708
Mean
13.833333
Both of these are called “the sum of squares”, and here they differ by a factor of 5.118. Σx² is the literal reading: square each value, add them up. Σ(x − x̄)² subtracts the mean first, and it is the one meant whenever the context is variance, regression or analysis of variance. The difference is exactly n·x̄² — large whenever the data sits far from zero, which is most data. A calculator that answers one of these without saying which is a calculator that is confidently wrong half the time.
The computational shortcut is Σx² − n·x̄², and it is a numerical trap. Algebraically exact, and on data far from zero it subtracts two nearly equal large numbers: here 1,427.000 minus 1,148.167. Every digit they share is a digit of precision lost. This tool computes Σ(x − x̄)² directly from the deviations instead, which costs one extra pass and never cancels — the same reason the variance calculator does.
What this tool shows
The phrase names two different numbers. Σx² and Σ(x − x̄)² differ by exactly n·x̄² — on the test-scores preset, 66,310 against 700. And SST = SSR + SSE is not a general fact: remove the intercept and it fails by 36.89 on data where every term still looks reasonable.
Σx² and Σ(x − x̄)² together, with n·x̄² as the gap between them
Sample and population variance from the corrected sum
SST, SSR and SSE for a straight-line fit
SST − SSR − SSE printed rather than assumed to be zero
A with-intercept and through-the-origin toggle, so the identity can be watched failing
R² as 1 − SSE/SST, including when it goes below zero
Both meanings The identity, tested No cancellation Variance from it
66,310 against 700 — both correctly called the sum of squares.
Updated 12 September 2026 · Works in any browser, no installation
“Sum of squares” means Σx² in some contexts and Σ(x − x̄)² in others, and in regression it means the three-way split of the second into explained and unexplained parts. This tool computes all of them, because picking one silently is how a calculator returns a number that is right for a question you did not ask.
At a glance
Formula shown
For one column: the raw sum is Σx², the corrected sum is Σ(x − x̄)², and raw − corrected = n·x̄² exactly. Sample variance is the corrected sum over n − 1. For a regression: SST = Σ(y − ȳ)², SSR = Σ(ŷ − ȳ)², SSE = Σ(y − ŷ)². SST = SSR + SSE holds because the intercept’s normal equation forces Σ(y − ŷ) = 0, which makes the cross-product 2Σ(ŷ − ȳ)(y − ŷ) vanish. Without an intercept, it does not.
Scenario support
Working out variance or standard deviation by hand, filling in an ANOVA table, reporting the explained and residual parts of a regression, checking a statistics exercise, or understanding why software reports a different R² for a model fitted through the origin.
Educational estimate
Planning support from the values you enter — not professional advice.
Two quantities, one name
Search for a sum of squares calculator and you will find tools that answer Σx² and tools that answer Σ(x − x̄)², mostly without saying which.
Σx² is the literal reading. Square each value, add them up. It is what the phrase means in a sum-of-squares identity from algebra, in a least-squares normal equation, and in the denominator of a correlation formula written out longhand.
Σ(x − x̄)² is the statistical one. Subtract the mean first. This is the quantity meant whenever the context is variance, standard deviation, regression or analysis of variance — and it is what an ANOVA table’s “SS” column holds. Its other names are the corrected sum of squares and the total sum of squares.
They differ by exactly n·x̄², which is called the correction for the mean. On data centred at zero the two coincide exactly — the second preset has a mean of precisely zero, and both sums come to 228.
On data far from zero they are not close. Ten test scores in the sixties to nineties give a raw sum of 66,310 and a corrected sum of 700: a factor of 94.7. If a tool hands you one of those and you needed the other, nothing about the number will look wrong.
So this tool prints both, always, with the gap between them. The disambiguation is the useful part, and it costs nothing.
SST = SSR + SSE needs an intercept
The decomposition appears in every regression chapter as though it were arithmetic. It is a consequence, and it has a condition.
The algebra leaves a cross-product. Writing y − ȳ as (ŷ − ȳ) + (y − ŷ) and squaring gives SSR + SSE plus 2Σ(ŷ − ȳ)(y − ŷ). The identity holds only if that last term is zero.
It is zero because of the intercept. Least squares with an intercept produces a normal equation that says exactly Σ(y − ŷ) = 0 — the residuals sum to zero — and a second saying the residuals are uncorrelated with x. Together those kill the cross-product.
Force the line through the origin and both equations are gone. On the first preset the residuals then sum to 1.835 rather than zero, and SSR + SSE comes to 202.75 against an SST of 165.86 — out by 36.89. Every individual term is still computable and still looks plausible.
The same happens with weighted least squares and with some robust fits, for the same reason: whatever removes the plain intercept condition removes the identity with it.
Even when the origin is the right constraint, the identity still fails. The third preset is data that genuinely passes through zero, and fitting it without an intercept is entirely reasonable — the gap is 0.65 rather than 36.89, but it is not zero. A small failure is still a failure, and it is the reason software switches to a different R² definition for these models rather than reporting the usual one.
R² below zero, and the other R² software quietly substitutes
Once the identity is gone, the two usual formulas for R² stop agreeing, and one of them stops being bounded.
1 − SSE/SST has no lower bound. It compares your model against the flat line at ȳ. A model forced through an origin the data is nowhere near can leave far more error than that flat line would, and the ratio goes past 1.
The second preset makes it vivid. Five points between 105 and 125, forced through the origin: R² comes out at −36.80. With an intercept the same data scores 0.992149. The fit is not slightly worse; it is worse than knowing nothing but the mean.
SSR/SST is the other formula, and it is not the same number here. While the identity holds the two are identical. Without it they diverge, and SSR/SST can exceed 1 — on that same preset SSR is 12,066 against an SST of 242.
Which is why statistical software silently changes the definition. For a no-intercept model, R, SAS and Excel all report an uncentred R², computed as 1 − SSE/Σy² rather than 1 − SSE/SST. That measures against zero rather than against the mean, it is nearly always flattering, and it is not comparable with an ordinary R² from a model that has an intercept.
The practical rule is short. Do not compare an R² across models with and without an intercept, and be suspicious of a no-intercept R² above 0.99 — on data far from zero that is frequently what the uncentred formula returns for a poor fit. The R² calculator covers the other ways the statistic goes negative.
The computational formula is a numerical trap
Textbooks give Σ(x − x̄)² = Σx² − n·x̄² as a shortcut, and it is exactly correct in real arithmetic. In floating point it is a way to lose most of your precision.
It subtracts two nearly equal large numbers. On the test-scores preset it is 66,310 minus 65,610 to get 700. Every leading digit the two share is a digit of the answer that cancels away, and the relative error in the result is amplified by roughly the ratio of the operands to the difference — a factor of 94.7 here.
On realistic data it can leave nothing. Measurements around 100,000 with a spread of 0.1 give operands agreeing to ten significant figures; a double carries about sixteen, so the answer arrives with six. A variance computed that way can come out negative, which is the classic symptom.
This tool computes the deviations directly. One pass for the mean, a second for the squared deviations. It costs an extra traversal and it never cancels, which is the same choice the variance calculator makes.
Welford’s method is the single-pass alternative, updating the mean and the corrected sum together as values arrive. It is as stable as the two-pass version and is what you want when the data cannot be held in memory or arrives as a stream.
The shortcut is not wrong to teach. It makes the relationship between the two sums visible, which is genuinely useful — it is the same n·x̄² this page opens with. It is wrong to implement, and the distinction between an identity and an algorithm is worth keeping.
The same split, one level up
An ANOVA table is the identical decomposition applied to groups rather than to a fitted line, which is why the arithmetic looks familiar.
Total splits into between and within. SStotal= Σ(y − ȳ)² over every observation; SSbetween= Σnᵢ(ȳᵢ − ȳ)² over the group means; SSwithin is what is left. Between plays the role of SSR and within the role of SSE.
And it holds for the same reason. Each group mean is the least-squares fit within that group, so the deviations from it sum to zero and the cross-product vanishes — the group means are playing the part the intercept played.
Dividing by degrees of freedom turns sums into mean squares, and their ratio is the F statistic. That is the whole of a one-way ANOVA: a sum-of-squares split, divided by its degrees of freedom, compared as a ratio.
Eta-squared is SSbetween/SStotal, which is R² under another name — the share of the total sum of squares the grouping accounts for. The two literatures use different words for the same quantity, which is worth knowing when reading across them.
The split generalises further. Two-way designs add an interaction term, repeated measures split the within part again, and every one of those tables is the same cross-product argument applied recursively. Getting the one-variable case exact is what makes the rest readable.
Why the divisor is n − 1, and then n − 2
A sum of squares becomes a variance by dividing by degrees of freedom, and the divisor changes depending on what was estimated to produce it.
Σ(x − x̄)² has n − 1 degrees of freedom. The deviations sum to zero by construction, so once n − 1 of them are known the last is determined. There are n numbers and one constraint.
That is the whole of Bessel’s correction. Dividing by n gives the population variance, which is exactly right if x̄ is the true mean and biased downward otherwise — because Σ(x − x̄)² is the smallest such sum over any centre, and the true mean is not the sample mean.
A regression residual sum has n − 2. Two parameters were estimated, so two constraints were imposed: the residuals sum to zero and are uncorrelated with x. The residual standard error divides by n − 2 for the same reason variance divides by n − 1.
A quadratic costs one more. Three parameters, so n − 3, and a k-predictor regression has n − k − 1. That is the counting behind adjusted R², which charges for each parameter and can therefore fall when one is added.
With n = 2 the residual sum is exactly zero and has zero degrees of freedom. A line through two points fits perfectly, R² is 1, and the residual standard error is 0/0. That is not a good fit; it is a model with nothing left to be wrong about.
Which is the practical warning. Degrees of freedom are how much information remained after the fitting, and a model with few of them will report a flattering sum of squares for reasons that have nothing to do with the data. This tool prints n and the divisor alongside every figure so that count stays visible.
Sources and methodology
References for the decomposition and for computing it without losing precision.
Method. The corrected sum is computed from the deviations in a second pass rather than as Σx² − n·x̄², because the shortcut subtracts two nearly equal numbers and loses a digit of precision for every digit they share. The regression decomposition is computed term by term with SST − SSR − SSE reported rather than assumed to be zero, so the identity can be watched failing when the intercept is removed. The suite asserts that the identity holds on every one of 500 random intercept fits and on none of the corresponding through-the-origin fits, that raw minus corrected equals n·x̄² exactly, and pins the presets: a gap of 36.889412 and residuals summing to 1.835294 without an intercept, and an R² of −36.799324 on data offset from zero. That engine is verified on every change against 188 assertions. The count and the per-case breakdown are published on the formula verification page.
Related calculators
Where this goes next:
VarianceSample and population variance from your data, with a live simulation that shows exactly how much the wrong divisor costs — 20% low at n = 5, closing as the sample grows.
Standard DeviationSample and population standard deviation, plus variance, mean, median, quartiles, z-scores, outliers, and confidence intervals.
Coefficient of DeterminationR-squared across five models at once with adjusted R-squared beside it, because adding a term can never lower it and the value most tools report for a curve fit was computed in log space.
One-Way ANOVAThe full F table with eta and omega squared, plus every pairwise gap — because a significant F says something differs and never says which, and ten groups tested pairwise carry a 90% false-positive rate.
ResidualResiduals, standardised and studentised residuals, leverage and Cook's distance, with Anscombe's quartet built in — including the dataset every residual rule scores cleanest and which one point controls entirely.
Linear RegressionThe least-squares line with r and r² — and the regression of x on y beside it, because those are two different lines rather than one line rearranged.
An educational tool. The identity SST = SSR + SSE depends on the model carrying an intercept, and R² computed as 1 − SSE/SST is not comparable with the uncentred R² statistical software reports for models fitted through the origin.
Published a sum of squares calculator that computes both quantities the phrase names, because the search term does not distinguish them: the raw sum of squares and the corrected sum of squares. They differ by exactly n times the squared mean — 66,310 against 700 on the test-scores preset, a factor of 94.7.
Prints SST minus SSR minus SSE rather than assuming it is zero. The identity holds only because the intercept's normal equation forces the residuals to sum to zero; forced through the origin, the first preset's residuals sum to 1.835294 and SSR plus SSE overshoots SST by 36.889412, with every term still looking reasonable.
Shows R-squared going below zero when the model is forced through an origin the data is nowhere near — -36.80 on the offset preset against 0.992149 with an intercept — and explains that statistical software silently substitutes an uncentred R-squared for no-intercept models, which is not comparable with an ordinary one.
Computes the corrected sum from the deviations in a second pass rather than from the textbook shortcut, which subtracts two nearly equal large numbers and loses a digit of precision for every digit they share — the classic route to a negative computed variance.
Add this calculator to your site
Responsive embed — and private: nothing your visitors type leaves their browser.