Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Square Numbers






Perfect Squares as a Sequence

The square numbers 1,4,9,16,25,1, 4, 9, 16, 25, \ldots are among the most recognizable sequences in mathematics. Each is the product of an integer with itself, each can be visualized as dots filling a square grid, and each is a sum of consecutive odd numbers. Their properties connect to arithmetic sequences, triangular numbers, and divisibility.



Definition

The nn-th square number is:

Sn=n2S_n = n^2


The name reflects the geometric construction: arrange n2n^2 dots in a square grid with nn rows and nn columns. The first square numbers are:

1,4,9,16,25,36,49,64,81,100,1, 4, 9, 16, 25, 36, 49, 64, 81, 100, \ldots


A positive integer is called a perfect square if it equals n2n^2 for some integer nn. Testing whether a number is a perfect square amounts to checking whether its square root is an integer.

Recursive Form and Odd Number Sums

Each square number can be built from the previous one by adding an L-shaped border — a gnomon — containing 2n12n - 1 dots:

S1=1,Sn=Sn1+(2n1)S_1 = 1, \quad S_n = S_{n-1} + (2n - 1)


The increments 1,3,5,7,9,1, 3, 5, 7, 9, \ldots are the odd numbers, which form an arithmetic sequence with first term 11 and common difference 22. Summing all the increments gives:

n2=1+3+5++(2n1)n^2 = 1 + 3 + 5 + \cdots + (2n - 1)


Every perfect square is a sum of consecutive odd numbers starting from 11. This identity can be verified by the arithmetic series formula: the sum of the first nn odd numbers is n2(1+(2n1))=n2\frac{n}{2}(1 + (2n-1)) = n^2.

The difference between consecutive squares is always odd: SnSn1=2n1S_n - S_{n-1} = 2n - 1. This means no two consecutive integers are both perfect squares — there is always an odd gap between neighboring squares, and that gap widens as nn grows.

Properties

Perfect squares have distinctive divisibility patterns. A perfect square modulo 44 is always 00 or 11 — never 22 or 33. This is because even numbers squared give multiples of 44, and odd numbers squared give 11 more than a multiple of 44. Similarly, a perfect square modulo 33 is always 00 or 11 — never 22.

The last digit of a perfect square can only be 0,1,4,5,6,0, 1, 4, 5, 6, or 99. Any integer ending in 2,3,7,2, 3, 7, or 88 is immediately ruled out as a perfect square, without computing any square root.

Consecutive perfect squares are always coprime: gcd(n2,(n+1)2)=1\gcd(n^2, (n+1)^2) = 1, because gcd(n,n+1)=1\gcd(n, n+1) = 1 and the GCD of squares equals the square of the GCD.

The number of perfect squares up to NN is N\lfloor \sqrt{N} \rfloor. Perfect squares become increasingly sparse — the gap between n2n^2 and (n+1)2(n+1)^2 is 2n+12n + 1, which grows linearly. Among the first 100100 integers, 1010 are perfect squares; among the first 10,00010{,}000, only 100100 are.

Sum of Squares

The sum of the first nn square numbers is:

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


One derivation uses the telescoping identity (k+1)3k3=3k2+3k+1(k+1)^3 - k^3 = 3k^2 + 3k + 1. Summing both sides from k=1k = 1 to nn:

(n+1)31=3k2+3k+n(n+1)^3 - 1 = 3\sum k^2 + 3\sum k + n


Substituting k=n(n+1)2\sum k = \frac{n(n+1)}{2} and solving for k2\sum k^2 gives the result.

For example, the sum of the first 55 squares is 1+4+9+16+25=551 + 4 + 9 + 16 + 25 = 55, which matches 56116=55\frac{5 \cdot 6 \cdot 11}{6} = 55.

This formula contrasts with the triangular number sum k=n(n+1)2\sum k = \frac{n(n+1)}{2}, which is quadratic in nn. The sum of squares is cubic — each additional term contributes a squared value, making the total grow faster.

Connections to Triangular Numbers

Square numbers and triangular numbers are linked by the identity:

Sn=Tn+Tn1S_n = T_n + T_{n-1}


Every perfect square is the sum of two consecutive triangular numbers. For n=4n = 4: 16=T4+T3=10+616 = T_4 + T_3 = 10 + 6. The geometric proof is direct: cut a square grid of n2n^2 dots along the diagonal staircase. The dots on and above the staircase form a triangle with nn rows (TnT_n dots), and the dots below form a triangle with n1n-1 rows (Tn1T_{n-1} dots).

Another connection runs through Pythagorean triples — sets of three positive integers (a,b,c)(a, b, c) satisfying a2+b2=c2a^2 + b^2 = c^2. Every primitive Pythagorean triple can be generated by choosing integers m>n>0m > n > 0 with gcd(m,n)=1\gcd(m, n) = 1 and opposite parity, then setting:

a=m2n2,b=2mn,c=m2+n2a = m^2 - n^2, \quad b = 2mn, \quad c = m^2 + n^2


The triple (3,4,5)(3, 4, 5) comes from m=2,n=1m = 2, n = 1; the triple (5,12,13)(5, 12, 13) from m=3,n=2m = 3, n = 2. Pythagorean triples connect square numbers to geometry — each triple defines a right triangle with integer side lengths.