Shrug

L'arithmétique modulaire - Partie 1

#Bowie41#crypto#rsa

Note: au cours de ce wiki, je vais utiliser de nombreuses notations mathématiques, il n'est pas grave de ne pas les comprendre :)

Introduction

L'arithmétique modulaire est une branche des mathématiques qui s'interesse aux entiers relatifs

L'ensemble des entiers relatifs est noté Z\mathbb{Z}

Il contient tous les nombres entiers de -\infty à ++\infty

Par exemple :

  • 42Z\textcolor{#DBAE24}{-42} \in \mathbb{Z}
  • 67Z\textcolor{#DBAE24}{67} \in \mathbb{Z}
  • 5.3Z\textcolor{#DBAE24}{5.3} \notin \mathbb{Z}
  • πZ\textcolor{#DBAE24}{\pi} \notin \mathbb{Z}

Note: "\in" veut dire "appartient à", on dit qu'un nombre appartient à un ensemble si on peut le trouver dans cet ensemble.

Divisibilité

Définition

L'arithmétique modulaire s'interesse particulièrement à la divisibilité. On dit que "a divise b" si et seulement si il existe q entier tel que :

b=qa\textcolor{#DBAE24}{b} = \textcolor{#DBAE24}{q} \cdot \textcolor{#DBAE24}{a}

En notations mathématiques, on écrit :

abqZtel queb=qa\textcolor{#DBAE24}{a} \mid \textcolor{#DBAE24}{b} \Leftrightarrow \exists \textcolor{#DBAE24}{q} \in \mathbb{Z} \: \text{tel que} \: \textcolor{#DBAE24}{b} = \textcolor{#DBAE24}{q} \cdot \textcolor{#DBAE24}{a}

Exemples

  • 2 divise 42 car 42=122\textcolor{#DBAE24}{42} = \textcolor{#DBAE24}{12} \cdot \textcolor{#DBAE24}{2} -> On a donc bien q=12\textcolor{#DBAE24}{q} = \textcolor{#DBAE24}{12} et 12Z\textcolor{#DBAE24}{12} \in \mathbb{Z}
  • -11 divise 121 car 121=1111\textcolor{#DBAE24}{121} = \textcolor{#DBAE24}{-11} \cdot \textcolor{#DBAE24}{-11} -> On a donc bien q=11\textcolor{#DBAE24}{q} = \textcolor{#DBAE24}{-11} et 11Z\textcolor{#DBAE24}{-11} \in \mathbb{Z}
  • 5 ne divise pas 22 car il n'existe pas de qq entier tel que 22=q5\textcolor{#DBAE24}{22} = \textcolor{#DBAE24}{q} \cdot \textcolor{#DBAE24}{5}
    On note alors : 522\textcolor{#DBAE24}{5} \nmid \textcolor{#DBAE24}{22}

Division euclidienne

Définition

L'arithmétique modulaire utilise souvent la division euclidienne.

Exemples

  • La division euclidienne de 10 par 5 est: 10502\begin{array}{r|r} \textcolor{#DBAE24}{10}&\textcolor{#DBAE24}{5} \\ \textcolor{#DBAE24}{0}&\textcolor{#DBAE24}{2} \\ \end{array}

  • La division euclidienne de 20 par 3 est : 20326\begin{array}{r|r} \textcolor{#DBAE24}{20}&\textcolor{#DBAE24}{3} \\ \textcolor{#DBAE24}{2}&\textcolor{#DBAE24}{6} \\ \end{array}

  • La division euclidienne de 43 par -5 : 43538\begin{array}{r|r} \textcolor{#DBAE24}{43}&\textcolor{#DBAE24}{-5} \\ \textcolor{#DBAE24}{3}&\textcolor{#DBAE24}{-8} \\ \end{array}

On dit alors que pour tout couple (a,b)(\textcolor{#DBAE24}{a},\textcolor{#DBAE24}{b}) de Z2\mathbb{Z}^2 avec a0\textcolor{#DBAE24}{a} \neq \textcolor{#DBAE24}{0} (on ne divise jamais par 00) il existe un couple (ou plusieurs) (q,r)(\textcolor{#DBAE24}{q},\textcolor{#DBAE24}{r}) de Z2\mathbb{Z}^2 tel que :

b=qa+r\textcolor{#DBAE24}{b} = \textcolor{#DBAE24}{q} \cdot \textcolor{#DBAE24}{a} + \textcolor{#DBAE24}{r}

Note: Z2\mathbb{Z}^2 est l'ensemble des couples (x,y)(\textcolor{#DBAE24}{x},\textcolor{#DBAE24}{y}) avec xZ\textcolor{#DBAE24}{x} \in \mathbb{Z} et yZ\textcolor{#DBAE24}{y} \in \mathbb{Z}

Et en notations mathématiques :

(a,b)Z2,a0,(q,r)Z2tel queb=qa+r\forall (\textcolor{#DBAE24}{a},\textcolor{#DBAE24}{b}) \in \mathbb{Z}^2 ,\textcolor{#DBAE24}{a} \neq \textcolor{#DBAE24}{0}, \: \exists (\textcolor{#DBAE24}{q},\textcolor{#DBAE24}{r}) \in \mathbb{Z}^2 \: \text{tel que} \: \textcolor{#DBAE24}{b} = \textcolor{#DBAE24}{q} \cdot \textcolor{#DBAE24}{a} + \textcolor{#DBAE24}{r}

Exemples

  • Pour (a,b)=(5,10)(\textcolor{#DBAE24}{a},\textcolor{#DBAE24}{b}) = (\textcolor{#DBAE24}{5},\textcolor{#DBAE24}{10}) on trouve (q,r)=(2,0)(\textcolor{#DBAE24}{q},\textcolor{#DBAE24}{r}) = (\textcolor{#DBAE24}{2},\textcolor{#DBAE24}{0}) : 10502\begin{array}{r|r} \textcolor{#DBAE24}{10}&\textcolor{#DBAE24}{5} \\ \textcolor{#DBAE24}{0}&\textcolor{#DBAE24}{2} \\ \end{array} on vérifie : 10=25+0\textcolor{#DBAE24}{10} = \textcolor{#DBAE24}{2} \cdot \textcolor{#DBAE24}{5} + \textcolor{#DBAE24}{0}

  • Pour (a,b)=(3,20)(\textcolor{#DBAE24}{a},\textcolor{#DBAE24}{b}) = (\textcolor{#DBAE24}{3},\textcolor{#DBAE24}{20}) on trouve (q,r)=(6,2)(\textcolor{#DBAE24}{q},\textcolor{#DBAE24}{r}) = (\textcolor{#DBAE24}{6},\textcolor{#DBAE24}{2}) : 20326\begin{array}{r|r} \textcolor{#DBAE24}{20}&\textcolor{#DBAE24}{3} \\ \textcolor{#DBAE24}{2}&\textcolor{#DBAE24}{6} \\ \end{array} on vérifie : 20=63+2\textcolor{#DBAE24}{20} = \textcolor{#DBAE24}{6} \cdot \textcolor{#DBAE24}{3} + \textcolor{#DBAE24}{2}

  • Pour (a,b)=(5,43)(\textcolor{#DBAE24}{a},\textcolor{#DBAE24}{b}) = (\textcolor{#DBAE24}{-5},\textcolor{#DBAE24}{43}) on trouve (q,r)=(8,3)(\textcolor{#DBAE24}{q},\textcolor{#DBAE24}{r}) = (\textcolor{#DBAE24}{-8},\textcolor{#DBAE24}{3}) : 43583\begin{array}{r|r} \textcolor{#DBAE24}{43}&\textcolor{#DBAE24}{-5} \\ \textcolor{#DBAE24}{-8}&\textcolor{#DBAE24}{3} \\ \end{array} on vérifie : 43=85+3\textcolor{#DBAE24}{43} = \textcolor{#DBAE24}{-8} \cdot \textcolor{#DBAE24}{-5} + \textcolor{#DBAE24}{3}

Congruences

Définition

Les congruences se conecntrent uniquement sur l'anayse du reste de la division euclidienne.

Pour tout 4-uplet (a,b,q,r)Z4(\textcolor{#DBAE24}{a},\textcolor{#DBAE24}{b},\textcolor{#DBAE24}{q},\textcolor{#DBAE24}{r}) \in \mathbb{Z}^4 avec a0 \textcolor{#DBAE24}{a} \neq \textcolor{#DBAE24}{0} et b=qa+r\textcolor{#DBAE24}{b} = \textcolor{#DBAE24}{q} \cdot \textcolor{#DBAE24}{a} + \textcolor{#DBAE24}{r} on note :

br(moda)\textcolor{#DBAE24}{b} \equiv \textcolor{#DBAE24}{r} \pmod {\textcolor{#DBAE24}{a}}

En notations mathématiques :

(a,b,q,r)Z4,(a0,b=qa+r)br(moda)\forall (\textcolor{#DBAE24}{a},\textcolor{#DBAE24}{b},\textcolor{#DBAE24}{q},\textcolor{#DBAE24}{r}) \in \mathbb{Z}^4, \: \bigl( \textcolor{#DBAE24}{a} \neq \textcolor{#DBAE24}{0} \: , \textcolor{#DBAE24}{b} = \textcolor{#DBAE24}{q} \cdot \textcolor{#DBAE24}{a} + \textcolor{#DBAE24}{r} \bigr) \Longrightarrow \textcolor{#DBAE24}{b} \equiv \textcolor{#DBAE24}{r} \pmod {\textcolor{#DBAE24}{a}}

Exemples

  • 100(mod5)\textcolor{#DBAE24}{10} \equiv \textcolor{#DBAE24}{0} \pmod {\textcolor{#DBAE24}{5}} car 10=25+0\textcolor{#DBAE24}{10} = \textcolor{#DBAE24}{2} \cdot \textcolor{#DBAE24}{5} + \textcolor{#DBAE24}{0}
  • 202(mod3)\textcolor{#DBAE24}{20} \equiv \textcolor{#DBAE24}{2} \pmod {\textcolor{#DBAE24}{3}} car 20=63+2\textcolor{#DBAE24}{20} = \textcolor{#DBAE24}{6} \cdot \textcolor{#DBAE24}{3} + \textcolor{#DBAE24}{2}
  • 433(mod5)\textcolor{#DBAE24}{43} \equiv \textcolor{#DBAE24}{3} \pmod {\textcolor{#DBAE24}{-5}} car 43=85+3\textcolor{#DBAE24}{43} = \textcolor{#DBAE24}{-8} \cdot \textcolor{#DBAE24}{-5} + \textcolor{#DBAE24}{3}

Propriétés

  • La congruence est stable par addition :
    six1y1(modn)etx2y2(modn)alorsx1+x2y1+y2(modn)\text{si} \:\: \textcolor{#DBAE24}{x_{1}} \equiv \textcolor{#DBAE24}{y_{1}} \pmod {\textcolor{#DBAE24}{n}} \newline \text{et} \:\: \textcolor{#DBAE24}{x_{2}} \equiv \textcolor{#DBAE24}{y_{2}} \pmod {\textcolor{#DBAE24}{n}} \newline \text{alors} \:\: \textcolor{#DBAE24}{x_{1}} + \textcolor{#DBAE24}{x_{2}} \equiv \textcolor{#DBAE24}{y_{1}} + \textcolor{#DBAE24}{y_{2}} \pmod {\textcolor{#DBAE24}{n}}

  • La congruence est stable par produit :
    six1y1(modn)etx2y2(modn)alorsx1x2y1y2(modn)\text{si} \:\: \textcolor{#DBAE24}{x_{1}} \equiv \textcolor{#DBAE24}{y_{1}} \pmod {\textcolor{#DBAE24}{n}} \newline \text{et} \:\: \textcolor{#DBAE24}{x_{2}} \equiv \textcolor{#DBAE24}{y_{2}} \pmod {\textcolor{#DBAE24}{n}} \newline \text{alors} \:\: \textcolor{#DBAE24}{x_{1}} \cdot \textcolor{#DBAE24}{x_{2}} \equiv \textcolor{#DBAE24}{y_{1}} \cdot \textcolor{#DBAE24}{y_{2}} \pmod {\textcolor{#DBAE24}{n}}

  • La congruence est stable par passage a la puissance :
    six1y1(modn)alorsx1ky1k(modn)pour tout k entier0\text{si} \:\: \textcolor{#DBAE24}{x_{1}} \equiv \textcolor{#DBAE24}{y_{1}} \pmod {\textcolor{#DBAE24}{n}} \newline \text{alors} \:\: \textcolor{#DBAE24}{x_{1}}^{\textcolor{#DBAE24}{k}} \equiv \textcolor{#DBAE24}{y_{1}}^{\textcolor{#DBAE24}{k}} \pmod {\textcolor{#DBAE24}{n}} \: \text{pour tout k entier} \ge 0

En notations mathématiques :

  • (x1,y1,x2,y2,n)Z5,(n0,x1y1(modn),x2y2(modn))x1+x2y1+y2(modn)\forall (\textcolor{#DBAE24}{x_1},\textcolor{#DBAE24}{y_1}, \textcolor{#DBAE24}{x_2},\textcolor{#DBAE24}{y_2}, \textcolor{#DBAE24}{n}) \in \mathbb{Z}^5 , \bigl( {\textcolor{#DBAE24}{n}} \neq \textcolor{#DBAE24}{0},\: \textcolor{#DBAE24}{x_{1}} \equiv \textcolor{#DBAE24}{y_{1}} \pmod {\textcolor{#DBAE24}{n}},\: \textcolor{#DBAE24}{x_{2}} \equiv \textcolor{#DBAE24}{y_{2}} \pmod {\textcolor{#DBAE24}{n}} \bigr) \newline \Rightarrow \textcolor{#DBAE24}{x_{1}} + \textcolor{#DBAE24}{x_{2}} \equiv \textcolor{#DBAE24}{y_{1}} + \textcolor{#DBAE24}{y_{2}} \pmod {\textcolor{#DBAE24}{n}}

  • (x1,y1,x2,y2,n)Z5,(n0,x1y1(modn),x2y2(modn))x1x2y1y2(modn)\forall (\textcolor{#DBAE24}{x_1},\textcolor{#DBAE24}{y_1}, \textcolor{#DBAE24}{x_2},\textcolor{#DBAE24}{y_2}, \textcolor{#DBAE24}{n}) \in \mathbb{Z}^5 , \bigl( {\textcolor{#DBAE24}{n}} \neq \textcolor{#DBAE24}{0},\: \textcolor{#DBAE24}{x_{1}} \equiv \textcolor{#DBAE24}{y_{1}} \pmod {\textcolor{#DBAE24}{n}},\: \textcolor{#DBAE24}{x_{2}} \equiv \textcolor{#DBAE24}{y_{2}} \pmod {\textcolor{#DBAE24}{n}} \bigr) \newline \Rightarrow \textcolor{#DBAE24}{x_{1}} \cdot \textcolor{#DBAE24}{x_{2}} \equiv \textcolor{#DBAE24}{y_{1}} \cdot \textcolor{#DBAE24}{y_{2}} \pmod {\textcolor{#DBAE24}{n}}

  • (x1,y1,n)Z3,(n0,x1y1(modn))kNx1ky1k(modn)\forall (\textcolor{#DBAE24}{x_1},\textcolor{#DBAE24}{y_1}, \textcolor{#DBAE24}{n}) \in \mathbb{Z}^3 , \bigl( {\textcolor{#DBAE24}{n}} \neq \textcolor{#DBAE24}{0},\: \textcolor{#DBAE24}{x_{1}} \equiv \textcolor{#DBAE24}{y_{1}} \pmod {\textcolor{#DBAE24}{n}} \bigr) \newline \Rightarrow \forall \textcolor{#DBAE24}{k} \in \mathbb{N} \:\: \textcolor{#DBAE24}{x_{1}}^{\textcolor{#DBAE24}{k}} \equiv \textcolor{#DBAE24}{y_{1}}^{\textcolor{#DBAE24}{k}} \pmod {\textcolor{#DBAE24}{n}}

Promis ça sera plus fun après mais faut bien commencer quelque part :3