More arithmetic; towards Fermat’s little theorem [01BD]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
Proposition [01BF]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all integers p and m, if p is prime and 0<m<p then {p \choose m} \equiv 0 \mod p.
Proof sketch.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
We don‘t actually have the tools yet needed to complete the proof, but we can make some headway.
Let m and p be integers with p prime. Using the formula for binomial coefficients, we compute {p \choose m} below so as to factor out p:
{p \choose m} = \frac {p!}{ m!(p-m)! } = p\left ( \frac {(p-1)!}{m!(p-m)!} \right )Any multiple of p by a natural number is congruent to zero modulo p, so it suffices to argue that \frac {(p-1)!}{m!(p-m)!} is natural. You are going to have to take this on faith for now, but it will ultimately follow from p being prime and m being a positive integer strictly less than p. We will see how to deduce this in a later lecture once we have learned a bit more.
Proposition [01BE]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all prime numbers p and integers 0\leq m \leq p, either {p \choose m} \equiv 0 \mod p or {p \choose m}\equiv 1 \mod p.
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
We fix a prime p and a natural number m\leq p. We must show \left ({p \choose m}\equiv 0\mod p\right )\lor \left ({p \choose m}\equiv 1\mod p\right )\text {.} Before choosing which path to go down, we note that the following disjunction holds:
(m=0) \lor (m=p) \lor (0<m<p)We consider each of the three cases above:
We state but do not yet prove the binomial theorem below. To prove it, we would need induction (which we will learn in a later lecture), as well as a few additional insights.
Theorem The Binomial Theorem [01BG]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
Let x,y be elements of a commutative semiring {\mathopen {}\left (A,+,0,\cdot ,1\right )\mathclose {}}. For all n\in \mathbb {N}, we have {\mathopen {}\left (x+y\right )\mathclose {}}^n = \sum _{k=0}^n \binom {n}{k}\cdot x^{n-k}\cdot y^k \text {.}
Corollary The Freshman’s Dream [01BH]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all natural numbers m,n and primes p we have (m+n)^p \equiv m^p + n^p \mod p \text {.}
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
Let m,n be natural numbers and let p be a prime. It suffices to show that the difference (m+n)^p - (m^p+n^p) is congruent to zero modulo p. First we calculate (m+n)^p using the Binomial theorem and extracting the first and last summands:
\begin {aligned} (m+n)^p &= \sum _{k=0}^p {p \choose k} m^{p-k} n^k \\ &= {p\choose 0}m^p + {p\choose p}n^p + \sum _{k=1}^{p-1} {p\choose k}m^{p-k} n^k \\ &= m^p + n^p + \sum _{k=1}^{p-1} {p\choose k}m^{p-k} n^k \end {aligned}Therefore we have:
(m+n)^p - (m^p +n^p) = \sum _{k=1}^{p-1} {p\choose k}m^{p-k} n^kBy Proposition [01BF], we know that {p\choose k} \equiv 0 \mod p when 0<k<p, so the sum above is itself congruent to 0 modulo p. (For this, we are using the fact that sums and products and powers preserve congruence, which we have technically not proved.)
Corollary The Dropout Lemma [01BI]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all natural numbers m and primes p, we have (m+1)^p \equiv m^p + 1\mod p\text {.}
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
Let m be a natural number and p a prime. By the freshman’s dream, we have (m+1)^p \equiv m^p + 1^p \equiv m^p+1\mod p\text {.}
Proposition The Many Dropout Lemma [01BJ]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all natural numbers m and i and primes p, we have (m+i)^p \equiv m^p+i\mod p\text {.}
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
We note that any natural number i may be rewritten as a sum of ones:
i = \sum _{k=1}^i 1Therefore by i-many applications of the dropout lemma, we have (m+i)^p \equiv m^p + \sum _{k=1}^i1 \equiv m^p + i \mod p\text {.}
(You might be a little skeptical about the part where we said ”i-many applications” in the proof of the many dropout lemma. We will return to that in the future with a more rigorous proof using mathematical induction!)
We now come to Fermat’s Little Theorem, the first part of which is the many dropout lemma. We do not actualy yet have the tools to deduce the second part from the first, but we will do that later.
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
Corollary Existence of reciprocals [01BM]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
Let p be prime. Then every natural number i which is not a multiple of p has a reciprocal modulo p, i.e. some natural number \bar \imath _p such that i\cdot \bar \imath _p \equiv 1 \mod p.
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
By Fermat’s Little Theorem, we know that i^{p-1}\equiv 1\mod p. Choosing \bar \imath _p \coloneqq i^{i-2}, we have i \cdot \bar \imath _p = i \cdot i^{p-2} = i^{p-1} \equiv 1 \mod p\text {.}