User:Travailen/CallAbstractAlgebra

Modular arithmetic
Congruence modulo n, $$a \equiv r\pmod n$$, is the call of cycling group on integers, by Gauss.  Action of finite cyclic group on integers $$\mathbb{Z}$$.  Generally, we have a partition and $$n$$ equivalence classes. On $$\mathbb{Z}$$:
 * The partition on $$\mathbb{Z}$$ is denoted as $$\mathbb{Z}_n$$ or $$\mathbb{Z}/n\mathbb{Z}$$.
 * The equivalence class $$\{ a \}$$ on $$\mathbb{Z}$$ is denoted as $$[r]_n$$, $$0 \leq r \leq n-1$$.
 * $$\{ a \} = [r]_n = \{ nk + r, k \in \mathbb{Z} \}$$. The equivalence class $$[r]_n$$ is a subset of $$\mathbb{Z}$$.
 * $$\{ r: 0 \leq r \leq n-1, r \in \mathbb{Z} \}$$ is the residue set.
 * A partition on $$\mathbb{Z}$$ is thus a set of equivalence classes:
 * $$\mathbb{Z}/n\mathbb{Z} = \{ [r]_n: 0 \leq r \leq n-1; r, n \in \mathbb{Z} \}$$


 * Congruence modulo n $$\pmod{n}$$ is closed under addition and multiplication:
 * The principle: Any integer modulo $$n$$ is in $$\{ r: 0 \leq r \leq n-1, r \in \mathbb{Z} \}$$:
 * $$r_1, r_2 \in \{ r \} \Rightarrow (r_1 + r_2)\!\!\!\!\mod\!\! n \in \{ r \},\ \ (r_1 r_2)\!\!\!\!\mod \!\! n \in \{ r \}$$.


 * Let $$a \equiv r_1\!\!\pmod n,\ \ b \equiv r_2\!\!\pmod n$$:
 * The additive modulo group:
 * $$(a+b)\!\!\!\!\mod\! n = ((pn + r_1)+(qn + r_2))\!\!\!\!\mod\! n = (r_1 + r_2)\!\!\!\!\mod\!\! n \in \{ r \}$$
 * The multiplicative modulo group:
 * $$(a b)\!\!\!\!\mod\! n = ((pn + r_1)(qn + r_2))\!\!\!\!\mod\! n = (r_1 r_2)\!\!\!\!\mod\!\! n \in \{ r \}$$

Fermat's Little Theorem
A theorem of number theory about a prime and its relation to other integers - a congruence modulo relation.


 * The definition of a prime is:
 * $$\exist \ p \in \mathbb{N^+}, \ p > 1 \ni \ \forall \ x \in \mathbb{N^+}, x < p, \ \gcd(p, x) = 1$$.
 * That is, the positive integer which is coprime to all positive integers less than it; number 1 is not a prime by design.
 * This is a relation about a number and the numbers less than it.


 * Fermat's little theorem states a relation of a prime to all other numbers:
 * Let $$p$$ be a prime, then $$(a^p - a)$$ is divisible by $$p$$, $$a \in \mathbb{N^+}$$.
 * That is: $$\exist \ p \in \mathbb{N^+}, \ p > 1 \ni \ \forall \ x \in \mathbb{N^+}, \ x < p, \ \gcd(p, x) = 1 \Rightarrow \forall a \in \mathbb{N^+}, \ a^p \equiv a \pmod{p}$$.
 * The simplest examples are $$3^2 \equiv 3 \pmod{2}$$ and $$2^2 \equiv 2 \pmod{2}$$.


 * Note that, $$(2^2 \equiv 2 \pmod{2}) \cong (2^2 \equiv 0 \pmod{2})$$ introduces the number 0 not in $$\mathbb{N^+}$$, thus we may want to modify the theorem to exclude such a case, to make it more consistent, i.e., to make the theorem a theorem in $$\mathbb{N^+}$$:
 * Let $$p$$ be a prime, then $$(a^p - a)$$ is divisible by $$p$$, for all positive integers $$a$$ not equal to $$p$$.
 * That is: $$\exist \ p \in \mathbb{N^+}, \ p > 1 \ni \ \forall \ x \in \mathbb{N^+},\ x < p, \ \gcd(p, x) = 1 \Rightarrow \forall a \in \mathbb{N^+}, \ a \neq p, \ a^p \equiv a \pmod{p}$$.


 * Thus, it's clear that, Fermat's little theorem states a fact:
 * If $$p$$ is a prime, then for any positive integer $$a, \ a \neq p$$, $$a^p$$ is not divisible by $$p$$, and the remainder will be $$a$$.

The Abstract Algebra of Fermat's Little Theorem
We may wonder how Fermat's little theorem works. In fact, it is a result of permutations of a residue set.
 * The residue set of $$\equiv_5$$ is $$\{ 0, 1, 2, 3, 4\}$$.


 * Multiplying each member with $$4^n$$:
 * $$\times 4^0 \rightarrow \{ 0, 1, 2, 3, 4\}$$.
 * $$\times 4^1 \rightarrow \{ 0, 4, 3, 2, 1\}$$.
 * $$\times 4^2 \rightarrow \{ 0, 1, 2, 3, 4\}$$.
 * $$\times 4^3 \rightarrow \{ 0, 4, 3, 2, 1\}$$.
 * $$\times 4^4 \rightarrow \{ 0, 1, 2, 3, 4\},\ 4^{(5-1)} \equiv 1\!\!\!\! \pmod{5}$$. Permutation cycles here.
 * $$\times 4^5 \rightarrow \{ 0, 4, 3, 2, 1\},\ 4^5 \equiv 4\!\!\!\! \pmod{5}$$.


 * Multiplying each member with $$3^n$$:
 * $$\times 3^0 \rightarrow \{ 0, 1, 2, 3, 4\}$$.
 * $$\times 3^1 \rightarrow \{ 0, 3, 1, 4, 2\}$$.
 * $$\times 3^2 \rightarrow \{ 0, 4, 3, 2, 1\}$$.
 * $$\times 3^3 \rightarrow \{ 0, 2, 4, 1, 3\}$$.
 * $$\times 3^4 \rightarrow \{ 0, 1, 2, 3, 4\},\ 3^{(5-1)} \equiv 1\!\!\!\! \pmod{5}$$. Permutation cycles here.
 * $$\times 3^5 \rightarrow \{ 0, 3, 1, 4, 2\},\ 3^5 \equiv 3\!\!\!\! \pmod{5}$$.


 * Multiplying each member with $$2^n$$:
 * $$\times 2^0 \rightarrow \{ 0, 1, 2, 3, 4\}$$.
 * $$\times 2^1 \rightarrow \{ 0, 2, 4, 1, 3\}$$.
 * $$\times 2^2 \rightarrow \{ 0, 4, 3, 2, 1\}$$.
 * $$\times 2^3 \rightarrow \{ 0, 3, 1, 4, 2\}$$.
 * $$\times 2^4 \rightarrow \{ 0, 1, 2, 3, 4\},\ 2^{(5-1)} \equiv 1\!\!\!\! \pmod{5}$$. Permutation cycles here.
 * $$\times 2^5 \rightarrow \{ 0, 2, 4, 1, 3\},\ 2^5 \equiv 2\!\!\!\! \pmod{5}$$.

For the proof, see Proofs of Fermat's little theorem. Basically, multiplication is iteration of addition, and the residue set is a finite cyclic group.

Euler's and Gauss's Versions of FLT
We see that $$4^{(5-1)} \equiv 1\!\! \pmod{5}$$. Euler has a more general result, it does not require a prime, just coprime can do:
 * $$\forall\ n, a \in \mathbb{N^+}, \gcd(n, a) = 1 \Rightarrow a^{\phi (n)} \equiv 1\!\!\!\! \pmod{n} $$.

$$\phi(n)$$ is Euler's totient function, the count of totatives of $$n$$. Note that number $$1$$ is counted as a coprime number.

If $$n$$ is a prime $$p$$, then $$\phi(p) = p - 1$$, thus we have Gauss's version of FLT:
 * $$a^{(p-1)} \equiv 1\!\!\!\! \pmod{p},\ a \neq p$$

Quadratic Residue, Euler's Criterion, and Decomposition of Quadratic Forms
Fermat's little theorem has something to do with integer decomposition. Let $$p$$ be a prime:
 * $$a^p \equiv a\!\!\! \pmod{p} \Rightarrow a(a^{(p-1)} - 1) = p \times m, m \in \mathbb{N^+}$$

E.g., $$2(2^{(5-1)} - 1) = 2 \times 15 = 5 \times 6$$.  Thus, FLT says that, with a prime $$p$$, for any $$a \in \mathbb{N^+}$$, $$(a^p - a)$$ can always be decomposed into $$p \times m, m \in \mathbb{N^+}$$.

To be more meaningful, Euler said that:
 * $$a^{(p-1)} \equiv 1\!\!\! \pmod{p} \Rightarrow (a - 1)(a^{(p-2)} + a^{(p-3)} + ... + 1) = p \times q,\ q \in \mathbb{N^+}$$