Skip to main content

General Methods for Solving Sums

Mathematics · Summation · Closed Forms

General Methods for Solving Sums

Target sum

We want a direct formula for \(\square_n=\sum_{0 \le k \le n} k^2\).

Closed form

The answer is \(\frac{n(n+1)(2n+1)}{6}\), and the point is to derive it in multiple ways.

Why this matters

Each method generalizes beyond squares and helps build real fluency with symbolic summation.

Definition

A closed form means an exact formula you can evaluate directly, without carrying a summation sign along with it.

Instead of computing \[ 1 + 4 + 9 + \cdots + n^2 \] term by term, we want a single expression that returns the result immediately.

We define

\[ \square_n = \sum_{0 \le k \le n} k^2, \qquad n \ge 0. \]
Goal Derive a compact formula for \(\square_n\) using several different methods.
Small cases

Table of Small Values

Before hunting for a formula, it helps to compute several small cases by hand.

\(n\) 0 1 2 3 4 5 6 7 8 9 10 11 12
\(n^2\) 0 1 4 9 16 25 36 49 64 81 100 121 144
\(\square_n\) 0 1 5 14 30 55 91 140 204 285 385 506 650
Method 0

Look It Up

The quickest method is simply to consult a reference. The closed form is:

\[ \square_n = \frac{n(n+1)(2n+1)}{6}, \qquad n \ge 0. \]

For example, when \(n=4\), \[ \frac{4 \cdot 5 \cdot 9}{6}=30, \] which matches the table.

This is often a reasonable first move in practice. The interesting part comes when you want to understand why the formula has this shape.

Method 1

Guess the Formula, Then Prove It by Induction

Once the small-value table suggests a pattern, induction is a natural way to confirm it.

Claim:

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

Base case: when \(n=0\), both sides equal 0.

Inductive step: assume the formula holds for \(n-1\). Then

$$ \begin{aligned} \square_n &= \square_{n-1} + n^2 \\ &= \frac{(n-1)n(2n-1)}{6} + n^2 \\ &= \frac{(n-1)n(2n-1) + 6n^2}{6} \\ &= \frac{n\bigl((n-1)(2n-1) + 6n\bigr)}{6} \\ &= \frac{n(2n^2+3n+1)}{6} \\ &= \frac{n(n+1)(2n+1)}{6}. \end{aligned} $$

So the formula holds for all \(n \ge 0\).

Method 2

Perturb the Sum

Perturbation means shifting a related expression and comparing the shifted version to the original.

Start from the cubic identity \[ (k+1)^3 - k^3 = 3k^2 + 3k + 1. \]

Summing from \(k=0\) to \(n\) makes the left side telescope:

\[ (n+1)^3 = 3\sum_{0 \le k \le n} k^2 + 3\sum_{0 \le k \le n} k + \sum_{0 \le k \le n} 1. \]

Using \[ \sum_{0 \le k \le n} k = \frac{n(n+1)}{2} \quad \text{and} \quad \sum_{0 \le k \le n} 1 = n+1, \] we get:

$$ \begin{aligned} (n+1)^3 &= 3\square_n + \frac{3n(n+1)}{2} + (n+1), \\ 3\square_n &= (n+1)^3 - \frac{3n(n+1)}{2} - (n+1), \\ 3\square_n &= n(n+1)\left(n+\frac{1}{2}\right). \end{aligned} $$

Therefore,

\[ \square_n = \frac{n\left(n+\frac{1}{2}\right)(n+1)}{3} = \frac{n(n+1)(2n+1)}{6}. \]
Method 3

Build a Repertoire

The repertoire method starts with a more general recurrence and solves several simpler coefficient problems inside it.

Define a general sequence \(R_n\) by

\[ R_0=\alpha, \qquad R_n = R_{n-1} + \beta + \gamma n + \delta n^2 \quad (n>0). \]

Because the recurrence is linear in the constants, the solution has the form

\[ R_n = A(n)\alpha + B(n)\beta + C(n)\gamma + D(n)\delta. \]

Now solve the coefficient functions:

  • \(A(n)=1\), because \(\alpha\) simply carries the initial condition through.
  • \(B(n)=n\), from the constant-increment case.
  • \(C(n)=\frac{n(n+1)}{2}\), from the sum of the first \(n\) integers.
  • \(D(n)=\square_n\), which is the piece we actually want.

Now use the known sequence \(R_n=n^3\). Since \[ n^3-(n-1)^3 = 3n^2 - 3n + 1, \] this corresponds to \[ \alpha=0,\qquad \beta=1,\qquad \gamma=-3,\qquad \delta=3. \]

Therefore

\[ n^3 = B(n) - 3C(n) + 3D(n). \]

Substitute \(B(n)=n\) and \(C(n)=\frac{n(n+1)}{2}\):

$$ \begin{aligned} 3D(n) &= n^3 - n + \frac{3n(n+1)}{2} \\ &= n^3 + \frac{3n^2}{2} + \frac{n}{2}. \end{aligned} $$

Since \(D(n)=\square_n\),

\[ \square_n = \frac{n(n+1)(2n+1)}{6}. \]
Method 4

Replace Sums by Integrals

Geometrically, \(\square_n\) is the total area of rectangles of width 1 and heights \(0^2,1^2,2^2,\dots,n^2\).

The first approximation is the area under the curve \(y=x^2\):

\[ \int_0^n x^2\,dx = \frac{n^3}{3}. \]

So \(\square_n\) should be roughly \(\frac{n^3}{3}\). To make that exact, define the error:

\[ E_n = \square_n - \int_0^n x^2\,dx. \]

Compute it directly:

$$ \begin{aligned} E_n &= \sum_{k=1}^{n}\left(k^2 - \int_{k-1}^{k} x^2\,dx\right) \\ &= \sum_{k=1}^{n}\left(k^2 - \frac{k^3-(k-1)^3}{3}\right) \\ &= \sum_{k=1}^{n}\left(k - \frac{1}{3}\right). \end{aligned} $$

Using \(T_n=\frac{n(n+1)}{2}\),

\[ E_n = \frac{n(n+1)}{2} - \frac{n}{3} = \frac{n^2}{2} + \frac{n}{6}. \]

Add the approximation and the error:

\[ \square_n = \frac{n^3}{3} + \frac{n^2}{2} + \frac{n}{6} = \frac{n(n+1)(2n+1)}{6}. \]
Method 5

Expand and Contract

This method replaces the single sum with a double sum that is easier to rearrange.

Since \[ k = \sum_{1 \le j \le k} 1, \] we can write \[ k^2 = k \cdot k = \sum_{1 \le j \le k} k. \]

Substituting into \(\square_n\):

\[ \square_n = \sum_{1 \le k \le n} k^2 = \sum_{1 \le j \le k \le n} k. \]

Swap the order of summation:

\[ \square_n = \sum_{1 \le j \le n} \sum_{j \le k \le n} k. \]

The inner sum is an arithmetic series from \(j\) to \(n\), so its value is

\[ \frac{j+n}{2}(n-j+1). \]

Therefore

\[ \square_n = \sum_{1 \le j \le n} \frac{j+n}{2}(n-j+1). \]

Expand the product:

\[ (j+n)(n-j+1) = n(n+1) - j^2 + j. \]

So

\[ \square_n = \frac{1}{2}\sum_{1 \le j \le n} \bigl(n(n+1) + j - j^2\bigr). \]

Split the sum:

\[ \square_n = \frac{1}{2}\left(n^2(n+1) + \frac{n(n+1)}{2} - \square_n\right). \]

Move the \(\square_n\) term to the left:

$$ \begin{aligned} \square_n + \frac{1}{2}\square_n &= \frac{1}{2}n^2(n+1) + \frac{1}{4}n(n+1), \\ \frac{3}{2}\square_n &= \frac{1}{2}n\left(n+\frac{1}{2}\right)(n+1), \end{aligned} $$

and therefore

\[ \square_n = \frac{n\left(n+\frac{1}{2}\right)(n+1)}{3} = \frac{n(n+1)(2n+1)}{6}. \]
Method 6

Use Finite Calculus

Coming soon.

Method 7

Use Generating Functions

Coming soon.

FAQ

Frequently Asked Questions

These are the practical questions students usually have when they first compare different methods for solving the same sum.

Why learn several methods if the formula is already known?

Because each method teaches a different way of thinking: proof by induction, perturbation, recurrence solving, geometric approximation, or double-sum manipulation.

Which method is the fastest in practice?

Looking the result up is fastest, but induction is often the quickest proof once you already know the formula.

Which method generalizes best?

The repertoire method, finite calculus, and generating functions usually scale well to broader families of sums.

Why does the perturbation method use cubes?

Because the identity \((k+1)^3-k^3\) naturally produces a \(k^2\) term, which is exactly what the square sum needs.

Why does the integral method still give an exact result if integration starts as an approximation?

Because the error between the sum and the integral can itself be written and evaluated exactly.

What is the simplest takeaway from this whole discussion?

A single sum can often be attacked from multiple angles, and the best method depends on what kind of structure you notice first.

Raell Dottin

Comments