1

I want to know the reason why in Fermat's Little Theorem, we need a prime number. I read it here, but may be it needs more elaboration for me to understand. I can understand that for the combinatorial interpretation of the FlT, with size of circular string being $p$, there are $p$ cyclic permutations (for each indistinguishable, by ordering, permutation) separated by rotations. But, why the division occurs only for $p$ being prime is unclear.

I would like to emphasize that I am not able to understand in abstract algebra terminology.

jiten
  • 4,524

2 Answers2

2

Take $a=2$, $p=4$. We can make $16$ necklaces, of which we throw away $2$. The remaining ones cannot be grouped into sets of $4$, however, because although there are four necklaces each for some designs:

$$BWWW=WBWW=WWBW=WWWB \\ BBWW=WBBW=WWBB=BWWB \\ BBBW=WBBB=BWBB=BBWB,$$

there are only two necklaces representing one of the designs $$BWBW=WBWB.$$

Cases such as this last one can only occur for composite $p$.


After looking at such examples, let's think back to what's going on in the proof. We want to show that the number of necklaces ($a^p-a$) is a multiple of $p$. If we can divide a set of objects evenly into groups of size $p$, then we have proved that the size of the set is a multiple of $p$. In cases where such a division does not occur, we have not proved anything.

In these cases, we have divided $2^3-2$ and $2^5-2$ evenly into groups of size $3$ and $5$, respectively. However, our method of grouping did not result in uniform groups of size $4$ or $6$ when we started with $2^4-2$ or $2^6-2$ necklaces.

The reason the division into groups worked out nicely for $3$ and $5$ was precisely because $3$ and $5$ are prime. The reason it didn't work for $4$ and $6$ can be seen by looking at the cases where it failed: The failure only occurred by exploiting the fact that $4$ and $6$ have factors. If you write out every cyclic permutation of $BWBW$, you get

$$B_1W_1B_2W_2, W_2B_1W_1B_2, B_2W_2B_1W_1, W_1B_2W_2B_1,$$ but two of those are identical, so there are really only $2$. That only happens because $4=2\times 2$, so we can have repetition between the first two beads and the second two.

G Tony Jacobs
  • 31,218
  • Thanks for such an example. It will instigate me into thinking by drawing more examples. But, still satisfying oneself that only prime value of $p$ will help, needs some more details or reasoning. – jiten Nov 25 '17 at 07:35
  • I recommend writing out the cases $a=2,p=3$ and $a=2,p=5$ in full. :) – G Tony Jacobs Nov 25 '17 at 07:37
  • 1
    Take $a=2$, $p=3$. We can make $2^3 = 8$ necklaces, of which we throw away $2$ with $a=1$, i.e. one color only for both strings. The remaining can be grouped in sets of $3$:

    $$BWW=WBW=WWB \ BBW=WBB=BWB \ $$

    Take $a=2$, $p=5$. We can make $2^5 = 32$ necklaces, of which we throw away $2$ strings one color for both strings. The remaining ones can be grouped in sets of $5$ :

    $$BWWWW=WBWWW=WWBWW=WWWBW=WWWWB \ BBWWW=WBBWW=WWBBW=WWWBB=BWWWB\ BBBWW=WBBBW=WWBBB=BWWBB=BBWWB\ BBBBW=WBBBB=BWBBB=BBWBB=BBBWB\ BBWBW=WBBWB=BWBBW=WBWBB=BWBWB\ WWBWB=BWWBW=WBWWB=BWBWW=WBWBW\ $$

    – jiten Nov 25 '17 at 08:05
  • Exactly! See how none of those groups could collapse into repetition, because $3$ and $5$ can’t be split into factors? – G Tony Jacobs Nov 25 '17 at 08:08
  • 1
    So, in order to approach the problem's understanding; I need to conjecture a formula (i.e., the same as FlT) and then use something that fits my understanding (i.e., based on WOP), as M.I. – jiten Nov 25 '17 at 08:10
  • Moving up to $p=6$, the six necklaces representing $BWBWBW$ aren’t really six different necklaces; they’re only two, repeated $3$ times each. – G Tony Jacobs Nov 25 '17 at 08:10
  • The $62$ cases are listed: $$BWWWWW=WBWWWW=WWBWWW=WWWBWW=WWWWBW=WWWWWB,\ BBWWWW=WBBWWW=WWBBWW=WWWBBW =WWWWBB=BWWWWB,\ BBBWWW=WBBBWW=WWBBBW=WWWBBB=BWWWBB=BBWWWB,\ BBBBWW=WBBBBW =WWBBBB=BWWBBB=BBWWBB=BBBWWB,\ BBBBBW=WBBBBB=BWBBBB=BBWBBB=BBBWBB=BBBBWB,\ BWBWBW=WBWBWB,\ BBWBBW=WBBWBB=BWBBWB,\ WWBWWB=BWWBWW=WBWWBW,\ BBWWBB= BBBWWB=BBBBWW=WBBBBW=WWBBBB=BWWBBB,\ BWWWBW=WBWWWB=BWBWWW=WBWBWW=WWBWBW= WWWBWB,\BBWBWW=WBBWBW=WWBBWB=BWWBBW=WBWWBB=BWBWWB,\BBWWBW=WBBWWB=BWBBWW= WBWBBW= WWBWBB=BWWBWB\ $$ But, will the necklaces $BWBWBW$, $WBWBWB$ be repeated three times, is not clear. – jiten Nov 25 '17 at 09:08
  • 1
    I hope you meant that in this case, the $BWBWBW$ permutation has only one other permutation,i.e.$WBWBWB$. – jiten Nov 25 '17 at 10:41
  • In response to your comment concerning no split into factors for the case of $p=3$ and $5$, is there a significance of split for $p=6$ case. That case has one permutation set of $2$, and two sets of size $3$. Also, for the $p=4$ shown by you, there are two permutations in one set. I mean that is there any significance attached to the size of the permutation set and the number of such repeating sets. – jiten Nov 25 '17 at 12:27
  • Yes, there is s significance. That’s exactly the heart of the proof. – G Tony Jacobs Nov 25 '17 at 14:50
  • If all of the permutation sets are of size $p$, that shows that the total number of necklaces is a multiple of $p$, which is what we want to prove. If, on the other hand, there are any permutation sets of sizes other than $p$, then we have not shown that the total number of permutations is a multiple of $p$. Whether or not any permutations sets are smaller than $p$ has everything to do with whether $p$ is prime. – G Tony Jacobs Nov 25 '17 at 15:07
  • But, it still falls short of ascribing any pattern to the number of such permutation groups and their size. Say, for $a=2$ and $p=4$, there is one permutation group (for failure) of size $2$, i.e. there are two elements $BWBW=WBWB$. Similarly, there are $3$ permutation groups for $a=2$ and $p=6$ with $2,3,3$ elements respectively, as shown in my comments for the $p=6$ case above. – jiten Nov 25 '17 at 16:31
  • Or is it that the FlT has a combinatorial interpretation in circular beads of different colors (actually, not all same colors). But, to get a meaning for the number of failures and their 'group' sizes; may need a different sort of interpretation, say based on group theory or any other that 'works'. – jiten Nov 25 '17 at 16:34
  • The purpose of the proof isn't to ascribe a pattern to the cases where the proof breaks down. Your questions was, "why do we need $p$ to be prime?" It should be clear from our discussion that the proof doesn't break down when $p$ is prime, right? – G Tony Jacobs Nov 25 '17 at 16:36
  • Yes, but ascribing a meaning is a natural extension. But, may be this particular interpretation is lesser capable than other equivalent interpretations of FlT, to ascribe a meaning to the failure cases. – jiten Nov 25 '17 at 16:38
  • Ok, but analyzing how the proof breaks down in non-prime cases is no longer a conversation about Fermat's little theorem. The theorem does not address the non-prime cases. – G Tony Jacobs Nov 25 '17 at 16:41
  • Yes, you are right. But, still it fails to dissuade me from thinking about that. May be, some other subject/topic handles that. – jiten Nov 25 '17 at 16:45
  • I don't mean to dissuade you! Counting periodic strings according to the divisors of the string length can lead to some interesting combinatorics! – G Tony Jacobs Nov 25 '17 at 16:47
  • Please shed some more details on that, and if possible a brief indication of how that would link to our issue. – jiten Nov 25 '17 at 16:53
  • 1
    That's an interesting topic, but I think this comment thread is getting rather far afield. Perhaps I'll post the new topic as a new question... – G Tony Jacobs Nov 25 '17 at 16:55
  • Here: https://math.stackexchange.com/questions/2536827/question-arising-from-combinatorial-proof-of-fermats-little-theorem – G Tony Jacobs Nov 25 '17 at 17:08
1

I really like this proof of Fermat's Little Theorem and hopefully by inspecting it you can see why we need the assumption that $p$ is a prime number in the proof.

Consider the reduced residue system modulo $p$, where $p$ is prime. It's $\{1,2,\dots p-1\}$. Multiply all numbers by $a$, s.t. $\gcd(a,p)=1$. Then we obtain the set $\{a,2a,\dots (p-1)a\}$. We'll prove that this set also represent the reduced residue system modulo $p$. It's enough to show that the numbers are unique modulo $p$. If we have that $na \equiv ma \pmod p$. Then we have that $p \mid (n-m)a \implies p \mid (n-m)$, by Euclid's Lemma as $\gcd(a,p) = 1$. But obviously $|n-m| \le p-1$ so we must have $n=m$. Now multiplying all elements from the two reduced residue systems we have:

$$(p-1)! \equiv a \cdot 2a \cdots (p-1)a \equiv a^{p-1}(p-1)!\pmod p \implies a^{p-1} \equiv 1 \pmod p$$

Note that the last implication isn't true in general if $p$ isn't prime, as $n \mid (n-1)!$ for all composite integers $n$. Anyway this proves that the equation $a^{n-1} \equiv 1 \pmod n$ whenever $\gcd(a,n) = 1$ is true for all primes $p$. Unfortunately it's true for some other composite integers too, called Carmichael numbers. So technically it's not a necessary condition that $p$ must be prime. But we know it's true for all primes, so $p$ being prime is a sufficient condition. But the proof that there exist Carmichael Numbers is different and can't be performed in this way, so this proof works only for prime numbers $p$.


Note that if you take $p$ to be any positive integer $n$ in a similar fashion you can prove the Euler's Theorem, i.e. $a^{\phi(n)} \equiv 1 \pmod n$ for $\gcd(a,n) = 1$.

Stefan4024
  • 35,843
  • Please tell the name of this proof approach. – jiten Nov 25 '17 at 09:41
  • @jiten I don't know whether it has a particular name. Little search on the internet gives us that Wikipedia puts it under the modular arithmetics tag. Here's the link https://en.wikipedia.org/wiki/Proofs_of_Fermat%27s_little_theorem – Stefan4024 Nov 25 '17 at 09:47