Fermat’s Little Theorem From the Multinomial Theorem
Thomas J. Osler (osler@rowan.edu) Rowan University, Glassboro, NJ 08028 Fermat’s Little Theorem [1] states that n p −1 − 1 is divisible by p whenever p is prime and n is an integer not divisible by p. This theorem is used in many of the simpler tests for primality. The so-called multinomial theorem (described in [2]) gives the expansion of a multinomial to an integer power p > 0, (a1 + a2 + ⋅⋅⋅ + an ) p = p k1 k2 kn a1 a2 ⋅⋅⋅ an . k1 , k2 , ⋅⋅⋅, kn k1 + k2 +⋅⋅⋅+ kn = p
∑
(1)
Here the multinomial coefficient is calculated by p p! . = k1 , k2 , ⋅⋅⋅, kn k1 !k2 !⋅⋅⋅ kn ! (2)
This is a generalization of the familiar binomial theorem to the case where the sum of n terms ( a1 + a2 + + an ) is raised to the power p. In (1), the sum is taken over all , kn such that k1 + k2 + + kn = p .
nonnegative integers k1 , k2 ,
In this capsule, we show that Fermat’s Little Theorem can be derived easily from the multinomial theorem. The following steps provide the derivation. 1. All the multinomial coefficients (2) are positive integers. This is clear from the way in which they arise by repeated multiplication by (a1 + a2 + ⋅⋅⋅ + an ) in (1). 2. There are n values of the multinomial coefficient that equal 1. These occur when all but one of the indices kr = 0 , so that the remaining index equals p. For example, 0, p , 0, p, 0, p! = 1. = , 0 0! 0! p !0! 0!
2
3. With the exception of the n coefficients just listed above, all of the remaining coefficients are divisible by p if p is a prime number. This follows from the fact that (2) is an integer, so the denominator k1 !k2 ! kn ! divides the numerator p ! . Since kr < p for r = 1, 2, , n , the factor p never occurs in the prime factorization of the
denominator k1 !k2 ! kn ! . Therefore, k1 !k2 ! kn ! must divide ( p − 1)! and so p divides the multinomial coefficient. 4. Let each of the ar = 1 for r = 1, 2, (1 + 1
References: [1] Burton, David M., Elementary Theory of Numbers, (4th ed.), McGraw-Hill, New York, NY, 1997, pp. 91-92. [2] R. L. Graham, D. E. Knuth, O. Patashnik, Concrete Mathematics, Addison-Wesley, 1989, pp. 166-172.