# Lecture 12

## The fundamental theorem of arithmetic

We’ll go on now and describe three uses of this result. Firstly, we return to the question of unique factorisation into primes. Of course we’ve proved that every positive integer can be written as a product of primes. The question is, can every positive integer be written as a product of primes in *only one way*?

Of course, we should be careful to say what we mean by “only one way”. We certainly do have: $\begin{aligned} 420 &= 2 \times 2 \times 3 \times 5 \times 7\\ &= 5 \times 2 \times 3 \times 7 \times 2\\ &= 7 \times 5 \times 3 \times 2 \times 2,\quad\text{and so on\ldots}\end{aligned}$ Clearly, what we mean is that every positive integer can be written as a product of primes in only one way, where reordering doesn’t count as different. Or, more precisely, that any two ways of writing a positive integer as a product of primes differ only by reordering. Mathematicians say, “in only one way, up to reordering”.

So the question we ask ourselves is (for example) why we can’t have $487 \times 205339 = 7 \times 17 \times 59 \times 14243,$ (I promise you that all six of those numbers are prime).

One wants to say something like “as the right-hand side is clearly divisible by $7$, the left-hand side must be divisible by $7$ too, but there isn’t a $7$ listed among the primes on the left”.

But if we have $7\mid(487 \times 205339)$, why must we have either $7\mid 487$ or $7\mid 205339$? It wouldn’t be true if $7$ weren’t a prime. But this is true for primes!

#### Proposition

Let $p$ be a prime, and $a$ and $b$ be integers. Then, if $p\mid ab$, then $p\mid a$ or $p\mid b$.

This result is not only not obvious, we should expect it to be difficult. The definition of “$p$ being prime” talks about what things divide $p$. But this result says something about what things $p$ divides, which is completely unrelated.

#### Proof

Suppose that $p\mid ab$, and consider $\gcd(p,a)$. Since $\gcd(p,a)\mid p$, we either have $\gcd(p,a)=1$ or $\gcd(p,a)=p$.

If $\gcd(p,a)=p$, then as $\gcd(p,a)\mid a$, we have $p\mid a$.

If $\gcd(p,a)=1$, however, then by Bezout’s Lemma, we know that there are integers $m$ and $n$ such that $mp+na=1$. Now suppose we multiply both sides by $b$; we get $mpb+nab=b$.

Clearly $p\mid mpb$, and also we have $p\mid nab$ since we are supposing that $p\mid ab$. Hence $p\mid mpb+nab$, so $p\mid b$, as needed.

The second part of this proof can in fact be used to show that, for any integers $n$, $a$ and $b$, that if $n\mid ab$ and $\gcd(n,a)=1$, then $n\mid b$.

We can also boost it to a result about a product of *lots* of terms:

#### Proposition

Let $p$ be a prime and let $a_1,\ldots,a_n$ be integers. Then if $p\mid a_1\cdots a_n$, then $p\mid a_i$ for some $i$.

This is an easy induction argument using above.

Now, equipped with that tricky result, we’re ready to prove the main result of this section:

#### Proof

We have shown that any positive integer can be written as a product of primes. We need to show that this expression is unique. We’ll prove it by contradiction.

Suppose not: there is a number $n$ with two genuinely different prime factorisations $n=p_1\cdots p_r$ and $n=q_1\cdots q_s$. We can suppose that the $p$’s and the $q$’s have nothing in common (if $p_i = q_j$, then we can cancel them out and use $p_1\cdots p_{i-1}p_{i+1}\cdots p_r = q_1\cdots q_{j-1}q_{j+1}\cdots q_s$, which is a smaller example).

Now, that means that $p_1$ is different to all of $q_1,q_2,\ldots,q_s$.

We have $p_1\mid n$, since $n=p_1\cdots p_r$. But then we also have $p_1\mid q_1\cdots q_s$. But by our previous result, this means that $p_1\mid q_j$ for some $j$. But, by the definition of $q_j$ being a prime number, that means that $p_1=q_j$, which we said didn’t happen: that gives us our contradiction.

## Linear diophantine equations

A *diophantine equation* is an equation where we’re interested in solutions with the variables lying in $\mathbb{N}$ or $\mathbb{Z}$. They’re named after the ancient Greek mathematician Diophantus of Alexandria.

An example of a diophantine equation is the Fermat equation for exponent 7: $x^7 + y^7 = z^7.$

If we were interested in solutions to this equation over $\mathbb{R}$, the story would be really, really simple: we could take any $x$ and any $y$ we wanted and then just take $z = \sqrt[7]{x^7 + y^7}.$ The Fermat equation becomes more interesting because of our inability to reliably take $n$th roots in $\mathbb{Z}$ or $\mathbb{N}$: which $x$ and $y$ can we take for which this recipe works?

While they’re much easier, a similar thing is true of *linear diophantine equations*: equations of the form $ax + by = c,$ where $a$, $b$ and $c$ are integer constants.

Consider, for example, the equation $39x + 54y = 120$.

This equation would be simple if we cared about real solutions: we could take any $x$ we like and then just take $y = (120-39x)/54$. However, because we can’t do division reliably in $\mathbb{Z}$, this recipe is not very helpful: how do we know which $x$ will give us an integer $y$?