User:Marty/UCSC Math 110 Fall 2008/Week 1

=Linear Diophantine Equations=

On the first day of class, we examined the game of 1-dimensional hop and skip. This game can be expressed algebraically (more maturely, perhaps) as a linear Diophantine equation. Suppose as before, we are allowed to "hop" 123 units, and "skip" 73 units each move. In order to move from $0$ to $1$, it is necessary and sufficient to find two integers $x$ and $y$, such that: $$123 x + 73 y = 1.$$ Finding such integers $x$ and $y$, one may perform $x$ hops and $y$ skips (interpreting negative hops or skips as hops or skips to the left).

An equation such as $123 x + 73 y = 1$ is called a Diophantine equation, when one intends to find only integer solutions. It is a linear equation (in contrast to equations such as $x^2 - 2 y^2 = 1$, which is quadratic). We devote some time here to studying linear Diophantine equations.

One variable
Linear Diophantine equations with one variable are not too interesting. For example, $13 x = 39$ is such a Diophantine equation. Solving such an equation involves nothing more than division. A Diophantine equation $ax = b$ (with integer constants $a,b$) has a solution if and only if $a$ divides $b$.

Two variables
Linear Diophantine equations with two variables are more interesting. Their solutions can always be found (or proven not to exist), using the Euclidean algorithm. For example, consider the following linear Diophantine equation: $$53 x - 24 y = 3.$$ We are interested in finding integers $x,y$ satisfying the above equation. We can find such integers using the Euclidean algorithm on $53$ and $24$: $$53 = 2(24) + 5.$$ $$24 = 4(5) + 4.$$ $$5 = 1(4) + 1.$$

Solving for the remainders, and working from bottom to top, yields the following: $$1 = 5 - 1(4).$$ $$4 = 24 - 4(5).$$ $$5 = 53 - 2(24).$$ Substitution yields: $$1 = 5-1(4) = 5-1(24 - 4(5)) = 5(5) - 1(24) = 5(53 - 2(24)) - 1(24) = 5(53) - 11(24).$$ It is very important to check the work at this point; a short calculation checks that: $$5(53) - 11(24) = 265 - 264 = 1.$$ Now, multiplying both sides by $3$ yields: $$15(53) - 33(24) = 3.$$ Hence, a solution to the given Diophantine equation has been found: $x = 15$, $y = -33$.

Such a method always works, in the following sense: You can find a proof that linear Diophantine equations can be solved with the Euclidean algorithm on this wiki. The essential strategy is the following:
 * If $a,b,c \in \ZZ$, with $a,b \neq 0$, and $g = GCD(a,b)$, then the Diophantine equation $ax + by = c$ has a solution if and only if $g$ divides $c$.
 * Suppose that $a,b,c \in \ZZ$, $a,b \neq 0$, and $g$ divides $c$.
 * Running the Euclidean algorithm on $a$ and $b$, and solving for remainders, it is possible to find integers $u,v$ such that $au + bv = g$. Recall that $g$ is the last nonzero remainder occurring in the Euclidean algorithm.
 * Since $g$ divides $c$, there exists $d$ such that $c = dg$.
 * Since $au + bv = g$, we find that $aud + bvd = dg = c$. Letting $x = ud$ and $y = vd$ yields $ax + by = c$, and the desired solution.

On the other hand, if $g$ does not divide $c$, then the Diophantine equation $ax + by = c$ cannot have a solution. Indeed, if it had a solution $(x,y)$, then $g$ would divide $ax$ and $g$ would divide $by$. By the two out of three principle, $g$ would also divide $c$, a contradiction.

Three or more variables
It turns out that the Euclidean algorithm, used to solve linear Diophantine equations in two variables, is also the key to solving linear Diophantine equations in more than two variables. The "bootstrapping" procedure may be exemplified by the following. Consider the Diophantine equation: $$15x + 21 y + 35 z = 2.$$ From our previous arguments, using the Euclidean algorithm, it can be seen that the equation $15x + 21y = 3w$ has a solution, for every integer $w$, since $3 = GCD(15,21)$. Also, using the Euclidean algorithm, there exist integers $w,z$ such that $3w + 35z = 2$ (since $GCD(w,z) = 1$).

Hence, we may find $w$ and $z$, and from $w$ we may find $x$ and $y$, such that altogether, we find that: $$15x + 21y + 35z = 3w + 35z = 2.$$

Such a process will suffice to solve linear Diophantine equations in any number of variables.

=Factorization=

Our discussion of factorization begins with prime numbers. A natural number $p$ is called prime if $p \neq 1$ and, for all $x,y \in \NN$, if $xy = p$ then one of the following two statements holds: Observe that $1$ is not a prime number; this is "built into" the definition of prime. Generally, this yields a classification of natural numbers as exactly one of the following:
 * $x = 1$ and $y = p$, or
 * $x = p$ and $y = 1$.
 * Zero
 * One
 * Prime numbers
 * Composite numbers.

Primes dividing a product
A fundamental fact about prime numbers, which is key to proving results about factorization, is the following: Proof: Suppose that $p$ is a prime number, and $x,y \in \NN$, and $p$ divides $xy$. Then, there exists $d \in \NN$, such that $xy = pd$. Suppose that $p$ does not divide $x$.
 * If $p$ is a prime number, and $x,y \in \NN$, then if $p$ divides $xy$, then $p$ divides $x$ or $p$ divides $y$.
 * Then, we claim that $GCD(p,x) = 1$.  Indeed, if $g$ is a common divisor of $p$ and $x$, then $g = 1$ or $g = p$, since $p$ is prime.  Since $p$ does not divide $x$, it follows that $g = 1$.
 * It follows that there exist integers $u,v$ such that $pu + xv = 1$, since linear Diophantine equations can be solved with the Euclidean algorithm.
 * Multiplying both sides by $y$ yields $puy + xyv = y$. Since $xy = pd$, this yields:

$$puy + pdv = y.$$
 * By the two out of three principle, $p$ divides $y$.

Hence, we find that if $p$ does not divide $x$, then $p$ divides $y$. In other words, if $p$ divides $xy$, then $p$ must divide $x$ or $y$. More generally (using induction), it is not difficult to prove that: This is discussed in more detail at Covers::State/Primes dividing a product must divide a factor
 * If $p$ is a prime number, and $x_1, \ldots, x_k$ is a finite sequence of natural numbers, and $p$ divides $\prod_{i=1}^k x_i$, then there exists $i$ such that $1 \leq i \leq k$ and $p$ divides $x_i$.

Prime factorization
Suppose that $n$ is a natural number. A prime factorization of $n$ consists of two pieces of data:
 * A positive natural number $k$ (the number of prime factors).
 * A finite sequence $p_1, \ldots, p_k$ of prime numbers, such that $n = p_1 \cdot \cdots \cdot p_k$.

As a technical note, some people might allow $n = 0$, in which case the finite sequence of prime numbers would be the "empty sequence", and $n$ would equal the "empty product", which is defined to be $1$.

As a first result, we can prove that: To prove this, we use an adaptation of proof-by-contradiction and proof-by-induction. It is called "proof by minimal counterexample". It is based on the fundamental fact that every nonempty set of natural numbers has a smallest element.
 * If $n \in \NN$, and $n \geq 2$, then there exists a factorization of $n$ into prime numbers.

Indeed, if there exists one $n \in \NN$ such that $n \geq 2$ and $n$ does not have a factorization into prime numbers, then there exists a smallest such integer. Let $m$ be the smallest natural number such that $m \geq 2$, and $m$ does not have a factorization into prime numbers. Then, $m$ cannot be prime, since otherwise the data: would be a factorization of $m$ into prime numbers.
 * $n = 1$
 * $p_1 = m$

Therefore, since $m$ is not prime, there exist natural numbers $x,y$ such that $2 \leq x,y < m$, and $xy = m$. By the minimality of $m$, we find that both $x$ and $y$ have factorizations into prime numbers: $$x = p_1 \cdot \cdots \cdot p_a, \mbox{ and } y = q_1 \cdot \cdots \cdot q_b.$$ By concatenating the two finite sequences of prime numbers, we arrive at a factorization of $m$: $$m = p_1 \cdot \cdots \cdot p_a \cdot q_1 \cdot \cdots \cdot q_b.$$ Hence $m$ possesses a factorization of $m$ into primes, a contradiction.

This contradicts our original assumption that we could find $x \in \NN$ such that $x \geq 2$ and $x$ does not have a factorization into prime numbers. Therefore, every natural number greater than $1$ has a factorization into prime numbers.

Aside on the infinitude of primes
Using nothing but the existence of a factorization into primes, we may prove that there are infinitely many prime numbers. We prove this by contradiction:

Uniqueness of Factorization
Now, we verify that the factorization of natural numbers into prime numbers is unique. Suppose $n \in \NN$, and $n \geq 2$. We have seen that there exists a factorization of $n$ into prime numbers: $$n = p_1 \cdot \cdots \cdot p_k.$$ Suppose that there is another factorization of $n$ into prime numbers: $$n = q_1 \cdot \cdots \cdot q_\ell.$$ (observe that there is no reason to expect, a priori, that $k = \ell$).

When we say that $n$ has a unique factorization into prime numbers, we mean the following two things:
 * $k = \ell$. No matter how we break up $n$ into prime numbers, there are the same number of prime numbers in the factorization.
 * After reordering the factors, if necessary, $p_1 = q_1, p_2 = q_2, \ldots, p_k = q_k$.

We prove this uniqueness by induction on $k$; a more careful proof can be found at Covers::State/Uniqueness of prime factorization.

=Canonical Decompositions=

Canonical decomposition in $\NN$
The sequence of prime numbers is the infinite sequence $(2,3,5,7,11, \ldots)$. It is one of the primary targets of study for mathematicians. We have shown that this sequence is infinite; in addition, we have demonstrated that every natural number (starting with $2$) can be "broken up" into prime numbers. Using the commutativity of multiplication, this can be expressed as follows:

If $n$ is a positive natural number, then there exists a sequence of natural numbers $e_2, e_3, e_5, \ldots$, indexed by the prime numbers, such that the following statements are true:
 * For "almost all" prime numbers $p$, $e_p = 0$. By "almost all", we mean "all but finitely many".
 * $n = 2^{e_2} \cdot 3^{e_3} \cdot 5^{e_5} \cdot \cdots.$

In fact, the second statement above does not really make sense without the first, since one cannot simply take the product of an infinite number of numbers. What we have just described is called the canonical decomposition of $n$ into primes. The following are examples of canonical decompositions of nonzero natural numbers:
 * $22 = 2^1 \cdot 3^0 \cdot 5^0 \cdot 7^0 \cdot 11^1 \cdot 13^0 \cdot \cdots$.
 * $3 = 2^0 \cdot 3^1 \cdot 5^0 \cdot \cdots$.
 * $1 = 2^0 \cdot 3^0 \cdot \cdots$.
 * $7000000 = 2^6 \cdot 3^0 \cdot 5^6 \cdot 7^1 \cdot 11^0 \cdot \cdots$.

When writing down the canonical decomposition, one proceeds until the point at which all succeeding exponents equal zero; at that point, one writes a few "dots", as in $11^0 \cdot \cdots$, to denote that every following exponent equals zero.

The uniqueness of prime factorization implies that the sequence of exponents is uniquely determined by the natural number one begins with. Observe that the natural number $1$ also has a canonical decomposition (though not a particularly interesting one), using the sequence of "all zeroes" for exponents.

Canonical decomposition in $\ZZ$ and $\QQ$
Integers can also be canonically decomposed. Every nonzero integer $z$ can be written as $\pm \vert z \vert$, where $\vert z \vert$ is a nonzero natural number. It follows that every nonzero integer $z$ has a canonical decomposition: there exists a sequence $e_{-1}, e_2, e_3, e_5, \ldots$ of natural numbers, where these "exponents" satisfy the following three properties:
 * For "almost all" prime numbers $p$, $e_p = 0$. By "almost all", we mean "all but finitely many".
 * The exponent $e_{-1}$ equals either $0$ or $1$.
 * $z = (-1)^{e_{-1}} 2^{e_2} \cdot 3^{e_3} \cdot 5^{e_5} \cdot \cdots.$

The following are examples of canonical decompositions of nonzero integers:
 * $22 = (-1)^{0} \cdot 2^1 \cdot 3^0 \cdot 5^0 \cdot 7^0 \cdot 11^1 \cdot 13^0 \cdot \cdots$.
 * $-15 = (-1)^{1} 2^0 \cdot 3^1 \cdot 5^1 \cdot 7^0 \cdot \cdots$.

Finally, rational numbers can be canonically decomposed. Every nonzero rational number can be uniquely written as $\pm \frac{a}{b}$, where $a,b$ are nonzero natural numbers and $GCD(a,b) = 1$. It follows that every nonzero rational number $q$ has a canonical decomposition: there exists a sequence $e_{-1}, e_2, e_3, e_5, \ldots$ of integers, where these "exponents" satisfy the following three properties:
 * For "almost all" prime numbers $p$, $e_p = 0$. By "almost all", we mean "all but finitely many".
 * The exponent $e_{-1}$ equals either $0$ or $1$.
 * $q = (-1)^{e_{-1}} 2^{e_2} \cdot 3^{e_3} \cdot 5^{e_5} \cdot \cdots.$

The following are examples of canonical decompositions of nonzero natural numbers:
 * $22 = (-1)^{0} 2^1 \cdot 3^0 \cdot 5^0 \cdot 7^0 \cdot 11^1 \cdot 13^0 \cdot \cdots$.
 * $-\frac{3}{4} = (-1)^{1} 2^{-2} \cdot 3^1 \cdot 5^0 \cdot \cdots$.

Applications to Rationality
A very important application of the "canoncial decomposition" of rational numbers is the following statement, that rational roots of integers are integers:

Theorem: Suppose that $f \in \NN$, and $y \in \ZZ$. If $q \in \QQ$ and $q^f = y$, then $q \in \ZZ$.

This theorem immediately implies the irrationality of an (infinite number) of numbers. For example, we can immediately see that there are no rational numbers $q$, such that $q^f = 2$, if $2 \leq f \in \NN$. Indeed, if there were such a rational number $q$, then by the above theorem, we would find that $q \in \ZZ$. But, for $q \in \ZZ$, one cannot have $q^f = 2$ by observing the following:
 * If $q = \pm 1$, then $\vert q^f \vert = 1$.
 * If $q = 0$, then $q^f = 0$.
 * If $q \geq 2$, then $\vert q^f \vert > 2$.

The power of the above theorem is the following: a priori, it seems impossible to determine whether a number has a rational root, since there are infinitely many rational numbers within any "range" (i.e., between $1.4$ and $1.417$). But, it is "easy" to determine whether a number has an integer root, since there are only finitely many integers within any range. Thus, the above theorem narrows a search from an infinite number of "candidates" to a finite number.

Digression on roots
One implication of the previous theorem is usually stated as follows: "$\sqrt{2}$ is irrational". However, such a statement is considerably deeper than what we have proven. Indeed, to talk about $\sqrt{2}$, one must already know that $\sqrt{2}$ exists, in some sense. One must have already defined a system of numbers, in which there exists $x$ such that $x^2 = 2$. Such a definition, usually via the construction of the real numbers, is quite difficult. Therefore, it is simpler, and more fundamental to say instead that: "There does not exist a rational number $q$ such that $q^2 = 2$". Such a statement assumes nothing about real numbers, existence of square roots within the field of real numbers. It relies only on the basic arithmetic operations of natural numbers, integers, and rational numbers.

From the Greek perspective, it might be completely natural to say that "$\sqrt{2}$ is irrational". Indeed, from their perspective, $\sqrt{2}$ has a very natural definition -- an Greek mathematician in the age of Pythagoras or Euclid would view $\sqrt{2}$ as the length of the diagonal in a unit square. Such a Greek would also view rationality naturally, using the concept of "measurement".

Canonical decompositions of factorials
It is interesting, and surprisingly useful, to consider the canonical decompositions of various factorials. Recall that if $n \in \NN$, then $n!$ is defined recursively as follows: Intuitively, $n!$ is the product of all natural numbers between $1$ and $n$ (inclusive), but the above two statements is essential for writing proofs.
 * If $n = 0$, then $n! = 1$.
 * If $n > 0$, then $n! = n \cdot (n-1)!$.

Let us consider the number $100!$. It is extremely large; it has well over $100$ digits. Factoring large numbers is generally quite difficult, but when large numbers are presented to us as products, their factorization should be no more difficult than the factorization of their factors (and some counting problems). Observe that any prime factor of $100!$ must divide one of the numbers between $1$ and $100$. Thus, the canonical decomposition of $100!$ only involves exponents $e_2, e_3, \ldots, e_{97}$ (since $97$ is the largest prime number before $100$).

As an example, we compute $e_7$, the exponent of $7$ in the canonical decomposition of $100!$. One should think of the factors $1,2,3,4, \ldots, 99,100$ as contributing to canonical decomposition of $100!$. The numbers $1, 2, 3,4,5,6$ do not contribute to $e_7$, since there are no sevens in the decompositions of numbers from $1$ to $6$. However, $7$ contributes $1$ to $e_7$. In this sense, every multiple of $7$ between $1$ and $100$ contributes to $e_7$:
 * $7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98$ contribute to $e_7$.

Thus, one may naively guess that $e_7 = 14$, since there are 14 multiples of $7$ contributing. However, their contributions are not equal. While $7,14,21,28,35,42$ each contribute "one seven" to the canonical decomposition of $100!$, the factor $49 = 7^2$ contributes "two sevens" to the canonical decomposition of $100!$. In fact, every multiple of $49$ will contribute at least two sevens to the canonical decomposition. In this way, we find that:
 * The $14$ multiples of $7$ each contribute one to $e_7$.
 * The $2$ multiples of $49$ ($49$ and $98$) each contribute an additional seven to $e_7$.

Altogether, there are $e_7 = 14 + 2 = 16$ sevens in the canonical decomposition of $100!$.