You are currently browsing the tag archive for the ‘Modular Arithmetic’ tag.

John Wilson (1741-1793) was a well-known English mathematician in his time, whose legacy lives on in his eponymous result, Wilson’s Theorem. To recall, this is the statement that an integer $n >1$ is prime if and only if

$(n-1)! \equiv -1 \mod n.$

(The “if” part is trivial.) As is the case for many historical results, Wilson’s Theorem was not proven by Wilson. Instead, it was Joseph Lagrange who provided the first proof.

The proof, as we see it today, might be phrased as follows:

Proof: Suppose that $p$ is prime. Then each of the nonzero residues modulo $p$ is a unit, so that $(p-1)!$ represents the product over all units in $\mathbb{Z}/p\mathbb{Z}$. If

$a \not\equiv a^{-1} \mod p$,   i.e.    $a^2 \not\equiv 1 \mod p$,

then $a$ and its inverse each show up in our list of units. We cancel out such terms in pairs, and conclude that

$\displaystyle (p-1)! \equiv \prod_{a^2 \equiv 1 (p)} a \mod p.$

We have $a^2 \equiv 1 \mod p$ if and only if $p \mid (a-1)(a+1)$, which by primality of $p$ forces $p \mid (a-1)$ or $p \mid (a+1)$. In other words, $a \equiv \pm 1 \mod p$. It follows that

$(p-1)! \equiv 1(-1) \equiv -1 \mod p.$

$\square$

When $n$ is composite, the direct translation of Wilson’s problem gives

$(n-1)! \equiv 0 \mod n.$

The problem, here, is that we’ve multiplied a number of zero divisors together, which can be avoided by only multiplying across the units, $U_n$, of $\mathbb{Z}/n\mathbb{Z}$. In this post, we consider the product

$\displaystyle \prod_{a \in U_n} a \mod n,$

determine its value, give credit to Gauss for doing so over two centuries ago, and discuss a few generalizations.