MathorynMathematical Formula Database

Sequences & Series

Sum of the First n Squares

This closed form gives 12+22+⋯+n21^2+2^2+\cdots+n^2. It appears in calculus (Riemann sums for x2x^2) and in statistics. Use it to sum square numbers quickly or to compute areas by Riemann sums.

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

Variables

nn
number of terms

Example

Compute 12+22+⋯+1021^2+2^2+\cdots+10^2.

  1. 10⋅11⋅216\frac{10\cdot11\cdot21}{6}.

Answer: 385385.

Related formulas