-
Notifications
You must be signed in to change notification settings - Fork 2
/
integers.xml
520 lines (419 loc) · 28.5 KB
/
integers.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This file is part of the book -->
<!-- -->
<!-- Logic and Proof for Teachers -->
<!-- -->
<!-- Copyright (C) 2019 Lesa L. Beverly, Kimberly M. Childs, Deborah A. Pace, Thomas W. Judson -->
<!-- -->
<!-- See the file COPYING for copying conditions. -->
<chapter xml:id="integers" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Integers and the Division Algorithm</title>
<introduction>
<p>The integers are the building blocks of mathematics. In this chapter we will investigate the fundamental properties of the integers, including mathematical induction, the division algorithm, and the Fundamental Theorem of Arithmetic.</p>
</introduction>
<section xml:id="section-math-induction">
<title>Mathematical Induction</title>
<p>Suppose we wish to show that
<me>
1 + 2 + \cdots + n = \frac{n(n + 1)}{2}
</me>
for any natural number <m>n</m>. This formula is easily verified for small numbers such as <m>n = 1</m>, <m>2</m>, <m>3</m>, or <m>4</m>, but it is impossible to verify for all natural numbers on a case-by-case basis. To prove the formula true in general, a more generic method is required.</p>
<p>Suppose we have verified the equation for the first <m>n</m> cases. We will attempt to show that we can generate the formula for the <m>(n + 1)</m>th case from this knowledge. The formula is true for <m>n = 1</m> since
<me>
1 = \frac{1(1 + 1)}{2}
</me>.
If we have verified the first <m>n</m> cases, then
<md>
<mrow>1 + 2 + \cdots + n + (n + 1) & = \frac{n(n + 1)}{2} + n + 1</mrow>
<mrow>& = \frac{n^2 + 3n + 2}{2}</mrow>
<mrow>& = \frac{(n + 1)[(n + 1) + 1]}{2}</mrow>
</md>.
This is exactly the formula for the <m>(n + 1)</m>th case.</p>
<p>This method of proof is known as <term>mathematical induction</term>. Instead of attempting to verify a statement about some subset <m>S</m> of the positive integers <m>{\mathbb N}</m> on a case-by-case basis, an impossible task if <m>S</m> is an infinite set, we give a specific proof for the smallest integer being considered, followed by a generic argument showing that if the statement holds for a given case, then it must also hold for the next case in the sequence. We summarize mathematical induction in the following axiom.</p>
<idx><h>Mathematical induction</h></idx>
<principle xml:id="principle-integers-first-pmi">
<title>First Principle of Mathematical Induction</title>
<statement>
<p>Let <m>S(n)</m> be a statement about integers for <m>n \in {\mathbb N}</m> and suppose <m>S(n_0)</m> is true for some integer <m>n_0</m>. If for all integers <m>k</m> with <m>k \geq n_0</m>, <m>S(k)</m> implies that <m>S(k+1)</m>is true, then <m>S(n)</m> is true for all integers <m>n</m> greater than or equal to <m>n_0</m>.</p>
</statement>
</principle>
<example>
<p>For all integers <m>n \geq 3</m>, <m>2^n \gt n + 4</m>. Since
<me>
8 = 2^3 \gt 3 + 4 = 7
</me>,
the statement is true for <m>n_0 = 3</m>. Assume that <m>2^k \gt k + 4</m> for <m>k \geq 3</m>. Then <m>2^{k + 1} = 2 \cdot 2^{k} \gt 2(k + 4)</m>. But
<me>
2(k + 4) = 2k + 8 \gt k + 5 = (k + 1) + 4
</me>
since <m>k</m> is positive. Hence, by induction, the statement holds for all integers <m>n \geq 3</m>.
</p>
</example>
<example xml:id="example-integers-induction-divisible">
<p>Every integer <m>10^{n + 1} + 3 \cdot 10^n + 5</m> is divisible by <m>9</m> for <m>n \in {\mathbb N}</m>. For <m>n = 1</m>,
<me>
10^{1 + 1} + 3 \cdot 10 + 5 = 135 = 9 \cdot 15
</me>
is divisible by <m>9</m>. Suppose that <m>10^{k + 1} + 3 \cdot 10^k + 5</m> is divisible by <m>9</m> for <m>k \geq 1</m>. Then
<md>
<mrow>10^{(k + 1) + 1} + 3 \cdot 10^{k + 1} + 5& = 10^{k + 2} + 3 \cdot 10^{k + 1} + 50 - 45</mrow>
<mrow>& = 10 (10^{k + 1} + 3 \cdot 10^{k} + 5) - 45</mrow>
</md>
is divisible by <m>9</m>.</p>
</example>
<p>A nonempty subset <m>S</m> of <m>{\mathbb Z}</m> is <term>well-ordered</term> <idx><h>Well-ordered set</h></idx> if <m>S</m> contains a least element. Notice that the set <m>{\mathbb Z}</m> is not well-ordered since it does not contain a smallest element. However, the natural numbers are well-ordered.</p>
<idx><h>Well-ordered set</h></idx>
<principle>
<title>Principle of Well-Ordering</title>
<statement>
<p>Every nonempty subset of the natural numbers is well-ordered.</p>
</statement>
</principle>
<idx><h>Principle of Well-Ordering</h></idx>
<p>The Principle of Well-Ordering is equivalent to the Principle of Mathematical Induction.</p>
<theorem xml:id="theorem-integers-pmi-implies-pwo">
<statement>
<p>The Principle of Mathematical Induction implies the Principle of Well-Ordering. That is, every nonempty subset of <m>\mathbb N</m> contains a least element.</p>
</statement>
</theorem>
You can find the proof of <xref ref="theorem-integers-pmi-implies-pwo"/> in <xref ref="subsection-backmatter-pmi"/>
<p>Induction can also be very useful in formulating definitions. For instance, there are two ways to define <m>n!</m>, the factorial of a positive integer <m>n</m>.
<ul>
<li><p>The <em>explicit</em> definition: <m>n! = 1 \cdot 2 \cdot 3 \cdots (n - 1) \cdot n</m>.</p></li>
<li><p>The <em>inductive</em> or <em>recursive</em> definition: <m>1! = 1</m> and <m>n! = n(n - 1)!</m> for <m>n \gt 1</m>.</p></li>
</ul>
Every good mathematician or computer scientist knows that looking at problems recursively, as opposed to explicitly, often results in better understanding of complex issues.</p>
<exercises>
<title>Exercises</title>
<exercise>
<statement>
<p>Prove that
<me>1^2 + 2^2 + \cdots + n^2 = \frac{n(n + 1)(2n + 1)}{6}</me>
for <m>n \in {\mathbb N}</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Prove that
<me>1^3 + 2^3 + \cdots + n^3 = \frac{n^2(n + 1)^2}{4}</me>
for <m>n \in {\mathbb N}</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Prove that <m>n! \gt 2^n</m> for <m>n \geq 4</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Prove that
<me>x + 4x + 7x + \cdots + (3n - 2)x = \frac{n(3n - 1)x}{2}</me>
for <m>n \in {\mathbb N}</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Prove that <m>10^{n + 1} + 10^n + 1</m> is divisible by <m>3</m> for <m>n \in {\mathbb N}</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Prove that <m>4 \cdot 10^{2n} + 9 \cdot 10^{2n - 1} + 5</m> is divisible by <m>99</m> for <m>n \in {\mathbb N}</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Use induction to prove that <m>1 + 2 + 2^2 + \cdots + 2^n = 2^{n + 1} - 1</m> for <m>n \in {\mathbb N}</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Prove that
<me>\frac{1}{2}+ \frac{1}{6} + \cdots + \frac{1}{n(n + 1)} = \frac{n}{n + 1}</me>
for <m>n \in {\mathbb N}</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>If <m>x</m> is a nonnegative real number, then show that <m>(1 + x)^n - 1 \geq nx</m> for <m>n = 0, 1, 2, \ldots</m>.</p>
</statement>
</exercise>
<exercise>
<title>Power Sets</title>
<statement>
<p>Let <m>X</m> be a set. Define the <term>power set</term> of <m>X</m>, denoted <m>{\mathcal P}(X)</m>, to be the set of all subsets of <m>X</m>.
<notation>
<usage>\mathcal P(X)</usage>
<description>power set of <m>X</m></description>
</notation>
For example,
<me>{\mathcal P}( \{a, b\} ) = \{ \emptyset, \{a\}, \{b\}, \{a, b\} \}</me>. For every positive integer <m>n</m>, show that a set with exactly <m>n</m> elements has a power set with exactly <m>2^n</m> elements.</p>
</statement>
</exercise>
</exercises>
</section>
<section xml:id="section-division-algorithm">
<title>The Division Algorithm</title>
<p>An application of the Principle of Well-Ordering that we will use often is the division algorithm.</p>
<theorem xml:id="theorem-integers-division_algorithm">
<title>Division Algorithm</title>
<idx><h>Division algorithm</h></idx>
<statement>
<p>Let <m>a</m> and <m>b</m> be integers, with <m>b \gt 0</m>. Then there exist unique integers <m>q</m> and <m>r</m> such that
<me>a = bq + r</me>
where <m>0 \leq r \lt b</m>.</p>
</statement>
<proof>
<p>This is a perfect example of the existence-and-uniqueness type of proof. We must first prove that the numbers <m>q</m> and <m>r</m> actually exist. Then we must show that if <m>q'</m> and <m>r'</m> are two other such numbers, then <m>q = q'</m> and <m>r = r'</m>.</p>
<p><em>Existence of <m>q</m> and <m>r</m>.</em> Let
<me>S = \{ a - bk : k \in {\mathbb Z} \text{ and } a - bk \geq 0 \}</me>.
If <m>0 \in S</m>, then <m>b</m> divides <m>a</m>, and we can let <m>q = a/b</m> and <m>r = 0</m>. If <m>0 \notin S</m>, we can use the Well-Ordering Principle. We must first show that <m>S</m> is nonempty. If <m>a \gt 0</m>, then <m>a - b \cdot 0 \in S</m>. If <m>a \lt 0</m>, then <m>a - b(2a) = a(1 - 2b) \in S</m>. In either case <m>S \neq \emptyset</m>. By the Well-Ordering Principle, <m>S</m> must have a smallest member, say <m>r = a - bq</m>. Therefore, <m>a = bq + r</m>, <m>r \geq 0</m>. We now show that <m>r \lt b</m>. Suppose that <m>r \gt b</m>. Then
<me>a - b(q + 1)= a - bq - b = r - b \gt 0</me>.
In this case we would have <m>a - b(q + 1)</m> in the set <m>S</m>. But then <m>a - b(q + 1) \lt a - bq</m>, which would contradict the fact that <m>r = a - bq</m> is the smallest member of <m>S</m>. So <m>r \leq b</m>. Since <m>0 \notin S</m>, <m>r \neq b</m> and so <m>r \lt b</m>.</p>
<p><em>Uniqueness of <m>q</m> and <m>r</m>.</em> Suppose there exist integers <m>r</m>, <m>r'</m>, <m>q</m>, and <m>q'</m> such that
<me>a = bq + r, 0 \leq r \lt b \quad \text{and}\quad a = bq' + r', 0 \leq r' \lt b</me>.
Then <m> bq + r = bq' + r'</m>. Assume that <m>r' \geq r</m>. From the last equation we have <m>b(q - q') = r' - r</m>; therefore, <m>b</m> must divide <m>r' - r</m> and <m>0 \leq r'- r \leq r' \lt b</m>. This is possible only if <m>r' - r = 0</m>. Hence, <m>r = r'</m> and <m>q = q'</m>.</p>
</proof>
</theorem>
<p>Let <m>a</m> and <m>b</m> be integers. If <m>b = ak</m> for some integer <m>k</m>, we write <m>a \mid b</m>. An integer <m>d</m> is called a <term>common divisor</term> of <m>a</m> and <m>b</m> if <m>d \mid a</m> and <m>d \mid b</m>. The <term>greatest common divisor</term><idx><h>Greatest common divisor</h><h>of two integers</h></idx> of integers <m>a</m> and <m>b</m> is a positive integer <m>d</m> such that <m>d</m> is a common divisor of <m>a</m> and <m>b</m> and if <m>d'</m> is any other common divisor of <m>a</m> and <m>b</m>, then <m>d' \mid d</m>.
<notation>
<usage>a \mid b</usage>
<description><m>a</m> divides <m>b</m></description>
</notation>
<notation>
<usage>\gcd(a, b)</usage>
<description>greatest common divisor of <m>a</m> and <m>b</m></description>
</notation>
We write <m>d = \gcd(a, b)</m>; for example, <m>\gcd( 24, 36) = 12</m> and <m>\gcd(120, 102) = 6</m>. We say that two integers <m>a</m> and <m>b</m> are <term>relatively prime</term> if <m>\gcd( a, b ) = 1</m>.</p>
<theorem xml:id="theorem-integers-gcd">
<statement>
<p>Let <m>a</m> and <m>b</m> be nonzero integers. Then there exist integers <m>r</m> and <m>s</m> such that
<me>\gcd( a, b) = ar + bs.</me>
Furthermore, the greatest common divisor of <m>a</m> and <m>b</m> is unique.</p>
</statement>
<proof>
<p>Let
<me>S = \{ am + bn : m, n \in {\mathbb Z} \text{ and } am + bn \gt 0 \}.</me>
Clearly, the set <m>S</m> is nonempty; hence, by the Well-Ordering Principle <m>S</m> must have a smallest member, say <m>d = ar + bs</m>. We claim that <m>d = \gcd( a, b)</m>. Write <m>a = dq + r'</m> where <m>0 \leq r' \lt d</m>. If <m>r' \gt 0</m>, then
<md>
<mrow>r'& = a - dq</mrow>
<mrow>& = a - (ar + bs)q</mrow>
<mrow>& = a - arq - bsq</mrow>
<mrow>& = a( 1 - rq ) + b( -sq ),</mrow>
</md>
which is in <m>S</m>. But this would contradict the fact that <m>d</m> is the smallest member of <m>S</m>. Hence, <m>r' = 0</m> and <m>d</m> divides <m>a</m>. A similar argument shows that <m>d</m> divides <m>b</m>. Therefore, <m>d</m> is a common divisor of <m>a</m> and <m>b</m>.</p>
<p>Suppose that <m>d'</m> is another common divisor of <m>a</m> and <m>b</m>, and we want to show that <m>d' \mid d</m>. If we let <m>a = d'h</m> and <m>b = d'k</m>, then
<me>d = ar + bs = d'hr + d'ks = d'(hr + ks).</me>
So <m>d'</m> must divide <m>d</m>. Hence, <m>d</m> must be the unique greatest common divisor of <m>a</m> and <m>b</m>.</p>
</proof>
</theorem>
<corollary xml:id="corollary-integers-coprime">
<statement>
<p>Let <m>a</m> and <m>b</m> be two integers that are relatively prime. Then there exist integers <m>r</m> and <m>s</m> such that <m>ar + bs = 1</m>.</p>
</statement>
</corollary>
<exercises>
<title>Exercises</title>
<exercise>
<statement>
<p>Show that the Principle of Well-Ordering for the natural numbers implies that 1 is the smallest natural number. Use this result to show that the Principle of Well-Ordering implies the Principle of Mathematical Induction; that is, show that if <m>S \subset {\mathbb N}</m> such that <m>1 \in S</m> and <m>n + 1 \in S</m> whenever <m>n \in S</m>,then <m>S = {\mathbb N}</m>.</p>
</statement>
</exercise>
<exercise>
<title>Fibonacci Numbers</title>
<statement>
<p>The Fibonacci numbers are
<me>1, 1, 2, 3, 5, 8, 13, 21, \ldots.</me>
We can define them inductively by <m>f_1 = 1</m>, <m>f_2 = 1</m>, and <m>f_{n + 2} = f_{n + 1} + f_n</m> for <m>n \in {\mathbb N}</m>.
<ol>
<li><p>Prove that <m>f_n \lt 2^n</m>.</p></li>
<li><p>Prove that <m>f_{n + 1} f_{n - 1} = f^2_n + (-1)^n</m>,<m>n \geq 2</m>.</p></li>
<li><p>Prove that <m>f_n = [(1 + \sqrt{5}\, )^n - (1 - \sqrt{5}\, )^n]/ 2^n \sqrt{5}</m>.</p></li>
<li><p>Show that <m>\lim_{n \rightarrow \infty} f_n / f_{n + 1} = (\sqrt{5} - 1)/2</m>.</p></li>
<li><p>Prove that <m>f_n</m> and <m>f_{n + 1}</m> are relatively prime.</p></li>
</ol></p>
</statement>
</exercise>
<exercise>
<statement>
<p>Let <m>a</m> and <m>b</m> be nonzero integers. If there exist integers <m>r</m> and <m>s</m> such that <m>ar + bs =1</m>, show that <m>a</m> and <m>b</m> are relatively prime.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Let <m>a</m> and <m>b</m> be integers such that <m>\gcd(a,b) = 1</m>. Let <m>r</m> and <m>s</m> be integers such that <m>ar + bs = 1</m>. Prove that
<me>\gcd(a,s) = \gcd(r,b) = \gcd(r,s) = 1.</me></p>
</statement>
</exercise>
<exercise>
<statement>
<p>Let <m>x, y \in {\mathbb N}</m> be relatively prime. If <m>xy</m> is a perfect square, prove that <m>x</m> and <m>y</m> must both be perfect squares.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Using the division algorithm, show that every perfect square is of the form <m>4k</m> or <m>4k + 1</m> for some nonnegative integer <m>k</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Suppose that <m>a, b, r, s</m> are pairwise relatively prime and that
<md>
<mrow>a^2 + b^2 & = r^2</mrow>
<mrow>a^2 - b^2 & = s^2.</mrow>
</md>
Prove that <m>a</m>, <m>r</m>, and <m>s</m> are odd and <m>b</m> is even.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Let <m>n \in {\mathbb N}</m>. Use the division algorithm to prove that every integer is congruent mod <m>n</m> to precisely one of the integers <m>0, 1, \ldots, n-1</m>. Conclude that if <m>r</m> is an integer, then there is exactly one <m>s</m> in <m>{\mathbb Z}</m> such that <m>0 \leq s \lt n</m> and <m>[r] = [s]</m>. Hence, the integers are indeed partitioned by congruence mod <m>n</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Define the <term>least common multiple</term> of two nonzero integers <m>a</m> and <m>b</m>, denoted by <m>\lcm(a,b)</m>, to be the nonnegative integer <m>m</m> such that both <m>a</m> and <m>b</m> divide <m>m</m>, and if <m>a</m> and <m>b</m> divide any other integer <m>n</m>, then <m>m</m> also divides <m>n</m>.
<notation>
<usage>\lcm(m,n)</usage>
<description>the least common multiple of <m>m</m> and <m>n</m></description>
</notation>
Prove there exists a unique least common multiple for any two integers <m>a</m> and <m>b</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>If <m>d= \gcd(a, b)</m> and <m>m = \lcm(a, b)</m>, prove that <m>dm = |ab|</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Show that <m>\lcm(a,b) = ab</m> if and only if <m>\gcd(a,b) = 1</m>.</p>
</statement>
</exercise>
<exercise xml:id="exercise-integers-gcd-products">
<statement>
<p>Prove that <m>\gcd(a,c) = \gcd(b,c) =1</m> if and only if <m>\gcd(ab,c) = 1</m> for integers <m>a</m>, <m>b</m>, and <m>c</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Let <m>a, b, c \in {\mathbb Z}</m>. Prove that if <m>\gcd(a,b) = 1</m> and <m>a \mid bc</m>, then <m>a \mid c</m>.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Let <m>p \geq 2</m>. Prove that if <m>2^p - 1</m> is prime, then <m>p</m> must also be prime.</p>
</statement>
</exercise>
<exercise>
<statement>
<p>Using the fact that <m>2</m> is prime, show that there do not exist integers <m>p</m> and <m>q</m> such that <m>p^2 = 2 q^2</m>. Demonstrate that therefore <m>\sqrt{2}</m> cannot be a rational number.</p>
</statement>
</exercise>
</exercises>
</section>
<section xml:id="integers-subsection-euclidean-algorithm">
<title>The Euclidean Algorithm</title>
<p>Among other things, <xref ref="theorem-integers-gcd"/> allows us to compute the greatest common divisor of two integers.</p>
<example xml:id="example-integers-gcd">
<p>Let us compute the greatest common divisor of <m>945</m> and <m>2415</m>. First observe that
<md>
<mrow>2415 & = 945 \cdot 2 + 525</mrow>
<mrow>945 & = 525 \cdot 1 + 420</mrow>
<mrow>525 & = 420 \cdot 1 + 105</mrow>
<mrow>420 & = 105 \cdot 4 + 0.</mrow>
</md>
Reversing our steps, <m>105</m> divides <m>420</m>, <m>105</m> divides <m>525</m>, <m>105</m> divides <m>945</m>, and <m>105</m> divides <m>2415</m>. Hence, <m>105</m> divides both <m>945</m> and <m>2415</m>. If <m>d</m> were another common divisor of <m>945</m> and <m>2415</m>,then <m>d</m> would also have to divide <m>105</m>. Therefore, <m>\gcd( 945, 2415 ) = 105</m>.</p>
<p>If we work backward through the above sequence of equations, we can also obtain numbers <m>r</m> and <m>s</m> such that <m>945 r + 2415 s = 105</m>. Observe that
<md>
<mrow>105 & = 525 + (-1) \cdot 420</mrow>
<mrow>& = 525 + (-1) \cdot [945 + (-1) \cdot 525]</mrow>
<mrow>& = 2 \cdot 525 + (-1) \cdot 945</mrow>
<mrow>& = 2 \cdot [2415 + (-2) \cdot 945] + (-1) \cdot 945</mrow>
<mrow>& = 2 \cdot 2415 + (-5) \cdot 945.</mrow>
</md>
So <m>r = -5</m> and <m>s= 2</m>. Notice that <m>r</m> and <m>s</m> are not unique, since <m>r = 41</m> and <m>s = -16</m> would also work.</p>
</example>
<p>To compute <m>\gcd(a,b) = d</m>, we are using repeated divisions to obtain a decreasing sequence of positive integers <m>r_1 \gt r_2 \gt \cdots \gt r_n = d</m>; that is,
<md>
<mrow>b & = a q_1 + r_1</mrow>
<mrow>a & = r_1 q_2 + r_2</mrow>
<mrow>r_1 & = r_2 q_3 + r_3</mrow>
<mrow>& \vdots</mrow>
<mrow>r_{n - 2} & = r_{n - 1} q_{n} + r_{n}</mrow>
<mrow>r_{n - 1} & = r_n q_{n + 1}.</mrow>
</md>
To find <m>r</m> and <m>s</m> such that <m>ar + bs = d</m>, we begin with this last equation and substitute results obtained from the previous equations:
<md>
<mrow>d & = r_n</mrow>
<mrow>& = r_{n - 2} - r_{n - 1} q_n</mrow>
<mrow>& = r_{n - 2} - q_n( r_{n - 3} - q_{n - 1} r_{n - 2} )</mrow>
<mrow>& = -q_n r_{n - 3} + ( 1+ q_n q_{n-1} ) r_{n - 2}</mrow>
<mrow>& \vdots</mrow>
<mrow>& = ra + sb.</mrow>
</md>
The algorithm that we have just used to find the greatest common divisor <m>d</m> of two integers <m>a</m> and <m>b</m> and to write <m>d</m> as the linear combination of <m>a</m> and <m>b</m> is known as the
<term>Euclidean algorithm</term>.
<idx><h>Euclidean algorithm</h></idx>
<idx><h>Algorithm</h><h>Euclidean</h></idx></p>
</section>
<section xml:id="integers-subsection-prime-numbers">
<title>Prime Numbers</title>
<p>Let <m>p</m> be an integer such that <m>p \gt 1</m>. We say that <m>p</m> is a <term>prime number</term>, <idx><h>Prime integer</h></idx> or simply <m>p</m> is <term>prime</term>, if the only positive numbers that divide <m>p</m> are <m>1</m> and <m>p</m> itself. An integer <m>n \gt 1</m> that is not prime is said to be <term>composite</term>. <idx><h>Composite integer</h></idx></p>
<lemma xml:id="theorem-integers-prime-divisor">
<title>Euclid</title>
<statement>
<p>Let <m>a</m> and <m>b</m> be integers and <m>p</m> be a prime number. If <m>p \mid ab</m>, then either <m>p \mid a</m> or <m>p \mid b</m>.</p>
</statement>
<proof>
<p>Suppose that <m>p</m> does not divide <m>a</m>. We must show that <m>p \mid b</m>. Since <m>\gcd( a, p ) = 1</m>, there exist integers <m>r</m> and <m>s</m> such that <m>ar + ps = 1</m>. So
<me>b = b(ar + ps) = (ab)r + p(bs).</me>
Since <m>p</m> divides both <m>ab</m> and itself, <m>p</m> must divide <m>b = (ab)r + p(bs)</m>.</p>
</proof>
</lemma>
<theorem xml:id="theorem-integers-infinite-primes">
<title>Euclid</title>
<statement>
<p>There exist an infinite number of primes.</p>
</statement>
<proof>
<p>We will prove this theorem by contradiction. Suppose that there are only a finite number of primes, say <m>p_1, p_2, \ldots, p_n</m>. Let <m>P = p_1 p_2 \cdots p_n + 1</m>. Then <m>P</m> must be divisible by some <m>p_i</m> for <m>1 \leq i \leq n</m>. In this case, <m>p_i</m> must divide <m>P - p_1 p_2 \cdots p_n = 1</m>, which is a contradiction. Hence, either <m>P</m> is prime or there exists an additional prime number <m>p \neq p_i</m> that divides <m>P</m>.</p>
</proof>
</theorem>
<theorem xml:id="theorem-fund-theorem-arithmetic">
<title>Fundamental Theorem of Arithmetic</title>
<idx>
<h>Fundamental Theorem</h>
<h>of Arithmetic</h>
</idx>
<statement>
<p>Let <m>n</m> be an integer such that <m>n \gt 1</m>. Then
<me>n = p_1 p_2 \cdots p_k,</me>
where <m>p_1, \ldots, p_k</m> are primes (not necessarily distinct). Furthermore, this factorization is unique; that is, if
<me>n = q_1 q_2 \cdots q_l,</me>
then <m>k = l</m> and the <m>q_i</m>'s are just the <m>p_i</m>'s rearranged.</p>
</statement>
</theorem>
<exercises>
<title>Exercises</title>
<exercise>
<statement>
<p>For each of the following pairs of numbers <m>a</m> and <m>b</m>, calculate <m>\gcd(a,b)</m> and find integers <m>r</m> and <m>s</m> such that <m>\gcd(a,b) = ra + sb</m>.
<ol cols="2">
<li><p><m>14</m> and <m>39</m></p></li>
<li><p><m>234</m> and <m>165</m></p></li>
<li><p><m>1739</m> and <m>9923</m></p></li>
<li><p><m>471</m> and <m>562</m></p></li>
<li><p><m>23771</m> and <m>19945</m></p></li>
<li><p><m>-4357</m> and <m>3754</m></p></li>
</ol></p>
</statement>
</exercise>
<exercise>
<statement>
<p>Let <m>p \geq 2</m>. Prove that if <m>2^p - 1</m> is prime, then <m>p</m> must also be prime.</p>
</statement>
</exercise>
</exercises>
</section>
</chapter>