\( \definecolor{colordef}{RGB}{249,49,84} \definecolor{colorprop}{RGB}{18,102,241} \)
CommeUnJeu · L2 MP

Discrete random variables

⌚ ~67 min ▢ 8 blocks ✓ 17 exercises Prerequisites : Random variables on a finite universe, Probability spaces
The gcd extends to any finite family of integers --- not all zero --- by associativity, and Bézout's identity follows by a short induction.
I Discrete random variables and their distribution
I.1 Discrete random variables
Definition — gcd of \(k\) integers
Let \(k \geq 2\) and \(a_1, \dots, a_k \in \mathbb{Z}\) not all zero. The greatest common divisor of \(a_1, \dots, a_k\), denoted \(a_1 \wedge \dots \wedge a_k\), is the largest positive integer dividing all \(a_i\) (existence: the set of common positive divisors is non-empty since it contains \(1\), and finite as in the two-integer case).
Proposition — Recursive computation of the gcd
Equivalently, the gcd of \(k\) integers can be computed recursively by $$ \textcolor{colorprop}{a_1 \wedge \dots \wedge a_k = (a_1 \wedge \dots \wedge a_{k-1}) \wedge a_k.} $$

Both sides equal the largest common positive divisor of \(a_1, \dots, a_k\). For the right side: by the Proposition « Common divisors and the gcd » above, the divisors of \((a_1 \wedge \dots \wedge a_{k-1}) \wedge a_k\) are exactly the common divisors of \(a_1 \wedge \dots \wedge a_{k-1}\) and \(a_k\), which by the same proposition again are the common divisors of \(a_1, \dots, a_{k-1}, a_k\).

Proposition — Bézout's identity for \(k\) integers
For \(a_1, \dots, a_k \in \mathbb{Z}\) not all zero, there exist \(u_1, \dots, u_k \in \mathbb{Z}\) such that $$ \textcolor{colorprop}{a_1 \wedge \dots \wedge a_k = a_1 u_1 + a_2 u_2 + \dots + a_k u_k.} $$

By induction on \(k \geq 2\).
  • Base \(k = 2\). Already done (Bézout for two integers).
  • Heredity. Assume the result for \(k - 1\) integers. Two cases.
    • If \(a_1 = \dots = a_{k-1} = 0\), then \(a_1 \wedge \dots \wedge a_k = a_k \wedge 0 = |a_k|\), and the Bézout identity \(|a_k| = a_k \cdot \mathrm{sgn}(a_k)\) (with all other \(u_i = 0\)) is immediate.
    • Otherwise, set \(d' = a_1 \wedge \dots \wedge a_{k-1}\) (well-defined since the family is not all zero) and \(d = d' \wedge a_k = a_1 \wedge \dots \wedge a_k\). By Bézout for two integers, \(d = d' \alpha + a_k \beta\) for some \(\alpha, \beta \in \mathbb{Z}\). By induction hypothesis, \(d' = a_1 u'_1 + \dots + a_{k-1} u'_{k-1}\). Substituting, $$ d = \alpha (a_1 u'_1 + \dots + a_{k-1} u'_{k-1}) + a_k \beta = a_1 (\alpha u'_1) + \dots + a_{k-1} (\alpha u'_{k-1}) + a_k \beta. $$ Set \(u_i = \alpha u'_i\) for \(i \leq k-1\) and \(u_k = \beta\).

Proposition — gcd factorisation
For \(a_1, \dots, a_r \in \mathbb{Z}\) not all zero (with \(r \geq 2\)) and \(\lambda \in \mathbb{Z}^*\), $$ \textcolor{colorprop}{(\lambda a_1) \wedge \dots \wedge (\lambda a_r) = |\lambda| \cdot (a_1 \wedge \dots \wedge a_r).} $$

Set \(d = a_1 \wedge \dots \wedge a_r\). We show that \(|\lambda| d\) is a common divisor of \(\lambda a_1, \dots, \lambda a_r\), and conversely that any common divisor of \(\lambda a_1, \dots, \lambda a_r\) divides \(|\lambda| d\).
  • \(|\lambda| d\) divides each \(\lambda a_i\): from \(d \mid a_i\), we get \(|\lambda| d \mid |\lambda| a_i\), and \(|\lambda| a_i = \pm \lambda a_i\), so \(|\lambda| d \mid \lambda a_i\).
  • Let \(\delta\) be a common divisor of \(\lambda a_1, \dots, \lambda a_r\). By Bézout for \(r\) integers, \(d = a_1 u_1 + \dots + a_r u_r\) for some \(u_i \in \mathbb{Z}\). Multiply by \(\lambda\): \(\lambda d = (\lambda a_1) u_1 + \dots + (\lambda a_r) u_r\), so \(\delta \mid \lambda d\), hence \(\delta \mid |\lambda| d\).
By the divisor characterization (Proposition « Common divisors and the gcd » above), \(|\lambda| d = (\lambda a_1) \wedge \dots \wedge (\lambda a_r)\).

The lcm \(a \vee b\) is the dual notion to the gcd: smallest common multiple instead of largest common divisor. The same two characterizations apply --- smallest in \(\leq\) on \(\mathbb{N}^*\) and smallest in \(\mid\) ---, and the gcd-lcm relation \((a \wedge b)(a \vee b) = |ab|\) ties the two together. We state this last formula here but postpone the cleanest proof to the section on the \(p\)-adic valuation below.
Definition — Least common multiple (lcm)
Let \(a, b \in \mathbb{N}^*\). The least common multiple of \(a\) and \(b\), denoted \(a \vee b\), is the smallest element of \(\{m \in \mathbb{N}^* : a \mid m \text{ and } b \mid m\}\) for the natural order \(\leq\) on \(\mathbb{N}^*\). The set is non-empty (it contains \(a b\)).
Convention with zero. Since \(0 \mathbb{Z} = \{0\}\), the only common multiple of \(0\) and any integer is \(0\). We therefore set \(0 \vee b := 0\) for every \(b \in \mathbb{N}\).
Extension to \(\mathbb{Z}\). For \(a, b \in \mathbb{Z}\), \(a \vee b := |a| \vee |b|\).
Proposition — Common multiples are multiples of the lcm
For all \(a, b \in \mathbb{N}^*\), $$ \textcolor{colorprop}{a \mathbb{Z} \cap b \mathbb{Z} = (a \vee b) \mathbb{Z}.} $$ Equivalently: \(a \mid n\) and \(b \mid n \iff (a \vee b) \mid n\). Hence \(a \vee b\) is also the smallest common multiple in the divisibility order \(\mid\).
For \(a, b \in \mathbb{Z}^*\), the same statement holds with the convention \(a \vee b := |a| \vee |b|\) (since \(a \mathbb{Z} = |a| \mathbb{Z}\)).

Set \(m = a \vee b\).
  • \((\supset)\) \(m\) is a common multiple of \(a\) and \(b\) by definition, so every multiple of \(m\) is also a common multiple.
  • \((\subset)\) Let \(n\) be a common multiple of \(a\) and \(b\). Apply Euclidean division to \(n\) by \(m\): \(n = m q + r\) with \(0 \leq r < m\). Then \(r = n - m q\) is a \(\mathbb{Z}\)-linear combination of two common multiples of \(a\) and \(b\), hence a common multiple of \(a\) and \(b\). Since \(0 \leq r < m\) and \(m\) is the smallest positive common multiple, \(r\) cannot be in \(\mathbb{N}^*\); therefore \(r = 0\). So \(n = m q \in m \mathbb{Z}\).

Example
\(12 \vee 18 = 36\), and \(12 \cdot 18 = 216 = 6 \cdot 36 = (12 \wedge 18)(12 \vee 18)\).
Ex 1
Two integers are coprime when their gcd is \(1\), i.e.\ their only common divisors are \(\pm 1\). Bézout's identity, applied to this special case, becomes the celebrated Bézout's theorem --- a characterization of coprimeness by an explicit linear equation. From there, Gauss's lemma follows in two lines and unlocks every divisibility argument of the rest of the chapter. The two notions « coprime as a set » (gcd = 1) and « coprime pairwise » must be carefully distinguished: pairwise implies as-a-set, but the converse is false (example: \(6, 10, 15\)).
The defining condition for coprime integers is \(a \wedge b = 1\). Bézout's theorem upgrades this from a definition to a working tool: \(a\) and \(b\) are coprime iff one can find \(u, v \in \mathbb{Z}\) with \(a u + b v = 1\). The forward direction is immediate from Bézout's identity proved in the previous section; the reverse is a one-line application of the linear-combinations property.
Skills to practice
  • Identifying a discrete random variable
I.2 The distribution of a discrete random variable
Definition — Coprime integers
Two integers \(a, b \in \mathbb{Z}\) are coprime (or « premiers entre eux ») if their only common divisors are \(\pm 1\), equivalently \(a \wedge b = 1\).
Theorem — Bézout's theorem
For all \(a, b \in \mathbb{Z}\), $$ \textcolor{colorprop}{a \wedge b = 1 \iff \exists u, v \in \mathbb{Z}, \; a u + b v = 1.} $$

  • \((\Rightarrow)\) If \(a \wedge b = 1\), Bézout's identity (Proposition « Bézout's identity » above) gives \(u, v \in \mathbb{Z}\) with \(a u + b v = a \wedge b = 1\).
  • \((\Leftarrow)\) Suppose \(a u + b v = 1\) for some \(u, v \in \mathbb{Z}\). Let \(\delta\) be a common divisor of \(a\) and \(b\). By the linear-combination property, \(\delta \mid (a u + b v) = 1\), so \(\delta \in \{\pm 1\}\). Hence the only common divisors are \(\pm 1\), so \(a \wedge b = 1\).

Example
\(7 \wedge 5 = 1\) since \(3 \cdot 7 - 4 \cdot 5 = 21 - 20 = 1\). (Equivalently, the only positive common divisor of \(7\) and \(5\) is \(1\), since \(7\) is prime and \(5\) is prime.)
Ex 2 Ex 3 Ex 4
Gauss's lemma is the second engine of arithmetic. It says: if \(a\) divides a product \(b c\) and \(a\) has nothing in common with \(b\), then \(a\) must divide \(c\). The proof uses Bézout's theorem to multiply through and isolate \(c\).
Proposition — Consequences of Gauss
  • Coprime divisors. Let \(a, b \in \mathbb{Z}^*\) and \(n \in \mathbb{Z}\). If \(a \wedge b = 1\), \(a \mid n\) and \(b \mid n\), then \(a b \mid n\).
  • Coprime to a product. Let \(a, b, n \in \mathbb{Z}^*\). If \(a \wedge n = 1\) and \(b \wedge n = 1\), then \((a b) \wedge n = 1\).

(i) Coprime divisors. From \(a \mid n\), write \(n = a k\) for some \(k \in \mathbb{Z}\). Then \(b \mid a k\). Since \(a \wedge b = 1\), Gauss's lemma gives \(b \mid k\), i.e.\ \(k = b k'\), so \(n = a b k'\), i.e.\ \(a b \mid n\).
(ii) Coprime to a product. From \(a \wedge n = 1\), take \(a u + n v = 1\). From \(b \wedge n = 1\), take \(b u' + n v' = 1\). Multiply: $$ 1 = (a u + n v)(b u' + n v') = a b (u u') + n (a u v' + b v u' + n v v'). $$ This is a Bézout identity for \(a b\) and \(n\), so by Bézout's theorem \((a b) \wedge n = 1\).

Example — Counter-example without coprime hypothesis
\(6 \mid 12\) and \(4 \mid 12\), but \(6 \cdot 4 = 24\) does not divide \(12\). The hypothesis \(a \wedge b = 1\) in « coprime divisors » is essential. Here \(6 \wedge 4 = 2 \neq 1\).
Skills to practice
  • Computing the distribution of a random variable
I.3 Pairs of random variables and marginal distributions
Ex 5 Ex 6 Ex 7
Definition — Coprime as a set\(\virgule\) pairwise coprime
Let \(k \geq 2\) and \(a_1, \dots, a_k \in \mathbb{Z}\) not all zero.
  • The integers \(a_1, \dots, a_k\) are coprime as a set (« premiers entre eux dans leur ensemble ») if \(a_1 \wedge \dots \wedge a_k = 1\).
  • The integers \(a_1, \dots, a_k\) are pairwise coprime (« premiers entre eux deux à deux ») if for every \(i \neq j\), \(a_i \wedge a_j = 1\).
Prime numbers are the multiplicative atoms of \(\mathbb{N}^*\): every \(n \geq 2\) is built from primes by multiplication, and the building blocks are unique up to ordering. We start with the definition and Euclid's classical infinitude proof, present the Sieve of Eratosthenes, then use Bézout/Gauss to prove Euclid's lemma (\(p \mid ab \Rightarrow p \mid a\) or \(p \mid b\)), the additivity of the \(p\)-adic valuation, and the existence and uniqueness of the prime factorization. The chapter closes with closed-form expressions for \(a \mid b\), \(a \wedge b\) and \(a \vee b\) in terms of valuations.
A prime is an integer \(p \geq 2\) whose only divisors are \(\pm 1\) and \(\pm p\). The set of primes, denoted \(\mathbb{P}\), is infinite (Euclid). The sieve of Eratosthenes is the classical algorithm to list the primes up to a given bound \(N\), using the fact that every composite \(n \leq N\) has a prime divisor \(\leq \sqrt{N}\).
Definition — Prime number\(\virgule\) composite number
A natural number \(p \geq 2\) is called prime if its only divisors in \(\mathbb{N}^*\) are \(1\) and \(p\) (equivalently, \(\operatorname{div}(p) = \{\pm 1, \pm p\}\)). We denote by \(\mathbb{P}\) the set of prime numbers.
A natural number \(n \geq 2\) that is not prime is called composite: it admits a divisor \(d\) with \(1 < d < n\).
The integer \(1\) is, by convention, neither prime nor composite.
Example
The first prime numbers are \(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, \dots\). The integer \(4 = 2 \cdot 2\) is composite. The integer \(1\) is neither prime nor composite. (The exclusion of \(1\) from the primes is required to keep the prime factorization unique: otherwise \(6 = 2 \cdot 3 = 1 \cdot 2 \cdot 3 = 1 \cdot 1 \cdot 2 \cdot 3\), etc.)
Proposition — Existence of a prime divisor
Every integer \(n \geq 2\) admits at least one prime divisor.

The set \(D = \{d \in \mathbb{N} : d \geq 2 \text{ and } d \mid n\}\) is non-empty (it contains \(n\)) and bounded below by \(2\), so admits a smallest element \(p_0 \in D\).
Claim: \(p_0\) is prime. If \(p_0\) were composite, it would have a divisor \(d\) with \(1 < d < p_0\). Then \(d\) also divides \(n\) (transitivity), so \(d \in D\) with \(d < p_0\) --- contradicting the minimality of \(p_0\).
Hence \(p_0\) is prime, and \(p_0 \mid n\).

Skills to practice
  • Computing joint and marginal distributions
II Independent random variables
II.1 Independence of two random variables
Theorem — Infinitude of primes
The set \(\mathbb{P}\) of prime numbers is infinite.

Euclid's classical proof, by contradiction. Suppose for contradiction that \(\mathbb{P}\) is finite, say \(\mathbb{P} = \{p_1, p_2, \dots, p_r\}\). Consider the integer $$ N = p_1 \, p_2 \cdots p_r + 1. $$ Since \(N \geq 2\), by the previous proposition \(N\) admits a prime divisor, say \(p_k\) for some \(k \in \{1, \dots, r\}\). Then \(p_k\) divides both \(N\) and \(p_1 \cdots p_r\), so \(p_k\) divides their difference \(N - p_1 \cdots p_r = 1\). But a prime is \(\geq 2\), so cannot divide \(1\) --- contradiction. Hence \(\mathbb{P}\) is infinite.

Method — Sieve of Eratosthenes
To list all prime numbers \(\leq N\) (for some \(N \geq 2\)):
Step 1. Write the integers \(2, 3, 4, \dots, N\) in a table.
Step 2. Take the smallest non-crossed integer \(p\). Then \(p\) is prime; cross out all proper multiples \(2p, 3p, 4p, \dots \leq N\).
Step 3. Repeat Step 2 until \(p > \sqrt{N}\). At that point, every remaining non-crossed integer \(\leq N\) is prime.
Why \(\sqrt{N}\) suffices. If \(n \leq N\) is composite, write \(n = a b\) with \(a \leq b\). Then \(a \leq \sqrt{n} \leq \sqrt{N}\), so \(n\) is crossed out by some prime \(\leq a \leq \sqrt{N}\).
Example — Primes \(\leq 30\) by the sieve
\(\sqrt{30} < 6\), so the primes used to cross out are \(2, 3, 5\).
  • Cross multiples of \(2\): \(4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30\).
  • Cross multiples of \(3\) (still standing): \(9, 15, 21, 27\).
  • Cross multiples of \(5\) (still standing): \(25\).
Survivors: $$ \textcolor{colorprop}{\mathbb{P} \cap [\![ 2, 30 ]\!] = \{2, 3, 5, 7, 11, 13, 17, 19, 23, 29\}.} $$ Total: \(10\) primes \(\leq 30\).
Proposition — Prime divisibility and coprimeness
Let \(p\) be a prime number and \(a \in \mathbb{Z}\). Then $$ \textcolor{colorprop}{p \nmid a \iff a \wedge p = 1.} $$

The divisors of \(p\) in \(\mathbb{N}^*\) are only \(1\) and \(p\). Therefore \(a \wedge p \in \{1, p\}\).
  • If \(p \mid a\), then \(p \in \operatorname{div}(a) \cap \operatorname{div}(p)\), so \(a \wedge p = p\).
  • If \(p \nmid a\), then \(p \notin \operatorname{div}(a) \cap \operatorname{div}(p)\), so \(a \wedge p = 1\).
The two cases are exclusive and exhaustive, giving the equivalence.

Proposition — Euclid's lemma
Let \(p\) be a prime number and \(a, b \in \mathbb{Z}\). Then $$ \textcolor{colorprop}{p \mid a b \iff p \mid a \text{ or } p \mid b.} $$ In particular, for every \(n \in \mathbb{N}^*\), \(p \mid a^n \iff p \mid a\).

\((\Leftarrow)\) Immediate from the divisibility-of-products property.
\((\Rightarrow)\) Suppose \(p \mid a b\). If \(p \mid a\), done. Else \(p \nmid a\), so by the previous proposition \(a \wedge p = 1\). Apply Gauss's lemma to \(p \mid a b\) with \(p \wedge a = 1\): \(p \mid b\).

Theorem — Existence of prime factorization
Every integer \(n \in \mathbb{N}^*\) writes as a (possibly empty) product of prime numbers: $$ \textcolor{colorprop}{n = p_1 \, p_2 \cdots p_s \quad \text{with } p_1, \dots, p_s \in \mathbb{P} \text{ (and } s = 0 \text{ for } n = 1).} $$

By strong induction on \(n \geq 1\).
  • Base \(n = 1\). The empty product (with \(s = 0\)) gives \(1\), so the claim holds.
  • Heredity. Let \(n \geq 2\), and assume the claim holds for every integer \(1 \leq k < n\). Two cases:
    • If \(n\) is prime, write \(n = n\) (a single-term product), and we are done.
    • If \(n\) is composite, write \(n = a b\) with \(1 < a, b < n\) (by definition of composite). By the inductive hypothesis, \(a = q_1 \cdots q_s\) and \(b = q'_1 \cdots q'_t\) are products of primes. Concatenating, \(n = q_1 \cdots q_s \, q'_1 \cdots q'_t\) is a product of primes.

Ex 8 Ex 9
Skills to practice
  • Proving independence of two variables
II.2 Mutual independence and the coalition lemma
The \(p\)-adic valuation \(v_p(n)\) counts how many times the prime \(p\) appears in the factorization of \(n\). Once we prove its additivity (\(v_p(a b) = v_p(a) + v_p(b)\), an easy consequence of Euclid's lemma), the uniqueness of the prime factorization follows in two lines: the exponents \(\alpha_p\) in any decomposition must equal \(v_p(n)\).
Definition — \(p\)-adic valuation
Let \(p\) be a prime number and \(n \in \mathbb{Z}^*\). The \(p\)-adic valuation of \(n\), denoted \(v_p(n)\), is the largest integer \(k \in \mathbb{N}\) such that \(p^k \mid n\): $$ v_p(n) = \max \{ k \in \mathbb{N} : p^k \mid n \}. $$ The set \(\{k \in \mathbb{N} : p^k \mid n\}\) is non-empty (contains \(0\)) and bounded above (by \(\log_p |n|\)), so the max exists.
Convention with zero. \(v_p(0) = +\infty\) (since \(p^k \mid 0\) for all \(k\)).
Note. \(v_p(n) = v_p(|n|)\) since \(p^k \mid n \iff p^k \mid -n\).
Example
\(60 = 2^2 \cdot 3 \cdot 5\), so \(v_2(60) = 2\), \(v_3(60) = 1\), \(v_5(60) = 1\), and \(v_p(60) = 0\) for every prime \(p \notin \{2, 3, 5\}\).
Proposition — Additivity of \(v_p\)
For every prime \(p\) and every \(a, b \in \mathbb{Z}^*\), $$ \textcolor{colorprop}{v_p(a b) = v_p(a) + v_p(b).} $$

Set \(\alpha = v_p(a)\) and \(\beta = v_p(b)\). By definition, \(a = p^{\alpha} a'\) with \(p \nmid a'\), and \(b = p^{\beta} b'\) with \(p \nmid b'\). Then $$ a b = p^{\alpha + \beta} (a' b'). $$ By Euclid's lemma (contrapositive), \(p \nmid a'\) and \(p \nmid b'\) imply \(p \nmid a' b'\). Hence the largest power of \(p\) dividing \(a b\) is exactly \(p^{\alpha + \beta}\), i.e.\ \(v_p(a b) = \alpha + \beta = v_p(a) + v_p(b)\).

Theorem — Uniqueness of prime factorization
Every integer \(n \in \mathbb{N}^*\) writes uniquely as $$ \textcolor{colorprop}{n = \prod_{p \in \mathbb{P}} p^{v_p(n)},} $$ where the product is finite (only finitely many \(v_p(n)\) are non-zero, namely those \(p\) with \(p \mid n\)). Equivalently: if \(n = \prod_p p^{\alpha_p}\) for some family \((\alpha_p)_{p \in \mathbb{P}}\) of natural numbers with finite support, then \(\alpha_p = v_p(n)\) for every prime \(p\).

Existence. By the existence theorem above, \(n = q_1 q_2 \cdots q_s\) is a product of primes. Group equal primes together: \(n = \prod_p p^{\alpha_p}\) with \(\alpha_p = \) number of \(i\) such that \(q_i = p\). The family \((\alpha_p)_{p \in \mathbb{P}}\) has finite support.
Uniqueness. Suppose \(n = \prod_p p^{\alpha_p} = \prod_p p^{\beta_p}\) for two such families. Apply \(v_q\) (for an arbitrary prime \(q\)) to \(n = \prod_p p^{\alpha_p}\) using the additivity of \(v_q\): $$ v_q(n) = \sum_p \alpha_p \, v_q(p) = \alpha_q, $$ since \(v_q(p) = 1\) if \(p = q\) and \(0\) otherwise. The same argument applied to \(n = \prod_p p^{\beta_p}\) gives \(v_q(n) = \beta_q\). Hence \(\alpha_q = \beta_q = v_q(n)\) for every prime \(q\), so the two families coincide.

Ex 10 Ex 11
Skills to practice
  • Applying the coalition lemma
II.3 Sequences of i.i.d. random variables
The \(p\)-adic valuation gives a clean closed-form for divisibility, gcd, and lcm: \(a\) divides \(b\) iff every \(v_p(a) \leq v_p(b)\); \(a \wedge b\) has exponent \(\min(v_p(a), v_p(b))\); \(a \vee b\) has exponent \(\max(v_p(a), v_p(b))\). The relation \((a \wedge b)(a \vee b) = |a b|\) follows immediately from \(\min + \max = \alpha + \beta\), completing the proof postponed from the section on the least common multiple above.
Theorem — Divisibility\(\virgule\) gcd\(\virgule\) lcm via valuations
For all \(a, b \in \mathbb{Z}^*\),
  • Divisibility. \(a \mid b \iff \forall p \in \mathbb{P}, \; v_p(a) \leq v_p(b)\).
  • gcd via valuations. \(a \wedge b = \prod_{p \in \mathbb{P}} p^{\min(v_p(a), v_p(b))}\).
  • lcm via valuations. \(a \vee b = \prod_{p \in \mathbb{P}} p^{\max(v_p(a), v_p(b))}\).
  • gcd-lcm relation. \((a \wedge b)(a \vee b) = |a b|\).

Divisibility. If \(a \mid b\), then \(b = a k\) for some \(k \in \mathbb{Z}^*\), so \(v_p(b) = v_p(a) + v_p(k) \geq v_p(a)\) by additivity. Conversely, assume \(v_p(a) \leq v_p(b)\) for every prime \(p\). Write $$ |a| = \prod_p p^{\alpha_p}, \qquad |b| = \prod_p p^{\beta_p}, $$ with \(\alpha_p \leq \beta_p\) for every \(p\) by hypothesis. Then $$ |b| = |a| \cdot \prod_p p^{\beta_p - \alpha_p}, $$ where the product on the right is an integer of \(\mathbb{N}^*\). Hence \(|a| \mid |b|\), so \(a \mid b\).
gcd via valuations. Set \(d = \prod_p p^{\min(v_p(a), v_p(b))}\).
  • \(d \mid a\): \(v_p(d) = \min(v_p(a), v_p(b)) \leq v_p(a)\) for every \(p\), so \(d \mid a\) by the divisibility characterization. Similarly \(d \mid b\).
  • \(d\) is the largest such: suppose \(\delta \mid a\) and \(\delta \mid b\). Then \(v_p(\delta) \leq v_p(a)\) and \(v_p(\delta) \leq v_p(b)\) for every \(p\), so \(v_p(\delta) \leq \min(v_p(a), v_p(b)) = v_p(d)\). Hence \(\delta \mid d\), so \(|\delta| \leq d\).
Since \(d \in \mathbb{N}^*\) and is the largest common divisor in \(\leq\), \(d = a \wedge b\).
lcm via valuations. Symmetric argument with \(\max\) in place of \(\min\).
gcd-lcm relation. For every prime \(p\), \(\min(v_p(a), v_p(b)) + \max(v_p(a), v_p(b)) = v_p(a) + v_p(b)\). Multiplying \(a \wedge b\) and \(a \vee b\) then taking \(v_p\): $$ v_p((a \wedge b)(a \vee b)) = v_p(a) + v_p(b) = v_p(a b) = v_p(|a b|). $$ Both sides are positive integers with equal valuations at every prime, so by uniqueness of the factorization \((a \wedge b)(a \vee b) = |a b|\).

Example
Compute \(600 \wedge 740\) via valuations. \(600 = 2^3 \cdot 3 \cdot 5^2\) and \(740 = 2^2 \cdot 5 \cdot 37\). Take the min of the exponents prime by prime: $$ 600 \wedge 740 = 2^{\min(3, 2)} \cdot 3^{\min(1, 0)} \cdot 5^{\min(2, 1)} \cdot 37^{\min(0, 1)} = 2^2 \cdot 5 = 20. $$ For the lcm, take the max: \(600 \vee 740 = 2^3 \cdot 3 \cdot 5^2 \cdot 37 = 22\,200\). Verification: \(20 \cdot 22200 = 444\,000 = 600 \cdot 740\). \(\checkmark\)
Method — Compute gcd / lcm via prime decomposition
Step 1. Decompose \(a\) and \(b\) into prime factors: \(a = \prod p^{\alpha_p}\), \(b = \prod p^{\beta_p}\) (use the same set of primes by padding with zero exponents).
Step 2. For the gcd: take the min of the exponents prime by prime, \(a \wedge b = \prod p^{\min(\alpha_p, \beta_p)}\).
Step 3. For the lcm: take the max, \(a \vee b = \prod p^{\max(\alpha_p, \beta_p)}\).
Comparison with Euclid's algorithm. For small integers (up to ~5 digits), prime decomposition is faster and cleaner. For large integers, Euclid's algorithm wins (no need to factor).
Ex 12 Ex 13 Ex 14
The congruence \(a \equiv b \pmod n\) is just a different way of writing \(n \mid (a - b)\). It packages divisibility in a notation that is compatible with sums and products, which in turn turns the entire chapter into a calculus of « computing modulo \(n\) ». We start with the definition and basic operations (recall: the Grade 12 « Spécialité » chapter already covers this, but we restate rigorously and use all the divisibility, Bézout, Gauss, and prime-factorization machinery developed above); then describe \(\mathbb{Z}/n\mathbb{Z}\) as the set of \(n\) residue classes (with the explicit reminder that its ring structure is hors programme); next characterize invertibility modulo \(n\) via Bézout's theorem; and close with Fermat's little theorem, the central modular result of the chapter.
Skills to practice
  • Modelling with an i.i.d. sequence
III The usual discrete distributions
III.1 The geometric distribution
The Grade 12 baseline already gives the definition \(a \equiv b \pmod n\) and the « same remainder » characterization. We re-state both rigorously and prove the compatibility of \(\equiv\) with sum and product (program: « Opérations sur les congruences : somme, produit »).
Definition — Congruence modulo \(n\)
Let \(n \in \mathbb{N}^*\). For \(a, b \in \mathbb{Z}\), we say that \(a\) is congruent to \(b\) modulo \(n\), and we write $$ a \equiv b \pmod n \quad \text{or simply} \quad a \equiv b \; [n], $$ if \(n \mid (a - b)\), i.e.\ if there exists \(k \in \mathbb{Z}\) such that \(a - b = k n\).
For \(n = 1\), every pair of integers is congruent (since \(1\) divides everything). The interesting case is \(n \geq 2\), which we tacitly assume from now on.
Proposition — Equivalence relation
For every \(n \in \mathbb{N}^*\), the binary relation \(\equiv \pmod n\) on \(\mathbb{Z}\) is an equivalence relation: reflexive, symmetric, transitive.

Already shown in the chapter Binary relations. In short: \(a - a = 0 = n \cdot 0\) (reflexive); if \(n \mid (a - b)\) then \(n \mid (b - a) = -(a - b)\) (symmetric); if \(n \mid (a - b)\) and \(n \mid (b - c)\), then \(n \mid (a - c) = (a - b) + (b - c)\) by linear combinations (transitive).

Example — Divisibility by 9 criterion
\(10 \equiv 1 \pmod 9\), so by power compatibility \(10^k \equiv 1^k = 1 \pmod 9\) for every \(k \in \mathbb{N}\). Hence for \(n = a_k 10^k + \dots + a_1 \cdot 10 + a_0 \in \mathbb{N}\) (decimal expansion), $$ n \equiv a_k + a_{k-1} + \dots + a_1 + a_0 \pmod 9. $$ Consequence: \(n\) is divisible by \(9\) iff the sum of its decimal digits is. For instance \(n = 1234\): \(1 + 2 + 3 + 4 = 10\), \(1 + 0 = 1\), so \(1234 \equiv 1 \pmod 9\) and \(9 \nmid 1234\).
Method — Reduce powers modulo \(n\)
To compute \(a^N \pmod n\) for large \(N\):
Step 1. Find a small power of \(a\) congruent to \(1\) or \(-1\) modulo \(n\), if such a power appears quickly (e.g.\ try \(a^2, a^3, a^4, \dots\) until a small residue appears).
Step 2. Write \(N = k q + r\) with \(0 \leq r < k\) (Euclidean division of the exponent).
Step 3. Then \(a^N = (a^k)^q \cdot a^r \equiv 1^q \cdot a^r \equiv a^r \pmod n\), and \(a^r\) is small.
Worked example. Compute \(2^{1000} \pmod 7\). We find \(2^3 = 8 \equiv 1 \pmod 7\). Then \(1000 = 3 \cdot 333 + 1\), so \(2^{1000} = (2^3)^{333} \cdot 2 \equiv 1 \cdot 2 \equiv 2 \pmod 7\).
Ex 15
The Euclidean division by \(n\) partitions \(\mathbb{Z}\) into \(n\) classes, and the set of these classes has cardinal \(n\). We mention the set \(\mathbb{Z}/n\mathbb{Z}\) in this guise only --- the rings \(\mathbb{Z}/n\mathbb{Z}\) are hors programme at this level; the ring structure (addition and multiplication of classes) belongs to the chapter Algebraic structures.
Proposition — \(n\) classes modulo \(n\)
Let \(n \in \mathbb{N}^*\). For every \(a \in \mathbb{Z}\), there exists a unique \(r \in \{0, 1, \dots, n-1\}\) such that $$ \textcolor{colorprop}{a \equiv r \pmod n.} $$ Consequently, the set \(\mathbb{Z}/n\mathbb{Z}\) of equivalence classes of \(\equiv \pmod n\) has cardinal \(n\), with representatives \(\{0, 1, \dots, n-1\}\).

Apply the Euclidean division of \(a\) by \(n\) (Theorem « Euclidean division » from the section on Euclidean division above): there exists a unique \((q, r) \in \mathbb{Z} \times \mathbb{N}\) with \(a = n q + r\) and \(0 \leq r < n\). Then \(a - r = n q\), i.e.\ \(a \equiv r \pmod n\), with \(r \in \{0, 1, \dots, n-1\}\) unique.
For \(r, r' \in \{0, 1, \dots, n-1\}\) distinct, \(|r - r'| < n\) so \(n \nmid (r - r')\), hence \(r \not\equiv r' \pmod n\). The classes of \(0, 1, \dots, n-1\) are therefore pairwise distinct, and they cover \(\mathbb{Z}\). Hence \(|\mathbb{Z}/n\mathbb{Z}| = n\).

Important program note
We use here \(\mathbb{Z}/n\mathbb{Z}\) only as the set of congruence classes modulo \(n\). Its ring structure is hors programme and will be studied later (chapter Algebraic structures). In this chapter we add and multiply representatives (integers), not classes.
Skills to practice
  • Manipulating the geometric distribution
III.2 The Poisson distribution
The question « when is \(a\) invertible modulo \(n\)? » is answered by Bézout's theorem: iff \(a \wedge n = 1\). The construction of the inverse is constructive (extended Euclid). Once we have inverses, solving the linear congruence \(a x \equiv b \pmod n\) reduces to multiplying both sides by \(a^{-1}\).
Definition — Invertible modulo \(n\)
Let \(n \in \mathbb{N}^*\) and \(a \in \mathbb{Z}\). We say that \(a\) is invertible modulo \(n\) if there exists \(u \in \mathbb{Z}\) such that $$ a u \equiv 1 \pmod n. $$ Such a \(u\) is called an inverse of \(a\) modulo \(n\), often denoted \(a^{-1} \pmod n\). The inverse, when it exists, is unique up to congruence modulo \(n\).
Example
Find the inverse of \(3\) modulo \(7\). We seek \(x\) with \(3 x \equiv 1 \pmod{7}\). Trying \(x = 5\): \(3 \cdot 5 = 15 = 2 \cdot 7 + 1\), so \(3 \cdot 5 \equiv 1 \pmod 7\). Hence \(3^{-1} \equiv 5 \pmod 7\).
Proposition — Invertibility characterization
Let \(n \in \mathbb{N}^*\) and \(a \in \mathbb{Z}\). Then $$ \textcolor{colorprop}{a \text{ is invertible modulo } n \iff a \wedge n = 1.} $$ When this holds, an inverse \(u\) of \(a\) modulo \(n\) is given by any Bézout coefficient: \(a u + n v = 1\) for some \(v \in \mathbb{Z}\).

  • \((\Leftarrow)\) Assume \(a \wedge n = 1\). By Bézout's theorem, \(a u + n v = 1\) for some \(u, v \in \mathbb{Z}\). Then \(a u = 1 - n v \equiv 1 \pmod n\), so \(u\) is an inverse of \(a\) modulo \(n\).
  • \((\Rightarrow)\) Assume \(a u \equiv 1 \pmod n\), i.e.\ \(a u - 1 = n v\) for some \(v\), hence \(a u + n (-v) = 1\). By the converse of Bézout's theorem, \(a \wedge n = 1\).

Example
Solve \(3 x \equiv 5 \pmod 7\).

\(3 \wedge 7 = 1\), so \(3\) is invertible mod \(7\). Find an inverse: \(3 \cdot 5 = 15 \equiv 1 \pmod 7\), so \(3^{-1} \equiv 5 \pmod 7\). Multiply both sides by \(5\): $$ x \equiv 5 \cdot 5 \equiv 25 \equiv 4 \pmod 7. $$ The solutions are \(x \in 4 + 7 \mathbb{Z} = \{\dots, -10, -3, 4, 11, 18, \dots\}\).
Verification. \(3 \cdot 4 = 12 \equiv 5 \pmod 7\). \(\checkmark\)

Ex 16 Ex 17 Ex 18
Skills to practice
  • Recognising the Poisson distribution