The Fundamental Theorem of Arithmetic
Why can every integer greater than 1 be broken into primes in essentially one way? Take the number 360. You might factor it as . Or start differently as . Every route, if pushed all the way down to primes, ends at the same multiset . This is not an accident of small numbers. It is a theorem, and a surprisingly non-obvious one. Uniqueness fails in many number systems that look superficially similar to the integers. The Fundamental Theorem of Arithmetic (FTA) asserts two separate things. Every integer greater than 1 admits a factorization into primes (existence). Any two such factorizations agree up to the order of the factors (uniqueness). Existence is the easy half, provable by a short induction. Uniqueness is the deep half. Its standard proof rests entirely on Euclid's Lemma — the statement that a prime dividing a product must divide one of the factors. Without that lemma, uniqueness can genuinely fail. We will see this in rings where an analogue of "prime" exists but Euclid's Lemma does not hold. The theorem matters because it turns multiplicative questions about integers into combinatorial questions about exponent vectors of primes. Once you know uniquely, several things follow. Computing , , the number of divisors, and multiplicative functions like Euler's totient all become exercises. They reduce to comparing or manipulating exponents. The FTA is the load-bearing wall of elementary number theory. Nearly every later structural result about divisibility either uses it directly or generalizes it to other rings. This article gives the precise statement and a complete non-circular proof of both halves. It includes a worked example tracking every step of an unequal factorization. It also gives a concrete counterexample showing what breaks in when the analogue of Euclid's Lemma fails. It closes with the theorem's role in modern applications. These range from cryptographic key generation to the analytic machinery of the Riemann zeta function.
- Every integer factors into primes: this is the existence half, proved by strong induction.
- The uniqueness half says the prime factorization is the same multiset of primes no matter how you find it.
- Uniqueness is proved using Euclid's Lemma: if a prime then or .
- The theorem fails to hold in some other number systems (e.g. ), which shows Euclid's Lemma is not automatic.
- FTA converts multiplicative problems (gcd, lcm, divisor counting) into additive problems on exponent vectors.
- It underlies cryptographic assumptions (RSA) and the Euler product for the zeta function.
- Key idea: primes are the multiplicative "atoms" of , and every integer decomposes into them in exactly one way.
Where this lives today
The Fundamental Theorem of Arithmetic is the quiet engine behind an enormous range of mathematics and its applications:
- Cryptography. The security of RSA public-key encryption rests on the practical difficulty of factoring a large composite into its two prime factors, even though the Fundamental Theorem guarantees that factorization exists and is unique — the theorem guarantees what the answer is, while computational hardness is about finding it quickly.
- Analytic number theory. The Euler product formula
is a direct restatement of unique factorization: expanding the right side via geometric series and unique factorization shows every term on the left arises from exactly one combination of prime powers on the right. This identity is the starting point for the analytic study of the Riemann zeta function and the distribution of primes.
- Algebraic number theory and beyond. The failure of unique factorization in rings like motivated the development of ideal theory and Dedekind domains, a cornerstone of modern algebraic number theory, algebraic geometry, and the study of class groups.
- Computer science. Algorithms for integer factorization, primality testing, and computing gcd and lcm via Prime Factorization all take unique factorization as their conceptual foundation, even when the actual computation uses the Euclidean algorithm rather than factoring directly.
- Combinatorics and multiplicative functions. Functions like the divisor-counting function, sum-of-divisors function, and Euler's Totient Function are all defined and computed via the exponents in a number's unique prime factorization, and their multiplicativity is a direct consequence of the theorem.
:::quiz[In , the number 6 factors as both and . What does this demonstrate?]
- That is not actually composite in this ring
- That existence of a factorization into irreducibles can hold while uniqueness fails ✓
- That the norm function is not multiplicative
- That and are units in this ring
Ask the tutor: How does unique factorization let us derive formulas for Euler's totient function directly from a number's prime exponents?
An integer is prime if its only positive divisors are and . An integer that is not prime is composite. A prime factorization of an integer is an expression
where and each is prime (repetitions allowed, order unspecified).
The Fundamental Theorem of Arithmetic. Every integer has a prime factorization, and this factorization is unique up to the order of the factors. Equivalently, there exist a positive integer , distinct primes , and positive integers , such that
and this representation (the primes used and their exponents) is uniquely determined by .
Intuition
Think of the positive integers greater than as molecules and the primes as atoms. Multiplication combines atoms into molecules; factorization takes them back apart. The claim that factorization is unique is the number-theoretic analogue of saying a chemical compound has one determined atomic formula, not several inequivalent ones. This is far from automatic: in many other algebraic settings (systems of "numbers" built by adjoining roots like ), you can find irreducible elements that fail to play the role of atoms faithfully — the same "molecule" can be split into different irreducible pieces. What makes special is Euclid's Lemma, the mechanism that forces the split to be unique. A second useful picture is the lattice of exponent vectors. Fix a list of primes . Every positive integer corresponds to a finite sequence of exponents , almost all zero, via . Multiplying two integers corresponds to adding their exponent vectors coordinate-wise. The Fundamental Theorem of Arithmetic says this correspondence is a bijection between positive integers and such vectors — the "coordinates" of an integer in prime-space are well defined.
Central theorem
Let be an integer with . Then:
(Existence) There exist a positive integer and primes (not necessarily distinct) such that
(Uniqueness) If also with each prime, then and there is a permutation of such that for all . That is, the two factorizations use the same primes with the same multiplicities.
If is a prime and for integers , then or . More generally, if , then for at least one index .
We prove existence and uniqueness separately.
Existence, by strong induction on . Base case: . Since is prime, is itself a one-term prime factorization. Inductive step: let , and suppose every integer with has a prime factorization. We show does too. Case 1: is prime. Then is a (one-factor) prime factorization, and we are done. Case 2: is composite. By definition of composite, has a divisor with . Write where is a positive integer. Since and with (if then , contradiction; if then , contradiction, since ), we also get : indeed because , and because forces . Both and are strictly between and , so the induction hypothesis applies to each: and for primes . Concatenating,
a prime factorization of . By strong induction, every integer has a prime factorization. This completes existence.
Uniqueness, by strong induction on , using Euclid's Lemma. Base case: . The only factorization of into primes is the single factor itself, since any prime factor of must divide and primes dividing can only be (as 's only positive divisors are , and is not prime). So uniqueness holds trivially. Inductive step: let and suppose every integer with has a unique prime factorization (up to order). Suppose
are two prime factorizations of . Since is prime and , Euclid's Lemma (applied repeatedly, as stated in the generalized form above) gives that for some index . After relabeling the 's (a mere reordering, which does not affect the multiset of factors), assume . But is prime, so its only positive divisors are and . Since and , we must have . Now divide both factorizations of by :
Call this common value . There are two cases. If : then the products and both equal . A product of one or more primes is always (each prime factor is ), so the only way a product of primes equals is if there are no factors in the product, i.e. and . Hence , and the factorizations were both just . Uniqueness holds. If : then since (because and ), the induction hypothesis applies to : its two prime factorizations and must have the same length and agree up to order, i.e. (so ) and equals as multisets. Combined with established above, the full multisets and agree, i.e. there is a permutation matching them term for term. By strong induction, uniqueness holds for every integer .
∎The proof technique for existence is strong induction with a splitting argument (reduce a composite number to two strictly smaller factors); the proof technique for uniqueness is strong induction driven by Euclid's Lemma, peeling off one matched prime at a time. Neither half of the proof invokes the Fundamental Theorem itself at any stage, so the argument is non-circular: existence uses only the definition of composite numbers, and uniqueness uses only Euclid's Lemma (a prerequisite result) together with existence's conclusion that a factorization exists to induct on.
Worked examples
Example 1: An asymmetric factorization, tracked step by step. Factor two different ways and confirm the theorem's uniqueness claim concretely. Route A (peel off small factors): . Then . Then . Then . So
Route B (start from a different divisor): notice , since (check: , , sum ✓.) Now factor each piece: and . So
Route C (yet another split): . Check: ✓. Factor and . So
All three routes, despite splitting the number completely differently at the first step ( vs. vs. as the first factor extracted), converge on the same multiset , exactly as the theorem guarantees. In canonical form,
Example 2: Using unique factorization to compute and count divisors (foreshadowing <a class="wiki-link" href="/wiki/math-numthy-gcd-lcm-prime-factorization" data-track="wiki_article.body.wiki_link">gcd and lcm via Prime Factorization</a>). Let and . Compute , , and the number of divisors of . First verify the numbers: ✓, and ✓. By the Fundamental Theorem, every prime factorization of a common divisor of can only use primes appearing in both and 's factorizations, namely and , and the exponent of each such prime in a common divisor cannot exceed its exponent in either or . Hence
Similarly, a common multiple must contain each prime to at least the larger of the two exponents, and the least such multiple takes exactly the maximum exponent for every prime appearing in either number:
Compute: , , . So . Sanity check via : left side ; right side ✓ (computing ). Finally, the number of positive divisors of is obtained because unique factorization makes every divisor of the form with , , , giving
divisors, each corresponding to a distinct choice of exponents by uniqueness.
:::counterexample[Why Euclid's Lemma cannot be dropped: factorization into irreducibles in ] The uniqueness half of the Fundamental Theorem was proved using Euclid's Lemma as an essential ingredient. Drop the hypothesis that this lemma holds, and uniqueness can fail even when existence of a factorization into irreducible elements still holds. Work in the ring , with the usual addition and multiplication (and ). Define the norm , which is multiplicative: . Call a non-zero, non-unit element irreducible if whenever , one of is a unit (the only units in this ring are , since forces , i.e. ). Consider the number . It factors two ways:
Check the second: ✓. Each of the four factors is irreducible in :
- . If non-trivially, then with neither factor , forcing . But has no integer solutions (check impossible; ). So is irreducible.
- ; a non-trivial factorization would need a factor of norm , and has no integer solution by the same check. So is irreducible.
- ; a non-trivial factorization would need factors of norm and (the only factor pairs of besides ), but norm is impossible as shown. So is irreducible. The same argument applies to .
So has two genuinely different factorizations into irreducibles, and , and no unit multiple relates or to (their norms differ: versus ), so these are not just the same factorization relabeled. Existence of a factorization into irreducibles still holds in this ring (a norm-descent argument analogous to the strong induction above works), but uniqueness fails. The reason it fails is precisely that Euclid's Lemma fails here: is irreducible but while divides neither nor (dividing would force an integer solution to a norm equation with no solutions, e.g. in the required divisibility sense). This single missing ingredient — Euclid's Lemma for irreducibles — is exactly what the uniqueness proof for used at its pivotal step, confirming that the hypothesis is essential, not merely convenient.
Scope, edge cases & common traps
| Situation | What the theorem says | Common error |
|---|---|---|
| Not covered: has the empty product of primes, conventionally, but is not itself required to have a "prime factorization" in the sense of the theorem's statement | Treating as prime, or as requiring a nonempty factorization | |
| prime | Factorization is the single factor itself | Thinking a prime "has no factorization" |
| Negative integers | Theorem as stated applies to ; extends to with a unit prefactor | Forgetting the sign, e.g. claiming and have "the same" factorization without the unit |
| Order of factors | Irrelevant — uniqueness is as a multiset / up to permutation | Treating and as different factorizations |
| Rings other than | Uniqueness can fail without an analogue of Euclid's Lemma | Assuming all "number-like" rings have unique factorization automatically |
The mathematician behind it
Origins · 1 minEuclid of Alexandria and how this was discovered
Euclid compiled the Elements, the most influential mathematics text in history, systematizing geometry and number theory into an axiomatic deductive structure. Book IX of the Elements contains Proposition 14, an early ancestor of the Fundamental Theorem of Arithmetic (restricted to certain cases), and Book VII contains what is now called Euclid's Lemma along with the Euclidean algorithm. Little is known of Euclid's life; he is thought to have taught at Alexandria's great library under Ptolemy I. His deductive method — deriving all results from a short list of explicit postulates — became the template for rigorous mathematics for over two thousand years, and the FTA's modern proof, resting on Euclid's Lemma, is a direct descendant of his own arguments.
Does the Fundamental Theorem of Arithmetic apply to the number 1?
No. The theorem as standardly stated applies to integers . The number is conventionally treated as an "empty product" of primes (a product with zero factors), which is a useful bookkeeping convention (it makes multiplicativity of functions like the divisor-count function work cleanly), but is neither prime nor composite, and the theorem's existence and uniqueness claims are not asserted for it. Including as if it had a factorization with actual prime factors would also break uniqueness trivially, since has no canonical form among primes.
Why does the theorem require primes specifically, rather than just "irreducible" numbers?
In the integers, "prime" (only divisible by and itself) and "irreducible" (cannot be written as a product of two smaller-than-itself positive integers) turn out to coincide, so the distinction is invisible in . In more general rings, they can differ: an irreducible element might not satisfy Euclid's Lemma. The uniqueness proof strictly needs the prime property (Euclid's Lemma-compatible), not merely irreducibility, which is exactly why unique factorization can fail in rings like where elements are irreducible but not prime.
Is unique factorization true for negative integers too?
Yes, with a small adjustment. Every integer with can be written as for primes , and this is unique up to reordering the primes and up to the sign choice being forced by the sign of . Formally one says is a unique factorization domain where the units are , and factorizations are unique "up to units and order." The core content of the theorem, though, is entirely about the positive integers, since every integer's factorization reduces to that of its absolute value.
How does the Fundamental Theorem let you count the divisors of a number?
If is the unique factorization, then unique factorization guarantees that every positive divisor of has the form with , and different exponent tuples give different divisors. So the number of divisors is exactly the number of such tuples, . Without uniqueness, you could not be sure that every divisor arises this way, or that distinct tuples always give distinct divisors.
Can a number have infinitely many distinct prime factors?
No — every integer has only finitely many prime factors, and in fact at most of them (with multiplicity), since each prime factor is at least and the product of factors each is at least , which must be . This finiteness is implicit in the existence proof: the induction terminates because the factors used at each splitting step are strictly smaller than , guaranteeing the recursive splitting process cannot continue forever.
Is the Fundamental Theorem of Arithmetic used to prove that there are infinitely many primes?
Not directly — the infinitude of primes (Euclid's other classical theorem) is logically independent of the FTA and is usually proved separately by contradiction (assuming a finite list of primes and constructing a number not divisible by any of them). However, the two results are often presented together because both underlie the basic structural picture of the integers: infinitude tells you there are infinitely many "atoms," while the FTA tells you how integers are built from those atoms uniquely.
What goes wrong in the proof if you only assume every irreducible splits products, i.e. weaken Euclid's Lemma to hold only for irreducibles times themselves?
The uniqueness proof's key inductive step needs the full strength of Euclid's Lemma applied to an arbitrary product of primes at once (via repeated application to pairs). If Euclid's Lemma held only in some restricted form — say only for a prime dividing a product of exactly two specific irreducibles rather than an arbitrary product — the inductive step matching to some among an arbitrary-length product could fail, and the argument would break down exactly at the point where is shown to divide one particular .