# Proof of Fermat's little theorem using groups

I am trying to prove Fermat's little theorem using groups. Here is my proof:

Let $p$ be a prime. Since all numbers a such that $1\leq a\leq p-1$ are relatively prime with $p$, they form a group under multiplication modulo $p$.(There is a theorem about this, that must be true, they should be forming a group). So, let the group be $G=\{a,a^2,\dots,a^{p-1}\}$ and binary operation is multiplication modulo $p$. Since all elements of this group are relatively prime with $p$, then any element $a \in G$ is a generator of this group, and this group is cyclic. So, we must have $a \cdot a^{p-1}=a \bmod p$. Then multiplying each sides with $a{-1}$ (which exists since this is a group) we get $a^{p-1}=1 \bmod p$.

Is there any mistake in my proof? I appreciate your helps. Thank you

• Knowing that the group is of order $p-1$ is not the same as knowing that the group is generated by a single element. It's true that this group is generated by a single element, $a$, but proving that is a bit harder than proving little Fermat... – Thomas Andrews Mar 18 '13 at 15:58
• Or maybe you mean that $G$ is the subgroup of the full group generated by $a$. It is still not true that if $a$ generates a subgroup, then $a^2$ generates the same subgroup. For example, when $p=2$, the set of powers of $2\equiv 3^2$ is not the same as the set of powers of $3$. – Thomas Andrews Mar 18 '13 at 16:04
• – lhf Mar 18 '13 at 16:35

As pointed out by Thomas Andrews, one cannot assume that $a$ generates the group (extreme example: $a=1$).

However, $a$ does generate a subgroup, and the order of that subgroup divides $p-1$. That will yield a proof.

There is an elementary proof, that works for abelian groups, and does not require Lagrange or any facts about group orders.

Let $G$ be a finite abelian group of order $n$. Let $a \in G$. The map $x \mapsto a x$ is a permutation of $G$. Thus $$\prod_{x \in G} x = \prod_{x \in G} a x = a^n \cdot \prod_{x \in G} x,$$ where we have used the fact that $G$ is abelian.

It follows $a^n = 1$.

• I wish I knew how to prove that for non-abelian groups without using Lagrange's theorem. – lhf Mar 18 '13 at 17:40

You're close yet you chose to do things harder: you have a group of order $\,p-1\,$ so any element to the power the order's group, i.e. to the $\,(p-1)$-th power, is the unity, $\,1\,$