Perfect Square

Arithmetic

A perfect square is an integer that is the product of some integer multiplied by itself.

Formula

n^2 = n \times n
Visualization

Definition

A perfect square is a number you get when you multiply a whole number by itself, one that can be arranged as a square of dots. Formally, it is an integer of the form $n^2$ for some non-negative integer $n$; its square root is always a whole number, and perfect squares have an odd number of total factors, since the middle factor $\sqrt{n}$ is shared by its own pair. An integer $n \ge 0$ is a perfect square if and only if every exponent in its prime factorization $n = p_1^{a_1} \cdots p_k^{a_k}$ is even, equivalently if $n$ is a quadratic residue modulo every prime; Fermat's theorem on sums of two squares states that a prime $p$ is a sum of two squares ($p = a^2+b^2$) if and only if $p=2$ or $p \equiv 1 \pmod 4$.

Example

$9$ is a perfect square because $3 \times 3 = 9$; others include $1, 4, 9, 16, 25, 36, 49, 64, 81, 100$. Is $225$ a perfect square? $15^2 = 225$, yes; is $50$? $\sqrt{50} = 5\sqrt{2}$ is irrational, so no. $36 = 2^2 \cdot 3^2$ has all even exponents (a perfect square), while $72 = 2^3 \cdot 3^2$ has an odd exponent on $2$, so it is not, and $\sqrt{72} = 6\sqrt{2}$.

Key Insight

You can picture perfect squares as square arrays: $16$ dots can form a $4\times4$ grid, and if you cannot make a perfect square array, the number is not a perfect square. Perfect squares have an odd number of factors because their square root is counted only once instead of as a pair. The theory of quadratic residues, which integers are perfect squares mod $p$, is central to number theory, encoded by the Legendre symbol $\left(\frac{n}{p}\right)$, and quadratic reciprocity (Gauss's "golden theorem") relates the symbols for different primes.