Đinh ly nho cua Fermat (hay đinh ly Fermat nho - phan biet voi đinh ly Fermat lon) khang đinh rang neu 
  
    
      
        p
      
    
    {\displaystyle p}
  
 la mot so nguyen to, thi voi so nguyen 
  
    
      
        a
      
    
    {\displaystyle a}
  
 bat ky, 
  
    
      
        
          a
          
            p
          
        
        −
        a
      
    
    {\displaystyle a^{p}-a}
  
 se chia het cho 
  
    
      
        p
      
    
    {\displaystyle p}
  
. Bang ki hieu đong du ta co:

  
    
      
        
          a
          
            p
          
        
        ≡
        a
        
          
          (
          mod
          
          p
          )
        
        
        
      
    
    {\displaystyle a^{p}\equiv a{\pmod {p}}\,\!}
  

Vi du: voi 
  
    
      
        a
        =
        3
        ,
        
        p
        =
        5
        
        ⟹
        
        
          3
          
            5
          
        
        −
        3
        =
        240
        ≡
        0
        
          
          (
          mod
          
          5
          )
        
      
    
    {\displaystyle a=3,\;p=5\implies 3^{5}-3=240\equiv 0{\pmod {5}}}
  
.
Mot cach phat bieu khac cua đinh ly nhu sau: neu 
  
    
      
        p
      
    
    {\displaystyle p}
  
 la so nguyen to va 
  
    
      
        a
      
    
    {\displaystyle a}
  
 la so nguyen khong chia het cho 
  
    
      
        p
      
    
    {\displaystyle p}
  
, thi 
  
    
      
        
          a
          
            p
            −
            1
          
        
        −
        1
      
    
    {\displaystyle a^{p-1}-1}
  
 se chia het cho 
  
    
      
        p
      
    
    {\displaystyle p}
  
. Nghia la:

  
    
      
        
          a
          
            p
            −
            1
          
        
        ≡
        1
        
          
          (
          mod
          
          p
          )
        
        
        
      
    
    {\displaystyle a^{p-1}\equiv 1{\pmod {p}}\,\!}
  

Vi du: voi 
  
    
      
        a
        =
        4
        ,
        p
        =
        5
        
        ⟹
        
        
          4
          
            5
            −
            1
          
        
        −
        1
        =
        255
        ≡
        0
        
          
          (
          mod
          
          5
          )
        
      
    
    {\displaystyle a=4,p=5\implies 4^{5-1}-1=255\equiv 0{\pmod {5}}}
  

Cung co mot cach phat bieu khac la: Neu 
  
    
      
        p
      
    
    {\displaystyle p}
  
 la mot so nguyen to va 
  
    
      
        a
      
    
    {\displaystyle a}
  
 la so nguyen khong chia het cho 
  
    
      
        p
      
    
    {\displaystyle p}
  
, thi 
  
    
      
        
          a
          
            p
            −
            1
          
        
        −
        1
      
    
    {\displaystyle a^{p-1}-1}
  
 chia het cho 
  
    
      
        p
      
    
    {\displaystyle p}
  
.
Đinh ly Fermat nho la co so đe kiem tra tinh nguyen to theo xac suat trong kiem tra Fermat va la mot trong nhung ket qua nen tang cua ly thuyet so.


Lich su Pierre de Fermat la nguoi đau tien phat bieu đinh ly trong mot buc thu gui ngay 18 thang 10 nam 1640 cho nguoi ban tri ki Frenicle de Bessy. Y kien cua ong tuong đuong voi cau sau:

Neu 
  
    
      
        p
      
    
    {\displaystyle p}
  
 la so nguyen to va 
  
    
      
        a
      
    
    {\displaystyle a}
  
 la mot so nguyen khong chia het cho 
  
    
      
        p
      
    
    {\displaystyle p}
  
 thi 
  
    
      
        
          a
          
            p
            −
            1
          
        
        −
        1
      
    
    {\displaystyle a^{p-1}-1}
  
 se chia het cho 
  
    
      
        p
      
    
    {\displaystyle p}
  
.

Thuc te, phat bieu goc la

Tout nombre premier mesure infailliblement une des puissances – 1 de quelque progression que ce soit, et l'exposant de la dite puissance est sous-multiple du nombre premier donne – 1; et, apres qu'on a trouve la premiere puissance qui satisfait a la question, toutes celles dont les exposants sont multiples de l'exposant de la premiere satisfont tout de meme a la question.

Nhu thuong le, Fermat khong chung minh đinh ly nay ma chi thong bao:

Et cette proposition est generalement vraie en toutes progressions et en tous nombres premiers; de quoi je vous envoierois la demonstration, si je n'apprehendois d'etre trop long.
(And this proposition is generally true for all series [sic] and for all prime numbers; I would send you a demonstration of it, if I did not fear going on for too long.) (Tam dich: Menh đe nay la đung voi moi day [sic] va voi moi so nguyen to; Neu khong phai chung minh cua no qua dai thi toi đa gui no cho ban.)
Euler lan đau tien cong bo mot chung minh vao nam 1736 trong bai bao tua đe "Theorematum Quorundam ad Numeros Primos Spectantium Demonstratio" trong to Proceedings cua Vien St. Petersburg, nhung Leibniz đa co chung minh voi y tuong tuong tu trong ban thao khong đuoc cong bo vao khoang truoc nam 1683.
Ten goi "đinh ly nho cua Fermat" đuoc dung lan đau vao nam 1913 trong Zahlentheorie boi Kurt Hensel:

Fur jede endliche Gruppe besteht nun ein Fundamentalsatz, welcher der kleine Fermatsche Satz genannt zu werden pflegt, weil ein ganz spezieller Teil desselben zuerst von Fermat bewiesen worden ist.
(There is a fundamental theorem holding in every finite group, usually called Fermat's little theorem because Fermat was the first to have proved a very special part of it.) (Tam dich: Co mot đinh ly nen tang trong moi nhom huu han, thuong đuoc goi la đinh ly nho cua Fermat vi Fermat la nguoi đau tien đa chung minh đuoc mot phan rat đac biet cua no.)


= Lich su xa hon =

Mot cach đoc lap cac nha toan hoc Trung Quoc đua ra mot gia thuyet (thuong goi la gia thiet Trung Quoc) rang 
  
    
      
        p
        
      
    
    {\displaystyle p\,}
  
 la mot so nguyen to thi 
  
    
      
        
          2
          
            p
          
        
        ≡
        2
        
          
          (
          mod
          
          p
          )
        
        
      
    
    {\displaystyle 2^{p}\equiv 2{\pmod {p}}\,}
  
. Đung la neu 
  
    
      
        p
        
      
    
    {\displaystyle p\,}
  
 la so nguyen to, thi 
  
    
      
        
          2
          
            p
          
        
        ≡
        2
        
          
          (
          mod
          
          p
          )
        
        
      
    
    {\displaystyle 2^{p}\equiv 2{\pmod {p}}\,}
  
. Đay la truong hop đac biet cua đinh ly nho cua Fermat. Tuy the, đieu nguoc lai (neu 
  
    
      
        
        
          2
          
            p
          
        
        ≡
        2
        
          
          (
          mod
          
          p
          )
        
      
    
    {\displaystyle \,2^{p}\equiv 2{\pmod {p}}}
  
 thi 
  
    
      
        p
        
      
    
    {\displaystyle p\,}
  
 la so nguyen to) la sai. Chang han, 
  
    
      
        
          2
          
            341
          
        
        ≡
        2
        
          
          (
          mod
          
          341
          )
        
        
      
    
    {\displaystyle 2^{341}\equiv 2{\pmod {341}}\,}
  
, nhung 
  
    
      
        341
        =
        11
        ×
        31
      
    
    {\displaystyle 341=11\times 31}
  
 la hop so (goi la so gia nguyen to [pseudoprime]).


Chung minh Neu 
  
    
      
        (
        a
        ,
        p
        )
        =
        1
      
    
    {\displaystyle (a,p)\neq 1}
  
 thi hien nhien 
  
    
      
        
          a
          
            p
          
        
        ≡
        a
        ≡
        0
        
          
          (
          mod
          
          p
          )
        
      
    
    {\displaystyle a^{p}\equiv a\equiv 0{\pmod {p}}}
  
. 
Neu 
  
    
      
        (
        a
        ,
        p
        )
        =
        1
      
    
    {\displaystyle (a,p)=1}
  
, 
liet ke  
  
    
      
        p
        −
        1
      
    
    {\displaystyle p-1}
  
 boi cua 
  
    
      
        a
      
    
    {\displaystyle a}
  
:

  
    
      
        a
        ,
        2
        a
        ,
        3
        a
        ,
        .
        .
        .
        ,
        (
        p
        −
        1
        )
        a
      
    
    {\displaystyle a,2a,3a,...,(p-1)a}
  
, cac so nay đeu phai nguyen to cung nhau voi p 
Gia su ton tai : 
  
    
      
        n
        a
        ≡
        m
        a
        
          
          (
          mod
          
          p
          )
        
      
    
    {\displaystyle na\equiv ma{\pmod {p}}}
  
, voi  
  
    
      
        p
        −
        1
        ≥
        n
        >
        m
        ≥
        1
      
    
    {\displaystyle p-1\geq n>m\geq 1}
  
,

  
    
      
        a
        (
        n
        −
        m
        )
        ≡
        0
        
          
          (
          mod
          
          p
          )
        
        ⇒
        n
        −
        m
        ≡
        0
        
          
          (
          mod
          
          p
          )
        
      
    
    {\displaystyle a(n-m)\equiv 0{\pmod {p}}\Rightarrow n-m\equiv 0{\pmod {p}}}
  
.
do cach chon m,n thi đieu nay khong the xay ra,
nen cac so  
  
    
      
        n
        a
        (
        n
        =
        1
        ,
        2
        ,
        .
        .
        .
        ,
        p
        −
        1
        )
      
    
    {\displaystyle na(n=1,2,...,p-1)}
  
 lap thanh he thang du thu gon modulo p
Nhan tung so voi nhau, ta đuoc:

  
    
      
        a
        ×
        2
        a
        ×
        3
        a
        ×
        .
        .
        .
        ×
        (
        p
        −
        1
        )
        a
        ≡
        (
        p
        −
        1
        )
        !
        
          
          (
          mod
          
          p
          )
        
      
    
    {\displaystyle a\times 2a\times 3a\times ...\times (p-1)a\equiv (p-1)!{\pmod {p}}}
  
.
Hay

  
    
      
        
          a
          
            p
            −
            1
          
        
        ×
        (
        p
        −
        1
        )
        !
        ≡
        (
        p
        −
        1
        )
        !
        
          
          (
          mod
          
          p
          )
        
        ⟹
        
          a
          
            p
            −
            1
          
        
        ≡
        1
        
          
          (
          mod
          
          p
          )
        
        ⇒
        
          a
          
            p
          
        
        ≡
        a
        
          
          (
          mod
          
          p
          )
        
      
    
    {\displaystyle a^{p-1}\times (p-1)!\equiv (p-1)!{\pmod {p}}\Longrightarrow a^{p-1}\equiv 1{\pmod {p}}\Rightarrow a^{p}\equiv a{\pmod {p}}}
  
 
  
    
      
        ◻
      
    
    {\displaystyle \Box }
  

Fermat phat bieu đinh ly ma khong chung minh. Đa co nhieu chung minh cua đinh ly. Tuy nhien đinh ly thuong đuoc chung minh bang cach dung he qua cua đinh ly Euler.


Tong quat hoa Mot dang tong quat cua đinh ly nay la: neu p la so nguyen to va m va n la cac so nguyen duong thoa man 
  
    
      
        m
        ≡
        n
        
          
          (
          mod
          
          p
          −
          1
          )
        
        
      
    
    {\displaystyle m\equiv n{\pmod {p-1}}\,}
  
, thi 
  
    
      
        ∀
        a
        ∈
        
          Z
        
        :
        
        
          a
          
            m
          
        
        ≡
        
          a
          
            n
          
        
        
          
          (
          mod
          
          p
          )
        
        .
      
    
    {\displaystyle \forall a\in \mathbb {Z} :\quad a^{m}\equiv a^{n}{\pmod {p}}.}
  
.
Đinh ly Fermat con đuoc tong quat hoa boi Đinh ly Euler: voi modulo n bat ky va so nguyen a bat ky la so nguyen to cung nhau voi n, ta co

  
    
      
        
          a
          
            φ
            (
            n
            )
          
        
        ≡
        1
        
          
          (
          mod
          
          n
          )
        
      
    
    {\displaystyle a^{\varphi (n)}\equiv 1{\pmod {n}}}
  

trong đo φ(n) la ky hieu cua phi ham Euler đem so cac so nguyen giua 1 va n nguyen to cung nhau voi n. Đay la tong quat hoa cua đinh ly nho Fermat vi neu n = p la so nguyen to thi φ(p) = p − 1.
Tong quat hon nua la Đinh ly Carmichael.
Mot đinh ly khac tong quat hoa cua no nam trong cac truong huu han.


He qua đao Luan điem đao cua đinh ly nho Fermat la khong đung do no sai voi cac so Carmichael. Tuy vay dang chinh xac hon cua đinh ly la đung voi ten goi la đinh ly Lehmer. Đinh ly đo đuoc phat bieu nhu sau:
Neu ton tai so nguyen a sao cho

  
    
      
        
          a
          
            p
            −
            1
          
        
        ≡
        1
        
          
          (
          mod
          
          p
          )
        
      
    
    {\displaystyle a^{p-1}\equiv 1{\pmod {p}}}
  

va voi moi so nguyen to q la uoc so cua p − 1 đe

  
    
      
        
          a
          
            (
            p
            −
            1
            )
            
              /
            
            q
          
        
        ≡
        1
        
          
          (
          mod
          
          p
          )
        
      
    
    {\displaystyle a^{(p-1)/q}\not \equiv 1{\pmod {p}}}
  
,
thi p la so nguyen to.
Đinh ly nay tao nen tang cho phep kiem tra Lucas–Lehmer, mot phep kiem tra tinh nguyen to quan trong.


So gia nguyen to Neu p la hop so va co so nguyen a sao cho 
  
    
      
        
        
          a
          
            p
            −
            1
          
        
        −
        1
      
    
    {\displaystyle \,a^{p-1}-1}
  
 chia het cho p, thi p đuoc goi la so gia nguyen to co so a. F. Sarrmus vao nam 1820 đa tim thay 341 = 11×31 la so gia nguyen to đau tien,voi co so 2.
Mot so p la so gia nguyen to co so a voi moi (a,p)=1 thi đuoc goi la so Carmichael (chang han 561).


Xem them Đinh ly cuoi cung cua Fermat
Thuong so Fermat


Tham khao Lien ket ngoai Fermat's theorem (mathematics) tai Encyclopædia Britannica (tieng Anh)
Fermat's Little Theorem
Euler Function and Theorem
Fermat's Little Theorem and Sophie's Proof
Vuon Toan: modulo - Phan 5