1
00:00:00,540 --> 00:00:02,990
The following content is
provided under a Creative
2
00:00:02,990 --> 00:00:04,500
Commons license.
3
00:00:04,500 --> 00:00:06,840
Your support will help
MIT OpenCourseWare
4
00:00:06,840 --> 00:00:11,210
continue to offer high quality
educational resources for free.
5
00:00:11,210 --> 00:00:13,820
To make a donation, or
view additional materials
6
00:00:13,820 --> 00:00:17,716
from hundreds of MIT courses,
visit MIT OpenCourseWare
7
00:00:17,716 --> 00:00:18,341
at ocw.mit.edu.
8
00:00:23,310 --> 00:00:26,490
PROFESSOR: So
welcome to this week.
9
00:00:26,490 --> 00:00:28,980
We are going to talk
about number theory.
10
00:00:28,980 --> 00:00:30,560
Actually, before I
forget, there are
11
00:00:30,560 --> 00:00:32,450
some handouts at the very back.
12
00:00:32,450 --> 00:00:35,670
Please raise you hand if you
don't have any, then one of us
13
00:00:35,670 --> 00:00:37,802
can actually come
over and hand you
14
00:00:37,802 --> 00:00:41,070
out this sheet, which
contain some facts
15
00:00:41,070 --> 00:00:43,900
about the visibility.
16
00:00:43,900 --> 00:00:45,824
Thanks a lot.
17
00:00:45,824 --> 00:00:50,780
And we will be using these
throughout the lecture.
18
00:00:50,780 --> 00:00:53,330
So today we're going to
talk about number theory.
19
00:00:53,330 --> 00:00:56,420
And this is a really different
way of thinking, actually.
20
00:00:56,420 --> 00:00:58,170
But we will use
the same concepts
21
00:00:58,170 --> 00:01:01,280
as you have learned before,
like induction, and invariance,
22
00:01:01,280 --> 00:01:04,179
stuff like that, to
prove whole theorems.
23
00:01:04,179 --> 00:01:05,220
So what is number theory?
24
00:01:09,070 --> 00:01:12,050
Well, first of all,
it's a very old science.
25
00:01:12,050 --> 00:01:14,940
One of the oldest
mathematical disciplines.
26
00:01:14,940 --> 00:01:19,340
And only recently
it actually got
27
00:01:19,340 --> 00:01:21,480
to have some more
practical applications.
28
00:01:21,480 --> 00:01:23,950
So what this number
theory-- it's actually
29
00:01:23,950 --> 00:01:28,200
the study of the integers.
30
00:01:31,580 --> 00:01:33,160
And what are the integers?
31
00:01:33,160 --> 00:01:38,950
Well, these are the numbers
0, 1, 2 3, and so on.
32
00:01:38,950 --> 00:01:44,430
So number theory got-- Oh,
there's some more over here.
33
00:01:44,430 --> 00:01:45,555
Another handout over there.
34
00:01:48,530 --> 00:01:53,870
So number theory got used
actually in cryptography
35
00:01:53,870 --> 00:01:56,890
only about 40 years ago.
36
00:01:56,890 --> 00:01:59,880
And at the end of
the second lecture,
37
00:01:59,880 --> 00:02:03,150
we will be talking about this
application into cryptography.
38
00:02:03,150 --> 00:02:05,970
There are many application
in cryptography.
39
00:02:05,970 --> 00:02:07,700
But we'll be talking
about one of them
40
00:02:07,700 --> 00:02:10,500
to show you how useful
this actually is.
41
00:02:10,500 --> 00:02:16,110
Now cryptography is the study
and practice of hiding numbers.
42
00:02:16,110 --> 00:02:19,230
So you can imagine
how important that is.
43
00:02:19,230 --> 00:02:23,090
We have like medical
data that we need
44
00:02:23,090 --> 00:02:25,360
to store outside in the cloud.
45
00:02:25,360 --> 00:02:25,860
Right?
46
00:02:25,860 --> 00:02:27,500
So, gee.
47
00:02:27,500 --> 00:02:29,490
Do we really want that?
48
00:02:29,490 --> 00:02:33,200
We actually want to
hide our information.
49
00:02:33,200 --> 00:02:35,680
We do not want
others who are not
50
00:02:35,680 --> 00:02:39,030
allowed to see my private
information to see it.
51
00:02:39,030 --> 00:02:40,850
So this art of
hiding information
52
00:02:40,850 --> 00:02:44,080
is extremely important,
especially nowadays.
53
00:02:44,080 --> 00:02:47,020
And number theory actually
will help us with this.
54
00:02:47,020 --> 00:02:52,530
So number theory is something,
you'll be very surprised,
55
00:02:52,530 --> 00:02:57,520
that can be used to save-- oops.
56
00:02:57,520 --> 00:03:00,110
I have to put this on.
57
00:03:00,110 --> 00:03:04,550
To save New York City in the
Die Hard number 3, I believe.
58
00:03:04,550 --> 00:03:05,960
So let me start up again.
59
00:03:16,339 --> 00:03:17,505
So let's see where it plays.
60
00:03:20,780 --> 00:03:22,265
Maybe not.
61
00:03:22,265 --> 00:03:25,240
[VIDEO PLAYBACK]
62
00:03:25,240 --> 00:03:27,193
-Yeah, go ahead and grab it.
63
00:03:27,193 --> 00:03:28,140
-You're the cop.
64
00:03:28,140 --> 00:03:30,306
-Simon said you're supposed
to be helping with this.
65
00:03:30,306 --> 00:03:30,930
-I'm helping.
66
00:03:30,930 --> 00:03:32,350
-Well, when you going
to start helping?
67
00:03:32,350 --> 00:03:33,349
-After you get the bomb.
68
00:03:51,740 --> 00:03:53,220
Careful.
69
00:03:53,220 --> 00:03:54,000
-You be careful.
70
00:03:54,000 --> 00:03:55,040
-Don't open it.
71
00:03:55,040 --> 00:03:56,100
-What?
72
00:03:56,100 --> 00:03:57,539
I got to open it.
73
00:03:57,539 --> 00:03:58,830
And it's going to be all right.
74
00:04:08,790 --> 00:04:10,284
[BEEPING]
75
00:04:10,284 --> 00:04:11,778
[ELECTRONIC CHIRPING]
76
00:04:11,778 --> 00:04:13,190
Shit.
77
00:04:13,190 --> 00:04:13,690
-Shit!
78
00:04:13,690 --> 00:04:15,421
I told you not to open it.
79
00:04:15,421 --> 00:04:16,834
[PHONE RINGING]
80
00:04:16,834 --> 00:04:18,718
[PHONE RINGING]
81
00:04:19,660 --> 00:04:22,215
-I thought you'd
see the message.
82
00:04:22,215 --> 00:04:25,380
It has a proximity circuit,
so please don't run.
83
00:04:25,380 --> 00:04:26,142
-Yeah, I got it.
84
00:04:26,142 --> 00:04:27,100
We're not going to run.
85
00:04:27,100 --> 00:04:28,908
How do we turn this thing off?
86
00:04:28,908 --> 00:04:30,830
-On the front there
should be two jugs.
87
00:04:30,830 --> 00:04:32,270
Do you see them?
88
00:04:32,270 --> 00:04:34,850
A give gallon, and
a three gallon.
89
00:04:34,850 --> 00:04:38,510
Fill on of the jugs with
exactly four gallons of water
90
00:04:38,510 --> 00:04:41,880
and place it on the scale,
and the timer will stop.
91
00:04:41,880 --> 00:04:43,970
You must be precise.
92
00:04:43,970 --> 00:04:46,920
One ounce or lower less
will result in demolition.
93
00:04:46,920 --> 00:04:49,405
If you're still alive in five
minutes, we'll speak again.
94
00:04:49,405 --> 00:04:49,905
-Wait!
95
00:04:49,905 --> 00:04:50,730
Wait a sec.
96
00:04:54,410 --> 00:04:55,390
I don't get it.
97
00:04:55,390 --> 00:04:55,930
You get it?
98
00:04:55,930 --> 00:04:56,429
-No.
99
00:04:59,067 --> 00:04:59,650
-Get the jugs.
100
00:05:02,407 --> 00:05:04,490
Obviously, we can't fill
the three gallon jug will
101
00:05:04,490 --> 00:05:06,096
four gallons of water, right?
102
00:05:06,096 --> 00:05:06,690
-Obviously.
103
00:05:06,690 --> 00:05:07,190
-I know.
104
00:05:07,190 --> 00:05:08,610
There we go.
105
00:05:08,610 --> 00:05:11,210
We fill the three gallon jug
exactly to the top, right?
106
00:05:11,210 --> 00:05:11,710
-Uh-huh.
107
00:05:11,710 --> 00:05:12,210
-OK.
108
00:05:12,210 --> 00:05:14,760
Now we pour that three gallons
into the five gallon jugs,
109
00:05:14,760 --> 00:05:17,180
giving us exactly 3 gallons
in the five gallon jug, right?
110
00:05:17,180 --> 00:05:17,680
-Right.
111
00:05:17,680 --> 00:05:18,640
Then what?
112
00:05:18,640 --> 00:05:20,799
-Now, we take the
three gallon jug,
113
00:05:20,799 --> 00:05:22,090
fill it a third of the way up--
114
00:05:22,090 --> 00:05:22,190
-No, no.
115
00:05:22,190 --> 00:05:23,190
He said be precise.
116
00:05:23,190 --> 00:05:23,830
Exactly four gallons.
117
00:05:23,830 --> 00:05:25,746
-Every cop in 50 miles
is running his ass off,
118
00:05:25,746 --> 00:05:27,970
and I'm out here playing
kids games in a park.
119
00:05:27,970 --> 00:05:29,950
-Hey.
120
00:05:29,950 --> 00:05:31,820
You want to focus on
the problem at hand?
121
00:05:31,820 --> 00:05:32,740
[END PLAYBACK]
122
00:05:32,740 --> 00:05:35,040
[LAUGHING]
123
00:05:35,040 --> 00:05:36,370
PROFESSOR: All right.
124
00:05:36,370 --> 00:05:39,690
You can imagine what we are
going to do right here, right?
125
00:05:39,690 --> 00:05:42,510
So.
126
00:05:42,510 --> 00:05:45,594
You can imagine what's
below this table is a bomb.
127
00:05:45,594 --> 00:05:47,910
[LAUGHING]
128
00:05:47,910 --> 00:05:49,610
You guys have to save 6042.
129
00:05:49,610 --> 00:05:50,940
[LAUGHING]
130
00:05:50,940 --> 00:05:52,890
So we have the fountain here.
131
00:05:52,890 --> 00:05:55,030
Each tennis ball is
one gallon of water.
132
00:05:55,030 --> 00:05:58,050
We have a big jug, five
gallons and three gallons.
133
00:05:58,050 --> 00:06:00,040
So you all got to
help me out here.
134
00:06:00,040 --> 00:06:02,380
So who has an idea
of what we can do?
135
00:06:02,380 --> 00:06:02,880
So.
136
00:06:05,720 --> 00:06:07,196
AUDIENCE: [INAUDIBLE]
137
00:06:07,196 --> 00:06:08,680
PROFESSOR: All right.
138
00:06:08,680 --> 00:06:09,690
Let's first do that.
139
00:06:09,690 --> 00:06:11,180
Fill up the three gallons.
140
00:06:11,180 --> 00:06:12,680
AUDIENCE: And pout
it into the five.
141
00:06:12,680 --> 00:06:16,170
PROFESSOR: Let's
pour it into five.
142
00:06:16,170 --> 00:06:19,010
Maybe someone else
can-- can continue.
143
00:06:19,010 --> 00:06:20,700
Over there.
144
00:06:20,700 --> 00:06:22,450
AUDIENCE: If we
do the same again,
145
00:06:22,450 --> 00:06:26,000
we'll end up with just one
gallon in the three gallon.
146
00:06:26,000 --> 00:06:26,750
PROFESSOR: Uh-huh.
147
00:06:26,750 --> 00:06:28,405
So, let's do that.
148
00:06:28,405 --> 00:06:29,530
Because that's true, right.
149
00:06:29,530 --> 00:06:32,010
You can only fill it
up to five gallons.
150
00:06:32,010 --> 00:06:34,030
So only, at more,
two gallons can add
151
00:06:34,030 --> 00:06:36,190
to this, exactly two gallons.
152
00:06:36,190 --> 00:06:37,780
And one gallon is left.
153
00:06:37,780 --> 00:06:38,877
All right, next one.
154
00:06:38,877 --> 00:06:39,377
You?
155
00:06:39,377 --> 00:06:40,168
Would you like to--
156
00:06:40,168 --> 00:06:41,335
AUDIENCE: Take out the five.
157
00:06:41,335 --> 00:06:42,542
PROFESSOR: Take out the five.
158
00:06:42,542 --> 00:06:43,120
All right.
159
00:06:47,300 --> 00:06:48,424
And then what?
160
00:06:48,424 --> 00:06:49,840
AUDIENCE: Pour the
one over there.
161
00:06:49,840 --> 00:06:51,256
PROFESSOR: Pour
the one over here?
162
00:06:55,142 --> 00:06:56,769
AUDIENCE: [INAUDIBLE]
163
00:06:56,769 --> 00:06:58,310
AUDIENCE: Then fill
the three gallon,
164
00:06:58,310 --> 00:07:00,042
and put it into the five.
165
00:07:00,042 --> 00:07:01,399
PROFESSOR: All right.
166
00:07:01,399 --> 00:07:01,940
That's great.
167
00:07:01,940 --> 00:07:03,380
And I fill it up right here.
168
00:07:03,380 --> 00:07:04,720
Fantastic.
169
00:07:04,720 --> 00:07:07,690
So we actually have
four gallons here.
170
00:07:07,690 --> 00:07:08,870
And luckily, they are safe.
171
00:07:08,870 --> 00:07:09,370
Right?
172
00:07:09,370 --> 00:07:10,730
So you say, thank god.
173
00:07:10,730 --> 00:07:13,354
6042
174
00:07:13,354 --> 00:07:14,145
So we can continue.
175
00:07:17,400 --> 00:07:20,230
So this is actually
pretty amazing, though.
176
00:07:20,230 --> 00:07:22,770
How can we get four gallon
out of three gallon jug,
177
00:07:22,770 --> 00:07:23,750
and a five gallon jug?
178
00:07:23,750 --> 00:07:26,370
And that's what we are
going to talk about in more
179
00:07:26,370 --> 00:07:28,190
generality, actually.
180
00:07:28,190 --> 00:07:32,250
And if you would just change
it a little bit, right?
181
00:07:32,250 --> 00:07:36,060
Then things would get more
difficult. For example,
182
00:07:36,060 --> 00:07:40,850
if you would change the five
gallon jug into a six gallon
183
00:07:40,850 --> 00:07:44,320
jug, can we still
get four gallons?
184
00:07:44,320 --> 00:07:44,820
No.
185
00:07:44,820 --> 00:07:45,319
Why not?
186
00:07:47,695 --> 00:07:49,690
AUDIENCE: [INAUDIBLE]
187
00:07:49,690 --> 00:07:51,826
PROFESSOR: Everything has
to be multiples of three.
188
00:07:51,826 --> 00:07:54,410
That's exactly right.
189
00:07:54,410 --> 00:07:55,510
This is a multiple of 3.
190
00:07:55,510 --> 00:07:56,190
1 times 3.
191
00:07:56,190 --> 00:07:57,280
This is 2 times 3.
192
00:07:57,280 --> 00:07:59,770
So if I do combinations
with those,
193
00:07:59,770 --> 00:08:03,440
like pouring one into the
other completely, or emptying,
194
00:08:03,440 --> 00:08:05,350
of filling up, we
always will have
195
00:08:05,350 --> 00:08:10,160
a multiple of three gallons in
either one of those, or both.
196
00:08:10,160 --> 00:08:12,630
So we can never
have four gallons.
197
00:08:12,630 --> 00:08:15,540
So this is something
that we would like
198
00:08:15,540 --> 00:08:16,960
to analyze a little bit more.
199
00:08:16,960 --> 00:08:20,420
And to do that, we're
going to first a all
200
00:08:20,420 --> 00:08:22,080
start with a definition.
201
00:08:22,080 --> 00:08:25,080
Actually you can put up
the screen over here.
202
00:08:28,480 --> 00:08:29,930
So let me take that out.
203
00:08:33,840 --> 00:08:37,610
Can someone up there
pull up the screen?
204
00:08:37,610 --> 00:08:38,520
Maybe not?
205
00:08:38,520 --> 00:08:40,190
Maybe later.
206
00:08:40,190 --> 00:08:40,840
All right.
207
00:08:40,840 --> 00:08:42,524
So let's go with a definition.
208
00:08:48,150 --> 00:08:59,340
We say n denote by m and a bar,
and a, we mean m defines a.
209
00:08:59,340 --> 00:09:00,920
And how do you define this?
210
00:09:00,920 --> 00:09:04,910
Well, we say that n
defines a, if and only
211
00:09:04,910 --> 00:09:11,260
if there exists an
integer k, such that a can
212
00:09:11,260 --> 00:09:18,100
be written as some multiple
m, mainly k times m.
213
00:09:18,100 --> 00:09:21,980
So if you look at
this definition
214
00:09:21,980 --> 00:09:25,100
we, for example, have
that 3 divides 6,
215
00:09:25,100 --> 00:09:27,645
like what we just discussed.
216
00:09:27,645 --> 00:09:29,270
There's something
interesting going on.
217
00:09:29,270 --> 00:09:33,160
Suppose a is equal to 0.
218
00:09:33,160 --> 00:09:38,030
Well, any integer will
define a, will define 0.
219
00:09:38,030 --> 00:09:39,030
Why is that?
220
00:09:39,030 --> 00:09:42,090
Because I can't take
k to be equal to 0,
221
00:09:42,090 --> 00:09:45,190
so this is equal to 0
times any integer m.
222
00:09:45,190 --> 00:09:48,910
So m defines 0 for all integers.
223
00:09:48,910 --> 00:09:51,440
So this is kind of
the exception, right?
224
00:09:51,440 --> 00:09:56,840
And we are going to use
this to set up a theorem,
225
00:09:56,840 --> 00:10:02,090
and analyze this whole
situation over here.
226
00:10:02,090 --> 00:10:08,310
Now in order to do that, we
will need to sort of define
227
00:10:08,310 --> 00:10:09,790
what we can do with all this.
228
00:10:09,790 --> 00:10:12,710
So there are states.
229
00:10:12,710 --> 00:10:14,940
We will define a state machine.
230
00:10:14,940 --> 00:10:18,060
We will see what kind
of possible transitions
231
00:10:18,060 --> 00:10:19,230
we can have.
232
00:10:19,230 --> 00:10:22,120
And once we have modeled
all this very precisely,
233
00:10:22,120 --> 00:10:25,520
we can start proofing stuff.
234
00:10:25,520 --> 00:10:30,970
Now let me first of all write
out what our assumptions are.
235
00:10:30,970 --> 00:10:36,980
So suppose we have
an a gallon jug.
236
00:10:40,110 --> 00:10:44,500
So in our case, a equals 3.
237
00:10:44,500 --> 00:10:46,480
And we have also b gallon jug.
238
00:10:50,140 --> 00:10:53,740
And in our case,
b equals 5, right?
239
00:10:53,740 --> 00:10:58,180
And we issue that
a is at most b.
240
00:10:58,180 --> 00:11:01,169
That is sort of the situation
that we are working with.
241
00:11:01,169 --> 00:11:02,710
And he would like
to prove a theorem.
242
00:11:05,220 --> 00:11:08,330
Exactly what we notice over
here, that three defines both.
243
00:11:08,330 --> 00:11:10,580
The three gallon jug,
and the six gallon jug,
244
00:11:10,580 --> 00:11:13,740
we would like to prove
something like this.
245
00:11:13,740 --> 00:11:20,270
If m defines a, and
also m defines be,
246
00:11:20,270 --> 00:11:26,720
well, then m should
define any results
247
00:11:26,720 --> 00:11:32,670
that I can get with the pouring,
and emptying and filling
248
00:11:32,670 --> 00:11:34,042
those jugs.
249
00:11:34,042 --> 00:11:36,000
So this is the theorem,
if you'd like to prove.
250
00:11:36,000 --> 00:11:38,080
And we can only do that
if you start to have
251
00:11:38,080 --> 00:11:40,380
a proper model for this.
252
00:11:40,380 --> 00:11:43,020
So let's go for that.
253
00:11:43,020 --> 00:11:44,060
And--
254
00:11:47,490 --> 00:11:52,570
And, well, the state machine
that we're going to use here
255
00:11:52,570 --> 00:11:53,380
looks like this.
256
00:12:00,570 --> 00:12:05,060
First of all, the
states that we have
257
00:12:05,060 --> 00:12:08,750
are the number of gallons
that are in these two jugs.
258
00:12:08,750 --> 00:12:10,575
So we will denote
those by pairs.
259
00:12:13,810 --> 00:12:16,700
Pairs x, comma y.
260
00:12:16,700 --> 00:12:24,020
And x denotes the number of
gallons in the a gallon jug.
261
00:12:26,640 --> 00:12:33,560
The number of gallons m m that
we abbreviate as by the a jug,
262
00:12:33,560 --> 00:12:41,970
and y is the number of
gallons in the b jug.
263
00:12:41,970 --> 00:12:43,960
So these are the states.
264
00:12:43,960 --> 00:12:49,760
And the start state it
exactly as it is right there.
265
00:12:49,760 --> 00:12:51,717
We have nothing in
either of the jugs.
266
00:12:55,300 --> 00:12:57,980
So that's the pair 0, comma 0.
267
00:12:57,980 --> 00:13:00,590
So now we start to build up
some mathematics here, right?
268
00:13:00,590 --> 00:13:04,380
So we express the state
of this whole situation
269
00:13:04,380 --> 00:13:05,980
by a pair of number.
270
00:13:05,980 --> 00:13:08,877
Now we need to find out
what they can do with it.
271
00:13:08,877 --> 00:13:10,043
So what are the transitions?
272
00:13:18,480 --> 00:13:20,650
The transitions are,
as we have seen, right?
273
00:13:20,650 --> 00:13:22,830
We can just fill
one of the jugs.
274
00:13:22,830 --> 00:13:23,881
We can empty those.
275
00:13:23,881 --> 00:13:25,380
And the other
possibility is that we
276
00:13:25,380 --> 00:13:29,020
can pour one jug over into the
other one as much as we can.
277
00:13:29,020 --> 00:13:30,590
So let's write all of those out.
278
00:13:34,320 --> 00:13:36,010
We can do emptying.
279
00:13:36,010 --> 00:13:38,080
Well, how does that
change the state?
280
00:13:40,820 --> 00:13:43,970
If we have x
gallons in this jug,
281
00:13:43,970 --> 00:13:46,620
and y-- and y
gallons in that one,
282
00:13:46,620 --> 00:13:49,460
we can transition this
into, for example,
283
00:13:49,460 --> 00:13:51,420
emptying the a gallon jug.
284
00:13:51,420 --> 00:13:53,540
So be y of 0.
285
00:13:53,540 --> 00:14:00,262
Or we can empty the b jug.
286
00:14:00,262 --> 00:14:01,720
Well, filling is
something similar.
287
00:14:05,710 --> 00:14:10,860
But now we are actually pouring
more water from the fountain,
288
00:14:10,860 --> 00:14:11,430
essentially.
289
00:14:11,430 --> 00:14:11,930
Right?
290
00:14:11,930 --> 00:14:13,930
All those tennis balls here.
291
00:14:13,930 --> 00:14:20,430
And we can fill up say the
a gallon up to a gallons,
292
00:14:20,430 --> 00:14:23,410
and leave the b jug as it is.
293
00:14:23,410 --> 00:14:30,410
Or w we can fill up the b gallon
jug, and leave the a gallon jug
294
00:14:30,410 --> 00:14:32,520
as it is.
295
00:14:32,520 --> 00:14:34,670
So these are these
two transitions.
296
00:14:34,670 --> 00:14:40,570
And the pouring of one--
of one jug into the other
297
00:14:40,570 --> 00:14:42,570
is actually a little
bit more complex.
298
00:14:42,570 --> 00:14:43,850
So let's have a look.
299
00:14:47,370 --> 00:14:49,770
So how does pouring work?
300
00:14:49,770 --> 00:14:55,000
Well, suppose we
start with x and y.
301
00:14:55,000 --> 00:14:57,562
So let's have a look here.
302
00:14:57,562 --> 00:14:58,270
Um, I don't know.
303
00:14:58,270 --> 00:15:02,450
Suppose we have 2 balls in
here, and 2 balls in here.
304
00:15:02,450 --> 00:15:06,400
Well, in that case, I can say
pour all of these over in here.
305
00:15:06,400 --> 00:15:07,670
Right?
306
00:15:07,670 --> 00:15:08,930
So that's easy.
307
00:15:08,930 --> 00:15:11,920
But there's also another
possibility, better
308
00:15:11,920 --> 00:15:13,840
when I pour all of
these over in here.
309
00:15:13,840 --> 00:15:16,340
But hey, I can
only put in 1 ball,
310
00:15:16,340 --> 00:15:19,000
because it's only
a three gallon jug.
311
00:15:19,000 --> 00:15:22,170
So I'm left with only 1.
312
00:15:22,170 --> 00:15:25,410
A gallon in this jug.
313
00:15:25,410 --> 00:15:28,600
So these are two-- these
are two situations that we
314
00:15:28,600 --> 00:15:30,080
need to explain.
315
00:15:30,080 --> 00:15:34,400
So let's first do the first
example that I just did.
316
00:15:34,400 --> 00:15:37,210
I pour everything over
into the other jug.
317
00:15:37,210 --> 00:15:41,440
So we have 0 gallons
left in here,
318
00:15:41,440 --> 00:15:45,800
and x plus y gallons
left in the other jug.
319
00:15:45,800 --> 00:15:50,160
And this can happen if there's
sufficient space, right?
320
00:15:50,160 --> 00:15:55,320
So this can only happen
if x plus y is at most b.
321
00:15:55,320 --> 00:15:59,530
Which is the capacity
of this b gallon jug.
322
00:15:59,530 --> 00:16:01,170
Now if that's not
the case, then I
323
00:16:01,170 --> 00:16:04,680
can pour in just a little
bit, like just say 1 ball.
324
00:16:04,680 --> 00:16:08,480
Like just one of
these can go in here.
325
00:16:08,480 --> 00:16:10,090
So that's the other case.
326
00:16:10,090 --> 00:16:16,620
So x, y we'll
actually go to-- well,
327
00:16:16,620 --> 00:16:19,580
let's just see how this works.
328
00:16:19,580 --> 00:16:25,260
How many gallons are left in
this b gallon jug to fill up?
329
00:16:25,260 --> 00:16:28,600
Well, we have b minus
y gallons left, right?
330
00:16:28,600 --> 00:16:30,080
Space left.
331
00:16:30,080 --> 00:16:33,790
So we can take b minus y
gallons out of this one
332
00:16:33,790 --> 00:16:35,410
to fill up this one.
333
00:16:35,410 --> 00:16:37,170
So let's do it.
334
00:16:37,170 --> 00:16:42,580
We take b minus y
gets out of the a jug,
335
00:16:42,580 --> 00:16:46,300
and put it all in here, and it
makes it completely filled up.
336
00:16:46,300 --> 00:16:48,800
So we have b gallons over here.
337
00:16:48,800 --> 00:16:56,350
So this is really equal to
x plus y minus b, comma b.
338
00:16:56,350 --> 00:17:03,010
And this only is possible
if-- if you are essentially
339
00:17:03,010 --> 00:17:05,119
in the complimentary case.
340
00:17:05,119 --> 00:17:12,980
So we have that x
plus y is at least b,
341
00:17:12,980 --> 00:17:19,720
such that there is enough
gallons in the a jug
342
00:17:19,720 --> 00:17:22,460
to be poured over to
fill up the b jug.
343
00:17:22,460 --> 00:17:24,430
So these are the
two kinds of cases.
344
00:17:24,430 --> 00:17:26,180
And, of course,
by symmetry we can
345
00:17:26,180 --> 00:17:29,830
do also the pouring from the
other jug into the first.
346
00:17:29,830 --> 00:17:32,650
So let's write all
those out, as well.
347
00:17:32,650 --> 00:17:38,530
So x, y can actually go
to x plus y, comma 0.
348
00:17:38,530 --> 00:17:41,750
I pour everything
from here to there.
349
00:17:41,750 --> 00:17:47,435
And this only holds if
x plus y is at most a.
350
00:17:54,970 --> 00:17:59,720
The other possibility is
where, exactly as in this case,
351
00:17:59,720 --> 00:18:06,170
we can only pour a minus
x gallons over from y
352
00:18:06,170 --> 00:18:08,220
into this particular jug.
353
00:18:08,220 --> 00:18:10,300
And then this one is
completely filled up.
354
00:18:10,300 --> 00:18:12,740
And then I have a few
gallons left over here.
355
00:18:12,740 --> 00:18:14,910
So how does that look?
356
00:18:14,910 --> 00:18:21,460
Well, we completely fill
this up to its capacity.
357
00:18:21,460 --> 00:18:24,697
And what is left this is
y minus-- how much did
358
00:18:24,697 --> 00:18:26,990
we have to pour in here?
359
00:18:26,990 --> 00:18:31,180
Well, that's a minus x.
360
00:18:31,180 --> 00:18:34,920
And we again have
a similar formula.
361
00:18:34,920 --> 00:18:36,870
But it now looks a
little bit different.
362
00:18:36,870 --> 00:18:38,720
X plus y minus a.
363
00:18:38,720 --> 00:18:45,060
And this is only for the case
where x plus y is at least a.
364
00:18:47,891 --> 00:18:48,390
OK.
365
00:18:48,390 --> 00:18:50,050
So these are all the cases.
366
00:18:50,050 --> 00:18:52,990
So maybe there are some
questions about this.
367
00:18:52,990 --> 00:18:56,940
Is this clear, that we have
these different possibilities?
368
00:18:56,940 --> 00:18:59,090
Like when we look at
these jugs we can either
369
00:18:59,090 --> 00:19:00,840
empty them, filling them up.
370
00:19:00,840 --> 00:19:04,260
Or we can pour say
only 1 ball over up
371
00:19:04,260 --> 00:19:05,940
to the full capacity
of this jug.
372
00:19:05,940 --> 00:19:09,660
Or we can just pour everything
over into, say, this jug.
373
00:19:09,660 --> 00:19:12,660
So those are the different cases
that are now fully described
374
00:19:12,660 --> 00:19:14,380
by this state machine.
375
00:19:14,380 --> 00:19:18,100
So now we can start to prove
this theorem over here.
376
00:19:18,100 --> 00:19:20,410
So how do we go ahead?
377
00:19:20,410 --> 00:19:24,100
How are we going to use what
you've learned like induction,
378
00:19:24,100 --> 00:19:25,660
and invariance?
379
00:19:25,660 --> 00:19:27,880
So let's do it.
380
00:19:27,880 --> 00:19:30,470
But before,
actually, we do this,
381
00:19:30,470 --> 00:19:34,940
let's take this
example that we had
382
00:19:34,940 --> 00:19:39,088
and see how we can describe all
the transitions that we just
383
00:19:39,088 --> 00:19:41,920
did, as far as I remember them.
384
00:19:41,920 --> 00:19:45,850
So we have that a
equals 3, b equals 5.
385
00:19:45,850 --> 00:19:47,320
Right?
386
00:19:47,320 --> 00:19:51,760
We start with empty jugs.
387
00:19:51,760 --> 00:19:54,980
We need to filled up the
five gallon jug, right?
388
00:19:59,060 --> 00:20:03,330
Then we started pouring
the five gallon jug as much
389
00:20:03,330 --> 00:20:05,240
as we could into the
three gallon jug.
390
00:20:05,240 --> 00:20:07,100
So it's one of those rules.
391
00:20:07,100 --> 00:20:09,860
We've got 3 into 2.
392
00:20:09,860 --> 00:20:13,080
Then we emptied the
three gallon jug.
393
00:20:13,080 --> 00:20:14,330
We got 0 and 2.
394
00:20:16,940 --> 00:20:20,070
Then we did-- What
did we did next?
395
00:20:20,070 --> 00:20:24,750
Oh yeah, we poured
everything into this one.
396
00:20:24,750 --> 00:20:28,890
So we have 2, 0
as the next state.
397
00:20:28,890 --> 00:20:35,550
We filled up-- actually I
forgot exactly what we did next.
398
00:20:35,550 --> 00:20:40,790
But I think we filled
up the five gallon jug.
399
00:20:40,790 --> 00:20:43,170
And then we simply
poured over as much
400
00:20:43,170 --> 00:20:45,400
as he could from
the five gallon jug.
401
00:20:45,400 --> 00:20:49,040
And we got 3 and
4, and here we are.
402
00:20:49,040 --> 00:20:51,440
We got 4 gallons.
403
00:20:51,440 --> 00:20:55,265
So what we just did is fully
describe this state machine.
404
00:20:55,265 --> 00:20:56,890
So let's not try to
prove this theorem.
405
00:21:02,769 --> 00:21:04,560
So as I said, we're
going to use induction.
406
00:21:09,660 --> 00:21:13,840
So you always would
like to write this out
407
00:21:13,840 --> 00:21:15,085
if you solve your problems.
408
00:21:17,880 --> 00:21:19,810
What are we going to assume?
409
00:21:19,810 --> 00:21:25,170
Well, we assume actually
that m defines a,
410
00:21:25,170 --> 00:21:27,919
and m defines also b.
411
00:21:27,919 --> 00:21:29,460
That's the assumption
of the theorem,
412
00:21:29,460 --> 00:21:32,880
and now we need to prove that
defies any result that you can
413
00:21:32,880 --> 00:21:36,340
achieve in this state machine.
414
00:21:36,340 --> 00:21:39,560
So what's the invariance
that we are thinking about?
415
00:21:43,090 --> 00:21:46,670
Invariance is going to be--
416
00:21:47,401 --> 00:21:47,900
Oops.
417
00:21:50,890 --> 00:21:53,530
It's a predicate.
418
00:21:53,530 --> 00:22:00,000
And it says something
like, if the state xy--
419
00:22:00,000 --> 00:22:06,034
if this is the state
after n transitions--
420
00:22:14,300 --> 00:22:20,900
Then we would like to conclude
that m the fights both x,
421
00:22:20,900 --> 00:22:23,220
and m defines y.
422
00:22:23,220 --> 00:22:27,150
So this is our-- our invariance.
423
00:22:27,150 --> 00:22:29,690
And we like to use this
to prove our theorem.
424
00:22:29,690 --> 00:22:31,280
So how do we start
usually, right?
425
00:22:31,280 --> 00:22:34,500
So we always start
with-- with a base state.
426
00:22:34,500 --> 00:22:35,690
Great.
427
00:22:35,690 --> 00:22:36,880
So let's do it.
428
00:22:40,690 --> 00:22:46,880
The base case is-- well,
we start with the all 0s,
429
00:22:46,880 --> 00:22:49,400
like the empty jugs.
430
00:22:49,400 --> 00:22:53,650
It's-- well, and we also--
have paid a little bit of extra
431
00:22:53,650 --> 00:22:56,120
attention to what we mean
by division over here.
432
00:22:56,120 --> 00:23:00,400
We said that all integers
actually divide 0.
433
00:23:00,400 --> 00:23:02,790
So in particular,
m. m divides 0.
434
00:23:02,790 --> 00:23:04,450
m, 0.
435
00:23:04,450 --> 00:23:07,790
So the very initial
state, 0 comma 0,
436
00:23:07,790 --> 00:23:13,760
is indeed complying to
is particular invariant.
437
00:23:13,760 --> 00:23:16,070
So let's write it out.
438
00:23:16,070 --> 00:23:19,000
So we have the
initial state 0, 0.
439
00:23:19,000 --> 00:23:21,360
We know that m divides 0.
440
00:23:21,360 --> 00:23:27,060
And therefore, we
know that p 0 is true.
441
00:23:27,060 --> 00:23:28,920
So that's great.
442
00:23:28,920 --> 00:23:31,380
So the inductive step.
443
00:23:31,380 --> 00:23:34,720
How do we start the inductive
step-- step all the time?
444
00:23:38,720 --> 00:23:42,420
And we will assume,
actually, p of n, right?
445
00:23:42,420 --> 00:23:45,230
So lets assume that.
446
00:23:45,230 --> 00:23:51,310
And now we would like to
prove p, and then n plus 1.
447
00:23:51,310 --> 00:23:53,620
So what do we really want to do?
448
00:23:53,620 --> 00:23:57,910
We want to say, well, we know
that we reached a certain state
449
00:23:57,910 --> 00:24:03,810
x comma y, for which m
divides x, and m divides y.
450
00:24:03,810 --> 00:24:06,370
Now we would like to show
that if we transition
451
00:24:06,370 --> 00:24:10,050
to a next state, we again have
that same property, that m
452
00:24:10,050 --> 00:24:14,820
divides the number of gallons
in both jugs once more.
453
00:24:14,820 --> 00:24:17,700
And then we can con--
can conclude p, n plus 1.
454
00:24:17,700 --> 00:24:21,020
So that's how we always proceed.
455
00:24:21,020 --> 00:24:22,900
So let's see where
we can write it out
456
00:24:22,900 --> 00:24:24,330
in a bit more formal way.
457
00:24:29,121 --> 00:24:29,620
OK.
458
00:24:29,620 --> 00:24:33,270
So how do we go ahead?
459
00:24:33,270 --> 00:24:45,175
Suppose that x, y is the
state after n transitions.
460
00:24:50,350 --> 00:24:53,150
Well, what can we conclude?
461
00:24:53,150 --> 00:24:57,160
Well, we have the predicate
pn, the invariant.
462
00:24:57,160 --> 00:25:06,390
So we know that n divides
x, and n divides y.
463
00:25:06,390 --> 00:25:08,780
And we concluded that
because pn is true.
464
00:25:13,320 --> 00:25:15,030
So after another
transition-- what
465
00:25:15,030 --> 00:25:17,580
happens after
another transition?
466
00:25:17,580 --> 00:25:25,280
So we can conclude
that the jugs are
467
00:25:25,280 --> 00:25:30,625
filled by the different
types of numbers
468
00:25:30,625 --> 00:25:32,840
that we see here this
is state machine.
469
00:25:32,840 --> 00:25:34,660
So let's write them out.
470
00:25:34,660 --> 00:25:44,060
So after another transition,
um, each of the jugs
471
00:25:44,060 --> 00:25:53,150
is actually filled-- Um,
are filled with-- well,
472
00:25:53,150 --> 00:26:01,990
either if I've emptied it, say
a 0, 0 gallons, a, b, x and y.
473
00:26:01,990 --> 00:26:04,060
I see appearing over here.
474
00:26:04,060 --> 00:26:06,810
And I also notice
that I see x plus y.
475
00:26:06,810 --> 00:26:08,330
And x plus y, minus b.
476
00:26:08,330 --> 00:26:09,980
And x plus y, minus a.
477
00:26:09,980 --> 00:26:11,740
Those are all the
different number
478
00:26:11,740 --> 00:26:13,040
of gallons that can be in jug.
479
00:26:13,040 --> 00:26:14,161
Yes, please?
480
00:26:14,161 --> 00:26:15,604
AUDIENCE: [INAUDIBLE]
481
00:26:18,216 --> 00:26:20,590
PROFESSOR: In our example--
Yeah, that's a good question.
482
00:26:20,590 --> 00:26:23,450
So in our example
problems of 3 and 5,
483
00:26:23,450 --> 00:26:26,480
it turns out that
the only number that
484
00:26:26,480 --> 00:26:29,765
divides 5 both the three gallon
jug, and the five gallon jugs
485
00:26:29,765 --> 00:26:31,390
is actually one.
486
00:26:31,390 --> 00:26:35,790
So in our example, we
would have that m equals 1.
487
00:26:35,790 --> 00:26:44,330
So over here we have
that only 1 divides a,
488
00:26:44,330 --> 00:26:47,030
as well as 1 divides b.
489
00:26:47,030 --> 00:26:49,800
So m equals 1 in our case.
490
00:26:49,800 --> 00:26:52,990
But for example, in the
three gallon jug, and the six
491
00:26:52,990 --> 00:26:54,650
gallon jug-- Right?
492
00:26:54,650 --> 00:27:01,320
We have that m equals 3, like
3 divides 3, And 3 divides 6.
493
00:27:01,320 --> 00:27:04,630
So those are the two cases that
you sort of look at right now.
494
00:27:04,630 --> 00:27:06,870
But you put into a much
more general setting, right,
495
00:27:06,870 --> 00:27:09,270
we are distracted away
from the actual numbers.
496
00:27:09,270 --> 00:27:13,355
And use a and b as
representations.
497
00:27:15,950 --> 00:27:19,130
Are any other questions?
498
00:27:19,130 --> 00:27:22,790
So after another
transition, each of the jugs
499
00:27:22,790 --> 00:27:25,890
are filled with, well,
either 0 gallons, if we
500
00:27:25,890 --> 00:27:28,120
have a completely emptied them.
501
00:27:28,120 --> 00:27:33,170
Or we have filled the first
a gallon jug, or it can be b.
502
00:27:33,170 --> 00:27:37,650
We also noticed that it can
be-- it can be of x, of course.
503
00:27:37,650 --> 00:27:41,610
It can be y, because that's
the state that we are in.
504
00:27:41,610 --> 00:27:47,950
And we can have x plus y, minus
a, which appears over here.
505
00:27:47,950 --> 00:27:49,570
And x plus y, minus b.
506
00:27:53,770 --> 00:27:58,801
So these are all the different
number-- possible number
507
00:27:58,801 --> 00:27:59,300
of gallons.
508
00:28:02,262 --> 00:28:04,280
The x plus y.
509
00:28:04,280 --> 00:28:06,520
That's also present.
510
00:28:06,520 --> 00:28:08,473
Is that true?
511
00:28:08,473 --> 00:28:08,973
Yeah.
512
00:28:08,973 --> 00:28:10,370
That's right. x plus y.
513
00:28:10,370 --> 00:28:13,280
So we also have x plus y.
514
00:28:13,280 --> 00:28:14,980
Actually, it's good
to check that again.
515
00:28:14,980 --> 00:28:18,340
So we have 0, x, y, a, b.
516
00:28:18,340 --> 00:28:19,280
Got those.
517
00:28:19,280 --> 00:28:24,090
X plus y, and x plus y, minus
p, and x plus y minus b.
518
00:28:24,090 --> 00:28:26,090
Yeah.
519
00:28:26,090 --> 00:28:32,120
So now we can start using
our-- our assumptions.
520
00:28:32,120 --> 00:28:33,600
So what our they?
521
00:28:33,600 --> 00:28:36,980
We have that in order
to prove this-- right?
522
00:28:36,980 --> 00:28:40,980
At the top over here, we assume
that m divides, and m divides
523
00:28:40,980 --> 00:28:42,420
b.
524
00:28:42,420 --> 00:28:46,900
So we know that first of
all, m divides 0, of course.
525
00:28:46,900 --> 00:28:49,460
But we know that m divides a.
526
00:28:49,460 --> 00:28:52,000
We know that m divides b.
527
00:28:52,000 --> 00:28:54,970
We have concluded
that m divides x.
528
00:28:54,970 --> 00:28:56,370
And also m divides y.
529
00:28:58,980 --> 00:29:02,790
So if you now use some
facts about divisibility
530
00:29:02,790 --> 00:29:05,770
on your handout, which
we will not prove now.
531
00:29:05,770 --> 00:29:10,520
But I think most of them will be
on your problem set, actually.
532
00:29:10,520 --> 00:29:16,270
We can conclude that also linear
combination of a, b x and y
533
00:29:16,270 --> 00:29:18,660
will be divisible by m.
534
00:29:18,660 --> 00:29:21,850
In particular, m
will divide x plus y.
535
00:29:21,850 --> 00:29:26,400
m will divide x plus y minus
a, and also x plus y, minus b.
536
00:29:26,400 --> 00:29:34,040
So we will conclude
that m actually
537
00:29:34,040 --> 00:29:37,960
divides any possible results.
538
00:29:37,960 --> 00:29:41,680
So divides any of the above.
539
00:29:41,680 --> 00:29:44,380
And now we're done.
540
00:29:44,380 --> 00:29:45,120
Why is that?
541
00:29:45,120 --> 00:29:48,510
Because we have shown now that
after the next transition--
542
00:29:48,510 --> 00:29:52,870
after we have reached
x, y after n steps,
543
00:29:52,870 --> 00:29:58,980
then in our n plus 1-th step,
all that you can achieve
544
00:29:58,980 --> 00:30:01,180
is divisible by m.
545
00:30:01,180 --> 00:30:03,810
So that's exactly
the invariance.
546
00:30:03,810 --> 00:30:08,620
So we conclude that
p, n plus 1 is true.
547
00:30:08,620 --> 00:30:09,600
And so now we're done.
548
00:30:12,230 --> 00:30:14,900
Are any questions
about this proof?
549
00:30:14,900 --> 00:30:16,540
So this is like the
standard technique
550
00:30:16,540 --> 00:30:20,200
that we tried to use all
the time here in this class.
551
00:30:20,200 --> 00:30:22,850
We will use it in all
the other areas, as well.
552
00:30:22,850 --> 00:30:26,440
In graph theory, in particular.
553
00:30:26,440 --> 00:30:30,430
And especially in number
theory, will also use it,
554
00:30:30,430 --> 00:30:33,220
especially in this class.
555
00:30:33,220 --> 00:30:33,720
OK.
556
00:30:33,720 --> 00:30:36,660
So let's apply this to theorem.
557
00:30:39,870 --> 00:30:43,790
Let's I think about
this movie that we saw,
558
00:30:43,790 --> 00:30:46,150
this Die Hard number 3.
559
00:30:46,150 --> 00:30:48,120
Die Hard number 4 came out.
560
00:30:48,120 --> 00:30:51,890
And then the cast got
stuck in Die Hard number 5.
561
00:30:51,890 --> 00:30:55,730
There's was a problem,
because the rumors
562
00:30:55,730 --> 00:31:01,810
were that in Die Hard number 5,
they had like a 33 gallon jug.
563
00:31:01,810 --> 00:31:02,760
That's a lot.
564
00:31:02,760 --> 00:31:05,680
And a 55 gallon jug.
565
00:31:05,680 --> 00:31:13,252
So Bruce has in
training his muscles,
566
00:31:13,252 --> 00:31:15,210
because you can imagine
those are pretty heavy.
567
00:31:15,210 --> 00:31:17,560
So if you want the pour one
into the other, my goodness.
568
00:31:17,560 --> 00:31:22,810
So-- but the question is, is
he training the right muscles?
569
00:31:22,810 --> 00:31:27,450
So can we apply this theorem
now, and showed that--
570
00:31:27,450 --> 00:31:31,100
Oh, I should to tell
you what is the problem.
571
00:31:31,100 --> 00:31:35,980
Well, again, he has to
get say 4 gallons out
572
00:31:35,980 --> 00:31:39,750
of this-- out of these two jugs.
573
00:31:39,750 --> 00:31:42,260
So is that possible?
574
00:31:42,260 --> 00:31:42,760
It's not.
575
00:31:42,760 --> 00:31:44,280
I see someone shaking his head.
576
00:31:44,280 --> 00:31:48,030
Do you want to explain why?
577
00:31:48,030 --> 00:31:50,874
AUDIENCE: A and b are
both divisible by 11.
578
00:31:50,874 --> 00:31:51,540
PROFESSOR: Yeah.
579
00:31:51,540 --> 00:31:54,640
AUDIENCE: So any other
configuration will also
580
00:31:54,640 --> 00:31:56,360
have to be divisible by 11.
581
00:31:56,360 --> 00:31:58,590
And 4 is not divisible by 11.
582
00:31:58,590 --> 00:31:59,810
PROFESSOR: Exactly.
583
00:31:59,810 --> 00:32:02,540
4 is not divisible by 11, so
the whole cast got blown up
584
00:32:02,540 --> 00:32:04,310
in Die Hard number 5.
585
00:32:04,310 --> 00:32:08,510
And so we have no Die
Hard number 6, as well.
586
00:32:08,510 --> 00:32:13,520
OK, so-- so now
all of this stuff
587
00:32:13,520 --> 00:32:17,860
actually helps us to define
a new concept, as well.
588
00:32:17,860 --> 00:32:20,580
So let's do that.
589
00:32:20,580 --> 00:32:21,485
I'll put it up here.
590
00:32:29,630 --> 00:32:42,770
We will use the
terminology GCD of a and b
591
00:32:42,770 --> 00:32:59,530
as being the greatest
common divisor of a and b.
592
00:32:59,530 --> 00:33:04,380
So, for example, if we
are looking at a equals 3,
593
00:33:04,380 --> 00:33:11,030
and b equals 5, well
then the GCD of 3 and 5
594
00:33:11,030 --> 00:33:13,360
is actually equal to 1.
595
00:33:13,360 --> 00:33:20,450
There's no other larger integer
that divides both 3 and 5.
596
00:33:20,450 --> 00:33:25,250
In other examples are, for
example, if we have the GCD of
597
00:33:25,250 --> 00:33:29,410
say 52 and 44.
598
00:33:29,410 --> 00:33:31,550
Well, what's this equal to?
599
00:33:31,550 --> 00:33:35,630
Well, this actually
is 4 times 13.
600
00:33:35,630 --> 00:33:38,170
This is 4 times 11.
601
00:33:38,170 --> 00:33:41,350
So 4 divides both this,
and both this one.
602
00:33:41,350 --> 00:33:44,220
But nothing larger can
divide both of those.
603
00:33:44,220 --> 00:33:45,940
So we have that
this is equal to 4.
604
00:33:49,330 --> 00:33:52,110
We will have a
separate definition
605
00:33:52,110 --> 00:33:54,650
that talks about this
very special case where
606
00:33:54,650 --> 00:33:59,630
two numbers-- if you look at
their greatest common divisor--
607
00:33:59,630 --> 00:34:02,445
when that greatest common
divisor is equal to 1,
608
00:34:02,445 --> 00:34:05,130
we actually define those
two numbers to be relatively
609
00:34:05,130 --> 00:34:08,310
prime to one another.
610
00:34:08,310 --> 00:34:10,979
So let's put that out over here.
611
00:34:20,550 --> 00:34:23,630
So that's another definition.
612
00:34:23,630 --> 00:34:28,929
We say that a and
b are relatively
613
00:34:28,929 --> 00:34:39,610
prime if the greatest common
divisor is actually equal to 1.
614
00:34:42,840 --> 00:34:45,810
Now today we will not really
use his definition so much,
615
00:34:45,810 --> 00:34:47,510
but it's actually
very important.
616
00:34:47,510 --> 00:34:49,714
And we'll come back
to this next lecture.
617
00:34:53,520 --> 00:34:56,600
So if we now look at this
particular thing them
618
00:34:56,600 --> 00:35:02,490
over here, can we see a
nice corollary of this?
619
00:35:02,490 --> 00:35:04,460
Like a result, if you
think about this greatest
620
00:35:04,460 --> 00:35:06,160
common divisor.
621
00:35:06,160 --> 00:35:09,200
Well, the greatest
common divisor off a an b
622
00:35:09,200 --> 00:35:11,670
divides both a and b.
623
00:35:11,670 --> 00:35:14,080
So the greatest common
divisor of a and b
624
00:35:14,080 --> 00:35:18,930
will divide any result that
we can generate by playing
625
00:35:18,930 --> 00:35:20,650
this game with the jugs.
626
00:35:20,650 --> 00:35:28,060
So the corollary here is
that the GCD of a and b
627
00:35:28,060 --> 00:35:31,751
divides any result.
628
00:35:34,440 --> 00:35:37,200
OK, so that's really cool.
629
00:35:37,200 --> 00:35:40,950
So this already tells us
quite a bit about this game
630
00:35:40,950 --> 00:35:42,590
that we have here.
631
00:35:42,590 --> 00:35:46,830
So now what we would
like to do is to find out
632
00:35:46,830 --> 00:35:49,050
what exactly we can be reached?
633
00:35:49,050 --> 00:35:51,760
We have a property that
we have shown here.
634
00:35:51,760 --> 00:35:55,300
But what else can we do here?
635
00:35:55,300 --> 00:35:58,640
Now it turns out that
you can say much more,
636
00:35:58,640 --> 00:36:01,600
and we would like to prove
the following theorem
637
00:36:01,600 --> 00:36:05,920
to make-- to analyze this
whole thing much better.
638
00:36:05,920 --> 00:36:09,400
I don't think I need the
state machine anymore.
639
00:36:09,400 --> 00:36:10,709
So let's take that off.
640
00:36:19,810 --> 00:36:21,580
The theorem that we
would like to prove
641
00:36:21,580 --> 00:36:29,022
is that any linear
combination of the-- let's
642
00:36:29,022 --> 00:36:32,210
change this into
the 3 and 5 again.
643
00:36:32,210 --> 00:36:35,180
Any linear combination
of 3 and 5,
644
00:36:35,180 --> 00:36:41,280
I can make with these 3
and the 5 a gallon jug.
645
00:36:41,280 --> 00:36:42,660
So let's write it out.
646
00:36:42,660 --> 00:36:55,680
So any linear
combination l, which
647
00:36:55,680 --> 00:37:01,330
we writes as some integer s
times a, plus some integer
648
00:37:01,330 --> 00:37:02,360
t times b.
649
00:37:05,170 --> 00:37:15,760
So any linear combination of a
and b, with-- well, of course,
650
00:37:15,760 --> 00:37:19,850
the number of gallons should
fit the largest the jug.
651
00:37:19,850 --> 00:37:25,430
So with 0 is, at most l.
652
00:37:25,430 --> 00:37:27,620
Is it mostly can be reached.
653
00:37:34,520 --> 00:37:37,920
So this theorem we
would like to prove now.
654
00:37:37,920 --> 00:37:39,610
And in order to
do that, we would
655
00:37:39,610 --> 00:37:44,260
like to already think about
some kind of a property
656
00:37:44,260 --> 00:37:45,250
that we have.
657
00:37:45,250 --> 00:37:49,090
So when we talk about linear
combinations, the s and the t
658
00:37:49,090 --> 00:37:50,820
can be negative, or positive.
659
00:37:50,820 --> 00:37:51,760
We really don't care.
660
00:37:51,760 --> 00:37:54,110
So for example, we
could have like,
661
00:37:54,110 --> 00:37:58,720
I don't know, minus 2
times-- so for example,
662
00:37:58,720 --> 00:38:06,140
4 is equal to minus 2, times 3,
plus-- actually, is that true?
663
00:38:06,140 --> 00:38:06,820
Yeah.
664
00:38:06,820 --> 00:38:10,590
Plus 2, times 5.
665
00:38:10,590 --> 00:38:18,710
So here we have s to be equal
to minus 2, and t is equal to 2.
666
00:38:18,710 --> 00:38:20,430
And of course, a is
equal to 3, right?
667
00:38:20,430 --> 00:38:23,210
And be is equal to 5.
668
00:38:23,210 --> 00:38:27,160
So 4 is a linear
combination of these two.
669
00:38:27,160 --> 00:38:31,070
And according to the theorem,
we can create that number
670
00:38:31,070 --> 00:38:33,280
of gallons in this jug.
671
00:38:33,280 --> 00:38:36,480
And we already saw
that, because we did it.
672
00:38:36,480 --> 00:38:40,430
But for our theorem,
in order to prove this,
673
00:38:40,430 --> 00:38:43,020
we really would like
s to be positive.
674
00:38:43,020 --> 00:38:45,390
So how can we do that?
675
00:38:45,390 --> 00:38:48,150
If anybody has an
indea what we could do?
676
00:38:48,150 --> 00:38:51,224
AUDIENCE: Let's assume
that b is greater than m.
677
00:38:51,224 --> 00:38:51,890
PROFESSOR: Yeah.
678
00:38:51,890 --> 00:38:56,160
We have still that a is supposed
to be-- We will assume that
679
00:38:56,160 --> 00:38:57,821
throughout the whole lecture.
680
00:38:57,821 --> 00:38:58,320
Thanks.
681
00:39:00,731 --> 00:39:02,230
So in order to prove
this, we really
682
00:39:02,230 --> 00:39:04,110
would like to have
s to be positive.
683
00:39:04,110 --> 00:39:05,867
So let's just play
around a little bit
684
00:39:05,867 --> 00:39:07,700
with linear combinations
to get a little bit
685
00:39:07,700 --> 00:39:09,280
of feeling for that.
686
00:39:09,280 --> 00:39:11,510
How could we write
4 differently,
687
00:39:11,510 --> 00:39:14,150
as a linear
combination of 3 and 5,
688
00:39:14,150 --> 00:39:19,150
such that we have actually
a positive number over here?
689
00:39:19,150 --> 00:39:23,895
Does anybody see
another way to see that?
690
00:39:23,895 --> 00:39:25,937
AUDIENCE: [INAUDIBLE]
691
00:39:25,937 --> 00:39:27,145
PROFESSOR: Yeah, that's true.
692
00:39:27,145 --> 00:39:31,270
3 times 3, minus-- minus 5.
693
00:39:31,270 --> 00:39:33,460
So-- and how did we do that?
694
00:39:33,460 --> 00:39:38,580
Well, we can just say
5 times 3 to this one,
695
00:39:38,580 --> 00:39:42,090
and then subtract the same
again, minus 3 times 5,
696
00:39:42,090 --> 00:39:43,320
over here.
697
00:39:43,320 --> 00:39:46,170
And if he adds those
things together,
698
00:39:46,170 --> 00:39:50,870
he will see 5 minus 2, is
3 times 3, as you said.
699
00:39:50,870 --> 00:39:55,580
And we have minus 3 plus 2
is actually minus 1 times 5.
700
00:39:55,580 --> 00:39:58,900
And this will be a different
linear combination of 4.
701
00:39:58,900 --> 00:40:02,930
So what we can do here, we can
sort of play around and make
702
00:40:02,930 --> 00:40:07,260
this s over here, which we now
say call s prime, is positive.
703
00:40:10,200 --> 00:40:11,640
Actually, it's larger than 0.
704
00:40:17,340 --> 00:40:22,960
So let's start the
proof for this theorem.
705
00:40:22,960 --> 00:40:27,595
It's pretty amazing
to me, actually,
706
00:40:27,595 --> 00:40:31,470
that you can do so
much a game like this,
707
00:40:31,470 --> 00:40:35,020
and see so much happening.
708
00:40:35,020 --> 00:40:40,651
So let's figure
out how this works.
709
00:40:40,651 --> 00:40:41,150
OK.
710
00:40:45,300 --> 00:40:51,850
So let's first formalize this
particular trick over here.
711
00:40:51,850 --> 00:40:54,030
And how do we go ahead with it?
712
00:40:54,030 --> 00:40:59,990
Ah, well, notice
that we can rewrite
713
00:40:59,990 --> 00:41:05,780
L, which is equal to s
times a, plus t times b.
714
00:41:05,780 --> 00:41:13,130
s, you know, we can just add
a multiple of b over here.
715
00:41:13,130 --> 00:41:16,880
n times b, say m times a.
716
00:41:16,880 --> 00:41:22,140
And we can subtract the
same amount over here,
717
00:41:22,140 --> 00:41:24,370
minus n times a, times b.
718
00:41:24,370 --> 00:41:26,530
So do you see what
I did over here?
719
00:41:26,530 --> 00:41:30,570
I have added n times b, times a,
and subtracted n, times a times
720
00:41:30,570 --> 00:41:32,760
b.
721
00:41:32,760 --> 00:41:35,140
And we did something similar
over here, not exactly
722
00:41:35,140 --> 00:41:35,750
the same.
723
00:41:35,750 --> 00:41:37,990
But that's what we did.
724
00:41:37,990 --> 00:41:42,390
And you can imagine
that we can choose m,
725
00:41:42,390 --> 00:41:45,970
such that s plus n times
b will be larger than 0.
726
00:41:45,970 --> 00:41:47,030
We can do that.
727
00:41:47,030 --> 00:41:53,450
So essentially this proved to
us that there exists an x prime,
728
00:41:53,450 --> 00:41:57,050
and also the t
prime, such that L
729
00:41:57,050 --> 00:41:59,610
can be rewritten as
a linear combination,
730
00:41:59,610 --> 00:42:04,600
s prime, times a,
plus t prime, times b.
731
00:42:04,600 --> 00:42:08,710
But now with you extra
property, that s prime
732
00:42:08,710 --> 00:42:13,010
is actually positive.
733
00:42:13,010 --> 00:42:15,690
Now this is really
important, because we're
734
00:42:15,690 --> 00:42:18,840
going to create an
algorithm of playing
735
00:42:18,840 --> 00:42:22,410
with those jugs that can
achieve this particular linear
736
00:42:22,410 --> 00:42:23,280
combination.
737
00:42:23,280 --> 00:42:26,700
And that's how we're going
to prove this theorem.
738
00:42:26,700 --> 00:42:36,215
So let's assume that 0 is
less than L, is less than b.
739
00:42:36,215 --> 00:42:39,690
I know that we, in
the theorem, we also
740
00:42:39,690 --> 00:42:42,472
consider the case is L
equals 0, and L equals b.
741
00:42:42,472 --> 00:42:43,680
But those are obvious, right?
742
00:42:43,680 --> 00:42:46,020
You could either empty
the jugs, or just
743
00:42:46,020 --> 00:42:49,130
fill up with the bigger one.
744
00:42:49,130 --> 00:42:51,260
So we will consider
just this case.
745
00:42:54,580 --> 00:42:55,080
All right.
746
00:42:55,080 --> 00:42:57,243
So what's the algorithm
going to do for us?
747
00:43:03,159 --> 00:43:12,740
The algorithm is going to
repeatedly fill and pour
748
00:43:12,740 --> 00:43:16,160
our jugs in a very special way.
749
00:43:16,160 --> 00:43:20,470
And miraculously we
will be able to get
750
00:43:20,470 --> 00:43:23,520
the desired linear
combination every single time.
751
00:43:26,229 --> 00:43:28,270
And of course, we're going
to use induction again
752
00:43:28,270 --> 00:43:30,611
to prove this property.
753
00:43:30,611 --> 00:43:31,110
OK.
754
00:43:31,110 --> 00:43:33,330
So how does the algorithm work?
755
00:43:33,330 --> 00:43:45,980
Well, to obtain L gallons
we're going to repeat
756
00:43:45,980 --> 00:43:50,047
s prime times, which is the
number that we have over here.
757
00:43:53,320 --> 00:44:00,260
The following algorithm--
we first of all,
758
00:44:00,260 --> 00:44:02,160
we will fill the a jug.
759
00:44:06,800 --> 00:44:08,609
This one.
760
00:44:08,609 --> 00:44:10,150
After we have done
this, we are going
761
00:44:10,150 --> 00:44:12,380
to pour this into the b jug.
762
00:44:12,380 --> 00:44:15,090
So how do we go ahead?
763
00:44:15,090 --> 00:44:18,470
We pour- oops.
764
00:44:18,470 --> 00:44:19,615
This into the b jug.
765
00:44:23,450 --> 00:44:28,960
And when this b jug becomes
full, we are going pour it out.
766
00:44:28,960 --> 00:44:31,040
So let's write it out.
767
00:44:31,040 --> 00:44:45,080
So when it becomes full, it
will actually empty it out.
768
00:44:49,080 --> 00:44:53,610
And we will continue pouring
the a jug into the b jug.
769
00:44:53,610 --> 00:44:56,060
So we'll continue this process.
770
00:45:00,120 --> 00:45:04,060
So let's take an example
to see how that works.
771
00:45:04,060 --> 00:45:10,680
So we keep on doing this until
the a jug is actually empty.
772
00:45:13,920 --> 00:45:15,070
So let's take an example.
773
00:45:18,436 --> 00:45:20,890
So let's see.
774
00:45:20,890 --> 00:45:22,555
Let's do that over here.
775
00:45:26,560 --> 00:45:29,960
Actually we can do
the tennis balls, too.
776
00:45:29,960 --> 00:45:32,100
Let's do that first.
777
00:45:32,100 --> 00:45:34,810
See how that works.
778
00:45:34,810 --> 00:45:41,510
So essentially, in
order to get 4 gallons,
779
00:45:41,510 --> 00:45:45,100
we just fill up the
three gallon jug.
780
00:45:45,100 --> 00:45:47,230
We empty it all in here.
781
00:45:49,780 --> 00:45:51,670
We fill it up again.
782
00:45:51,670 --> 00:45:54,110
You pour in as much as we can.
783
00:45:54,110 --> 00:45:56,480
That's-- that's it.
784
00:45:56,480 --> 00:45:58,501
We have to empty this one.
785
00:45:58,501 --> 00:45:59,000
Oops.
786
00:46:01,760 --> 00:46:04,040
We have to keep on pouring.
787
00:46:04,040 --> 00:46:05,740
Put this in here.
788
00:46:05,740 --> 00:46:12,900
Fill this one up, and then pour
over into the five gallon jug.
789
00:46:12,900 --> 00:46:15,640
And now we've got 4
gallons over here.
790
00:46:15,640 --> 00:46:17,160
So what did we do?
791
00:46:17,160 --> 00:46:19,490
So let's write it out.
792
00:46:19,490 --> 00:46:23,180
So for our special linear
combination over here,
793
00:46:23,180 --> 00:46:29,040
we have that 4 equals 3,
times 3, minus 1, times 5.
794
00:46:29,040 --> 00:46:33,620
So we need to repeat
this process three times.
795
00:46:33,620 --> 00:46:35,740
So let's do that.
796
00:46:35,740 --> 00:46:42,150
In our first loop we
will do the following.
797
00:46:42,150 --> 00:46:47,490
We start with the start
state, the pair 0, 0.
798
00:46:47,490 --> 00:46:50,720
We're going to fill up the
very first jug all the way up
799
00:46:50,720 --> 00:46:52,950
to its capacity, 3.
800
00:46:52,950 --> 00:46:57,860
And we put it all
over into the b jug.
801
00:46:57,860 --> 00:46:59,414
What happens in the second loop?
802
00:47:04,850 --> 00:47:09,200
The second loop, we
again fill up the a jug.
803
00:47:09,200 --> 00:47:13,320
So we have-- we start at 0, 3.
804
00:47:13,320 --> 00:47:15,730
We fill it up.
805
00:47:15,730 --> 00:47:18,430
We get 3, 3, the pair 3, 3.
806
00:47:18,430 --> 00:47:22,330
We pour everything in
here, as much as we can.
807
00:47:22,330 --> 00:47:24,320
That give us 1, 5.
808
00:47:24,320 --> 00:47:29,180
Only 2 gallons are poured
into the bigger gallon.
809
00:47:29,180 --> 00:47:32,230
We empty the bigger
gallon, the bigger jug.
810
00:47:32,230 --> 00:47:34,940
We get 1, 0.
811
00:47:34,940 --> 00:47:39,110
And we keep on pouring,
and you get 0, 1.
812
00:47:39,110 --> 00:47:41,660
So now in the third
loop-- and that's
813
00:47:41,660 --> 00:47:43,276
where we should
get the 4 gallons.
814
00:47:47,110 --> 00:47:51,440
We start off with 0,1.
815
00:47:51,440 --> 00:47:57,150
Um, we fill up the a jug.
816
00:47:57,150 --> 00:48:03,910
We pour everything over into
the bigger jug, and we get 0, 4.
817
00:48:03,910 --> 00:48:06,210
And that's the end result.
818
00:48:06,210 --> 00:48:09,970
So this algorithm seems to work
for this particular example.
819
00:48:09,970 --> 00:48:13,489
Of course we would like to prove
it for the general situation.
820
00:48:13,489 --> 00:48:14,280
So how do we do it?
821
00:48:16,800 --> 00:48:22,780
Well, we're going to just
to analyze the algorithm
822
00:48:22,780 --> 00:48:23,660
in the following way.
823
00:48:27,000 --> 00:48:32,530
We can notice that
in this algorithm,
824
00:48:32,530 --> 00:48:36,020
we fill up s prime
times the a jug,
825
00:48:36,020 --> 00:48:42,420
and we essentially pour
everything out into the b jugs,
826
00:48:42,420 --> 00:48:45,660
and we sometimes
empty the b jug.
827
00:48:45,660 --> 00:48:48,170
So let's try to think
about this a little bit,
828
00:48:48,170 --> 00:48:51,030
and see how we could
try to formalize this.
829
00:48:51,030 --> 00:48:52,160
So let's write it out.
830
00:48:54,700 --> 00:49:02,720
We have filled the a
gallon jug s prime times.
831
00:49:05,360 --> 00:49:09,500
We also know that the
b jug has been emptied
832
00:49:09,500 --> 00:49:10,880
a certain number of times.
833
00:49:10,880 --> 00:49:22,450
So let's-- let's just assume--
suppose that the b jug is
834
00:49:22,450 --> 00:49:24,375
actually emptied, say, u times.
835
00:49:30,700 --> 00:49:32,800
I do not know how many times.
836
00:49:32,800 --> 00:49:34,900
But I say, well, let's
assume it's u times,
837
00:49:34,900 --> 00:49:37,340
and try to figure
out whether we can
838
00:49:37,340 --> 00:49:40,470
find some algebraic expression.
839
00:49:40,470 --> 00:49:44,690
So at the very end
of the algorithm,
840
00:49:44,690 --> 00:49:48,270
let r be what is in the b jug.
841
00:49:48,270 --> 00:49:58,235
So let r be the remainder,
in the b gallon jug.
842
00:50:03,500 --> 00:50:06,220
So now we can continue.
843
00:50:06,220 --> 00:50:09,940
We know if r is what left
in the b gallon jug, well,
844
00:50:09,940 --> 00:50:13,780
we know already
some property of it.
845
00:50:13,780 --> 00:50:17,040
Actually, let's put
that on the next board.
846
00:50:17,040 --> 00:50:22,580
We know that 0 is at
most r, and at most b,
847
00:50:22,580 --> 00:50:25,170
because that's what's left
in the b gallon jug, right?
848
00:50:25,170 --> 00:50:27,740
So we know these bounds.
849
00:50:27,740 --> 00:50:33,700
We have assumed that 0 is
less than L, is less than b,
850
00:50:33,700 --> 00:50:36,620
which we put over there.
851
00:50:36,620 --> 00:50:40,650
We know that r must
be equal to what
852
00:50:40,650 --> 00:50:46,720
kind of linear combination
of s prime, and u?
853
00:50:46,720 --> 00:50:52,240
So-- Well, we have been
filling of s prime times.
854
00:50:52,240 --> 00:50:57,020
So this is what we added in
water to the whole system,
855
00:50:57,020 --> 00:50:59,660
you can say, s prime times a.
856
00:50:59,660 --> 00:51:02,060
And we poured out water.
857
00:51:02,060 --> 00:51:06,890
Well, we did that u times
from the b gallon jug.
858
00:51:06,890 --> 00:51:09,830
So we poured out
u times b gallons.
859
00:51:09,830 --> 00:51:13,520
So this is the remainder that
this left in this bigger jug,
860
00:51:13,520 --> 00:51:14,910
right?
861
00:51:14,910 --> 00:51:17,940
So are there any
questions about this?
862
00:51:17,940 --> 00:51:22,150
So-- OK.
863
00:51:22,150 --> 00:51:27,470
So we also know that
L is equal to s prime,
864
00:51:27,470 --> 00:51:31,220
times a, plus t prime, times b.
865
00:51:31,220 --> 00:51:33,500
And this is the
linear combination
866
00:51:33,500 --> 00:51:36,820
that we would try
to prove of, that it
867
00:51:36,820 --> 00:51:39,240
is left at the very end.
868
00:51:39,240 --> 00:51:42,440
So what we want to show
is that r equals L.
869
00:51:42,440 --> 00:51:44,290
So how do we do that now?
870
00:51:44,290 --> 00:51:51,110
How are we going to show
that r can be expressed
871
00:51:51,110 --> 00:51:52,770
in L, in a special way.
872
00:51:52,770 --> 00:51:53,710
So let's have a look.
873
00:51:53,710 --> 00:51:58,150
So these are all
tricks in the sense
874
00:51:58,150 --> 00:52:01,000
that I'm giving you
this proof, but how do
875
00:52:01,000 --> 00:52:03,340
you come up with this yourself?
876
00:52:03,340 --> 00:52:05,990
Sometimes you play a lot
with these kinds of things,
877
00:52:05,990 --> 00:52:12,250
and you get a feeling of what
kind of-- sort of pattern
878
00:52:12,250 --> 00:52:16,080
exists, and what
kind of intuition
879
00:52:16,080 --> 00:52:19,070
you need in order to write
down a proof like this.
880
00:52:19,070 --> 00:52:22,910
So let's rewrite this.
881
00:52:22,910 --> 00:52:26,030
I'm going add t prime times b.
882
00:52:26,030 --> 00:52:27,570
And I'm going to
subtract it again.
883
00:52:30,530 --> 00:52:34,650
So I have s prime times
a, plus t prime times b.
884
00:52:34,650 --> 00:52:38,240
I subtract it again, and I
still have this amount left open
885
00:52:38,240 --> 00:52:39,820
here.
886
00:52:39,820 --> 00:52:41,755
So what is this equal to?
887
00:52:41,755 --> 00:52:48,840
Well this part is equal to L.
So this is equal to minus--
888
00:52:48,840 --> 00:52:52,140
and I have a multiple
of b, which is t prime,
889
00:52:52,140 --> 00:52:53,708
plus u times b.
890
00:52:56,636 --> 00:52:59,072
Hm.
891
00:52:59,072 --> 00:53:00,280
Now this is very interesting.
892
00:53:00,280 --> 00:53:02,760
Does anybody see how
we could continue here?
893
00:53:02,760 --> 00:53:08,260
So we have r expressed as
L, minus a multiple of b.
894
00:53:08,260 --> 00:53:10,630
And I also know that
L is in this range.
895
00:53:10,630 --> 00:53:13,489
I also know that r
is in this range.
896
00:53:13,489 --> 00:53:15,030
So that's kind of
interesting, right?
897
00:53:15,030 --> 00:53:18,730
So how can that be?
898
00:53:18,730 --> 00:53:20,560
What should be the case here?
899
00:53:20,560 --> 00:53:25,660
Does anybody see what kind
of property t prime plus u
900
00:53:25,660 --> 00:53:30,490
must have in order
to make that happen?
901
00:53:30,490 --> 00:53:31,960
So let's have a look here.
902
00:53:31,960 --> 00:53:35,300
We have L. It's in this range.
903
00:53:35,300 --> 00:53:37,720
So let's just draw an axis.
904
00:53:37,720 --> 00:53:40,340
So at 0, we have b.
905
00:53:40,340 --> 00:53:48,300
And somehow in this
range, we have L. Now
906
00:53:48,300 --> 00:53:53,590
if I subtract like actually
b, or something more than b,
907
00:53:53,590 --> 00:53:55,470
or I add more than b.
908
00:53:55,470 --> 00:53:59,010
I will jump out of this range,
and I go somewhere over here,
909
00:53:59,010 --> 00:54:01,510
or I go somewhere over there.
910
00:54:01,510 --> 00:54:02,160
Right?
911
00:54:02,160 --> 00:54:06,050
So if I said suppose
L is over here,
912
00:54:06,050 --> 00:54:09,960
then L minus b would be over
here, which would be negative.
913
00:54:09,960 --> 00:54:12,900
Or if I add b, it
will be over here,
914
00:54:12,900 --> 00:54:15,670
which would be more than b.
915
00:54:15,670 --> 00:54:20,120
Now we know that this is equal
to r, but r is in this range.
916
00:54:20,120 --> 00:54:21,810
So that's not really possible.
917
00:54:21,810 --> 00:54:23,780
So let's write it out.
918
00:54:23,780 --> 00:54:29,370
So if t prime plus
u is unequal to 0,
919
00:54:29,370 --> 00:54:31,420
so we're actually
really subtract
920
00:54:31,420 --> 00:54:36,300
or add a multiple of b.
921
00:54:36,300 --> 00:54:41,770
Then I know that r is
either smaller than 0,
922
00:54:41,770 --> 00:54:45,110
or r is larger than b.
923
00:54:45,110 --> 00:54:46,910
Now we know that
cannot be the case,
924
00:54:46,910 --> 00:54:51,600
so we can conclude that
t prime plus u equals 0.
925
00:54:51,600 --> 00:54:58,520
Now that implies that
t prime equals minus u,
926
00:54:58,520 --> 00:55:01,040
or maybe other way around,
because that's easier
927
00:55:01,040 --> 00:55:02,200
to see what's happening.
928
00:55:02,200 --> 00:55:06,300
So u equals minus t prime.
929
00:55:06,300 --> 00:55:09,720
If you plug that
in here, well, we
930
00:55:09,720 --> 00:55:11,510
get exactly the same expression.
931
00:55:11,510 --> 00:55:12,590
You see?
932
00:55:12,590 --> 00:55:16,640
Minus, minus t prime is
equal to plus t prime.
933
00:55:16,640 --> 00:55:18,560
And we get the exact
same linear combination.
934
00:55:18,560 --> 00:55:21,910
So we conclude that r equals L.
935
00:55:21,910 --> 00:55:23,370
And now we're done.
936
00:55:23,370 --> 00:55:24,420
Why is that?
937
00:55:24,420 --> 00:55:29,034
Well, we have shown that the
very last number of gallons
938
00:55:29,034 --> 00:55:30,450
that is left after
this procedure,
939
00:55:30,450 --> 00:55:32,670
after this algorithm,
is actually
940
00:55:32,670 --> 00:55:35,090
exactly equal to the
linear combination
941
00:55:35,090 --> 00:55:36,630
that we wanted to achieve.
942
00:55:36,630 --> 00:55:40,720
So now we got the proof for
this theorem that tells us
943
00:55:40,720 --> 00:55:50,370
that any linear combination
is actually-- of a and b
944
00:55:50,370 --> 00:55:54,250
can actually be reached by
pouring gallons over and back,
945
00:55:54,250 --> 00:55:56,980
and emptying and
filling those jugs.
946
00:55:56,980 --> 00:55:58,995
All right let's continue.
947
00:55:58,995 --> 00:56:00,370
So there was a
question over here
948
00:56:00,370 --> 00:56:02,915
that I would like to-- that
I would like to address.
949
00:56:05,990 --> 00:56:10,600
So maybe I did not make
so clear what the s prime,
950
00:56:10,600 --> 00:56:12,900
and the t prime is over here.
951
00:56:12,900 --> 00:56:16,222
And in this proof,
we started off
952
00:56:16,222 --> 00:56:17,430
with this linear combination.
953
00:56:17,430 --> 00:56:20,270
I would like to
have an algorithm
954
00:56:20,270 --> 00:56:25,990
of pouring that creates L
gallons in say the bigger jug.
955
00:56:25,990 --> 00:56:30,870
So in order to do that,
I want to find, say,
956
00:56:30,870 --> 00:56:35,040
a linear combination that
makes this L such that this
957
00:56:35,040 --> 00:56:38,160
s prime is an integer--
positive integer.
958
00:56:38,160 --> 00:56:40,900
Why do I want to have
a positive integer?
959
00:56:40,900 --> 00:56:44,420
Because in this algorithm,
I'm going to repeat something
960
00:56:44,420 --> 00:56:45,190
s prime times.
961
00:56:45,190 --> 00:56:47,670
If s prime is negative,
I cannot do it, right?
962
00:56:47,670 --> 00:56:50,710
So s prime has to be
a positive integer.
963
00:56:50,710 --> 00:56:55,200
In order to create such
a positive integer,
964
00:56:55,200 --> 00:56:59,450
I can just add like
1,000 times b times,
965
00:56:59,450 --> 00:57:03,160
and subtract 1,000
times a times b.
966
00:57:03,160 --> 00:57:06,080
That's OK I could
just add a lot.
967
00:57:06,080 --> 00:57:11,220
And if I add enough, I can
make s plus n times b positive.
968
00:57:11,220 --> 00:57:17,620
Even if s is, say, minus 100,
well, if I add 1,000 times 5,
969
00:57:17,620 --> 00:57:19,770
I will get a positive number.
970
00:57:19,770 --> 00:57:22,520
So that's sort of
the reason this proof
971
00:57:22,520 --> 00:57:25,310
that we want to rewrite
the linear combination
972
00:57:25,310 --> 00:57:29,040
to a new one, such that
s prime is positive.
973
00:57:29,040 --> 00:57:31,800
And if we have s prime
positive, then we
974
00:57:31,800 --> 00:57:34,070
can actually talk
about this algorithm,
975
00:57:34,070 --> 00:57:37,890
because we can only repeat
something s prime times,
976
00:57:37,890 --> 00:57:41,435
if s prime is say 1, or 2,
or 3, or something positive.
977
00:57:44,970 --> 00:57:46,330
All right.
978
00:57:46,330 --> 00:57:51,470
So let's-- I'll talk
about say the next part.
979
00:57:51,470 --> 00:57:56,480
So we have gone-- We
have proved two theorems.
980
00:57:56,480 --> 00:58:01,529
But in the end we would like
to have a characterization
981
00:58:01,529 --> 00:58:02,820
of the greatest common divisor.
982
00:58:02,820 --> 00:58:05,410
That's the goal of this lecture.
983
00:58:05,410 --> 00:58:07,250
So let's do it.
984
00:58:07,250 --> 00:58:10,000
Um.
985
00:58:10,000 --> 00:58:14,750
In order to do this,
let's first of all
986
00:58:14,750 --> 00:58:18,290
look at our five gallon,
and three gallon example.
987
00:58:18,290 --> 00:58:22,830
We know that the greatest
common divisor is equal to 1.
988
00:58:22,830 --> 00:58:30,740
We know that 1 can be rewritten
as a linear combination, as 2
989
00:58:30,740 --> 00:58:35,960
times 3, minus 1 times 5.
990
00:58:35,960 --> 00:58:38,530
So that means that according
to the theorem that we
991
00:58:38,530 --> 00:58:44,120
have up here, we can
actually make exactly 1
992
00:58:44,120 --> 00:58:48,140
gallon in one of these jugs.
993
00:58:48,140 --> 00:58:51,770
So that means that we can also
have any multiple of those.
994
00:58:51,770 --> 00:58:54,970
So we can reach any multiple 1.
995
00:58:54,970 --> 00:58:56,180
That's very special.
996
00:58:56,180 --> 00:58:59,730
So this particular case,
we know that any multiple
997
00:58:59,730 --> 00:59:03,100
of 1, any number of
gallons can be reached.
998
00:59:03,100 --> 00:59:06,270
So can we sort of
generalize this a little bit
999
00:59:06,270 --> 00:59:08,050
by using the greatest
common divisor?
1000
00:59:08,050 --> 00:59:11,680
So the greatest common
divisor 3 and 5 is equal to 1.
1001
00:59:11,680 --> 00:59:16,700
And we have shown that the
greatest common divisor defies
1002
00:59:16,700 --> 00:59:19,000
any result. Can we
say something more?
1003
00:59:19,000 --> 00:59:21,840
Can we say that the
greatest common divisor
1004
00:59:21,840 --> 00:59:25,040
can be maybe written
as a linear combination
1005
00:59:25,040 --> 00:59:26,830
of this type over there?
1006
00:59:26,830 --> 00:59:30,610
And that's how we are
going to proceed now.
1007
00:59:30,610 --> 00:59:40,300
So let's set talk about the
very special algorithm which
1008
00:59:40,300 --> 00:59:43,240
is called Euclid's algorithm.
1009
00:59:43,240 --> 00:59:47,410
And I think in the book it's
also called The Pulverizer.
1010
00:59:47,410 --> 00:59:50,940
And you will have
a problem on this
1011
00:59:50,940 --> 00:59:55,660
just to see how that works,
and to really understand it.
1012
00:59:55,660 --> 00:59:59,100
So let's explain
what we want here.
1013
00:59:59,100 --> 01:00:05,390
So first of all, we know
that for any b and a,
1014
01:00:05,390 --> 01:00:08,580
there exists a unique
quotient and remainder r.
1015
01:00:08,580 --> 01:00:11,740
So let's write it out.
1016
01:00:11,740 --> 01:00:20,110
There exists unique q, which
we will call the quotient.
1017
01:00:25,280 --> 01:00:26,720
And r.
1018
01:00:26,720 --> 01:00:27,845
We call this the remainder.
1019
01:00:33,280 --> 01:00:44,670
Such that b equals
q times a, plus r.
1020
01:00:44,670 --> 01:00:54,380
With the property that 0 is
at least r, and at most a.
1021
01:00:54,380 --> 01:00:58,630
So we're not going to
prove this statement.
1022
01:00:58,630 --> 01:01:00,160
It's actually like
a theorem, right?
1023
01:01:00,160 --> 01:01:02,387
But let's just
assume it for now.
1024
01:01:02,387 --> 01:01:03,970
And in the book you
can read about it.
1025
01:01:07,805 --> 01:01:13,110
We're going to use this to prove
the following lemma that we
1026
01:01:13,110 --> 01:01:15,030
will need to give
a characterization
1027
01:01:15,030 --> 01:01:18,090
of the greatest common divisor,
as a linear combination
1028
01:01:18,090 --> 01:01:20,235
of integers.
1029
01:01:23,280 --> 01:01:28,040
Oh, before I forget, you
will denote this remainder
1030
01:01:28,040 --> 01:01:34,400
as rem of b, a.
1031
01:01:34,400 --> 01:01:38,930
And this is the notation
that we use in this lecture.
1032
01:01:38,930 --> 01:01:40,090
So what's the lemma?
1033
01:01:40,090 --> 01:01:46,730
The lemma is that the greatest
common divisor of a and b,
1034
01:01:46,730 --> 01:01:52,790
is equal to the greatest common
divisor of the remainder of b
1035
01:01:52,790 --> 01:01:53,441
and a.
1036
01:01:56,090 --> 01:01:56,590
With a.
1037
01:01:56,590 --> 01:01:58,420
So what did we do?
1038
01:01:58,420 --> 01:02:02,810
Let's give an example
to see how this works.
1039
01:02:02,810 --> 01:02:06,680
For example, let's
take-- actually
1040
01:02:06,680 --> 01:02:08,405
let's do it on this white board.
1041
01:02:14,678 --> 01:02:16,175
So, let's see.
1042
01:02:19,666 --> 01:02:21,040
For example, let's
see whether we
1043
01:02:21,040 --> 01:02:27,590
can use this to calculate the
greatest common divisor 105,
1044
01:02:27,590 --> 01:02:28,940
and 224.
1045
01:02:31,260 --> 01:02:33,250
So how can we go ahead?
1046
01:02:33,250 --> 01:02:38,000
Well, according
to this lemma, we
1047
01:02:38,000 --> 01:02:41,430
can rewrite this as the
greatest common divisor
1048
01:02:41,430 --> 01:02:49,720
of first the remainder of
224, after dividing out
1049
01:02:49,720 --> 01:02:54,680
as many multiples
of 105 as possible.
1050
01:02:54,680 --> 01:02:55,180
And 105.
1051
01:02:58,000 --> 01:03:01,640
So what are we
going to use here?
1052
01:03:01,640 --> 01:03:09,370
We're going to use that 224 is
actually equal to 2 times 105,
1053
01:03:09,370 --> 01:03:10,803
plus 14.
1054
01:03:14,070 --> 01:03:18,340
So we had the GCD of 14 and 105.
1055
01:03:18,340 --> 01:03:20,490
Now why can I do this?
1056
01:03:20,490 --> 01:03:28,540
Well, I'm essentially just
subtracting like 2 times 135
1057
01:03:28,540 --> 01:03:30,850
from 224.
1058
01:03:30,850 --> 01:03:32,320
Well, the greatest
common divisor
1059
01:03:32,320 --> 01:03:40,050
that divides 105 and
224 also divides 105,
1060
01:03:40,050 --> 01:03:43,700
and a linear
combination of 105, 224.
1061
01:03:43,700 --> 01:03:46,430
That's essentially
what we are using.
1062
01:03:46,430 --> 01:03:49,370
And that's actually
stated in this lemma,
1063
01:03:49,370 --> 01:03:52,840
and that's what we
would like to prove.
1064
01:03:52,840 --> 01:03:55,370
So let's continue
with this process,
1065
01:03:55,370 --> 01:03:58,330
and do the same trick once more.
1066
01:03:58,330 --> 01:04:03,900
So we can say that we can
rewrite this as the greatest
1067
01:04:03,900 --> 01:04:14,660
common divisor of, well,
the remainder of 105
1068
01:04:14,660 --> 01:04:20,150
after taking out this many
multiples of 14 as possible,
1069
01:04:20,150 --> 01:04:22,580
and 14.
1070
01:04:22,580 --> 01:04:25,720
So what are we going
to use over here?
1071
01:04:25,720 --> 01:04:34,200
We are going to use that 105
is equal to 7 times 14, plus 7.
1072
01:04:34,200 --> 01:04:40,580
So this is the greatest
common divisor of 7, and 14.
1073
01:04:40,580 --> 01:04:45,550
Now if you just
continue this process,
1074
01:04:45,550 --> 01:04:49,230
we can see that this is equal
to the greatest common divisor,
1075
01:04:49,230 --> 01:04:53,760
again, of the
remainder of now 14,
1076
01:04:53,760 --> 01:05:00,090
after dividing out as many
multiples of 7 with 7.
1077
01:05:00,090 --> 01:05:05,630
Now this is equal to 0, 7.
1078
01:05:05,630 --> 01:05:06,180
Why is that?
1079
01:05:06,180 --> 01:05:14,630
Because 14 is equal
to 2 times 7, plus 0.
1080
01:05:14,630 --> 01:05:18,940
So 0 is the remainder
after dividing out
1081
01:05:18,940 --> 01:05:21,510
7 as many possible
times as possible.
1082
01:05:21,510 --> 01:05:22,010
OK.
1083
01:05:22,010 --> 01:05:25,180
So we have the greatest
common divisor of 0, and 7.
1084
01:05:25,180 --> 01:05:28,950
What's the largest integer
that can divide both 0 and 7?
1085
01:05:28,950 --> 01:05:32,590
Well, any integer can divide 0.
1086
01:05:32,590 --> 01:05:36,280
So we know that
this is equal to 7.
1087
01:05:36,280 --> 01:05:38,590
So essentially, what
we have done here,
1088
01:05:38,590 --> 01:05:42,600
we have repeatedly used
this particular lemma
1089
01:05:42,600 --> 01:05:49,360
to compute in the end, the
greatest common divisor of 105
1090
01:05:49,360 --> 01:05:51,290
and 224.
1091
01:05:51,290 --> 01:05:57,030
And we have been very methodol--
we have used a specific method.
1092
01:05:57,030 --> 01:06:01,490
We used the lemma,
and we worked it out.
1093
01:06:01,490 --> 01:06:04,120
We used the lemma
again, and we just
1094
01:06:04,120 --> 01:06:05,880
plugged in the actual numbers.
1095
01:06:05,880 --> 01:06:06,860
Used to lemma again.
1096
01:06:06,860 --> 01:06:09,860
Plugged in the actual
numbers, and so on.
1097
01:06:09,860 --> 01:06:14,020
And this is what is
called Euclid's algorithm.
1098
01:06:14,020 --> 01:06:16,910
And in the book it's also
called The Pulverizer.
1099
01:06:16,910 --> 01:06:20,270
And there's, I think,
a few other names.
1100
01:06:20,270 --> 01:06:23,190
But I like this one.
1101
01:06:23,190 --> 01:06:29,010
So this is an example
of Euclid's algorithm.
1102
01:06:29,010 --> 01:06:31,370
So now let's have
to look whether we
1103
01:06:31,370 --> 01:06:35,660
can have prove this
particular lemma,
1104
01:06:35,660 --> 01:06:42,970
and actually I will-- Yep.
1105
01:06:42,970 --> 01:06:44,930
We're going to prove this lemma.
1106
01:06:55,240 --> 01:06:56,030
OK.
1107
01:06:56,030 --> 01:07:01,190
So how do we do the proof?
1108
01:07:01,190 --> 01:07:05,640
Well, first before we
know that if- yeah.
1109
01:07:05,640 --> 01:07:06,840
Well, how do we do this?
1110
01:07:06,840 --> 01:07:10,350
You would like to prove that
if the great-- well, if n
1111
01:07:10,350 --> 01:07:13,380
divides a and b, in
particular, the greatest
1112
01:07:13,380 --> 01:07:17,360
common divisor divides a and b.
1113
01:07:17,360 --> 01:07:21,910
We would like to show
that it's dividing also
1114
01:07:21,910 --> 01:07:27,890
the remainder of b, after
dividing out a, and a itself.
1115
01:07:27,890 --> 01:07:30,200
If you can show
that, then we know
1116
01:07:30,200 --> 01:07:33,330
that the greatest common
divisor of this thing
1117
01:07:33,330 --> 01:07:35,740
is at least what
we have over here.
1118
01:07:35,740 --> 01:07:37,370
So I said a lot right now.
1119
01:07:37,370 --> 01:07:40,210
So let's try to write
it out a little bit.
1120
01:07:40,210 --> 01:07:44,860
So suppose that m
is any divisor of a.
1121
01:07:44,860 --> 01:07:48,205
And at the same time,
m also divides b.
1122
01:07:51,690 --> 01:07:57,920
Well, then I know
that m also divides
1123
01:07:57,920 --> 01:08:04,520
b minus, say, the quotient, q
that we had over here, times a.
1124
01:08:04,520 --> 01:08:11,250
And-- and this is actually equal
to the remainder of b and a.
1125
01:08:11,250 --> 01:08:14,950
Now we also note
that m divides a.
1126
01:08:14,950 --> 01:08:16,210
So what did we show here?
1127
01:08:16,210 --> 01:08:22,439
We showed that if m divides,
and m divides b, then m
1128
01:08:22,439 --> 01:08:25,649
also divides the
remainder of b and a.
1129
01:08:25,649 --> 01:08:27,700
And n divides a.
1130
01:08:27,700 --> 01:08:29,790
So what does is prove?
1131
01:08:29,790 --> 01:08:32,370
Well, it proves
that, in particular,
1132
01:08:32,370 --> 01:08:36,470
the greatest common divisor
over here divides this one.
1133
01:08:36,470 --> 01:08:37,859
That's interesting.
1134
01:08:37,859 --> 01:08:42,930
That essentially means that
we have shown this inequality.
1135
01:08:42,930 --> 01:08:49,180
Because if this
one divides this,
1136
01:08:49,180 --> 01:08:51,970
well, that means that
this number over here
1137
01:08:51,970 --> 01:08:55,569
must be at least what
we have over here.
1138
01:08:55,569 --> 01:08:56,399
OK.
1139
01:08:56,399 --> 01:08:58,400
So let's continue.
1140
01:09:07,620 --> 01:09:09,080
We consider two cases.
1141
01:09:09,080 --> 01:09:14,439
If the remainder of b and
a is unequal to 0, well,
1142
01:09:14,439 --> 01:09:17,600
what can we say now?
1143
01:09:17,600 --> 01:09:21,859
We can say that if I
know that m divides
1144
01:09:21,859 --> 01:09:27,569
this remainder of b and a, which
can be rewritten as b minus q,
1145
01:09:27,569 --> 01:09:29,819
times a.
1146
01:09:29,819 --> 01:09:37,569
And I also note that-- if I
also know that n divides a,
1147
01:09:37,569 --> 01:09:41,710
then this actually implies
the reverse of this statement,
1148
01:09:41,710 --> 01:09:45,290
that n divides a, and divides b.
1149
01:09:45,290 --> 01:09:46,910
Now why is that?
1150
01:09:46,910 --> 01:09:49,439
Well, we're actually
using the fact
1151
01:09:49,439 --> 01:09:53,960
that if n divides b, minus
q, times a, and m divides a,
1152
01:09:53,960 --> 01:09:57,680
then m also defies any linear
combination of these two.
1153
01:09:57,680 --> 01:10:04,620
In particular, this plus
q, times a, which is b.
1154
01:10:04,620 --> 01:10:05,710
m divides b.
1155
01:10:05,710 --> 01:10:10,780
So maybe I'm going a little
bit fast here, I notice.
1156
01:10:10,780 --> 01:10:15,000
This all also has to do with
all the lecture handouts.
1157
01:10:15,000 --> 01:10:17,650
You see a few facts
on the divisibility.
1158
01:10:17,650 --> 01:10:23,380
And in particular, item number
three that talks about the fact
1159
01:10:23,380 --> 01:10:24,380
that I'm using here.
1160
01:10:24,380 --> 01:10:28,610
If a divides b on your handout,
and a divides c, then I
1161
01:10:28,610 --> 01:10:33,800
know that a divides any
linear combination of b and c.
1162
01:10:33,800 --> 01:10:36,255
So that's essentially what
I'm using here repeatedly.
1163
01:10:39,090 --> 01:10:41,250
OK
1164
01:10:43,610 --> 01:10:48,930
So let's look at the other case.
1165
01:10:48,930 --> 01:10:54,620
If the remainder is equal
to 0, well, then I actually
1166
01:10:54,620 --> 01:11:00,540
know that b minus q,
times a is equal to 0.
1167
01:11:00,540 --> 01:11:07,780
Well, if I know that
m divides a, well,
1168
01:11:07,780 --> 01:11:16,380
then since 0 equals b minus q,
times a, I know that b equals
1169
01:11:16,380 --> 01:11:17,450
q, times a.
1170
01:11:17,450 --> 01:11:21,260
So if m divides a, I also
now that m divides b.
1171
01:11:23,920 --> 01:11:25,570
So this is one argument.
1172
01:11:25,570 --> 01:11:27,240
This is another one.
1173
01:11:27,240 --> 01:11:30,610
And this was-- These are
the three arguments that
1174
01:11:30,610 --> 01:11:35,970
now show that anything
that divides these two also
1175
01:11:35,970 --> 01:11:37,439
divides a and b.
1176
01:11:37,439 --> 01:11:39,230
So now we have the
reverse argument, right?
1177
01:11:39,230 --> 01:11:43,590
So this greatest common
divisor divides this one here,
1178
01:11:43,590 --> 01:11:45,340
and this one.
1179
01:11:45,340 --> 01:11:49,002
And we just proved that
it divides a and b,
1180
01:11:49,002 --> 01:11:50,460
and so it must
divides the greatest
1181
01:11:50,460 --> 01:11:51,940
common divisor of a and b.
1182
01:11:51,940 --> 01:11:55,030
So now we have shown
the other inequality,
1183
01:11:55,030 --> 01:11:56,190
and this proves equality.
1184
01:11:56,190 --> 01:11:59,160
So you should definitely look
this up in your lecture notes.
1185
01:12:02,110 --> 01:12:05,790
So now we can finally prove
this beautiful theorem
1186
01:12:05,790 --> 01:12:12,895
a that will help us to
characterize the-- actually,
1187
01:12:12,895 --> 01:12:14,360
let me put this over here.
1188
01:12:21,600 --> 01:12:24,600
So the final theorem
that we prove here
1189
01:12:24,600 --> 01:12:30,630
is that the greatest
common divisor of a and b
1190
01:12:30,630 --> 01:12:38,280
is actually a linear
combination of a and b.
1191
01:12:40,910 --> 01:12:43,280
So we're going to use this
algorithm that you have
1192
01:12:43,280 --> 01:12:47,460
over here, Euclid's algorithm.
1193
01:12:47,460 --> 01:12:53,860
And we are going to do a
proof, again, by induction.
1194
01:12:53,860 --> 01:12:55,470
And we use an invariance.
1195
01:12:55,470 --> 01:13:03,360
So we use a similar kind
of strategy, of course.
1196
01:13:03,360 --> 01:13:08,770
The invariance that
we are going to use
1197
01:13:08,770 --> 01:13:26,050
says-- well, if Euclid's
algorithm reaches the greatest
1198
01:13:26,050 --> 01:13:30,150
common divisor of x
and y-- so for example,
1199
01:13:30,150 --> 01:13:36,350
it's reach, say, 7 or
14, and 105, for example.
1200
01:13:36,350 --> 01:13:47,790
Then, say, after n steps
then both x and y are
1201
01:13:47,790 --> 01:13:51,950
linear combinations of a and b.
1202
01:13:51,950 --> 01:14:04,370
So then x and y are linear
combinations of a and b.
1203
01:14:04,370 --> 01:14:07,020
And at the same
time, we also know
1204
01:14:07,020 --> 01:14:10,270
that the greatest common
divisor of a and b
1205
01:14:10,270 --> 01:14:15,020
is equal to the greatest
common divisor of x and y.
1206
01:14:15,020 --> 01:14:17,390
So this is my invariance.
1207
01:14:17,390 --> 01:14:24,540
And the way I will go ahead is
to simply do what you do always
1208
01:14:24,540 --> 01:14:25,650
in these situations.
1209
01:14:25,650 --> 01:14:28,210
So we start with the base case.
1210
01:14:28,210 --> 01:14:33,220
And we can immediately see that
after 0 steps in the Euclidean
1211
01:14:33,220 --> 01:14:35,530
algorithm, I've done
absolutely nothing.
1212
01:14:35,530 --> 01:14:42,890
So obviously after
0 steps, x equals a.
1213
01:14:42,890 --> 01:14:44,200
y equals b.
1214
01:14:44,200 --> 01:14:48,060
So of course, they are linear
combinations of a and b.
1215
01:14:48,060 --> 01:14:51,440
And this equality
holds, as well.
1216
01:14:51,440 --> 01:14:54,840
So for the base case--
1217
01:14:58,130 --> 01:15:04,790
So after 0 steps, we immediately
know that p 0 is true.
1218
01:15:04,790 --> 01:15:08,690
Now for the inductive step, we
have to do a little bit more.
1219
01:15:17,780 --> 01:15:19,025
As usual, right?
1220
01:15:19,025 --> 01:15:24,410
We always assume p n.
1221
01:15:24,410 --> 01:15:27,320
And now we would like
to prove p n plus 1.
1222
01:15:27,320 --> 01:15:29,572
So how do we do this?
1223
01:15:29,572 --> 01:15:41,510
Well, we notice that
there exists a q such
1224
01:15:41,510 --> 01:15:49,730
that the remainder of y and x
is equal to y minus q, times x.
1225
01:15:49,730 --> 01:15:51,270
So we assume p n.
1226
01:15:51,270 --> 01:15:54,470
We have reached
some state, x, y.
1227
01:15:54,470 --> 01:15:57,910
We know that the remainder
of y, x equals y minus q,
1228
01:15:57,910 --> 01:16:02,830
times x, for some quotient q.
1229
01:16:02,830 --> 01:16:06,610
We know that y is a linear
combination of a and b,
1230
01:16:06,610 --> 01:16:08,610
and x is, as well.
1231
01:16:08,610 --> 01:16:12,530
So that means that this
one is actually also
1232
01:16:12,530 --> 01:16:18,860
a linear combination of a and b.
1233
01:16:18,860 --> 01:16:25,420
So now when we look at this
, algorithm we can see that--
1234
01:16:25,420 --> 01:16:28,320
that if you look at the
remainder that appears in here,
1235
01:16:28,320 --> 01:16:30,850
that's still a linear
combination of a and b.
1236
01:16:30,850 --> 01:16:35,420
So after a extra step, we
notice that what we have reached
1237
01:16:35,420 --> 01:16:38,170
are still in
combinations of a and b.
1238
01:16:38,170 --> 01:16:40,890
And of course, the
lemme has showed--
1239
01:16:40,890 --> 01:16:46,392
has shown us that what
we reach is still equal--
1240
01:16:46,392 --> 01:16:48,600
the greatest common divisor
is still equal to what we
1241
01:16:48,600 --> 01:16:51,320
originally started out with.
1242
01:16:51,320 --> 01:16:54,300
So this proves p of n plus 1.
1243
01:16:58,800 --> 01:17:03,380
So n-- let's finish
this particular proof.
1244
01:17:03,380 --> 01:17:07,140
So for the very last
step, if you now
1245
01:17:07,140 --> 01:17:14,470
look at this particular-- so
if you look at the very end,
1246
01:17:14,470 --> 01:17:17,950
we notice that in every
step the remainder
1247
01:17:17,950 --> 01:17:20,260
is getting smaller, and
smaller, and smaller.
1248
01:17:20,260 --> 01:17:22,250
Right?
1249
01:17:22,250 --> 01:17:24,700
And you can use a similar
kind of proof technique
1250
01:17:24,700 --> 01:17:28,510
to show that after a
finite number of steps,
1251
01:17:28,510 --> 01:17:33,190
we will reach a GDP of 0, y.
1252
01:17:33,190 --> 01:17:35,200
Something like this.
1253
01:17:35,200 --> 01:17:41,030
So in the very last step
of Euclid's algorithm
1254
01:17:41,030 --> 01:17:44,890
we achieve something
off this form.
1255
01:17:44,890 --> 01:17:49,220
We now use our
predicate over here,
1256
01:17:49,220 --> 01:17:53,890
and say that y is a linear
combination of a and b,
1257
01:17:53,890 --> 01:17:57,020
but the greatest
common divisor of 0, y
1258
01:17:57,020 --> 01:17:59,900
is also equal to the original
greatest common divisor
1259
01:17:59,900 --> 01:18:01,860
that we want to characterize.
1260
01:18:01,860 --> 01:18:05,760
So now we have
proved the theorem
1261
01:18:05,760 --> 01:18:08,110
that says that the greatest
common divisor of a and b
1262
01:18:08,110 --> 01:18:11,830
is actually a
linear combination.
1263
01:18:11,830 --> 01:18:13,840
So now we're going to
combine all those three
1264
01:18:13,840 --> 01:18:16,969
theorems in one go.
1265
01:18:16,969 --> 01:18:25,580
And that will show
us the final result,
1266
01:18:25,580 --> 01:18:35,230
which is that the theorem that
the greatest common divisor
1267
01:18:35,230 --> 01:18:42,010
of a and b is
actually the smallest
1268
01:18:42,010 --> 01:18:54,000
positive linear
combination of a and b.
1269
01:18:54,000 --> 01:18:56,840
So we're going to combine
all of these together.
1270
01:18:56,840 --> 01:19:01,970
We know that the greatest common
divisor divides any result.
1271
01:19:01,970 --> 01:19:05,160
The theorem up there says
that any linear combination
1272
01:19:05,160 --> 01:19:07,160
can be reached.
1273
01:19:07,160 --> 01:19:09,710
And also just
showed-- have shown
1274
01:19:09,710 --> 01:19:12,325
that the greatest common divisor
is a linear combination of a
1275
01:19:12,325 --> 01:19:13,890
and b.
1276
01:19:13,890 --> 01:19:17,450
So we can combine those
three to get this theorem.
1277
01:19:17,450 --> 01:19:19,120
So how do we do it?
1278
01:19:19,120 --> 01:19:25,620
Well, let's just look
0 all the way up to b.
1279
01:19:25,620 --> 01:19:29,770
Suppose these are all
the results that we
1280
01:19:29,770 --> 01:19:32,530
can reach in our problem.
1281
01:19:32,530 --> 01:19:38,160
We know that the greatest common
divisor divides all of those.
1282
01:19:38,160 --> 01:19:41,390
At the same time, it's
also linear combination
1283
01:19:41,390 --> 01:19:42,160
that's over here.
1284
01:19:42,160 --> 01:19:45,860
Since it's a linear combination,
it can also be reached, right?
1285
01:19:45,860 --> 01:19:47,840
By the theorem that we have.
1286
01:19:47,840 --> 01:19:51,099
So suppose that this is the
greatest common divisor.
1287
01:19:51,099 --> 01:19:53,140
But we also know that the
greatest common divisor
1288
01:19:53,140 --> 01:19:57,760
is dividing all of these points
here that can be reached.
1289
01:19:57,760 --> 01:20:01,420
So therefore, it must
be the smallest one.
1290
01:20:01,420 --> 01:20:04,050
And I will leave you
with some homework
1291
01:20:04,050 --> 01:20:06,210
to think about this
very carefully.
1292
01:20:06,210 --> 01:20:09,220
And you can show for
yourself that you can now
1293
01:20:09,220 --> 01:20:12,660
combine those three
arguments together, and see
1294
01:20:12,660 --> 01:20:15,630
that the greatest common divisor
must be the smallest positive
1295
01:20:15,630 --> 01:20:18,420
linear combination.
1296
01:20:18,420 --> 01:20:21,770
So, I will see next Thursday.