Sum of Squares Calculator
- Sum of squares = n(n + 1)(2n + 1) / 6 with n = 10: 10 x 11 x 21 / 6 = 385.
- Check by size: the plain sum 1 + 2 + ... + 10 is only 55, and squaring weights the big end of the range, so the squares must add to much more.
- The same closed form gives the variance shortcut sum of (x - mean)^2 = sum of squares - (sum)^2 / n used throughout statistics.
A sum of squares calculator adds the squares of a sequence of integers and gives you the exact total instantly. Whether you want the sum of the first ten squares, which equals 385, or the first hundred squares, which equals 338,350, the calculator returns the result using the closed-form formula 1^2 + 2^2 + ... + n^2 = n(n + 1)(2n + 1) / 6, also known as the square pyramidal numbers. Any range of squares works by subtraction: F(end) - F(start - 1). For example, the squares from 5 to 10 sum to 355, found as F(10) - F(4) = 385 - 30. The same sum appears in statistics as sum of (x - mean)^2 = sum of squares - (sum)^2 / n, the shortcut behind variance calculations.
The closed-form formula is the accepted standard for this kind of calculation because it delivers an exact answer in a single expression rather than requiring you to add each squared term individually. The plain sum of 1 to 10 is only 55, while the first ten cubes sum to 3,025, illustrating how squaring changes the magnitude and why a reliable formula matters. This page shows the formula, step-by-step workings, worked examples, and sources so you can verify every result the calculator produces.
Worked examples
Squares 1 to 10
Primary result: 385 — the classic textbook value of the sum of the first ten squares. (Squares from 1 to n · 10 · 1 · 10)
| Sum of squares | 385 |
| Sum 1 + 2 + ... + n | 55 |
| Sum of cubes 1^3 + ... + n^3 | 3,025 |
| Terms counted | 10 |
Squares 1 to 100
Primary result: 338,350 — the closed form handles in one line what addition needs a hundred terms for. (Squares from 1 to n · 100 · 1 · 100)
| Sum of squares | 338,350 |
| Sum 1 + 2 + ... + n | 5,050 |
| Sum of cubes 1^3 + ... + n^3 | 25,502,500 |
| Terms counted | 100 |
Squares 5 to 10
Primary result: 355 — F(10) minus F(4) keeps just the 5-to-10 slice. (Squares over a range · 10 · 5 · 10)
| Sum of squares | 355 |
| Plain sum over the range | 45 |
| Terms counted | 6 |
The sum of squares formula
The sum of squares formula gives a closed form for the sum of the first n perfect squares: 1^2 + 2^2 + ... + n^2 = n(n + 1)(2n + 1) / 6. These values are known as the square pyramidal numbers, because they count the number of stacked spheres in a pyramid with a square base. If you arrange 1 sphere on top, 4 beneath it, 9 beneath those, and so on, the total number of spheres in the pyramid with n layers is exactly the sum of the first n squares. The formula also follows by induction: assume it holds for n, add (n + 1)^2 to both sides, and simplify to show it holds for n + 1.
A quick worked example confirms the formula. For n = 10, the first ten squares sum to 385. To put that in perspective, the plain sum of the integers from 1 to 10 is only 55, while the first ten cubes sum to 3,025. Scaling up, the first hundred squares sum to 338,350. A sum of squares calculator handles these values instantly, but the closed form lets you verify any result by hand.
Any range of consecutive squares works by subtraction. Define F(n) = n(n + 1)(2n + 1) / 6, so that F(n) equals the sum of the first n squares. To find the sum of the squares from a to b, compute F(b) - F(a - 1). For example, the squares from 5 to 10 sum to 355, found as F(10) - F(4) = 385 - 30. The same closed form applies no matter which range you choose.
The same sum appears in statistics, where it underpins a standard shortcut for variance. The sum of squared deviations from the mean can be written as the sum of squares minus the square of the sum divided by the count: sum of (x - mean)^2 = sum of squares - (sum)^2 / n. This identity lets you compute variance without first calculating every deviation, which is useful when working through data by hand or checking a calculator's output.
Worked examples
A reliable sum of squares calculator should be grounded in the closed-form formula for the square pyramidal numbers: 1^2 + 2^2 + ... + n^2 = n(n + 1)(2n + 1) / 6. Three verified cases show the formula in action. For the first ten squares, the result is 385 — a useful contrast to the plain sum 1 to 10, which is only 55, and the first ten cubes, which sum to 3,025. Scaling up, the first hundred squares sum to 338,350. Both values follow directly from plugging n = 10 and n = 100 into the formula above.
Ranges work just as well through subtraction. To find the squares from 5 to 10, compute F(10) - F(4) = 385 - 30 = 355. The same closed form applies to any range: use F(end) - F(start - 1). This subtraction method avoids adding each term individually and keeps the calculation exact regardless of how large the range becomes.
The same sum appears in statistics. The identity sum of (x - mean)^2 = sum of squares - (sum)^2 / n is the shortcut behind variance calculations. A sum of squares calculator built on the square pyramidal formula therefore serves both pure mathematics and practical data analysis.
| Range | Method | Result |
|---|---|---|
| 1 to 10 | F(10) | 385 |
| 1 to 100 | F(100) | 338,350 |
| 5 to 10 | F(10) - F(4) = 385 - 30 | 355 |
Sums over a range
When you need the sum of squares across an arbitrary range, the closed-form formula for square pyramidal numbers does the heavy lifting. The identity 1^2 + 2^2 + ... + n^2 = n(n + 1)(2n + 1) / 6 gives you a function, call it F(n), that returns the cumulative total from 1 through n. A sum of squares calculator uses this formula as its backbone, but the real power shows up when the range does not start at 1.
The subtraction trick is simple: to sum the squares from any starting integer to any ending integer, compute F(end) minus F(start - 1). The logic mirrors how you would count apples in a bowl by subtracting the count before you started adding from the count after you finished. Because F(n) is a closed form that holds for every positive integer, the difference always gives the exact sum of the squared terms in between, with no need to loop or add terms one by one.
Consider the squares from 5 to 10. The formula gives F(10) = 385 and F(4) = 30, so the range sum is 385 - 30 = 355. The same approach scales without effort: the first ten squares sum to 385, and the first hundred squares sum to 338,350. For comparison, the plain sum of the integers from 1 to 10 is only 55, and the first ten cubes sum to 3,025, which shows how quickly squared and cubed terms pull away from their linear counterparts.
This subtraction method works for any summable sequence that has a closed form, not just squares. Once you can express the cumulative total up to n as a single function of n, any contiguous slice reduces to two evaluations and one subtraction. The same sum appears in statistics as the shortcut behind variance calculations: sum of (x - mean)^2 = sum of squares - (sum)^2 / n, which lets you compute the sum of squared deviations from a single pass over the data without first finding every deviation.
Where the sum of squares shows up
The sum of squares shows up in several places that go well beyond a single math exercise. In number theory, the running total 1^2 + 2^2 + ... + n^2 = n(n + 1)(2n + 1) / 6 produces the square pyramidal numbers, so called because they count the number of spheres needed to stack a square-based pyramid. A sum of squares calculator that uses this closed form can handle any upper limit instantly, without adding each term one at a time.
Because the closed form gives the total from 1 up to n, you can find the sum over any interval by subtracting two totals. For a range that starts at a and ends at b, the result is F(b) - F(a - 1), where F is the same closed form. As a worked example, the squares from 5 to 10 sum to 355, found as F(10) - F(4) = 385 - 30. Any range works by subtraction with the same closed form, so partial sums take the same effort as full ones.
The same sum appears in statistics, where it drives a familiar shortcut for variance. Instead of computing each deviation from the mean separately, you can use the identity sum of (x - mean)^2 = sum of squares - (sum)^2 / n. This is the shortcut behind variance calculations, and it is one reason the sum of squares is worth computing accurately and efficiently.
These identities also connect to related sums. The first ten squares sum to 385, while the plain sum 1 to 10 is only 55, and the first ten cubes sum to 3,025. Scaling up, the first hundred squares sum to 338,350. The gaps between these totals show why squared values grow so quickly and why a reliable sum of squares calculator is useful for checking results by hand.
FAQs
What is the formula for the sum of squares?
The formula is n(n + 1)(2n + 1) / 6. For n = 10, that is 10 x 11 x 21 / 6 = 385. This closed-form expression gives you the total of every square from 1 squared through n squared without adding them one at a time.
What is the sum of the first 100 squares?
The sum of the first 100 squares is 338,350. The closed form gives it in one line instead of a hundred additions. By plugging 100 into the formula, you get the total instantly, avoiding the slow process of calculating each square and adding them individually.
How do you sum squares between two numbers?
Evaluate the closed form at both ends and subtract. For squares 5 to 10, compute F(10) - F(4) = 385 - 30 = 355. This method uses the standard sum-of-squares formula at the upper and lower bounds, then subtracts to get the range total quickly.
What is the sum of the first n cubes?
The sum of the first n cubes is the square of the plain sum: (n(n+1)/2)^2. For n = 10, this becomes 55^2 = 3,025. This elegant formula shows that adding cubes from 1 through n equals the square of the sum of the integers from 1 to n.
Why is it called a square pyramidal number?
The sum counts cannonballs in a square pyramid: layers of 1, 4, 9, 16... balls, so 385 balls stack into a 10-layer pyramid. Each layer forms a perfect square, and stacking them creates a pyramid shape, which is why these sums are called square pyramidal numbers.
How is the sum of squares used in statistics?
Sum of squared deviations = sum of squares - (sum)^2 / n, the computational shortcut for variance. This formula lets you calculate variance without first computing every individual deviation. You use the raw sum of squares and the sum of values to find the spread efficiently.