# Closed Form for Square Pyramidal Numbers

## Theorem

The closed-form expression for the $n$th square pyramidal number is:

$S_n = \dfrac {n \paren {n + 1} \paren {2 n + 1} } 6$

## Proof

 $\ds S_n$ $=$ $\ds \sum_{k \mathop = 1}^n k^2$ Definition of Square Pyramidal Number $\ds$ $=$ $\ds \dfrac {n \paren {n + 1} \paren {2 n + 1} } 6$ Sum of Sequence of Squares

$\blacksquare$