Why Every Whole Number Factors Into Primes in Only One Way
Follow both halves of the fundamental theorem of arithmetic, why prime factorizations exist and why no number can have two different ones.
Key takeaways
- Every whole number above 1 is a product of primes, because a composite number can keep being split into smaller factors.
- Uniqueness depends on Euclid's lemma: a prime that divides a product must divide at least one of the factors.
- There are number systems where factorizations exist but are not unique, so the theorem is a genuine fact about the integers.
- Writing numbers as prime powers makes divisors, greatest common divisors and least common multiples easy to read off.
Every whole number greater than 1 can be written as a product of primes, and apart from the order of the factors there is only one way to do it. This is the fundamental theorem of arithmetic. However you start splitting 360, you finish with three 2s, two 3s and one 5.
The statement has two halves. Existence, that some prime factorization is always there, is fairly easy. Uniqueness is deeper than it looks, and it rests on a special property of primes that has to be proved.
Seeing it with 360
Split 360 in two quite different ways.
360 = 36 × 10 = (6 × 6) × (2 × 5) = 2 × 3 × 2 × 3 × 2 × 5
360 = 8 × 45 = (2 × 4) × (9 × 5) = 2 × 2 × 2 × 3 × 3 × 5 Sort each list and they match exactly. Collecting repeated primes into powers gives the standard form 360 = 2³ × 3² × 5.
A single prime such as 13 counts as a product with one factor. The number 1 is treated as the empty product, the product of no primes at all. Primes themselves are introduced in prime numbers from the ground up.
Why a factorization always exists
Take any whole number n greater than 1. If n is prime, we are done. If it is not, it is composite, meaning n = a × b where both a and b are greater than 1 and smaller than n. Apply the same question to a and to b.
Each split produces strictly smaller numbers, all greater than 1, so the splitting cannot continue forever. When it stops, every piece is prime.
To make this airtight, suppose some numbers had no prime factorization, and let m be the smallest such number. It cannot be prime, so m = a × b with smaller factors. Being smaller than m, both a and b do have factorizations. Placing those side by side factors m, a contradiction. This pattern of argument is strong induction in another dress.
Why uniqueness is not obvious
It is tempting to say that primes cannot be broken down, so of course the final list is forced. That does not follow. "Cannot be broken down" tells you that each factorization has stopped. It does not tell you that two different routes stop at the same place.
Consider a smaller world made only of the numbers that leave remainder 1 on division by 4: 1, 5, 9, 13, 17, 21 and so on. Multiplying two of them gives another. Call such a number "irreducible" here if it is greater than 1 and is not a product of smaller members of this world.
441 = 9 × 49
441 = 21 × 21 The numbers 9, 21 and 49 are all irreducible in this world, since 3 and 7 are not members. So 441 has two different factorizations. Splitting always stops, yet uniqueness fails. Any proof of uniqueness for ordinary integers must therefore use something this smaller world lacks, namely the ability to subtract and take remainders freely.
Euclid's lemma, the key step
The needed property is this: if a prime p divides a product a × b, then p divides a or p divides b. A form of it appears in Book VII of Euclid's Elements.
The proof uses Bezout's identity, which says that the greatest common divisor of two integers can be written as a sum of integer multiples of them.
suppose p divides ab but p does not divide a
gcd(p, a) = 1 since the only divisors of p are 1 and p
1 = px + ay for some x, y Bezout
b = pbx + aby multiply both sides by b
p divides pbx obvious
p divides aby because p divides ab
so p divides b The statement is false for composite numbers. The number 6 divides 4 × 9 = 36, yet it divides neither 4 nor 9. By repeating the lemma, a prime that divides a long product must divide at least one of its factors.
Finishing the uniqueness proof
Suppose a number has two prime factorizations.
p₁ × p₂ × ... × pᵣ = q₁ × q₂ × ... × qₛ The prime p₁ divides the left side, so it divides the right. By Euclid's lemma it divides one of the q's. That q is prime, so its only divisors are 1 and itself, and since p₁ is not 1, the two are equal. Cancel them from both sides.
What remains is an equation between two shorter lists of primes. Repeat. Neither side can run out before the other, because that would make 1 equal to a product of primes, which are all at least 2. So the two lists contain the same primes, each the same number of times.
Carl Friedrich Gauss gave a clear statement and proof of the theorem in his Disquisitiones Arithmeticae of 1801.
What uniqueness lets you do
Because the factorization is a fixed fingerprint, you can answer many questions by looking only at exponents. Take 360 = 2³ × 3² × 5 and 84 = 2² × 3 × 7.
| Question | Rule on exponents | Result |
|---|---|---|
| Greatest common divisor | take the smaller of each | 2² × 3 = 12 |
| Least common multiple | take the larger of each | 2³ × 3² × 5 × 7 = 2520 |
| Product | add them | 2⁵ × 3³ × 5 × 7 = 30,240 |
| Is it a perfect square? | all exponents even | 360 is not |
Counting divisors becomes simple as well, as shown in counting divisors from prime factors. A divisor of 360 must be 2 to a power from 0 to 3, times 3 to a power from 0 to 2, times 5 to the power 0 or 1. Uniqueness guarantees that these 24 choices give 24 different numbers.
A proof of irrationality in two lines
Uniqueness settles why √2 is not a fraction. Suppose √2 = a/b with positive whole numbers a and b. Then a² = 2b².
In any perfect square, every prime appears an even number of times. So 2 appears an even number of times in a². In 2b² it appears an odd number of times. One number cannot have both, so no such fraction exists.
The same argument shows that √n is irrational whenever the whole number n is not a perfect square. Other routes are collected in several proofs that √2 is irrational.
Finding the factorization in practice
The theorem guarantees an answer, and for numbers of modest size you can find it by trial division. Try the primes in increasing order, divide out each one as many times as it goes, and continue with what is left.
Take 1386. It is even, giving 2 × 693. The digits of 693 add to 18, so 9 divides it, giving 693 = 3 × 3 × 77. Finally 77 = 7 × 11. The result is 1386 = 2 × 3² × 7 × 11.
You may stop early. If the part that remains has no prime factor up to its square root, it is prime. The reason is that two factors both larger than √n would multiply to more than n. For a remainder such as 97, testing 2, 3, 5 and 7 is enough, since the next prime, 11, has a square of 121.
Uniqueness gives you a free consistency check. If a friend factors the same number by starting somewhere else, say by noticing 1386 = 14 × 99, the final list must agree with yours: 14 contributes 2 and 7, while 99 contributes 3, 3 and 11. A disagreement means an arithmetic slip, or a "prime" in someone's list that was not prime.
Existence and uniqueness are different skills
It is worth seeing how differently the two proofs behave. The existence argument uses only the fact that factors of a number are smaller than the number. It works in almost any system with a sensible notion of size, including the world of numbers with remainder 1 on division by 4.
The uniqueness argument needs addition. Bezout's identity builds the number 1 out of multiples of p and a, and that step is meaningless in a system closed only under multiplication. In the smaller world above, 21 divides 9 × 49, yet it divides neither 9 nor 49. So 21 cannot be broken down there and still fails to behave like a prime.
Algebraists keep the two ideas apart by name. An element is irreducible if it cannot be split into smaller pieces, and prime if it satisfies Euclid's lemma. In the integers the two coincide. That coincidence is the real content of the fundamental theorem.
When the theorem fails elsewhere
Mathematicians often enlarge the integers by adding new numbers such as √−5. In that system 6 equals 2 × 3 and also (1 + √−5)(1 − √−5), and none of the four factors can be split further. The discovery that unique factorization can break down reshaped algebra in the 1800s, a story told in where unique factorization fails.
Other systems keep the property. Polynomials in one variable with real coefficients factor uniquely into irreducible polynomials, up to order and constant multiples. So do the Gaussian integers, numbers a + bi with a and b whole, up to order and multiplication by 1, −1, i or −i.
Common questions
Do negative integers factor uniquely too?
Yes, once you allow a sign. Every nonzero integer is 1 or −1 times a product of positive primes, in only one way up to order. Zero has no prime factorization.
Why not count 1 as a prime?
Uniqueness would be lost at once, since 6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3. See why 1 is not prime.
Is it easy to find the factorization?
It is easy for small numbers. For very large numbers, no efficient method for ordinary computers is publicly known. The theorem promises that the answer exists and is unique, and says nothing about how long the search will take.