The **Fundamental theorem of arithmetic** (also called the **unique factorization theorem**) is a theorem of number theory. The theorem says that *every* positive integer greater than 1 can be written as a product of prime numbers (or the integer is itself a prime number). The theorem also says that there is only one way to write the number. If two people found two different ways to write the number, the only thing that can be different is the order in which the primes are written. For example, we can write:

6936 = 23 · 3 · 172   or   1200 = 24 · 3 · 52
and if somebody else finds *another* way to write 6936 or 1200 as product of prime numbers, we can put those prime numbers in the right order and find out that it is the same as what we have here. Finding the prime numbers is called factorization. 

This theorem can be used in cryptography.

Proof
-----

The first person who proved the theorem was Euclid. The first detailed and correct proof was in the *Disquisitiones Arithmeticae* by Carl Friedrich Gauss. 

Some people may think that the theorem is true everywhere. However, the theorem is *not* true in more general number systems, like algebraic integers. This was first mentioned by Ernst Kummer in 1843, in his work on Fermat's last theorem. For more information about that: read algebraic number theory. 

The proof consists of two parts: *first* we show that every number can be written as a product of primes; *second* we show that if we write a number as a product of primes for a second time, then the two lists of prime numbers must be the same. 

### First part of the proof

We show that if *not* every number greater than 1 can be written as a product of primes, we end up in some kind of impossibility. So after that we conclude that it *must* be true that every number can be written as a product of primes. 

So, now see what happens when somebody says that he/she knows a positive integer, greater than 1, which can *not* be written as a product of primes. In that case we ask him/her to mention *all* the numbers, greater than 1, that can *not* be written as a product of primes. One of these numbers must be the *smallest*: let's call it *n*. Of course, this number *n* cannot be 1. Further, it cannot be a prime number, because a prime number is a 'product' of a single prime: itself. So it *must* be a product of numbers. Thus- 

*n* = *abcdefghok*
where both *a* and *b* are positive integers that are of course smaller than *n*. But: *n* was the *smallest* number that can not be written as a product of primes. So it must be possible to write *a* and *b* as products of primes, because they are both smaller than *n*. But then the product 

*n* = *ab*
can be written as a product of primes as well. This is an impossibility because we said that *n* can not be written as a product of primes. 

We have now shown the impossibility which exists if the first part of the theorem would not be true. In this way we have now proven the first part of the theorem. 

### Second part of the proof

Now we have to prove that there is only one way to write a positive number greater than 1 as a product of prime numbers. 

To do this, we use the following lemma: if a prime number *p* divides a product *ab*, then it divides *a* or it divides *b* (Euclid's lemma). 
First we now prove this lemma. Well, assume now that *p* does not divide *a*. Then *p* and *a* are coprime and we have Bezout's identity that says that there must be integers *x* and *y* such that 

*px* + *ay* = 1.
Multiplying everything with *b* gives 

*pbx* + *aby* = *b*,
Remember that *ab* could be divided by *p*. So now, on the left-hand side we have two terms that are divisible by *p*. So the term on the right-hand side is also divisible by *p*. We have now proven that if *p* does not divide *a*, it must divide *b*. That proves the lemma. 

Now we will prove that we can write an integer greater than 1 in *only one* way as a product of prime numbers.

Take a number *N*. Let's say *N* can be written as a product of primes in two different ways, say *P* and *Q*.

*N = P = Q*

*p1 \* p2 \* p3 \* p4 \* p5 ... = q1 \* q2 \* q3 \* q4 \* q5 ...*

We know that since *p1* divides *P*, it also has to divide *Q*. However, since all the factors in *Q* are primes, *p1* must be included in *Q*. Now let us remove *p1* from *P* and *Q*. We get two new products, and we can keep repeating this until both sides are reduced to *1 = 1*.

Since we reduced both sides by removing the same factors, both sides must be the same, so the prime factorization must be unique.

Related pages
-------------

* Fundamental theorem of algebra

| * v
* t
* e
Divisibility-based sets of integers |
| --- |
| Overview | 
* Integer factorization
* Divisor
* Unitary divisor
* Divisor function
* Prime factor
* Fundamental theorem of arithmetic

 | Divisibility of 60 |
| Factorization forms | 
* Prime
* Composite
* Semiprime
* Pronic
* Sphenic
* Square-free
* Powerful
* Perfect power
* Achilles
* Smooth
* Regular
* Rough
* Unusual

 |
| Constrained divisor sums | 
* Perfect
* Almost perfect
* Quasiperfect
* Multiply perfect
* Hemiperfect
* Hyperperfect
* Superperfect
* Unitary perfect
* Semiperfect
* Practical
* Erdős–Nicolas

 |
| With many divisors | 
* Abundant
* Primitive abundant
* Highly abundant
* Superabundant
* Colossally abundant
* Highly composite
* Superior highly composite
* Weird

 |
| Aliquot sequence-related | 
* Untouchable
* Amicable (Triple)
* Sociable
* Betrothed

 |
| Base-dependent | 
* Equidigital
* Extravagant
* Frugal
* Harshad
* Polydivisible
* Smith

 |
| Other sets | 
* Arithmetic
* Deficient
* Friendly
* Solitary
* Sublime
* Harmonic divisor
* Descartes
* Refactorable
* Superperfect

 |