# Euclid's lemma

In number theory, Euclid's lemma (also called Euclid's first theorem) is a lemma that captures one of the fundamental properties of prime numbers. It states that if a prime divides the product of two numbers, it must divide at least one of the factors. For example since 133 × 143 = 19019 is divisible by 19, one or both of 133 or 143 must be as well. In fact, 19 × 7 = 133. It is used in the proof of the fundamental theorem of arithmetic.

The lemma is not true for composite numbers. For example, 4 does not divide 6 and 4 does not divide 10, yet 4 does divide their product, 60.

## Formulations

Let p be a prime number, and assume p divides the product of two integers a and b. (In symbols this is written p|ab. Its negation, p does not divide ab is written pab.)
Then p|a or p|b (or both).

Equivalent statements are

If pa and pb, then pab.
If pa and p|ab, then p|b.

A generalization is also called Euclid's lemma:

If n|ab, and n is relatively prime to a, then n|b.
(This is a generalization because if n is prime, either n|a or n is relatively prime to a.)

## History

The lemma first appears as proposition 30 in Book VII of Euclid's Elements. It is included in practically every book that covers elementary number theory.[1][2][3][4][5]

## Proofs

### Via Bézout's identity

The easiest proof of Euclid's lemma uses another lemma called Bézout's identity. This states that if x and y are relatively prime integers (i.e. they share no common divisors other than 1) there exist integers r and s such that

$rx+sy = 1.$

Let a and n be relatively prime, and assume that n|ab. By Bézout, there are r and s making

$rn+sa = 1.$

Multiply both sides by b:

$rnb+sab = b.$

The first term on the left is divisible by n, and the second term is divisible by ab which by hypothesis is divisible by n. Therefore their sum, b, is also divisible by n. This is the generalization of Euclid's lemma mentioned above.

### Euclidean proof

The logic of this proof is basically Euclid's, but the notation and some of the concepts (zero, negative) would be foreign to him.[6] It relies on the fact that a set of non-negative integers has a smallest member.

#### Divisibility

Definition. Assume a ≠ 0 and let b be any integer. If there is an integer q such that b = aq, a is said to divide b; a is a divisor of b and b is a multiple of a.

Notation. a divides b is written a|b. a does not divide b is written ab.

Lemma. If a ≠ 0 then a|0, a|a and a|−a.
Lemma. 1|a and −1|a.
Lemma. If a|b then −a|b, a|−b, −a|−b, and |a|||b|. (i.e. |a| divides |b|; see absolute value).
Lemma. If ac|bc then a|b.
Lemma. If a|b and c ≠ 0 then ac|bc.
Lemma. If a|b and b|c then a|c.
Lemma. If a|b and x is an integer then a|bx.
Lemma. If a|b and a|c then a|(b ± c).
Lemma. If a|b and a|c and x and y are integers then a|(bx ± cy).
Lemma. If b ≠ 0 and a|b then |a| ≤ |b|. This implies that b only has a finite number of divisors, and that the largest one is |b|.

#### Euclidean division

Theorem. If b > 0 and a is an integer then there is a unique pair of integers q and r such that a = bq + r and 0 ≤ r < b.

Definition. q is the quotient and r is the remainder.

Proof. (existence) The set of numbers {aub: u an integer} contains both positive and negative numbers. Let r = aqb be the smallest non-negative number in the set. Then r ≥ 0, and rb = a − (q + 1)b < 0.
(uniqueness) If q were replaced by a smaller value, u < q, uq − 1 the corresponding remainder would be greater than or equal to b: auba − (q − 1)b = r + b b. Similarly, if u > q the remainder would be negative: uq + 1, auba − (q + 1)b = rb < 0.

#### Least common multiple

Definition. If a ≠ 0 and b ≠ 0 a common multiple of a and b is any integer k such that a|k and b|k.

Lemma. If a ≠ 0 and b ≠ 0 they have a least positive common multiple.
Proof. The set of positive common multiples contains |ab| so it is not empty and therefore has a smallest member.

Notation. If a ≠ 0 and b ≠ 0 their least positive common multiple is written lcm(a, b).

Theorem. Assume a ≠ 0 and b ≠ 0. Let m = lcm(a, b) and let n be any common multiple of a and b. Then m|n.

Proof. There are numbers q and r such that n = qm + r, 0 ≤ r < m. It follows from r = nqm, a|m and a|n that a|r. Similarly b|m and b|n imply that b|r. That is, r is a common multiple of a and b. r is non-negative and is less than the least positive common multiple m. Therefore r = 0. But then n = qm, i.e. m|n.

#### Greatest common divisor

Definition. If a ≠ 0 or b ≠ 0 a common divisor of a and b is any integer k such that k|a and k|b.

Lemma. If a ≠ 0 or b ≠ 0 they have a greatest common divisor. It is positive.
Proof. Every integer divides 0. If a = 0 then b ≠ 0, and their common divisors are simply the divisors of b. The largest of these is |b|.
Now assume that both a ≠ 0 and b ≠ 0. The set of divisors of a is finite, the set of divisors of b is finite, therefore their intersection is finite and has a largest member. It must be positive because 1 is a positive common divisor of a and b.

Notation. If a ≠ 0 or b ≠ 0 their greatest common divisor is written gcd(a, b).

Definition. If gcd(a, b) = 1, a and b are called coprime, or a is said to be relatively prime to b, or b is a relative prime to a.

Theorem. Assume a ≠ 0 or b ≠ 0. Let d = gcd(a, b) and let e be any common divisor of a and b. Then e|d.

Proof. If a = 0 then b ≠ 0. In this case d = gcd(0, b) = |b|, so e|a and e|b trivially imply that e|d.
Now assume that both a ≠ 0 and b ≠ 0, and let m = lcm(a, b). Since ab is a common multiple of a and b, m|ab, ab = gm. The proof has two steps i) if e|a and e|b then e|g; ii) d = |g|.
i) Let e|a, a = er, and e|b, b = es. Since ers = as = br is a common multiple of a and b, m|ers. But then, meg|erseg, (mg)e|(eres)g, abe|abg, e|g.
ii) Since a = g(m/b), b = g(m/a), and m/a and m/b are integers, g is a common divisor of a and b. But d = gcd(a, b) is defined as their greatest common divisor, so d ≥ |g|. Since d|a and d|b implies d|g, d ≤ |g|. Therefore, d = |g|.

#### Relation between gcd and lcm

Corollary. If a ≠ 0 and b ≠ 0 then lcm(a, b)gcd(a,b) = |ab|.
Corollary. If a ≠ 0, b ≠ 0 and a is relatively prime to b then lcm(a, b) = |ab|.

#### A generalization due to Gauss

Theorem. If a|bc and a and b are relatively prime then a|c.

Proof. Since a|bc, a ≠ 0. If b = 0, gcd(a, 0) = 1 implies that a = ±1 . But then a|c.
If b ≠ 0, let m = lcm(a, b). Since gcd(a, b) = 1, m = |ab|. Since a|bc and b|bc, bc is a common multiple of a and b.
Therefore m|bc, ab|bc, a|c.

## Notes

1. ^ Gauss, DA, Art. 14
2. ^ Hardy & Wright, Thm. 3
3. ^ Ireland & Rosen, prop. 1.1.1
4. ^ Landau, Thm. 15
5. ^ Riesel, Thm. A2.1
6. ^ Landau, ch. 1

## References

The Disquisitiones Arithmeticae has been translated from Latin into English and German. The German edition includes all of his papers on number theory: all the proofs of quadratic reciprocity, the determination of the sign of the Gauss sum, the investigations into biquadratic reciprocity, and unpublished notes.

• Gauss, Carl Friedrich; Clarke, Arthur A. (translator into English) (1986), Disquisitiones Arithemeticae (Second, corrected edition), New York: Springer, ISBN 0387962549
• Gauss, Carl Friedrich; Maser, H. (translator into German) (1965), Untersuchungen uber hohere Arithmetik (Disquisitiones Arithemeticae & other papers on number theory) (Second edition), New York: Chelsea, ISBN 0-8284-0191-8
• Ireland, Kenneth; Rosen, Michael (1990), A Classical Introduction to Modern Number Theory (Second edition), New York: Springer, ISBN 0-387-97329-X
• Landau, Edmund (1966), Elementary Number Theory, New York: Chelsea
• Riesel, Hans (1994), Prime Numbers and Computer Methods for Factorization (second edition), Boston: Birkhäuser, ISBN 0-8176-3743-5