Sum of First n Squares
Closed form for the sum of the first n squares.
Live Calculator
MembersVariables
Example
1² + 2² + 3² = 3·4·7/6 = 14. ✓
How it works
This formula gives the total of the perfect squares from 1² up to n² without adding them one by one. It works because the sum of square numbers grows in a very regular cubic pattern, and the expression n(n+1)(2n+1)/6 is the compact polynomial that matches that pattern for every whole number n. You can think of it as a shortcut that replaces a long arithmetic calculation with one exact formula.
When to use it
Use this when you need 1² + 2² + ... + n² in algebra, combinatorics, physics, or data analysis. It is especially useful for deriving formulas, checking sums quickly, or solving problems involving squared distances, variances, or counting patterns.
Worked example, step by step
Find 1² + 2² + 3² + 4² + 5². Use the formula: n(n+1)(2n+1)/6 Substitute n = 5: 5(5+1)(2·5+1)/6 Simplify: 5·6·11/6 Cancel the 6: 5·11 = 55 Final answer: 1² + 2² + 3² + 4² + 5² = 55
Common mistakes to avoid
- Using n instead of the upper limit only for the last term, instead of summing from 1 through n
- Forgetting to square each term before adding when checking the result manually
- Miscalculating the factors n+1 or 2n+1, especially when n is large
Did You Know?
The sum of the first n squares appears in physics when computing moments of inertia.
Share this formula
More in Number Theory
View allEuclidean Algorithm
BasicRecursively finds the greatest common divisor.
Modular Congruence
Basica and b have the same remainder when divided by m.
Fermat's Little Theorem
AdvancedHolds when p is prime and gcd(a,p)=1.
Euler's Totient
AdvancedCounts integers up to n coprime to n.
Prime Number Theorem
AdvancedApproximates the number of primes below x.
LCM from GCD
BasicLeast common multiple via the greatest common divisor.