Consecutive squares
1² + 2² + … + n² = n(n + 1)(2n + 1)/6. For n = 5: 55.
1² + 2² + … + n², the sum of squares Σx² of a data list, and the sum of squared deviations SS.
Enter your values below to get started.
Consecutive squares: the sum from a² to b² equals S(b) − S(a − 1), with S(m) = m(m + 1)(2m + 1)/6.
Σx² squares each value first and then adds. (Σx)² adds first and then squares. For 3, 4, 5 they are 50 and 144.
SS measures spread: divide it by n − 1 for the sample variance s², or by n for the population variance σ².
Paste a column straight from a spreadsheet into the data box; new lines work as separators.
A square sum calculator adds squared numbers, and this one has 3 modes: consecutive squares 1² + 2² + … + n², the sum of squares Σx² of your own data, and the sum of squared deviations SS = Σ(x − x̄)² used for variance. The first mode applies n(n + 1)(2n + 1)/6 with exact integers. The data modes keep exact fractions, so 0.1² + 0.2² gives exactly 0.05.
A sum of squares is the total you get by squaring numbers and adding the results, such as 1² + 2² + 3² = 1 + 4 + 9 = 14. The phrase covers 3 different calculations, and mixing them up is the most common error with this topic.
The consecutive total 1² + … + n² is the square pyramidal number Pn, the number of cannonballs in a pyramid with an n × n base. 5 layers hold 55 balls and 10 layers hold 385.
Use Σx² for the raw sum of squared values, (Σx)² only when you need the square of the total, and SS when you need spread around the mean for variance or regression. The 3 numbers are linked by one identity:
For 2, 4, 4, 4, 5, 5, 7, 9: Σx² = 232, (Σx)² = 40² = 1,600 and n = 8, so SS = 232 − 1,600/8 = 232 − 200 = 32. Statistics textbooks write SS, Sxx or “corrected sum of squares” for the same value; the raw Σx² is the “uncorrected” sum of squares.
The sum of the first n squares is n(n + 1)(2n + 1)/6, and the sum of squared deviations is Σx² − (Σx)²/n. The first formula turns 100 additions into 3 multiplications: 100 × 101 × 201 / 6 = 338,350.
Archimedes used an equivalent result around 225 BC to find the volume of a cone in On Spirals. Check: n = 4 gives 4 × 5 × 9 / 6 = 30 = 1 + 4 + 9 + 16.
For 11² to 20²: S(20) − S(10) = 2,870 − 385 = 2,485.
Sample variance s² = SS/(n − 1); population variance σ² = SS/n. For the 8 values above, s² = 32/7 ≈ 4.5714 and σ² = 4.
Besides 1² + … + n², the 3 most common square sums are odd squares, even squares and alternating squares, and each has its own closed form. All of them follow from n(n + 1)(2n + 1)/6.
1² + 2² + … + n² = n(n + 1)(2n + 1)/6. For n = 5: 55.
1² + 3² + … + (2n − 1)² = n(2n − 1)(2n + 1)/3. For n = 5: 1 + 9 + 25 + 49 + 81 = 165.
2² + 4² + … + (2n)² = 2n(n + 1)(2n + 1)/3, which is 4 times the consecutive sum. For n = 5: 220.
1² − 2² + 3² − … ± n² = (−1)n+1 n(n + 1)/2. For n = 4: 1 − 4 + 9 − 16 = −10.
Σx² for any list, including decimals and negatives. For 1.5, 2.5, −3: 2.25 + 6.25 + 9 = 17.5.
To add 1² through n² by hand, multiply n, n + 1 and 2n + 1, then divide by 6. For n = 10:
For SS of a data list, find the mean, subtract it from each value, square each difference and add. The shortcut Σx² − (Σx)²/n gives the same answer with fewer subtractions.
The sum of squared deviations SS adds the squared distance from every value to the mean, and dividing SS by n − 1 gives the sample variance. Draw each deviation as a square with side |x − x̄| and SS is their total area.
For 2, 4, 4, 4, 5, 5, 7, 9 the deviations from x̄ = 5 are −3, −1, −1, −1, 0, 0, 2, 4. Their squares 9, 1, 1, 1, 0, 0, 4, 16 add to SS = 32, so σ = √4 = 2 and s = √(32/7) ≈ 2.1381. The divisor n − 1 is Bessel's correction, named after Friedrich Bessel; it makes s² an unbiased estimate of the population variance.
Every whole number is a sum of at most 4 squares, a theorem Joseph-Louis Lagrange proved in 1770. Most numbers need fewer: 25 = 5², 50 = 5² + 5², 30 = 5² + 2² + 1², while 7 = 2² + 1² + 1² + 1² needs all 4.
The method of least squares fits a line by making the sum of squared errors SSE as small as possible. Adrien-Marie Legendre published the method in 1805, and Carl Friedrich Gauss published his version in 1809, saying he had used it since 1795 to predict the orbit of the asteroid Ceres.
SST is the SS of the y values, SSR the part the line explains and SSE the part left over. An R² of 0.95 means the line explains 95% of the total sum of squares. Squared errors are used instead of plain errors since positive and negative errors would otherwise cancel.
Pick one of the 3 modes, enter the bases or the data, and press Calculate. The result card names the mode in its heading so you always know which sum of squares you got.
Consecutive squares 1² + … + n², Sum of squares of data Σx², or Squared deviations SS.
First and last base for consecutive squares; a list of values for the 2 data modes.
The total appears exactly. SS mode adds the mean, variance and standard deviation.
The table lists k, k² and the running total, or x, x − x̄ and (x − x̄)² in SS mode.
Common square sums in all 3 modes. Click a row to load it.
| Sum | Mode | Value | Calculator |
|---|---|---|---|
| Consecutive | 55 | ||
| Consecutive | 385 | ||
| Consecutive | 338,350 | ||
| Consecutive | 2,485 | ||
| Σx² | 50 | ||
| Σx² | 17.5 | ||
| SS | 10 | ||
| SS | 32 |
Try each one, then reveal the answer or solve it in the calculator.
Find the sum of the squares of the first 20 natural numbers.
Find the sum of the squares of the first 50 natural numbers.
How many cannonballs are in a square pyramid with 24 layers?
Add the squares from 5² to 15².
Find Σx² for the data 6, 8, 10.
Find SS and the sample variance of 10, 12, 14, 16, 18.
Discover 67 free sum calculators across different categories. Find the right calculator for your needs.
Try a different name or choose another category.
The sum of the first n squares is n(n + 1)(2n + 1)/6. For a data list, the sum of squared deviations is SS = Σx² − (Σx)²/n.
1² + 2² + … + 10² = 385, found as 10 × 11 × 21 / 6 = 2,310 / 6.
The sum is 338,350, found as 100 × 101 × 201 / 6.
No, Σx² squares each value before adding, while (Σx)² adds first and squares the total. For 3, 4, 5 they are 50 and 144.
No, in statistics SS usually means the sum of squared deviations from the mean, Σ(x − x̄)², not the raw Σx². For 1 to 5 the raw sum is 55 and SS is 10.
Divide SS by n − 1 for the sample variance or by n for the population variance. SS = 32 with n = 8 gives s² ≈ 4.5714 and σ² = 4.
1² + 3² + … + (2n − 1)² = n(2n − 1)(2n + 1)/3. For n = 5 the total is 165.
Yes, Lagrange's four-square theorem (1770) shows that every whole number is a sum of at most 4 squares. Numbers of the form 4ᵃ(8b + 7), such as 7 and 15, need exactly 4.
Yes, both data modes accept decimals and negatives and keep exact fractions, so 1.5, 2.5, −3 gives Σx² = 17.5 exactly. The consecutive mode accepts negative whole-number bases.
The square sum calculator covers the 3 meanings of “sum of squares”: consecutive squares by n(n + 1)(2n + 1)/6, the raw sum Σx² of a data list, and the sum of squared deviations SS that leads to variance and standard deviation. Pick the mode by what you want to measure: a series total, a raw total of squared values, or spread around the mean.
Not sure which mode fits your problem? Answer the questions below.