Coprimality and Euclid’s theorem [01EH]
- October 20, 2026
- Marcelo Fiore, Jon Sterling
Definition Coprime integers [01EI]
- October 20, 2026
- Marcelo Fiore, Jon Sterling
Two natural numbers are said to be coprime when their greatest common divisor is 1.
Lemma [01EJ]
- October 20, 2026
- Marcelo Fiore, Jon Sterling
Let k and m be coprime and let n be an arbitrary integer. If k\mid {\mathopen {}\left (m\cdot n\right )\mathclose {}}, then k\mid n.
After attempting to prove this yourself, you may click this text to see my proof.
Proof.
- October 20, 2026
- Marcelo Fiore, Jon Sterling
By our assumption k\mid {\mathopen {}\left (m\cdot n\right )\mathclose {}} we may assume some integer l such that k\cdot l = m\cdot n. We now reason using our assumptions, the definition of coprimality, and the linearity of \gcd :
\begin {aligned} n &= 1\cdot n \\ &= \gcd {\mathopen {}\left (k,m\right )\mathclose {}} \cdot n \\ &= \gcd {\mathopen {}\left (k\cdot n, m\cdot n\right )\mathclose {}} \\ &= \gcd {\mathopen {}\left (k\cdot n, k\cdot l\right )\mathclose {}} \\ &= k\cdot \gcd {\mathopen {}\left (n,l\right )\mathclose {}} \end {aligned}Therefore, k\mid n.
Ironically, Euclid’s Theorem is going to be a corollary of the above.
Corollary Euclid’s Theorem [01EK]
- October 20, 2026
- Marcelo Fiore, Jon Sterling
For all integers m and n and a prime p, if p\mid {\mathopen {}\left (m\cdot n\right )\mathclose {}} then either p\mid m or p\mid n.
After attempting to prove this yourself, you may click this text to see my proof.
Proof.
- October 20, 2026
- Marcelo Fiore, Jon Sterling
If either m and n is zero, then the claim is trivial. We now assume without loss of generality that m and n are positive.
To show p\mid m \lor p \mid n it suffices to show that p\nmid m \implies p \mid n and p\nmid n\implies p\mid m. As these cases are symmetric, we consider just the first one.
Assume p \nmid m. The only candidates for common divisors of p and m are p and 1 because p is prime, and we have already ruled out p by our assumption p\nmid m. Hence \gcd {\mathopen {}\left (p,m\right )\mathclose {}} = 1 and thus p and m are coprime.
By Lemma [01EJ], then, p\mid {\mathopen {}\left (m\cdot n\right )\mathclose {}} implies p\mid n so we are done.
We now return to Fermat’s Little Theorem, which we did not properly have the tools to prove when we first encountered it.
Theorem Fermat’s Little Theorem [01BK]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all natural numbers i and primes p, we have the following:
- i^p \equiv i \mod p
- i^{p-1}\equiv 1 \mod p unless i is a multiple of p
After attempting to prove this yourself, you may click this text to see my proof.
Proof. Proof of Fermat’s Little Theorem [01EL]
- October 20, 2026
- Marcelo Fiore, Jon Sterling
The first property is precisely the many dropout lemma, which states (0+i)^p \equiv 0^p+i \equiv i \mod p.
For the second part, we assume that p\nmid i and must show that i^{p-1}\equiv 1 \mod p. We consider the following sequence of equivalences, where the first statement holds by the first part of the theorem:
\begin {aligned} i^p\equiv i \mod p &\Longleftrightarrow p\mid {\mathopen {}\left (i^p - i\right )\mathclose {}} \\ &\Longleftrightarrow p\mid i\cdot {\mathopen {}\left (i^{p-1}-1\right )\mathclose {}} \end {aligned}By Euclid’s Thoerem, it therefore follows that either p\mid i or p\mid {\mathopen {}\left (i^{p-1}-1\right )\mathclose {}}. The former is ruled out by assumption, and the latter is equivalent by definition to i^{p-1}\equiv 1 \mod p.
Corollary [01EM]
- October 20, 2026
- Marcelo Fiore, Jon Sterling
For all primes p and integers m such that 0<m<p, we have p\mid {p \choose m} and {\mathopen {}\left (p-m\right )\mathclose {}}\mid {{p-1}\choose m}.
After attempting to prove this yourself, you may click this text to see my proof.
Proof.
- October 20, 2026
- Marcelo Fiore, Jon Sterling
Fix a prime p and an integer m such that 0<m<p.
We first notice p\cdot {{p-1}\choose m} = {p \choose m}\cdot (p-m): thinking combinatorically, the former describes the process of choosing one member from a group of p and then choosing m members from what's left; we equally well could first choose m members from p, and then one member of the remaining p-m.
Because 0<m and p is prime, the greatest common divisor of p and p-m is 1, so p and p-m are coprime.
- To show that p\mid \binom {p}{m}, by Lemma [01EJ] it suffices to show that p\mid {\mathopen {}\left (p-m\right )\mathclose {}}\cdot \binom {p}{m} because p and p-m are coprime. By our combinatoric reasoning, this is the same as p\mid p\cdot \binom {p-1}{m} which immediately holds.
- To show that {\mathopen {}\left (p-m\right )\mathclose {}}\mid \binom {p-1}{m} it suffices by Lemma [01EJ] to show that {\mathopen {}\left (p-m\right )\mathclose {}}\mid p\cdot \binom {p-1}{m} which is equivalent to {\mathopen {}\left (p-m\right )\mathclose {}}\mid \binom {p}{m}\cdot {\mathopen {}\left (p-m\right )\mathclose {}} which immediately holds.
Corollary Integers modulo a prime form a field [01EN]
- October 20, 2026
- Marcelo Fiore, Jon Sterling
For a prime p, every non-zero element i of the modular integers \mathbb {Z}_p has {\mathopen {}\left [i^{p-2}\right ]\mathclose {}}_p as multiplicative inverse. Hence the ring \mathbb {Z}_p is a field.
After attempting to prove this yourself, you may click this text to see my proof.
Proof.
- October 20, 2026
- Marcelo Fiore, Jon Sterling
We want to check the following identity:
i \cdot _p {\mathopen {}\left [i^{p-2}\right ]\mathclose {}}_p = 1Equivalently, we must show i\cdot i^{p-2} \equiv 1, or equivalently i^{p-1}\equiv 1\mod p. This is the second part of Fermat’s little theorem, noting that i<p so i\nmid p.