<?xml version="1.0" encoding="UTF-8"?>

<record version="6" id="223">
 <title>Fermat's theorem proof</title>
 <name>FermatsTheoremProof</name>
 <created>2001-10-15 21:58:59</created>
 <modified>2008-01-30 16:37:57</modified>
 <type>Proof</type>
<parent id="195">Fermat's little theorem</parent>
 <selfproof>0</selfproof>
 <creator id="3" name="drini"/>
 <author id="2872" name="pahio"/>
 <author id="3" name="drini"/>
 <classification>
	<category scheme="msc" code="11-00"/>
 </classification>
 <related>
	<object name="EulerFermatTheorem"/>
	<object name="FermatsLittleTheorem"/>
	<object name="ProofOfEulerFermatTheoremUsingLagrangesTheorem"/>
	<object name="FermatsLittleTheoremProofInductive"/>
 </related>
 <preamble>\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{xypic}</preamble>
 <content>Consider the sequence $a,\,2a,\,\ldots,\,(p-1)a$.

They are all different (modulo $p$), because if $ma=na$ with $1\le m&lt;n\le p-1$ then
$0=a(m-n)$, and since\, $p\nmid a$, we get $p\mid(m-n)$,\, which is impossible.

Now, since all these numbers are different, the set \,$\{a,\,2a,\,3a,\,\ldots,\,(p-1)a\}$\, will have the $p-1$ possible congruence classes (although not necessarily in the same order) and therefore 
$$a\cdot2a\cdot3a\cdots (p-1)a\equiv (p-1)!a^{p-1}\equiv (p-1)!\pmod{p}$$
and using\, $\gcd((p-1)!,\;p)=1$\, we get
$$a^{p-1}\equiv 1\pmod{p}.$$</content>
</record>
