Sum of Squares Calculator

Calculate the sum of squares of consecutive integers from \(A\) to \(B\). See every square, the total, and the formula used to verify the result.

Calculate the Sum of Squares

Enter the starting value \(A\) and ending value \(B\). The calculator adds \(A^2+(A+1)^2+\cdots+B^2\).

Enter integers from 0 to 10,000, with \(A \leq B\).

What Is the Sum of Squares?

The sum of squares is the result of adding the squares of consecutive integers. For the first \(n\) positive integers, the expression is:

\[ 1^2+2^2+3^2+\cdots+n^2 \]

There is a closed-form formula that calculates the result without having to square and add every individual number:

\[ \boxed{ 1^2+2^2+\cdots+n^2 = \frac{n(n+1)(2n+1)}{6} } \]

This formula is one of the standard finite-sum identities used in algebra, number theory, calculus, and discrete mathematics.

Sum of Squares Formula

In sigma notation, the sum of the first \(n\) squares is:

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

The formula can also be written as:

\[ S_n = \frac{n(n+1)(2n+1)}{6} \]

The three factors in the numerator are \(n\), \(n+1\), and \(2n+1\), followed by division by \(6\).

Sum of Squares From A to B

When the range does not begin at \(1\), use two cumulative sums. First calculate the sum through \(B\), then subtract the sum through \(A-1\).

\[ \sum_{k=A}^{B}k^2 = \sum_{k=1}^{B}k^2 - \sum_{k=1}^{A-1}k^2 \]

Substituting the square-sum formula gives:

\[ \boxed{ \sum_{k=A}^{B}k^2 = \frac{B(B+1)(2B+1)}{6} - \frac{(A-1)A(2A-1)}{6} } \]

This allows a complete range to be calculated without manually generating every square.

Examples of Sum of Squares

Example 1: First Five Squares

The first five positive squares are:

\[ 1^2+2^2+3^2+4^2+5^2 \] \[ = 1+4+9+16+25 \] \[ =55 \]

Using the formula:

\[ \frac{5(6)(11)}{6} = 55 \]

Example 2: Squares From 3 to 6

\[ 3^2+4^2+5^2+6^2 \] \[ = 9+16+25+36 \] \[ =86 \]

Example 3: Sum of the First 10 Squares

\[ \sum_{k=1}^{10}k^2 = \frac{10(11)(21)}{6} \] \[ =385 \]

How to Calculate a Sum of Squares

Suppose you want to calculate:

\[ 4^2+5^2+6^2+7^2 \]

Calculate the cumulative sum through \(7\):

\[ \sum_{k=1}^{7}k^2 = \frac{7(8)(15)}{6} = 140 \]

Then calculate the cumulative sum through \(3\):

\[ \sum_{k=1}^{3}k^2 = \frac{3(4)(7)}{6} = 14 \]

Subtract the two:

\[ 140-14=126 \]

Therefore:

\[ 4^2+5^2+6^2+7^2=126 \]

Sum of Squares and Sigma Notation

Sigma notation provides a compact way to represent the sum of squares:

\[ \sum_{k=1}^{n}k^2 \]

For a range beginning at \(A\) and ending at \(B\):

\[ \sum_{k=A}^{B}k^2 \]

The corresponding closed form is:

\[ \sum_{k=A}^{B}k^2 = \frac{B(B+1)(2B+1)}{6} - \frac{(A-1)A(2A-1)}{6} \]

Important Properties of Square Sums

Closed-Form Formula The first \(n\) squares can be calculated directly using \(n(n+1)(2n+1)/6\).
Range Calculation Any consecutive range can be calculated by subtracting two cumulative square sums.
Polynomial Formula The square-sum expression is a polynomial of degree three in \(n\).
Connection to Cubes Square sums are one of the standard power sums and can be compared directly with cube and higher-power sums.

How to Use the Sum of Squares Calculator

  1. Enter the starting integer \(A\).
  2. Enter the ending integer \(B\).
  3. Make sure that \(A\leq B\).
  4. Click Calculate Sum.
  5. Review the total, individual squares, and formula verification.

For example, entering \(A=1\) and \(B=5\) calculates:

\[ 1^2+2^2+3^2+4^2+5^2=55 \]

Sum of Squares vs. Sum of Cubes

Both are examples of power sums. The main difference is the exponent.

\[ \text{Sum of squares: } \sum_{k=1}^{n}k^2 = \frac{n(n+1)(2n+1)}{6} \]

\[ \text{Sum of cubes: } \sum_{k=1}^{n}k^3 = \left(\frac{n(n+1)}{2}\right)^2 \]

For higher powers, the corresponding formulas become progressively more complex. Summe also provides a general Sum of Powers Calculator for power sums.

Related Summe Calculators

Explore more summation, sequence, and mathematical tools on Summe.org.

Frequently Asked Questions

What is the formula for the sum of squares?

The sum of the first \(n\) positive squares is:

\[ 1^2+2^2+\cdots+n^2 = \frac{n(n+1)(2n+1)}{6} \]

What is the sum of squares from A to B?

For non-negative integers \(A\) and \(B\), where \(A\leq B\):

\[ \sum_{k=A}^{B}k^2 = \frac{B(B+1)(2B+1)}{6} - \frac{(A-1)A(2A-1)}{6} \]

What is the sum of the first 10 squares?

The sum is:

\[ 1^2+2^2+\cdots+10^2 = 385 \]

What is the sum of squares from 1 to 100?

Using the formula:

\[ \sum_{k=1}^{100}k^2 = \frac{100(101)(201)}{6} = 338350 \]

Can I calculate squares in a range?

Yes. Enter the starting and ending integers into the calculator. It calculates every square in the range and gives the total.

What is \(0^2\)?

Zero squared is zero:

\[ 0^2=0 \]

Therefore, including zero at the beginning of a square-sum range does not change the total.