# Difference between revisions of "Fermat's Little Theorem"

m (→Statement: minor) |
(+) |
||

Line 60: | Line 60: | ||

=== Proof 4 (Geometry) === | === Proof 4 (Geometry) === | ||

− | + | <center><asy> | |

+ | void match(int i, int j){ | ||

+ | draw(shift((i,j))*unitsquare,linewidth(1)); | ||

+ | draw(shift((j,i))*unitsquare,linewidth(1)); | ||

+ | draw((i+0.5,j+0.5)--(j+0.5,i+0.5),linewidth(2)); | ||

+ | } | ||

+ | int n = 6; | ||

+ | for(int i = 0; i < n; ++i){ | ||

+ | for(int j = 0; j < n; ++j) | ||

+ | draw(shift((i,j))*unitsquare, linewidth(0.5)); | ||

+ | } | ||

+ | draw((0,0)--(n,n),red+linewidth(2)); match(2,4); match(0,3); | ||

+ | </asy> <asy> | ||

+ | import three; currentprojection = perspective(3,-2,4); | ||

+ | void match(int i, int j, int k){ | ||

+ | draw(shift((i,j,k))*box((0,0,0),(1,1,1)),linewidth(1)); | ||

+ | draw(shift((k,i,j))*box((0,0,0),(1,1,1)),linewidth(1)); | ||

+ | draw(shift((j,k,i))*box((0,0,0),(1,1,1)),linewidth(1)); | ||

+ | draw((i+0.5,j+0.5,k+0.5)--(j+0.5,k+0.5,i+0.5)--(k+0.5,i+0.5,j+0.5)--cycle,linewidth(2)); | ||

+ | } | ||

+ | int n = 4; | ||

+ | for(int i = 0; i < n; ++i){ | ||

+ | for(int j = 0; j < n; ++j) | ||

+ | for(int k = 0; k < n; ++k) | ||

+ | draw(shift((i,j,k))*box((0,0,0),(1,1,1)), linewidth(0.5)); | ||

+ | } | ||

+ | draw((0,0,0)--(n,n,n),red+linewidth(2));match(2,3,1); </asy>For <math>p=2,3</math> and <math>a=6,4</math>, respectively.</center> | ||

We imbed a [[hypercube]] of side length <math>a</math> in <math>\mathbb{R}^p</math> (the <math>p</math>-th dimensional [[Euclidean space]]), such that the vertices of the hypercube are at <math>(\pm a/2,\pm a/2, \ldots, \pm a/2)</math>. A hypercube is essentially a cube, generalized to higher dimensions. This hypercube consists of <math>a^p</math> separate unit hypercubes, with centers consisting of the points | We imbed a [[hypercube]] of side length <math>a</math> in <math>\mathbb{R}^p</math> (the <math>p</math>-th dimensional [[Euclidean space]]), such that the vertices of the hypercube are at <math>(\pm a/2,\pm a/2, \ldots, \pm a/2)</math>. A hypercube is essentially a cube, generalized to higher dimensions. This hypercube consists of <math>a^p</math> separate unit hypercubes, with centers consisting of the points | ||

Line 74: | Line 100: | ||

=== Introductory === | === Introductory === | ||

* Compute some examples, for example find <math>3^{31} \pmod{7}, 29^{25} \pmod{11}</math>, and <math>128^{129} \pmod{17}</math>, and check your answers by calculator where possible. | * Compute some examples, for example find <math>3^{31} \pmod{7}, 29^{25} \pmod{11}</math>, and <math>128^{129} \pmod{17}</math>, and check your answers by calculator where possible. | ||

− | |||

* Let <math>k = 2008^2 + 2^{2008}</math>. What is the units digit of <math>k^2 + 2^k</math>? ([[2008 AMC 12A Problems/Problem 15]]) | * Let <math>k = 2008^2 + 2^{2008}</math>. What is the units digit of <math>k^2 + 2^k</math>? ([[2008 AMC 12A Problems/Problem 15]]) | ||

Line 83: | Line 108: | ||

* One of Euler's conjectures was disproved in the 1960s by three American mathematicians when they showed there was a positive integer such that <math>133^5+110^5+84^5+27^5=n^5</math>. Find the value of <math>{n}</math>. ([[1989 AIME Problems/Problem 9|1989 AIME, #9]])<br><br> | * One of Euler's conjectures was disproved in the 1960s by three American mathematicians when they showed there was a positive integer such that <math>133^5+110^5+84^5+27^5=n^5</math>. Find the value of <math>{n}</math>. ([[1989 AIME Problems/Problem 9|1989 AIME, #9]])<br><br> | ||

− | To solve this problem, it would be nice to know some information about the remainders <math>n</math> can have after division by certain numbers. By Fermat's Little Theorem, we know <math>{n^{5}}</math> is congruent to <math>n</math> [[modulo]] 5. Hence,<br> | + | *If <math>f(x) = x^{x^{x^x}}</math>, find the last two digits of <math>f(17) + f(18) + f(19) + f(20)</math>. ([http://www.princeton.edu/~ahesterb/PUMaC08Problems/C2%20Number%20Theory 2008 PuMAC, NT A#4]) |

+ | |||

+ | === Advanced === | ||

+ | *Show that if <math>p</math> is a prime number, and <math>k</math> is an integer <math>2 \le k \le p</math>, then the sum of the products of each <math>k</math>-element subset of <math>\{1, 2, \ldots, p\}</math> is divisible by <math>p</math>. <br><br> | ||

+ | |||

+ | == Hints/Solutions == | ||

+ | Introductory: | ||

+ | * Hint: For the first example, we have <math>3^6 \equiv 1 \pmod{7}</math> by FLT (Fermat's Little Theorem). It follows that <math>3^{31} = 3 \cdot 3^{30} = 3 \cdot \left(3^{6}\right)^5 \equiv 3 \cdot 1^5 \equiv 3 \pmod{7}</math>. | ||

+ | |||

+ | Intermediate: | ||

+ | * Solution (1989 AIME, 9) To solve this problem, it would be nice to know some information about the remainders <math>n</math> can have after division by certain numbers. By Fermat's Little Theorem, we know <math>{n^{5}}</math> is congruent to <math>n</math> [[modulo]] 5. Hence,<br> | ||

<center><math>3 + 0 + 4 + 7 \equiv n\pmod{5}</math></center> | <center><math>3 + 0 + 4 + 7 \equiv n\pmod{5}</math></center> | ||

<center><math>4 \equiv n\pmod{5}</math></center> | <center><math>4 \equiv n\pmod{5}</math></center> | ||

− | + | <br><br> | |

− | <br><br>Continuing, we examine the equation modulo 3, | + | :Continuing, we examine the equation modulo 3, |

<center><math>-1 + 1 + 0 + 0 \equiv n\pmod{3}</math></center> | <center><math>-1 + 1 + 0 + 0 \equiv n\pmod{3}</math></center> | ||

<center><math>0 \equiv n\pmod{3}</math></center> | <center><math>0 \equiv n\pmod{3}</math></center> | ||

<br><br><br> | <br><br><br> | ||

− | Thus, <math>n</math> is divisible by three and leaves a remainder of four when divided by 5. It's obvious that <math>n>133</math>, so the only possibilities are <math>n = 144</math> or <math>n = 174</math>. It quickly becomes apparent that 174 is much too large, so <math>n</math> must be 144. | + | :Thus, <math>n</math> is divisible by three and leaves a remainder of four when divided by 5. It's obvious that <math>n>133</math>, so the only possibilities are <math>n = 144</math> or <math>n = 174</math>. It quickly becomes apparent that 174 is much too large, so <math>n</math> must be 144. |

− | |||

− | |||

− | + | Advanced: | |

− | * | + | * Hint: try to establish the identity <math>x^{p} - x \equiv x(x-1)(x-2) \cdots (x-(p-1)) \pmod{p}</math>, and then apply [[Vieta's formulas]]. |

− | |||

== See also == | == See also == |

## Revision as of 17:17, 28 February 2010

**Fermat's Little Theorem** is highly useful in number theory for simplifying the computation of exponents in modular arithmetic (which students should study more at the introductory level if they have a hard time following the rest of this article). This theorem is credited to Pierre de Fermat.

## Contents

## Statement

If is an integer, is a prime number and is not divisible by , then .

A frequently used corollary of Fermat's Little Theorem is . As you can see, it is derived by multipling both sides of the theorem by . The restated form is nice because we no longer need to restrict ourselves to integers not divisible by .

This theorem is a special case of Euler's Totient Theorem, which states that if and are integers, then , where denotes Euler's totient function. In particular, for prime numbers . In turn, this is a special case of Lagrange's Theorem.

In contest problems, Fermat's Little Theorem is often used in conjunction with the Chinese Remainder Theorem to simplify tedious calcalutions.

## Proof

We offer several proofs using different techniques to prove the statement . If , then we can cancel a factor of from both sides and retrieve the first version of the theorem.

### Proof 1 (Induction)

The most straightforward way to prove this theorem is by by applying the induction principle. We fix as a prime number. The base case, , is obviously true. Suppose the statement is true. Then, by the binomial theorem,

Note that divides into any binomial coefficient of the form for . This follows by the definition of the binomial coefficient as ; since is prime, then divides the numerator, but not the denominator.

Taken , all of the middle terms disappear, and we end up with . Since we also know that , then , as desired.

### Proof 2 (Inverses)

Let . Then, we claim that the set , consisting of the product of the elements of with , taken modulo , is simply a permutation of . In other words,

Clearly none of the for are divisible by , so it suffices to show that all of the elements in are distinct. Suppose that for . Since , by the cancellation rule, that reduces to , which is a contradiction.

Thus, , we have that the product of the elements of is

Cancelling the factors from both sides, we are left with the statement .

A similar version can be used to prove Euler's Totient Theorem, if we let .

### Proof 3 (Combinatorics)

An illustration of the case .

Consider a necklace with beads, each bead of which can be colored in different ways. There are ways to pick the colors of the beads. of these are necklaces that consists of beads of the same color. Of the remaining necklaces, for each necklace, there are exactly more necklaces that are rotationally equivalent to this necklace. It follows that must be divisible by . Written in another way, .

### Proof 4 (Geometry)

We imbed a hypercube of side length in (the -th dimensional Euclidean space), such that the vertices of the hypercube are at . A hypercube is essentially a cube, generalized to higher dimensions. This hypercube consists of separate unit hypercubes, with centers consisting of the points

where each is an integer from to . Besides the centers of the unit hypercubes in the main diagonal (from to ), the transformation carrying

maps one unit hypercube to a distinct hypercube. Much like the combinatorial proof, this splits the non-main diagonal unit hypercubes into groups of size , from which it follows that . Thus, we have another way to visualize the above combinatorial proof, by imagining the described transformation to be, in a sense, a rotation about the main diagonal of the hypercube.

## Problems

### Introductory

- Compute some examples, for example find , and , and check your answers by calculator where possible.

- Let . What is the units digit of ? (2008 AMC 12A Problems/Problem 15)

- Find mod . (Discussion).

### Intermediate

- One of Euler's conjectures was disproved in the 1960s by three American mathematicians when they showed there was a positive integer such that . Find the value of . (1989 AIME, #9)

- If , find the last two digits of . (2008 PuMAC, NT A#4)

### Advanced

- Show that if is a prime number, and is an integer , then the sum of the products of each -element subset of is divisible by .

## Hints/Solutions

Introductory:

- Hint: For the first example, we have by FLT (Fermat's Little Theorem). It follows that .

Intermediate:

- Solution (1989 AIME, 9) To solve this problem, it would be nice to know some information about the remainders can have after division by certain numbers. By Fermat's Little Theorem, we know is congruent to modulo 5. Hence,

- Continuing, we examine the equation modulo 3,

- Thus, is divisible by three and leaves a remainder of four when divided by 5. It's obvious that , so the only possibilities are or . It quickly becomes apparent that 174 is much too large, so must be 144.

Advanced:

- Hint: try to establish the identity , and then apply Vieta's formulas.