Sum of Squares

Sum of Squares gives you a formula to calculate the sum of the first n perfect squares instantly, without adding each term one by one.

k=1nk2=n(n+1)(2n+1)6\sum_{k=1}^{n} k^2 = \frac{n(n+1)(2n+1)}{6}

Solve a problem with Sum of Squares

Type the problem. The solver will use Sum of Squares where Sum of Squares is the right tool, and tell you when it is not.

Drag one in or paste from the clipboard. JPEG, PNG or WebP. You get the transcription to check before anything is solved.

How to get a better answer
  • Paste the whole problem, including the instruction word — "simplify", "solve for x" and "factor" lead to three different answers.
  • Say what you have already tried. "I got x = 4 and the book says 2" turns a solution into a diagnosis.
  • Set the level in the settings button. A calculus shortcut is not a better answer if you have not met derivatives yet.
  • For a photo, get the whole problem in frame and hold the page flat — you get the transcription to fix before anything is solved.

What each symbol means

What Sum of Squares takes
nn
kk
Sum of Squares
SymbolMeaning
nnThe total number of terms in the sum; a positive integer that defines the range from 1 to nn. If misread as n+1n+1 or n1n-1, you will include too many or too few squares.
kkThe index variable that represents each position in the sequence from 1 to nn. In each step of the sum, kk takes a new integer value. If misread as a constant, the sum will not work properly.

When to use it

Use this formula when you need to find the sum 12+22+...+n21^2 + 2^2 + ... + n^2 without adding each term individually.

Level

Usually taught in: Pre-Calculus

Worked examples

1. Sum of the first 5 perfect squares

Problem

Find the sum of the first 5 perfect squares: 12+22+32+42+521^2 + 2^2 + 3^2 + 4^2 + 5^2.
  1. n=5n = 5

    We identify that we need to sum the first 5 perfect squares, so n=5n = 5 in our formula.

  2. k=15k2=5(5+1)(25+1)6\sum_{k=1}^{5} k^2 = \frac{5(5+1)(2 \cdot 5+1)}{6}

    The formula tells us that the sum equals n(n+1)(2n+1)6\frac{n(n+1)(2n+1)}{6}, so we substitute n=5n = 5.

  3. 56116\frac{5 \cdot 6 \cdot 11}{6}

    We compute 5+1=65 + 1 = 6 and 2(5)+1=112(5) + 1 = 11, then multiply: 5611=3305 \cdot 6 \cdot 11 = 330.

  4. 3306=55\frac{330}{6} = 55

    We divide by 6 to get the final answer.

Answer: 12+22+32+42+52=551^2 + 2^2 + 3^2 + 4^2 + 5^2 = 55

The formula lets us avoid adding 1+4+9+16+251 + 4 + 9 + 16 + 25 by hand. We just substitute n=5n = 5 and compute using the given formula.

2. Sum of squares for a larger range

Problem

Calculate k=112k2\sum_{k=1}^{12} k^2.
  1. n=12n = 12

    We need to find the sum of squares from 121^2 to 12212^2, so n=12n = 12.

  2. k=112k2=12(13)(25)6\sum_{k=1}^{12} k^2 = \frac{12(13)(25)}{6}

    Using the formula with n=12n = 12, we get n(n+1)(2n+1)6=1213256\frac{n(n+1)(2n+1)}{6} = \frac{12 \cdot 13 \cdot 25}{6}.

  3. =1213256=21325= \frac{12 \cdot 13 \cdot 25}{6} = 2 \cdot 13 \cdot 25

    Since 12=6212 = 6 \cdot 2, we can simplify: 126=2\frac{12}{6} = 2.

  4. =2625=650= 26 \cdot 25 = 650

    Computing 213=262 \cdot 13 = 26, then 2625=65026 \cdot 25 = 650.

Answer: k=112k2=650\sum_{k=1}^{12} k^2 = 650

For larger values of nn, the formula saves significant calculation time. Instead of adding 144 terms, we just plug in and simplify.

3. Game score: total points across levels

Problem

In a game, your score for level kk is k2k^2 points. After completing levels 1 through 8, what is your total score?
  1. n=8n = 8

    Since you completed 8 levels and score k2k^2 at level kk, we need k=18k2\sum_{k=1}^{8} k^2 with n=8n = 8.

  2. k=18k2=8(9)(17)6\sum_{k=1}^{8} k^2 = \frac{8(9)(17)}{6}

    Substituting into the formula: 8(8+1)(2(8)+1)6=89176\frac{8 \cdot (8+1) \cdot (2(8)+1)}{6} = \frac{8 \cdot 9 \cdot 17}{6}.

  3. =89176=49173= \frac{8 \cdot 9 \cdot 17}{6} = \frac{4 \cdot 9 \cdot 17}{3}

    Simplify by dividing: 86=43\frac{8}{6} = \frac{4}{3}.

  4. =36173=1217=204= \frac{36 \cdot 17}{3} = 12 \cdot 17 = 204

    Since 493=363=12\frac{4 \cdot 9}{3} = \frac{36}{3} = 12, we get 1217=20412 \cdot 17 = 204.

Answer: k=18k2=204\sum_{k=1}^{8} k^2 = 204

This problem shows why the formula matters in real applications: manually adding 64+49+36+...+164 + 49 + 36 + ... + 1 would be tedious, but the formula gives us the answer instantly.

Common mistakes

Where Sum of Squares usually goes wrong
Answer came out wrong
Using 2(n+1)2(n+1) instead of (2n+1)(2n+1) in the numerator.
Use (2n+1)(2n+1), which means double nn then add 1. For n=5n=5, that is 11, not 12.
They sum up to (n1)2(n-1)^2 instead of including n2n^2.
Count your terms: from k=1k=1 to k=nk=n means nn terms total, with the last term being n2n^2. For n=5n=5: 1,4,9,16,251, 4, 9, 16, 25 (five terms).
They use the lower limit k=0k=0 instead of k=1k=1.
The correct formula is k=1nk2=n(n+1)(2n+1)6\sum_{k=1}^{n} k^2 = \frac{n(n+1)(2n+1)}{6}; always start at k=1k=1, not k=0k=0.
The mistakeWhy it is wrongThe fix
Using 2(n+1)2(n+1) instead of (2n+1)(2n+1) in the numerator.These are easily confused but different: 2(n+1)=2n+22(n+1) = 2n+2, while (2n+1)=2n+1(2n+1) = 2n+1.Use (2n+1)(2n+1), which means double nn then add 1. For n=5n=5, that is 11, not 12.
They sum up to (n1)2(n-1)^2 instead of including n2n^2.The notation k=1nk2\sum_{k=1}^{n} k^2 includes k=nk=n as the last term, so you must include n2n^2; if you stop at (n1)2(n-1)^2, you are missing the last and largest square.Count your terms: from k=1k=1 to k=nk=n means nn terms total, with the last term being n2n^2. For n=5n=5: 1,4,9,16,251, 4, 9, 16, 25 (five terms).
They use the lower limit k=0k=0 instead of k=1k=1.Including 02=00^2 = 0 adds nothing to the sum, but it reveals a misunderstanding of the formula, which is standardized to start at k=1k=1.The correct formula is k=1nk2=n(n+1)(2n+1)6\sum_{k=1}^{n} k^2 = \frac{n(n+1)(2n+1)}{6}; always start at k=1k=1, not k=0k=0.

Tips and when to use something else

  • The formula is much faster than adding all nn terms by hand, especially for large nn like n=100n = 100.
  • Check your arithmetic in the numerator n(n+1)(2n+1)n(n+1)(2n+1) before dividing by 6; one wrong number ruins the answer.
  • If you need k=1nk\sum_{k=1}^{n} k (just the integers, not squares), use the formula n(n+1)2\frac{n(n+1)}{2} instead; confusing the two is a common mistake.
  • For the sum of cubes k=1nk3\sum_{k=1}^{n} k^3, the formula is different: [n(n+1)2]2\left[\frac{n(n+1)}{2}\right]^2, not something with (2n+1)(2n+1) in it.

Frequently asked questions

Why is Sum of Squares formula n(n+1)(2n+1)6\frac{n(n+1)(2n+1)}{6} and not something simpler?
This is the only formula that gives the correct answer for all positive integers nn. It comes from algebra and can be proven by induction. The factors nn, (n+1)(n+1), and (2n+1)(2n+1) appear because they guarantee the numerator is always divisible by 6.
Can I use Sum of Squares for k=510k2\sum_{k=5}^{10} k^2, or does it only work starting from 1?
The formula works from 1 to nn, but you can adapt it: subtract the sum from 1 to 4 from the sum from 1 to 10 to get just 5 to 10. So k=510k2=k=110k2k=14k2=38530=355\sum_{k=5}^{10} k^2 = \sum_{k=1}^{10} k^2 - \sum_{k=1}^{4} k^2 = 385 - 30 = 355.
Is there a formula for the sum of fourth powers, like k4\sum k^4?
Yes, there are formulas for k3\sum k^3, k4\sum k^4, and higher powers, but they get complicated fast. For most pre-calculus work, you will only need the formulas for k\sum k and k2\sum k^2.
What if nn is negative or zero?
The formula applies to positive integers only. If n=0n = 0, the sum is empty (no terms), so it equals 0. Negative nn does not make sense in this context since you cannot have negative position in a sequence.

Need a different method?

The full solver is not scoped to one formula — type any problem and it will pick the method.

Open the math solver

Reviewed 2026-09-18