Number Theory
Number Theory
Lemma 4.1.1. (Division algorithm] Let a and b be tuo integers with b> 0. Then there erist unique
integers 4,r such that a = qb +r, where 0 sr<b. The integer q is called the quotient and r, the
remainder.
Proof. Eristence: Take S = fa+ b<z e Z} n W. Then a + la<b e S. Hence, S is a nonempty subset
of W. Therefore, by the well ordering principle, S contains its minimum, say so. So, s0 = a+ bro, for
some ro ¬ Z. Since so ¬ W, so > 0.
If s0 >b then 0 S s0 -b= a+ b(20 1) e S. This contradicts the minimality of s0- Hence
0s s0 < b. Take q= -o and r = s0- Then gb +r=-rgb+s0 = -rob +a +bro =a, i.e., we have
obtained q and r such that a = gb +r with 0<r<b.
Uniqueness: Assume that there exist integers q1,42,1 and r2 satisfying a =q1b+r, 0s r1 <b,
a= qpb+rg, and 0 S r <b. Suppase r1 < r2. Then 0 < r-71 <b. Notice that ra-TË = (91-2)b. So,
0< (91-g)b < b. This is a contradiction since (0, b) does not contain any integer which is a multiple
of b. Similarly, r <r leads to a contradiction. Therefore, r = F. Then, 0 = 1 -2 = (91 - 2)b
and b 0 imply that q1 = 2
Defnition 4.1.2. Let a, be Z with b 0. If a = be, for some c ¬ Z then b is said to divide a and
we write bla (read as b divides a. ) When b<a, we also say that b is a divisor of a, and that a is a
multiple of b.
Remark 4.1.3. Let a be a nonzero integer. If bis a positive divisor of a, then 1 < b< la). Hence the
set of all positive divisors of a nonzero integer is a nonempty finite set.
Further, if a is a positive integer and bis a positive divisor of a, then a = kbfor some k ENso
that bS a. It then follows that if a, bENsuch that a<b and b<a, then a = b.
Definition 4.1.4. 1. Let a and bbe two nonzero integers. Then the setS of their common positive
divisors is nonempty and ânite. Thus, S contains its greatest element. This element is called
the greatest common divisor of a and b and is denoted by gcd(a, b). The gcd is also called
the highest common factor.
The next result is often stated as "the ged(a, b) is a linear combination of a andb'.
Theoremn 4.1.5. (Bézout's identity] Lel a and b be two nonzero integers and let d = gcd(a. b).
Then there ezist integers zO, 4O such that d = ao + byo.
Proof. Consider the set S = {ar +by : ,y e Z}nN. Then, eithera e Sor -ae S. Thus, S is a
nonempty subset of N. By the well ordering principle, S contains its least element, say d. As de S,
we have d= aro +byo, for some to, yo EZ. We show that d= ged(a, b).
By the division algorithm, there exist integers q and r such that a = dq +r, with 0 r<d. If
r>0, then
Proof. Suppose d = gcd(a, b). Then dla and db, By Bézout's identity, d = ak+ bm for some k, m e Z.
Thus, any common divisor of a and b divides d = ged(a, b).
Conversely, suppose da, and cach còmmon divisor of a and b divides d. Since d is a common
divisor of a and b, by what we have just proved, dl ged(a, b). Further, ged(a, b) is a common divisor of
a and b; so, by assumption ged(a, b) |d. By Remark 4.1.3, d = ged(a, b).
Corollary 4.1.7. Lel a, b be nonzero integers. Then gcd(a, b) = 1if and only if there erist integers
To and y0 such that aro + byo = 1.
Proof. If gcd(a, b) =1, then by Bézout's identity, there exist integers ro and yo such that aro+byo = 1.
Conversely, suppose there exist integers zo and yo such that azo + byo = 1. If ged(a, b) =k, then k is
a positive integer such that kl1. It follows that k <1; consequently, k= 1.
Corollary 4.1.8. Let nj,... , n¡ be positive integers which are pairuise coprimes. If aE Z is such
that n1la,...,ngla, then nË a.
Proof. The positive integers nË,...,n7 are pair wise coprimes means that if i#j, then ged(n,, n;) = 1.
Let a ¬Z be such that n1la, , ngla. We show by induction that nË ngla. For k = 2, it is given
that nla, n2la and god(n1, n2) = 1. By Bézout's identity, there exist z, y E Z such that nz+n2y = 1.
Multiplying by a, we have a = an1z + angy = n1n2(z(4) + y(4)).
Since nzla and n1la, we see that eZ so that (z() + v()) ¬ Z. Hence n1 n2la.
Assume the induction hypothesis that the statement is true for k = m. Let each of nË,..., nm+l
divide a and that they are pairwise coprimes. Let nËnm = l. Then ged(l, nm+1) = 1. By the
induction hypothesis, <a. By the basis case, (k =2 as proved), we conclude that lnm+1la. That is,
nËnn+1|a.
4.1. DIVISION ALGORITHM AND ITS APPLICATIONS 63
The division algorithm helps to algorithmically compute the greatest commnon divisor of two
nonzero integers, comnonly known as the Euclid's algorithm.
Let a, and b be nonzero integers. By the division algorithm, there exists integers q and r with
0<r< b| such that a = |blq +r. We apply our observation that a common divisor of two integers
divides their ged.
Now, ged(|b|, r) divides both lbl and r; hence it divides a. Again, ged(|b|, r) divides both a and |b|.
Hence ged(|b|, r)l ged(a, |b|).
Similarly, with r = a- |blq, we see that ged(a, lo|) divides both a and bl; hence ged(a, |b|)|r.
Consequently, god(a. lb|)l ged(l, r).
Further, the ged of any two integers is positive. Thus, ged(a, b) = ged(a, Jb|). So, we obtain
The process will take at most b- 1 steps as 0S ro < b. Also, note that re+1 can be expressed in
the forn r+1 = a to + byo for integers ro, yo using backtracking. That is,
5 =35 -2-15 = 35-2(155 4-35) = 9-35 -2-155 = 9(-275+2-155)-2- 155 = 9- (-275) + 16- 155.
Also, note that 275 =5-55 and 155 = 5-31 and thus, 5 = (9+31z)·(-275) + (16+ 55z) 155, for all
r¬Z. Therefore, we see that there are ininite number of choices for the pair (r, y)¬Z', for which
d= az + by.
ExERCIsE 4.1.10. 1. Let a, beN with ged(a, b) = d. Then ged(4,4) = 1.
2. Prove that the system 15z + 12y = b has a solution for z, y ¬ Z if and only if3 divides b.
64 CHAPTER 4. ELEMENTARY NUMBER THEORY
5. Euclid's algorithm can sometimes be applied to check whether two numbers which are dependent
on an unknown integer n, are relatively prime or not. For erample, we can use the algorithm to
prove that ged(2n +3,5n +7) =1 for every n E Z.
6. Suppose a milkman has only 3 cans of sizes 7,9 and 16 liters. What is the minimum number of
operations required to deliverlliter of milk to a customer? Erplain.
To proceed further, we need the following definitions.
Definition 4.1.11. 1. The integer 1 is called the unity (or the unit element) of Z.
2. An integer p > 1 is called a prime, ifp has exactly two positive divisors, namely, 1and p.
3. An integer r>l is called composite if r is not a prime.
We are now ready to prove an important result that helps us in proving the fundamental theorem
of arithmnetic.
Lemma 4.1.12. (Euclid's Lemma] Let a, be Z and let p be a prime. Ifplab then pla or plb.
Proof. Suppose plab. If pla, then there is nothing to prove. So, assume that pta. As p is a prine,
gcd(p, a) = 1. Thus there exist integers r, ysuch that 1= ar + py. Then b= abr + pby. Since plab
and plpb, we see that plb.
One also has the following result.
Proposition 4.1.13. Let a, b, n ¬ Z be such that n<ab. If ged(n, a) = 1, then n|b.
Proof. Suppose gcd(n, a) = 1. There exist ro, yo ¬ Z such that nto + ayo =1. Then b= abyo + nbrÍ.
Since nlab and n<nb, we have nlb.
Now, we are ready to prove the funcdamnental theorem of arithmetic that states that 'every positive
integer greater than 1is either a prime or is a produet of primes. This product is unique, except for
the order in which the prime factors appear
Theorem 4.1.14. (Fundamental theorem of arithmetic] LetneN with n > 2. Then there ezist
prime numbers p1 > p>> Pk and positive integers s1, 82,..., 8k such that n = pi'pp,for
some k > 1. Moreover, ifn also equals ai'
a a , for distinct primesq>2> > qu and positive
integers t,,t2,te then k = l and for each ie {1,... , k}, p, = 4 and s, = t;.
Proof. See Example 2.2.6 for a proof.
Proposition 4.1.16. (Primality testing] Let n eN with n >2. If no prime psVn divides n, then
n is prime.
68 CHAPTER 4. ELEMENTARY NUMBER THEORY
Theorem 4.3.1. (Chinese remainder theorem) Fiz a positive integer m. Let n1, n2,..,n be
pairwise coprime positive integers. Write M=njn, n Then, the system of congruences
(mod n1)
r= a2 (mod nT)
(mod m)
has a unique solution modulo M.
M
Proof. For 1 < k<m, define M¡ = ng
Then, ged(Mk, n)= l and hence there exist integers Ik yk
such that M7z7 + nuyk = 1 for 1 <k< m. Let 1 < i,j< m. Then
Mz; =Mr; + niyi=1 (mod n); i j ’ n|M, ’ M,r,=0 (mod n;).
m
Now, zo := MkTRa; = M,z,a, = 1· a, = 4, (mod n;). That is, tÍ is a solution to the given
k=1
system of congruences.
If yo is any solution to the system of congruences, then for each integer k with 0 < k< m, we have
30 = a7 (mod ng) so that yo TÍ = ak a7 = 0 (mod nk). Since n1,...,ng are pairwise coprimes and
their product is M, Corollary 4.1.8 implies that yo - zo = 0 (mod M). Therefore, zo is the unique
solution of the system of congruences module M.
4.3. CHINESE REMAINDER THEOREM 69
Example 4.3.2. Consider the system of congruences z = 20 (mod 28) and z = 14 (mod 27) in
Exercise 4.2.7.5. In this case, ay =20, ag = 14, n = 28 and ng = 27 so that M= 28-27 = 756, MË =
27 and M¡ = 28. Then, zË = -l and zz = Ishow that Mj| +M2) = 27 -1+ 28· 1= 1. Hence
To = 27-1·20 + 281·14 E -540 + 392 = -148 608 (mod 756).
ExERCISE 4.3.3. 1. Find the snallest positive integer which when divided by 4 leaves a remainder
1and when divided by 9 leaves a remainder 2.
2. Find the smallest positive integer which when divided by 8 leaves a remained 4 and when divided
by 15 leaves a remainder 10.
3. Does there erist a positive integer n such that n = 4 (mod 14) and n = 6 (mod 18)? Give
reasons for your ansuwer. What if we replace 6 or 4 with an odd number?
4. Let n be a positive integer. Show that the set Z, := {0, 1, 2, . .. , n-1} has the following properties:
5. Let m and n be tuo coprime positive integers. By Erercise 4.3.3.4, the sels Zn, Zn, and Zmn are
commutative rings with unity. Now, define addition and multiplication in Zm XZ, component
wise. ALso, define the function
f:Zmn ’Z,, x Z, by f(r) = (r (nod m), a (mod n)) for all r ¬ Zmn.
D R A F T
34 CHAPTER 2. THE NATURAL NUMBER SYSTEM
Proof. Let m,neN. Suppose msn. Clearly, n <n+1. So, if m=n, then n<n+l implies that
m<n+1. If m<n, then n<n+1 again implies that m<n+1. Thus, in any case, m <n+1.
Conversely, suppose m<n+1. If mn, then by the law of trichotomy, m> n. That is, there
exists ( ¬ Nsuch that m=n+t. It follows that n + <n+1 for some E N. Thus, using Additive
Cancellation (Exercise 2.1.4.2), one has <1. However, either l = l or = S(k) for some k ¬ N.
The first cAse implies 1 < 1 and the second case implies that 1 is a successor of some natural number;
giving us a contradiction in either case. Hence m < n.
We are now in a position to state an important principle, namely the well ordering principle.
Theorem 2.4.7. [Well Ordering Principle in N] Every nonempty subset X of N contains its least
element.
Proof. By defnition, a least element of a set is an element of the set. We thus need to show that
every nonempty subset of N has a least element. On the contrary, suppose A is a nonempty subset of
Nthat has no least element. Let B = N\ A. If 1e A, then 1 will be the least element of A. Thus
1¢A so that 1 ¬ B.
Suppose 1, 2,...,m¬ B. Then, none of 1,2,...,m is in A. If S(n) ¬ A, then S(m) would be the
least element of A. Thus, S(m) A and hence S(m) ¬ B.
Hence, by the strong form of induction, B= N. Then, B = N\A implies A = 3, a contradiction. =
ExERCISE 2.4.8. [Variation of well ordering principle] Let nÍ EN and let X be a nonempty subset
of {n0 +1, nÍ + 2,...,). Then prove that X contains ts least element.
Recall how we defned addition and multiplication in N. For any fixed n EN, we defined addition by
declaring that n+1:= S(n) andn+ S(m) := S(n+m). Due to induction, we remarked that for each
meN, these two conditions defined n + m. This intuitive work requires a formal justification. Notice
that + is a binary operation on N, that is, + is a function from NxN to N. We need to derive rigorously
from our axioms that a function satisfying the properties n + 1:= S(n) and n + S(m) := S(n + m)
exists, and that such a function is unique. Similarly, multiplication is to be tackled. We rather present
a more general result, and view the definitions of addition and multiplication as special cases. The
following result provides this general framework in N.
2.5. RECURSION THEOREM 35
Theorem 2.5.1. [Recursion Theorem) Let f :N’N be afunction. Then, for any fred natural
numbera, there erists a unique function q:N’ N such that
Example 2.5.2. 1. [Addition function] Let f :N’N be the function defined by f(z) = S(r),
for all z ¬N. Fix any element y eN. By the recursion theorem, there existsa unique function
g:N’Nsuch that g(1) = S(y) and f(glr)) = g(S(1)), for all z ¬ N. (2.4)
Define
for all EN, y+ ;= gr) (2.5)
When z = 1, from Equation (2.5), we get y +1 = g(1). As g(1) = S(y), we get y+1= S(y).
Further, for any r¬N, we see that
y+ S(r) = g(S()) (using Equation (2.5))
f(glr) (using f(g(r)) = g(S())
= S(gl=)) (using f(z) = S())
= S(y + r). (using glr) =y+r)
Thus, for all y, z eN, y+ S(r) = S(y+z). Hence, both the rules of addition stated in stated
in Definition 2.1.2 are satisfied.
2. (Multiplication function] Fix an element yeN and consider the function f :N’N defined
by f(r) =1+y. (Observe that this is well defined by Part 1. )
Then, by the recursion theorem, there exists aunique function h :N’N, such that h(1) =y
and f(h(r)) = h(S(r), for all r ¬ N. Now, defne y · z := h(z), for all z e N.
Then, forz = 1, we get y·1= h(1) = y. Further, for any z ¬ N, we see that
yS(r) = h(S(r)) = f(h(r)) = f(y- z) = yz+y.
thereby, proving both the rules of multiplication stated in Definition 2.1.3.
36 CHAPTER 2. THE NATURAL NUMBER SYSTEM
Then, for g= 1, we get m' = p(1) = m. Further, for any z E N, S(r) = z+ 1gives
mr+! = mS() = p(S(r))= f(p(r)) = plr)· m = (m") · m.
Hence, we have obtained the required power function.
Remark 2.5.3. Recall that in Example 2.5.2.1, it was easy to show that y + S(r) = S(y +z), for all
V.reN. What is more difficult to prove is that S(u) + = S(y + a), for all #, y¬ Nwhich together
with Example 2.5.2.1 gives us conmutativity of addition.
So, we take X = {r EN S(y)+ r= S(y + )} and prove that X is an inductive set.
By the recursion theorem, there exists a unique function t : N’N such that t(1) = S(S(u)) and
f(r)) = I(S(r)), for all r EN. Define
As g(1) = S(u) (see Example 2.5.2.1) and g(1) =y+1 (Equation (2.5), we se that for a = 1,
S(y) +1 = t(1) = S(S(u)) = S(g(1)) = S(y+ 1). This implies that 1 ¬ X.
To show that X = N, we assue that z ¬ X. Now, consider S(u) + S(r). Then, using Exam
ple 2.5.2.1, S(u) + S(r) = S(S(y) + r). As z ¬ X, S(y) + r= S(y+z) and hence
Sy)+ S(r) = S(S(u) +) = S(S(y + r)) = S(y + S(r)).
where the last equality also follows from Example 2.5.2.1.
Therefore, S(r) ¬ X, whenever a e X. Therefore, by Axiom P3, X = N.
5
6
7
We want to create a bijection h from X to Y by eerasing some of these lines. Initially, we keep all solid
lines and look at rng f. Since f is not an onto function, there are elements in Y\ rngf. Each one of
these elemnents must be connected by a dotted line to some element in X. So, we keep all those pairs
(y,z) ¬g such that y ng f. We follow the heuristie of keeping as many pairs in f as possible; and
then keep a pair (y, z) ¬g if no pair (2,y) Ef has been kept.
1. The elements 1,2 ¬ Y but are not in rng f. So, the dotted lines connecting then to elenents in
X must stay. That is, the pairs (1,2), (2,3)¬g must be kept.
2. Then the pairs (2, 4), (3, 5) Ef must be deleted.
3. Now, (1,3) ¬ f: it is kept, and then (3,4) E g must be deleted.
4. The pair (4,5) ¬g is kept; so (5,7) ¬ f must be deleted.
5. The pair (4,6) ¬ f is kept, and then (6,7) Eg must be deleted.
6. The pair (7, 8) ¬g is kept; so (8, 10) ¬ f must be deleted.
Continue this scheme to realize what is happening. Then the bijection h: X ’Y is given by
if =3n - 2,n EN
h(r) =
lg-'() otherwise.
PRACTICE 3.4.1. Construct bijections using the given injections f : N’N and g:NN.
1. f(r) =r+1 and g(r) =r+2.
52 CHAPTER 3. COUNTABLE AND
52/Z63
Hence A = BUo(A). Notice that f(X) = Y\B, o(A) = f(g(A) C Y, and f is one-one. Hence
Alternate. If g is onto, we have nothing to prove: So, assume that g is not onto. Then 0 :=
X\ g(Y) o. Write y =gofand E = 0Ùv(O)U ñ?(0)U = 0U n=l kw" (O). Observe that
OCEC X, :X ’X is one-one, and g does not map any element ofY to any element of 0. Hence
if r¬ X\|E,
r() = a), ifreE.
Then is a bijection. Write h:=T'og. Then h is one-one and h(Y) ='(g(Y) = T-l(x\o) = X.
Therefore, h is a bijection from Y to X.
g¯(T)) f(T)
f(T)