Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132928 views
License: OTHER
Kernel:
%%html <link href="http://mathbook.pugetsound.edu/beta/mathbook-content.css" rel="stylesheet" type="text/css" /> <link href="https://aimath.org/mathbook/mathbook-add-on.css" rel="stylesheet" type="text/css" /> <style>.subtitle {font-size:medium; display:block}</style> <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic" rel="stylesheet" type="text/css" /> <link href="https://fonts.googleapis.com/css?family=Inconsolata:400,700&subset=latin,latin-ext" rel="stylesheet" type="text/css" /><!-- Hide this cell. --> <script> var cell = $(".container .cell").eq(0), ia = cell.find(".input_area") if (cell.find(".toggle-button").length == 0) { ia.after( $('<button class="toggle-button">Toggle hidden code</button>').click( function (){ ia.toggle() } ) ) ia.hide() } </script>

Important: to view this notebook properly you will need to execute the cell above, which assumes you have an Internet connection. It should already be selected, or place your cursor anywhere above to select. Then press the "Run" button in the menu bar above (the right-pointing arrowhead), or press Shift-Enter on your keyboard.

ParseError: KaTeX parse error: \newcommand{\lt} attempting to redefine \lt; use \renewcommand

Section2.2The Division Algorithm

An application of the Principle of Well-Ordering that we will use often is the division algorithm.

Theorem2.9Division Algorithm

Let aa and bb be integers, with b>0.b \gt 0\text{.} Then there exist unique integers qq and rr such that

a=bq+r\begin{equation*} a = bq + r \end{equation*}

where 0r<b.0 \leq r \lt b\text{.}

Proof

This is a perfect example of the existence-and-uniqueness type of proof. We must first prove that the numbers qq and rr actually exist. Then we must show that if qq' and rr' are two other such numbers, then q=qq = q' and r=r.r = r'\text{.}

Existence of qq and r.r\text{.} Let

S={abk:kZ and abk0}.\begin{equation*} S = \{ a - bk : k \in {\mathbb Z} \text{ and } a - bk \geq 0 \}. \end{equation*}

If 0S,0 \in S\text{,} then bb divides a,a\text{,} and we can let q=a/bq = a/b and r=0.r = 0\text{.} If 0S,0 \notin S\text{,} we can use the Well-Ordering Principle. We must first show that SS is nonempty. If a>0,a \gt 0\text{,} then ab0S.a - b \cdot 0 \in S\text{.} If a<0,a \lt 0\text{,} then ab(2a)=a(12b)S.a - b(2a) = a(1 - 2b) \in S\text{.} In either case S.S \neq \emptyset\text{.} By the Well-Ordering Principle, SS must have a smallest member, say r=abq.r = a - bq\text{.} Therefore, a=bq+r,a = bq + r\text{,} r0.r \geq 0\text{.} We now show that r<b.r \lt b\text{.} Suppose that r>b.r \gt b\text{.} Then

ab(q+1)=abqb=rb>0.\begin{equation*} a - b(q + 1)= a - bq - b = r - b \gt 0. \end{equation*}

In this case we would have ab(q+1)a - b(q + 1) in the set S.S\text{.} But then ab(q+1)<abq,a - b(q + 1) \lt a - bq\text{,} which would contradict the fact that r=abqr = a - bq is the smallest member of S.S\text{.} So rb.r \leq b\text{.} Since 0S,0 \notin S\text{,} rbr \neq b and so r<b.r \lt b\text{.}

Uniqueness of qq and r.r\text{.} Suppose there exist integers r,r\text{,} r,r'\text{,} q,q\text{,} and qq' such that

a=bq+r,0r<banda=bq+r,0r<b.\begin{equation*} a = bq + r, 0 \leq r \lt b \quad \text{and}\quad a = bq' + r', 0 \leq r' \lt b. \end{equation*}

Then bq+r=bq+r.bq + r = bq' + r'\text{.} Assume that rr.r' \geq r\text{.} From the last equation we have b(qq)=rr;b(q - q') = r' - r\text{;} therefore, bb must divide rrr' - r and 0rrr<b.0 \leq r'- r \leq r' \lt b\text{.} This is possible only if rr=0.r' - r = 0\text{.} Hence, r=rr = r' and q=q.q = q'\text{.}

Let aa and bb be integers. If b=akb = ak for some integer k,k\text{,} we write ab.a \mid b\text{.} An integer dd is called a of aa and bb if dad \mid a and db.d \mid b\text{.} The of integers aa and bb is a positive integer dd such that dd is a common divisor of aa and bb and if dd' is any other common divisor of aa and b,b\text{,} then dd.d' \mid d\text{.} We write d=gcd(a,b);d = \gcd(a, b)\text{;} for example, gcd(24,36)=12\gcd( 24, 36) = 12 and gcd(120,102)=6.\gcd(120, 102) = 6\text{.} We say that two integers aa and bb are if gcd(a,b)=1.\gcd( a, b ) = 1\text{.}

Theorem2.10

Let aa and bb be nonzero integers. Then there exist integers rr and ss such that

gcd(a,b)=ar+bs.\begin{equation*} \gcd( a, b) = ar + bs. \end{equation*}

Furthermore, the greatest common divisor of aa and bb is unique.

Proof

Let

S={am+bn:m,nZ and am+bn>0}.\begin{equation*} S = \{ am + bn : m, n \in {\mathbb Z} \text{ and } am + bn \gt 0 \}. \end{equation*}

Clearly, the set SS is nonempty; hence, by the Well-Ordering Principle SS must have a smallest member, say d=ar+bs.d = ar + bs\text{.} We claim that d=gcd(a,b).d = \gcd( a, b)\text{.} Write a=dq+ra = dq + r' where 0r<d.0 \leq r' \lt d\text{.} If r>0,r' \gt 0\text{,} then

r=adq=a(ar+bs)q=aarqbsq=a(1rq)+b(sq),\begin{align*} r'& = a - dq\\ & = a - (ar + bs)q\\ & = a - arq - bsq\\ & = a( 1 - rq ) + b( -sq ), \end{align*}

which is in S.S\text{.} But this would contradict the fact that dd is the smallest member of S.S\text{.} Hence, r=0r' = 0 and dd divides a.a\text{.} A similar argument shows that dd divides b.b\text{.} Therefore, dd is a common divisor of aa and b.b\text{.}

Suppose that dd' is another common divisor of aa and b,b\text{,} and we want to show that dd.d' \mid d\text{.} If we let a=dha = d'h and b=dk,b = d'k\text{,} then

d=ar+bs=dhr+dks=d(hr+ks).\begin{equation*} d = ar + bs = d'hr + d'ks = d'(hr + ks). \end{equation*}

So dd' must divide d.d\text{.} Hence, dd must be the unique greatest common divisor of aa and b.b\text{.}

Corollary2.11

Let aa and bb be two integers that are relatively prime. Then there exist integers rr and ss such that ar+bs=1.ar + bs = 1\text{.}

SubsectionThe Euclidean Algorithm

Among other things, Theorem 2.10 allows us to compute the greatest common divisor of two integers.

Example2.12

Let us compute the greatest common divisor of 945945 and 2415.2415\text{.} First observe that

2415=9452+525945=5251+420525=4201+105420=1054+0.\begin{align*} 2415 & = 945 \cdot 2 + 525\\ 945 & = 525 \cdot 1 + 420\\ 525 & = 420 \cdot 1 + 105\\ 420 & = 105 \cdot 4 + 0. \end{align*}

Reversing our steps, 105 divides 420, 105 divides 525, 105 divides 945, and 105 divides 2415. Hence, 105 divides both 945 and 2415. If dd were another common divisor of 945 and 2415, then dd would also have to divide 105. Therefore, gcd(945,2415)=105.\gcd( 945, 2415 ) = 105\text{.}

If we work backward through the above sequence of equations, we can also obtain numbers rr and ss such that 945r+2415s=105.945 r + 2415 s = 105\text{.} Observe that

105=525+(1)420=525+(1)[945+(1)525]=2525+(1)945=2[2415+(2)945]+(1)945=22415+(5)945.\begin{align*} 105 & = 525 + (-1) \cdot 420\\ & = 525 + (-1) \cdot [945 + (-1) \cdot 525]\\ & = 2 \cdot 525 + (-1) \cdot 945\\ & = 2 \cdot [2415 + (-2) \cdot 945] + (-1) \cdot 945\\ & = 2 \cdot 2415 + (-5) \cdot 945. \end{align*}

So r=5r = -5 and s=2.s= 2\text{.} Notice that rr and ss are not unique, since r=41r = 41 and s=16s = -16 would also work.

To compute gcd(a,b)=d,\gcd(a,b) = d\text{,} we are using repeated divisions to obtain a decreasing sequence of positive integers r1>r2>>rn=d;r_1 \gt r_2 \gt \cdots \gt r_n = d\text{;} that is,

b=aq1+r1a=r1q2+r2r1=r2q3+r3rn2=rn1qn+rnrn1=rnqn+1.\begin{align*} b & = a q_1 + r_1\\ a & = r_1 q_2 + r_2\\ r_1 & = r_2 q_3 + r_3\\ & \vdots \\ r_{n - 2} & = r_{n - 1} q_{n} + r_{n}\\ r_{n - 1} & = r_n q_{n + 1}. \end{align*}

To find rr and ss such that ar+bs=d,ar + bs = d\text{,} we begin with this last equation and substitute results obtained from the previous equations:

d=rn=rn2rn1qn=rn2qn(rn3qn1rn2)=qnrn3+(1+qnqn1)rn2=ra+sb.\begin{align*} d & = r_n\\ & = r_{n - 2} - r_{n - 1} q_n\\ & = r_{n - 2} - q_n( r_{n - 3} - q_{n - 1} r_{n - 2} )\\ & = -q_n r_{n - 3} + ( 1+ q_n q_{n-1} ) r_{n - 2} \\ & \vdots \\ & = ra + sb. \end{align*}

The algorithm that we have just used to find the greatest common divisor dd of two integers aa and bb and to write dd as the linear combination of aa and bb is known as the .

SubsectionPrime Numbers

Let pp be an integer such that p>1.p \gt 1\text{.} We say that pp is a , or simply pp is , if the only positive numbers that divide pp are 1 and pp itself. An integer n>1n \gt 1 that is not prime is said to be .

Lemma2.13Euclid

Let aa and bb be integers and pp be a prime number. If pab,p \mid ab\text{,} then either pap \mid a or pb.p \mid b\text{.}

Proof

Suppose that pp does not divide a.a\text{.} We must show that pb.p \mid b\text{.} Since gcd(a,p)=1,\gcd( a, p ) = 1\text{,} there exist integers rr and ss such that ar+ps=1.ar + ps = 1\text{.} So

b=b(ar+ps)=(ab)r+p(bs).\begin{equation*} b = b(ar + ps) = (ab)r + p(bs). \end{equation*}

Since pp divides both abab and itself, pp must divide b=(ab)r+p(bs).b = (ab)r + p(bs)\text{.}

Theorem2.14Euclid

There exist an infinite number of primes.

Proof

We will prove this theorem by contradiction. Suppose that there are only a finite number of primes, say p1,p2,,pn.p_1, p_2, \ldots, p_n\text{.} Let P=p1p2pn+1.P = p_1 p_2 \cdots p_n + 1\text{.} Then PP must be divisible by some pip_i for 1in.1 \leq i \leq n\text{.} In this case, pip_i must divide Pp1p2pn=1,P - p_1 p_2 \cdots p_n = 1\text{,} which is a contradiction. Hence, either PP is prime or there exists an additional prime number ppip \neq p_i that divides P.P\text{.}

Theorem2.15Fundamental Theorem of Arithmetic

Let nn be an integer such that n>1.n \gt 1\text{.} Then

n=p1p2pk,\begin{equation*} n = p_1 p_2 \cdots p_k, \end{equation*}

where p1,,pkp_1, \ldots, p_k are primes (not necessarily distinct). Furthermore, this factorization is unique; that is, if

n=q1q2ql,\begin{equation*} n = q_1 q_2 \cdots q_l, \end{equation*}

then k=lk = l and the qiq_i's are just the pip_i's rearranged.

Proof

Uniqueness. To show uniqueness we will use induction on n.n\text{.} The theorem is certainly true for n=2n = 2 since in this case nn is prime. Now assume that the result holds for all integers mm such that 1m<n,1 \leq m \lt n\text{,} and

n=p1p2pk=q1q2ql,\begin{equation*} n = p_1 p_2 \cdots p_k = q_1 q_2 \cdots q_l, \end{equation*}

where p1p2pkp_1 \leq p_2 \leq \cdots \leq p_k and q1q2ql.q_1 \leq q_2 \leq \cdots \leq q_l\text{.} By Lemma 2.13, p1qip_1 \mid q_i for some i=1,,li = 1, \ldots, l and q1pjq_1 \mid p_j for some j=1,,k.j = 1, \ldots, k\text{.} Since all of the pip_i's and qiq_i's are prime, p1=qip_1 = q_i and q1=pj.q_1 = p_j\text{.} Hence, p1=q1p_1 = q_1 since p1pj=q1qi=p1.p_1 \leq p_j = q_1 \leq q_i = p_1\text{.} By the induction hypothesis,

n=p2pk=q2ql\begin{equation*} n' = p_2 \cdots p_k = q_2 \cdots q_l \end{equation*}

has a unique factorization. Hence, k=lk = l and qi=piq_i = p_i for i=1,,k.i = 1, \ldots, k\text{.}

Existence. To show existence, suppose that there is some integer that cannot be written as the product of primes. Let SS be the set of all such numbers. By the Principle of Well-Ordering, SS has a smallest number, say a.a\text{.} If the only positive factors of aa are aa and 1, then aa is prime, which is a contradiction. Hence, a=a1a2a = a_1 a_2 where 1<a1<a1 \lt a_1 \lt a and 1<a2<a.1 \lt a_2 \lt a\text{.} Neither a1Sa_1\in S nor a2S,a_2 \in S\text{,} since aa is the smallest element in S.S\text{.} So

a1=p1pra2=q1qs.\begin{align*} a_1 & = p_1 \cdots p_r\\ a_2 & = q_1 \cdots q_s. \end{align*}

Therefore,

a=a1a2=p1prq1qs.\begin{equation*} a = a_1 a_2 = p_1 \cdots p_r q_1 \cdots q_s. \end{equation*}

So aS,a \notin S\text{,} which is a contradiction.

SubsectionHistorical Note

Prime numbers were first studied by the ancient Greeks. Two important results from antiquity are Euclid's proof that an infinite number of primes exist and the Sieve of Eratosthenes, a method of computing all of the prime numbers less than a fixed positive integer n.n\text{.} One problem in number theory is to find a function ff such that f(n)f(n) is prime for each integer n.n\text{.} Pierre Fermat (1601?–1665) conjectured that 22n+12^{2^n} + 1 was prime for all n,n\text{,} but later it was shown by Leonhard Euler (1707–1783) that

225+1=4,294,967,297\begin{equation*} 2^{2^5} + 1 = \text{4,294,967,297} \end{equation*}

is a composite number. One of the many unproven conjectures about prime numbers is Goldbach's Conjecture. In a letter to Euler in 1742, Christian Goldbach stated the conjecture that every even integer with the exception of 2 seemed to be the sum of two primes: 4=2+2,4 = 2 + 2\text{,} 6=3+3,6 = 3 + 3\text{,} 8=3+5,8 =3 + 5\text{,} .\ldots\text{.} Although the conjecture has been verified for the numbers up through 4×1018,4 \times 10^{18}\text{,} it has yet to be proven in general. Since prime numbers play an important role in public key cryptography, there is currently a great deal of interest in determining whether or not a large number is prime.