费马小定理

Fermat's Little Theorem.

Theorem. Let G\mathbb{G} be a finite group of order m=∣G∣m=|\mathbb{G}|. Then for any g∈Gg\in \mathbb{G}, it holds that gm=1g^m=1.

Proof. G={g1,g2,...,gm}\mathbb{G}=\{g_1,g_2,...,g_m\}, g∈Gg\in \mathbb{G}. gi≠gjg_i\neq g_j for all i,ji,j, therefore ggi≠ggjgg_i\neq gg_j for all i,ji,j. With the closure property of the group G\mathbb{G}, {gg1,gg2,...ggm}\{gg_1,gg_2,...gg_m\} is a permutation of {g1,g2,...,gm}\{g_1,g_2,...,g_m\}. Then we have (gg1)(gg2)...(ggm)=g1g2...gm(gg_1)(gg_2)...(gg_m)=g_1g_2...g_m, which could be reduced to gm=1g^m=1.

We could see the similarity between the proof of Fermat's little theorem and Euler's theorem. In fact, Fermat's little theorem is the general form of Euler's theorem. Let G\mathbb{G} be the modulo multiplication group (Z/n)∗(\mathbb{Z}/n)^{*}, one could derive the Euler's theorem.

Corollary 1

Corollary (Fermat's Little Theorem). Let G\mathbb{G} be a finite group of order mm. Then for any g∈Gg\in \mathbb{G}, and any integer xx, we have gx=g[xmod  m]g^x=g^{[x\mod m]}.

Many exponents calculation could be simplified using this corollary.

For example, if computing 51000mod  115^{1000}\mod 11, we could see 5∈(Z/11)∗5\in (\mathbb{Z}/11)^{*} since gcd⁡(5,11)=1\gcd(5,11)=1. Therefore 51000mod  11=5[1000mod  φ(11)]mod  11=5[1000mod  10]mod  11=15^{1000}\mod{11}=5^{[1000\mod \varphi(11)]}\mod{11}=5^{[1000\mod{10}]}\mod{11}=1.

Corollary 2

Corollary (Fermat's Little Theorem). Let G\mathbb{G} be a finite group of order mm. Let e>0e>0 be an integer, and define the function, fe:G→Gf_e:\mathbb{G}\to \mathbb{G} by fe(g)=gef_e(g)=g^e.

  • If gcd⁡(e,m)=1\gcd(e,m)=1, then fef_e is a permutation, i.e., a bijection.
  • Moreover, if d=e−1mod  md=e^{-1}\mod{m}, then fdf_d is the inverse of fef_e.
Eureka moment!

注意,我们这里介绍的是费马小定理的群论表述;事实上,其拥有一个更为广为人知的数学表述。对于任意整数 aa, 质数 pp,有 ap≡a(modp)a^{p}\equiv a\pmod{p}。

当 gcd⁡(a,p)=1\gcd(a,p)=1 时,我们能够由此推导出欧拉定理。

当 gcd⁡(a,p)≠1\gcd(a,p)\neq 1 时,由于 pp 是质数,aa 一定是 pp 的倍数 p∣ap|a. 那么显然此时 ap≡a≡0(modp)a^p \equiv a \equiv 0\pmod{p}.