Euclid's Lemma
Suppose a prime number divides a product of two integers. Must divide , or must divide ? This question looks innocent, almost too obvious to ask. Yet the answer is the single hinge on which the entire arithmetic of the integers turns. Without it, we could not even be sure that factors as and in no fundamentally different way. Perhaps some exotic system of numbers has a "" that splits as a product of primes in two genuinely different patterns. In the ordinary integers this cannot happen, and the reason is Euclid's Lemma. The lemma matters because it is the load-bearing wall between two very different-looking facts. First, that every integer greater than can be written as a product of primes (existence, which is easy). Second, that this factorization is unique up to reordering (uniqueness, which is the deep part). Euclid's Lemma is precisely the tool that converts "primes divide products" into "primes cannot secretly split their way through a product without dividing one of the pieces individually." Every proof of unique factorization that mathematicians actually use passes through this single statement. The big picture is that Euclid's Lemma is not a standalone curiosity. It is a consequence of a more primitive fact about integers: Bézout's identity. This is the statement that the greatest common divisor of two integers can always be written as an integer linear combination of them. This is characteristic of how number theory is built. Deep divisibility facts about primes are derived from the additive, linear structure of , not postulated separately. Once Bézout's identity is in hand, Euclid's Lemma falls out in a few clean lines. From there the Fundamental Theorem of Arithmetic is only one more short argument away. This article gives the precise statement of Euclid's Lemma and its natural generalization to arbitrary coprime divisors. It also gives a complete proof from Bézout's identity. Worked examples show both the lemma in action and why each hypothesis is essential. Finally, it discusses where the result surfaces across mathematics, from cryptography to abstract algebra.
- Euclid's Lemma: if a prime divides a product of integers, then or .
- It generalizes: if and , then — primality is really a coprimality statement in disguise.
- The proof is a direct application of Bezout's Identity: write and multiply through by .
- Primality is essential — composite numbers like divide products () without dividing either factor.
- The lemma extends by induction to any finite product: for some .
- It is the single technical engine behind uniqueness in the Fundamental Theorem of Arithmetic.
- Key idea: a prime cannot divide a product unless it "hides" inside one of the factors, and this rigidity comes entirely from the linear structure captured by Bézout's identity.
Where this lives today
Euclid's Lemma is the technical core of the proof of the Fundamental Theorem of Arithmetic: to show factorization into primes is unique, one shows that if divides a product of primes , then (by the finite product form above) must equal one of the , since each is prime and 's only divisors of a prime other than are itself. This single fact, applied repeatedly, forces any two prime factorizations of the same integer to match term-for-term. In abstract algebra, the lemma motivates the distinction between a prime element of a general ring (one satisfying exactly the Euclid's Lemma property: or ) and an irreducible element (one that cannot be factored nontrivially). In these two notions coincide, but in more exotic rings — such as , where gives two genuinely different factorizations into irreducibles — they do not, and unique factorization fails precisely because the analogue of Euclid's Lemma fails there. In elementary number theory and congruences, the coprime generalization is exactly the cancellation law for modular arithmetic: if and , one may "cancel" a suitably, recovering whenever ; this underlies solving linear congruences and is a direct restatement of the coprime form proved above. In cryptography, particularly RSA and related schemes, the arithmetic of coprimality and the structure of rest on exactly this machinery: knowing which elements are invertible modulo , and how prime divisors of interact with products, traces back to Euclid's Lemma and Bézout's identity working in tandem. In computer science, algorithms for integer factorization, primality testing, and computing modular inverses (the extended Euclidean algorithm) are computational incarnations of the same Bézout coefficients used in the proof above. In combinatorics and analytic number theory, Euclid's Lemma underlies the definition and manipulation of the arithmetic functions (like the Möbius function and Euler's totient) that depend on unique prime factorization for their multiplicative properties.
:::faq[Where does this lemma first break down if we work in a different number system, like the Gaussian integers or ?] In (Gaussian integers), an analogue of Euclid's Lemma still holds because has its own Euclidean algorithm and Bézout identity (it is a Euclidean domain), so unique factorization survives there too. In , however, there is no division algorithm compatible with the norm, Bézout's identity can fail for the relevant "irreducible" elements, and correspondingly Euclid's Lemma fails: is irreducible but not prime, since while divides neither factor. This is the precise mechanism behind the famous failure of unique factorization in that ring.
Ask the tutor: Can you show me, step by step, how Euclid's Lemma is actually used inside the proof of the Fundamental Theorem of Arithmetic's uniqueness part?
Let be a prime number, meaning an integer whose only positive divisors are and .
Euclid's Lemma. For all integers :
Generalized (coprime) form. For all integers with :
Here means and share no common positive divisor other than ; such are called coprime (or relatively prime). Euclid's Lemma is the special case prime, using the fact that a prime is coprime to any integer it does not divide.
Intuition
Think of divisibility by as a kind of sieve with holes only of "size ." If falls entirely through the sieve — that is, — common sense might suggest that and could each contribute a partial, fractional share of the divisibility, the way divides even though and individually is false here but is true for composite divisors. The content of Euclid's Lemma is that a prime sieve cannot be fooled this way: because has no nontrivial factors of its own, it cannot split its divisibility duty between and . All of 's "weight" must land in one factor or the other. The reason this rigidity holds traces back to linear algebra over , encoded in Bézout's identity. If , then since is prime, , so there exist integers with . This equation says the numbers and generate all of under integer linear combinations — in particular they generate itself. Multiplying by turns the abstract fact " is reachable" into the concrete fact " is reachable using multiples of and multiples of ," and since by hypothesis, this forces . The figure below shows the two-factor case pictorially: 's divisibility "flows" into or into , never fractionally split between both, which is exactly what distinguishes primes from composites.
Intuition, continued
It is worth stressing what the lemma does not say. It does not say and cannot both happen (they can — e.g. , , ). It says only that at least one must occur; the conclusion is an "or," not an "and," and it is not exclusive. It is also worth noting the direction of implication: the converse " or implies " is the easy direction (true for any integer, prime or not, by basic properties of divisibility), while the lemma asserts the hard direction, and this is exactly the direction that fails for composite .
Let with .
(Coprime form) If and , then .
(Prime form) If is a prime and for integers , then or .
(Finite product form) If is a prime and for integers (), then for some index .
We prove the three statements in order, each building on the last. The technique throughout is Bézout's identity together with basic manipulation of divisibility and, for the third part, mathematical induction on .
Step 1: the coprime form. Assume and . By Bezout's Identity, since , there exist integers such that
Multiply both sides of this equation by :
that is,
Now examine the two terms on the left. The term is manifestly divisible by (it is times the integer ). The term is also divisible by : by hypothesis , so for some integer , hence , which is times the integer . Therefore , being the sum of two multiples of , is itself a multiple of :
This shows , as claimed. This completes Step 1.
Step 2: the prime form, from Step 1. Let be prime and suppose . We must show or . Consider two cases based on whether . Case 1: . Then the conclusion " or " already holds, and there is nothing further to prove. Case 2: . We claim . Indeed, let ; then is a positive divisor of . Because is prime, its only positive divisors are and itself, so or . If , then (since and ), contradicting the case assumption . Hence , i.e. . Now we are exactly in the situation of Step 1 with : we have and . Step 1 gives . Thus in Case 2 the conclusion " or " holds via the second disjunct. In either case, or , completing Step 2. (Note there is no circularity: Step 2 uses only Step 1 and the definition of primality, not any statement about unique factorization.)
Step 3: the finite product form, by induction on . We induct on the number of factors . Base case . The statement is , which is trivially true. Base case (stated separately for clarity, though it is subsumed by the inductive step below with the base): this is exactly Step 2, already proved. Inductive step. Let and suppose the finite product form holds for products of factors (inductive hypothesis): that is, for any integers , if then for some . Now let be integers with . Group the product as
a product of exactly two integers, namely and . Since , Step 2 (the two-factor prime form) applies directly and gives:
If , we are done: take . If instead , then this is a product of exactly factors divisible by , so the inductive hypothesis applies and yields for some . In either branch we have produced an index with . This completes the inductive step, and by the principle of mathematical induction the finite product form holds for all .
∎Worked examples
Example 1 (asymmetric numbers, prime form). Let , , . Compute . Check divisibility: , an integer, so indeed . Now factor each piece: , so directly — and indeed . Meanwhile , and , not an integer, so . This is consistent with the lemma: the conclusion is a disjunction, and here it is satisfied through the first disjunct () while the second fails — the lemma never promised both. To see the Bézout mechanism explicitly in a case where , instead take , , (just swapping roles). Now since . We need : since is prime and does not divide , indeed . Find with via the Euclidean algorithm:
Back-substitute: . So , : check . ✓. Multiply by : . Since , this reads , i.e. . Compute the bracket: , and , sum . So — correct, and this recovers exactly as Step 1 of the proof predicts, entirely mechanically from the Bézout coefficients.
Example 2 (the finite product form with an unbalanced, non-uniform list). Let and consider the product of four integers . Compute
Step by step: ; ; . Check , an integer, so . The finite product form guarantees divides at least one . Inspect each: not integer, not integer, integer — so . Indeed the induction in Step 3 of the proof, applied here, would first group as ; since (as is not an integer), Step 2 forces , which is true (). Recursing one level further, group : since outright, the induction terminates having correctly located the culprit factor without ever needing to fully expand which of or might be divisible by (neither is). This illustrates that the inductive proof does not require searching for the right factor by brute force — it peels the product from the right and lets Step 2 make a binary decision at each stage, though the final "witness" factor can occur anywhere in the list, as it does here in the third slot out of four.
Drop the hypothesis that is prime, keeping everything else the same: let , , . Then
so , i.e. . Yet (since is not an integer) and (since is not an integer). So the conclusion " or " fails even though holds. The reason the proof breaks down is traceable exactly to Step 1: Bézout's identity requires , and here . There is no way to write for integers , because every integer combination is even (both and are even), while is odd. The linear-algebraic engine that powered the proof simply does not start turning. This confirms that primality of (or at least ) is not a technical convenience but a load-bearing hypothesis: composite divisors can distribute their prime factors across two coprime-to-each-other pieces of a product, exactly as distributes its factor into and its factor into .
Scope, edge cases & common traps
| Situation | What holds | What can fail |
|---|---|---|
| prime, | or (Euclid's Lemma) | Both can fail to be forced simultaneously — it's an inclusive "or," not "and" |
| composite, , | Nothing guaranteed about or | Counterexample above: , but |
| composite but , | still holds (generalized form) | Only needs coprimality with one factor, not primality |
| or | always, so lemma is vacuously/trivially fine (any divides ) | Easy to worry about, but no real edge case — by definition of divisibility |
| Finite product, factors | Some single factor is divisible by | It is not claimed that a specific factor (e.g. the first) works — any index is possible |
| Converse direction ( or ) | True, trivial, for any integer (prime or not) | Do not confuse this easy converse with the hard forward direction that defines the lemma |
The mathematician behind it
Origins · 1 minEuclid of Alexandria and how this was discovered
Euclid is known almost entirely through his monumental work, the Elements, a thirteen-book compilation and systematic organization of the geometry and number theory known in his era, most of it likely synthesizing earlier results (from Pythagorean and other traditions) into a single deductive structure built from explicit axioms. Book VII of the Elements contains the earliest surviving statement and proof of what we now call Euclid's Lemma (Proposition 30), phrased in the language of "measuring" rather than modern divisibility notation, and it is there as a stepping stone toward the Elements' further results on prime numbers, including the proof (Book IX, Proposition 20) that there are infinitely many primes. Euclid's original proof of the lemma proceeds via the Euclidean algorithm for the greatest common measure rather than via a Bézout-style linear combination explicitly, but the logical content — using the mutual "measuring" relationship between two numbers with no common factor to force divisibility through — is the same idea later formalized algebraically.
Is Euclid's Lemma the same statement as the Fundamental Theorem of Arithmetic?
No. Euclid's Lemma is a statement purely about divisibility: if a prime divides a product, it divides one of the factors. The Fundamental Theorem of Arithmetic is the stronger claim that every integer greater than has a factorization into primes that is unique up to the order of the factors. Euclid's Lemma is a lemma — a stepping stone — used to prove the uniqueness half of the Fundamental Theorem; existence of a factorization is proved separately (typically by strong induction, without needing Euclid's Lemma at all). So the lemma is strictly weaker in content but is the essential ingredient that makes uniqueness provable.
Does Euclid's Lemma require and to be positive?
No. The statement and proof work for all integers , including zero and negative values, because divisibility ( meaning for some integer ) and Bézout's identity are both defined and valid over all of , not just the positive integers. If , then trivially (since ), so the conclusion holds immediately regardless of . Negative integers behave identically to their absolute values for divisibility purposes, since .
Can Euclid's Lemma fail if is replaced by a prime power, like ?
Yes, and this is instructive. Take , , : then , so , but and . So the naive analogue fails for prime powers, because is not prime (it is composite), and , so the coprime hypothesis needed for the generalized lemma is violated. The correct statement for prime powers is more delicate: lets you conclude something about how the exponents of in and add up, which is exactly the content of unique factorization applied afterward, not Euclid's Lemma directly.
How does Euclid's Lemma relate to the Euclidean algorithm?
They share a name and a common ancestor but are logically distinct tools working together. The Euclidean algorithm is a computational procedure for finding by repeated division with remainder; running it "backwards" (back-substitution) produces the integers in Bézout's identity . Euclid's Lemma then uses this identity, in the case , as the engine of its proof. So the Euclidean algorithm supplies the raw coefficients, and Euclid's Lemma is the theorem built from having those coefficients available whenever coprimality holds.
Why is the "or" in Euclid's Lemma not exclusive — does it matter?
It does not matter for the proof or for applications, but it is worth noting precisely: the lemma concludes " or " as an inclusive or, meaning at least one (possibly both) must hold. For example , , : here and both hold simultaneously, and as well. The lemma makes no claim about exclusivity, and no step of the proof needs one branch to fail in order to conclude the other; the case split in the proof (Case 1: ; Case 2: ) is used only to organize the argument, not to assert the cases are mutually exclusive outcomes of interest.
Does the generalized coprime form require to be prime at all?
No — that is precisely the point of stating it separately. The generalized form only requires ; itself can be any nonzero integer, prime or composite. For instance , (so ), and suppose ; then the generalized lemma guarantees . You can check this with : , and , and indeed . The prime case is simply the special case where coprimality with is guaranteed automatically by together with primality of , which is why primality suffices but is not, strictly, necessary for the underlying mechanism.