1 00:00:00,499 --> 00:00:02,330 PROFESSOR: Cardinality is the word 2 00:00:02,330 --> 00:00:05,860 that's used to refer to the size of infinite sets. 3 00:00:05,860 --> 00:00:09,720 And before we go further, let's take a quick look 4 00:00:09,720 --> 00:00:11,860 at why we're interested in infinite sets 5 00:00:11,860 --> 00:00:14,770 in a course that's Mathematics for Computer Scientists. 6 00:00:14,770 --> 00:00:17,990 Why does computer science care about infinite sets? 7 00:00:17,990 --> 00:00:21,020 Well, like every data structure that you'd 8 00:00:21,020 --> 00:00:23,470 examine in computer memory is finite 9 00:00:23,470 --> 00:00:27,350 and the integers individually are finite, 10 00:00:27,350 --> 00:00:29,700 you only calculate with finite things. 11 00:00:29,700 --> 00:00:33,210 But, the infinite abstraction happens right at the beginning. 12 00:00:33,210 --> 00:00:36,480 Although any given integer is finite, the set of all integers 13 00:00:36,480 --> 00:00:37,350 is infinite. 14 00:00:37,350 --> 00:00:40,680 And although any given matrix is finite, 15 00:00:40,680 --> 00:00:43,090 the set of all the matrices that might 16 00:00:43,090 --> 00:00:49,490 be represented in a computation are an infinite set. 17 00:00:49,490 --> 00:00:53,650 So, we take infinite sets for granted and reason 18 00:00:53,650 --> 00:00:56,030 about them all the time. 19 00:00:56,030 --> 00:01:00,420 The second, from a pedagogical point of view, 20 00:01:00,420 --> 00:01:02,720 introducing the concept of infinite sets 21 00:01:02,720 --> 00:01:04,650 and reasoning about them carefully 22 00:01:04,650 --> 00:01:07,680 forces you to go beyond your intuition 23 00:01:07,680 --> 00:01:10,380 and really follow the rules and reason 24 00:01:10,380 --> 00:01:12,080 in a careful mathematical way. 25 00:01:12,080 --> 00:01:15,570 Because although some properties that you're familiar with from 26 00:01:15,570 --> 00:01:18,660 finite sets carry over to infinite sets, others don't. 27 00:01:18,660 --> 00:01:20,160 And in order to know which is which, 28 00:01:20,160 --> 00:01:23,420 you have to be thinking carefully about the rules 29 00:01:23,420 --> 00:01:25,470 and properties that they have, as opposed 30 00:01:25,470 --> 00:01:29,710 to just going by intuition and familiar properties. 31 00:01:29,710 --> 00:01:35,200 And finally, the reasoning that goes 32 00:01:35,200 --> 00:01:38,460 into comparing the sizes of infinite sets, which 33 00:01:38,460 --> 00:01:43,670 is the topic of today's video, has profound implications 34 00:01:43,670 --> 00:01:45,420 in computer science because it leads 35 00:01:45,420 --> 00:01:50,100 to the insight about the logical limits of computation 36 00:01:50,100 --> 00:01:53,610 and examples of specific problems 37 00:01:53,610 --> 00:01:56,100 that computers can't solve, which we'll 38 00:01:56,100 --> 00:01:58,420 be taking up in a later video. 39 00:01:58,420 --> 00:02:03,000 But for now, let's go back to the topic of cardinality. 40 00:02:03,000 --> 00:02:09,690 So, there was this mathematician in the late 19th century 41 00:02:09,690 --> 00:02:14,860 named Cantor who was actually working on Fourier's series. 42 00:02:14,860 --> 00:02:17,360 And he discovered that the kind of series 43 00:02:17,360 --> 00:02:20,676 that he was working with diverged 44 00:02:20,676 --> 00:02:23,770 in infinitely many places, which sounds kind of bad. 45 00:02:23,770 --> 00:02:25,840 But he wanted to get across the idea 46 00:02:25,840 --> 00:02:29,480 that it didn't diverge in very many infinite places. 47 00:02:29,480 --> 00:02:31,890 And that led him to this idea of comparing 48 00:02:31,890 --> 00:02:34,140 the sizes of infinite sets. 49 00:02:34,140 --> 00:02:36,610 So, this is Cantor's idea. 50 00:02:36,610 --> 00:02:39,430 We know from the mapping dilemma that if you're 51 00:02:39,430 --> 00:02:44,020 looking at finite sets A and B, then the size of A 52 00:02:44,020 --> 00:02:45,900 is greater than or equal to the size of B 53 00:02:45,900 --> 00:02:48,700 if and only if A surj B, were surj 54 00:02:48,700 --> 00:02:52,780 is this technical relation which means there exists a surjection 55 00:02:52,780 --> 00:02:57,070 function from A to B that is a function with greater 56 00:02:57,070 --> 00:03:01,670 than or equal to one arrow into every element of B. 57 00:03:01,670 --> 00:03:03,200 And Cantor's idea was saying, well, 58 00:03:03,200 --> 00:03:04,860 it works fine for finite sets. 59 00:03:04,860 --> 00:03:10,620 Why don't we take this as the definition of what we mean by A 60 00:03:10,620 --> 00:03:12,920 is at least the size of B for infinite sets? 61 00:03:12,920 --> 00:03:15,000 So, we're going to think of A surj B 62 00:03:15,000 --> 00:03:21,370 now as saying, A is as big as B. And for finite sets, 63 00:03:21,370 --> 00:03:24,610 it's literally true that A surj B if and only if the size of A 64 00:03:24,610 --> 00:03:26,530 is greater or equal to the size of B. 65 00:03:26,530 --> 00:03:30,750 Now, let me take a moment to say that this notion of size 66 00:03:30,750 --> 00:03:34,130 or cardinality, when you're talking about infinite sets, 67 00:03:34,130 --> 00:03:35,630 it's kind of a no-no. 68 00:03:35,630 --> 00:03:40,696 There's an abstract concept of what cardinal numbers are, what 69 00:03:40,696 --> 00:03:41,820 these infinite numbers are. 70 00:03:41,820 --> 00:03:43,840 But the truth is, they're technical and not of very much 71 00:03:43,840 --> 00:03:44,600 use. 72 00:03:44,600 --> 00:03:48,640 So, we will never actually be talking about the cardinality 73 00:03:48,640 --> 00:03:50,100 or size of an infinite set. 74 00:03:50,100 --> 00:03:52,270 But what we will do is compare them. 75 00:03:52,270 --> 00:03:56,170 We're going to have a nice elementary theory of the idea 76 00:03:56,170 --> 00:03:59,250 that the cardinality of one set is 77 00:03:59,250 --> 00:04:02,250 greater than or equal to the cardinality of another set. 78 00:04:02,250 --> 00:04:06,780 And the basic definition is going to be based on surj. 79 00:04:06,780 --> 00:04:09,150 Similarly, bijection is even easier. 80 00:04:09,150 --> 00:04:12,455 A bij B means that there's a bijection from A to B. 81 00:04:12,455 --> 00:04:13,830 And we're going to interpret that 82 00:04:13,830 --> 00:04:15,990 as saying that A and B are the same size. 83 00:04:15,990 --> 00:04:18,579 That is, for finite sets, it literally means A 84 00:04:18,579 --> 00:04:21,180 and B have the same number of elements. 85 00:04:21,180 --> 00:04:24,800 We're going to adopt the notion of a bijective relation 86 00:04:24,800 --> 00:04:28,664 for infinite sets as meaning, I don't know what their size is, 87 00:04:28,664 --> 00:04:30,330 but I know it's the same because there's 88 00:04:30,330 --> 00:04:31,550 a bijection between them. 89 00:04:31,550 --> 00:04:34,500 There's a perfect one to one correspondence between As 90 00:04:34,500 --> 00:04:37,560 and Bs. 91 00:04:37,560 --> 00:04:41,840 Let's look at an example of where bijection comes up. 92 00:04:41,840 --> 00:04:45,140 The power set of N-- if N is the non-negative integers-- 93 00:04:45,140 --> 00:04:47,080 the power set of N is all the subsets 94 00:04:47,080 --> 00:04:48,460 of non-negative integers. 95 00:04:48,460 --> 00:04:51,680 And let me just remark that there is an obvious bijection 96 00:04:51,680 --> 00:04:55,904 between the subsets of integers and the infinite bit-strings, 97 00:04:55,904 --> 00:04:57,570 the infinite strings of zeroes and ones. 98 00:04:57,570 --> 00:05:01,600 So, N is the set of non-negative integers, 0, 1, 2. 99 00:05:01,600 --> 00:05:05,400 If you take any subset of N, here's one with has 0, 100 00:05:05,400 --> 00:05:08,340 missing 1, has 2 and 3, missing 4, 5, has 6, 101 00:05:08,340 --> 00:05:13,300 and so on, then what I can do is represent such a subset, 102 00:05:13,300 --> 00:05:16,580 possibly an infinite subset now, by an infinite sequence 103 00:05:16,580 --> 00:05:17,610 of ones and zeros. 104 00:05:17,610 --> 00:05:21,120 Put in ones in the position where elements in the subset 105 00:05:21,120 --> 00:05:25,120 occur and zeroes in positions where elements don't occur. 106 00:05:25,120 --> 00:05:27,870 This was exactly the same bijection 107 00:05:27,870 --> 00:05:35,920 that we had found between the non-negative-- the bit-strings 108 00:05:35,920 --> 00:05:39,450 and the finite subsets of the non-negative integers. 109 00:05:39,450 --> 00:05:42,672 But now, we're just extending it to arbitrary subsets 110 00:05:42,672 --> 00:05:43,880 of the non-negative integers. 111 00:05:43,880 --> 00:05:46,770 So, this defines a bijection between any subset 112 00:05:46,770 --> 00:05:49,470 of integers corresponds to an infinite bit-strings. 113 00:05:49,470 --> 00:05:51,630 And conversely, from any infinite bit-string, 114 00:05:51,630 --> 00:05:54,770 you can reconstruct what subset it refers to. 115 00:05:54,770 --> 00:05:57,900 So, we use this notation [? 0,1 ?] to the omega, 116 00:05:57,900 --> 00:06:01,265 meaning the infinite bit-strings that are infinite to the right. 117 00:06:01,265 --> 00:06:02,880 They have a beginning. 118 00:06:02,880 --> 00:06:05,610 In comparison to [? 0,1 ?] superscript star, 119 00:06:05,610 --> 00:06:11,110 which refers to the finite sets of bit-strings. 120 00:06:11,110 --> 00:06:15,840 So now, let's examine the standard size properties 121 00:06:15,840 --> 00:06:19,750 that you would expect if these relationships of surj and bij 122 00:06:19,750 --> 00:06:23,050 behaved like relationships between sizes. 123 00:06:23,050 --> 00:06:26,530 So, one basic property that finite sizes have 124 00:06:26,530 --> 00:06:30,020 is that if A is equal to B and B is equal to C in size, 125 00:06:30,020 --> 00:06:32,640 then the size of A and the size of C are the same. 126 00:06:32,640 --> 00:06:34,690 That's certainly true for finite sets. 127 00:06:34,690 --> 00:06:38,130 Does it hold for infinite sets, where now equality is 128 00:06:38,130 --> 00:06:39,790 going to be replaced by bij? 129 00:06:39,790 --> 00:06:41,390 Well, we have to check it. 130 00:06:41,390 --> 00:06:47,700 Is it true that if A bij B and B bij C implies A bij C, well, 131 00:06:47,700 --> 00:06:48,910 how do you prove that? 132 00:06:48,910 --> 00:06:51,720 Well, it's true, and here's how. 133 00:06:51,720 --> 00:06:55,030 By definition, since A bij B, that 134 00:06:55,030 --> 00:07:00,060 means that you have a bijection g from A to B. 135 00:07:00,060 --> 00:07:05,600 And since B bij C, you have a bijection f from B to C. Now, 136 00:07:05,600 --> 00:07:07,580 I need from these two bijections that I'm 137 00:07:07,580 --> 00:07:11,780 given, I need to find a bijection between A and C. 138 00:07:11,780 --> 00:07:12,550 Well, that's easy. 139 00:07:12,550 --> 00:07:15,950 What you do is you use g to go from A to B, 140 00:07:15,950 --> 00:07:19,950 and then you use f to go from B to C. And you compose them, 141 00:07:19,950 --> 00:07:23,550 and that gives you the needed bijection from A to C. So, 142 00:07:23,550 --> 00:07:27,590 define h to be the composition of f and g. 143 00:07:27,590 --> 00:07:31,520 And it's easy to check that if g and f are bijections, then 144 00:07:31,520 --> 00:07:33,570 their composition is a bijection. 145 00:07:33,570 --> 00:07:36,670 So, that's how I find the needed bijection from A to C. So, 146 00:07:36,670 --> 00:07:38,820 this property works out just fine. 147 00:07:38,820 --> 00:07:42,730 The similar property applies to at least as big as, 148 00:07:42,730 --> 00:07:43,820 greater than or equal to. 149 00:07:43,820 --> 00:07:46,020 For finite sets, if A is greater than or equal to B 150 00:07:46,020 --> 00:07:47,950 and B is greater than or equal to C in size, 151 00:07:47,950 --> 00:07:49,590 then A is greater than or equal to C. 152 00:07:49,590 --> 00:07:53,070 And actually, the same argument that worked for bij 153 00:07:53,070 --> 00:07:56,460 works for surj, because the composition 154 00:07:56,460 --> 00:07:59,050 of surjective functions is a surjective function. 155 00:07:59,050 --> 00:08:03,660 So, if A surj B and B surj C implies A surj C. 156 00:08:03,660 --> 00:08:06,770 Now again remember, although we're thinking of surj 157 00:08:06,770 --> 00:08:09,910 as meaning greater than or equal to in size, 158 00:08:09,910 --> 00:08:12,550 you cannot take these size properties for granted. 159 00:08:12,550 --> 00:08:13,760 They have to be proved. 160 00:08:13,760 --> 00:08:16,130 Surj has a technical definition having 161 00:08:16,130 --> 00:08:18,980 to do with surjective functions, functions with greater 162 00:08:18,980 --> 00:08:20,600 than or equal to one arrow in. 163 00:08:20,600 --> 00:08:24,790 That is not the same as talking about equality 164 00:08:24,790 --> 00:08:27,470 of some kind of sizes. 165 00:08:27,470 --> 00:08:30,680 Well, let's look at an example where the size properties hold 166 00:08:30,680 --> 00:08:32,039 but they're less obvious. 167 00:08:32,039 --> 00:08:36,020 Because here's another familiar size property. 168 00:08:36,020 --> 00:08:39,304 If A and B are each of size greater than 169 00:08:39,304 --> 00:08:41,679 or equal to the other one, then they're the same size. 170 00:08:41,679 --> 00:08:44,350 So, if the size of A is greater than or equal to the size of B 171 00:08:44,350 --> 00:08:46,910 and the size of B is greater than or equal to the size of A, 172 00:08:46,910 --> 00:08:49,097 then A and B are the same size. 173 00:08:49,097 --> 00:08:50,930 Now, this is certainly true for finite sets. 174 00:08:50,930 --> 00:08:54,760 It's kind of, you don't even think about that fact. 175 00:08:54,760 --> 00:08:57,800 And it holds for infinite sets. 176 00:08:57,800 --> 00:08:59,730 But, it's not so obvious. 177 00:08:59,730 --> 00:09:03,110 So, what we're saying is that if I have a surjective function 178 00:09:03,110 --> 00:09:07,310 from A to B and I have another surjective function from B 179 00:09:07,310 --> 00:09:11,810 to A, then there's a bijection between A and B. 180 00:09:11,810 --> 00:09:15,200 And the problem here is that this surjection from A to B 181 00:09:15,200 --> 00:09:16,880 might not be a bijection. 182 00:09:16,880 --> 00:09:20,640 And this surjection from B to A might also not be a bijection. 183 00:09:20,640 --> 00:09:22,710 So, where's the bijection going to come from? 184 00:09:22,710 --> 00:09:24,170 I have to build it. 185 00:09:24,170 --> 00:09:27,247 And so, this is not an obvious property, it's true. 186 00:09:27,247 --> 00:09:29,080 It's called the Schroeder-Bernstein Theorem. 187 00:09:29,080 --> 00:09:33,460 And the trick, basically, is you take the bijection from A to B 188 00:09:33,460 --> 00:09:36,160 and the bijection from B to A and you take parts of one 189 00:09:36,160 --> 00:09:37,790 and combine it with parts of the other. 190 00:09:37,790 --> 00:09:41,500 And in a slightly ingenious way that 191 00:09:41,500 --> 00:09:44,680 actually is contained in a problem in the text, 192 00:09:44,680 --> 00:09:47,320 you can find the bijection from A to B, 193 00:09:47,320 --> 00:09:49,300 but it does take a little bit of ingenuity. 194 00:09:49,300 --> 00:09:54,320 So this is a size property that works for surj and bij, 195 00:09:54,320 --> 00:09:58,460 but you can't say it's obvious. 196 00:09:58,460 --> 00:10:00,540 Well, let's look at an unfamiliar size property. 197 00:10:00,540 --> 00:10:03,000 Something that's not true of finite sets 198 00:10:03,000 --> 00:10:05,990 where we have to start being careful and not just hand wave 199 00:10:05,990 --> 00:10:07,800 and use our intuition about finite sets. 200 00:10:07,800 --> 00:10:13,170 Namely, for infinite sizes, size plus 1 is equal to size. 201 00:10:13,170 --> 00:10:15,280 Now, what exactly does that mean? 202 00:10:15,280 --> 00:10:17,286 Well, let's just illustrate it with an example. 203 00:10:17,286 --> 00:10:19,160 In fact, in some ways, you can the definition 204 00:10:19,160 --> 00:10:23,140 of an infinite set is that its size plus 1 205 00:10:23,140 --> 00:10:25,180 is equal to its size. 206 00:10:25,180 --> 00:10:26,800 Let's look at a simple example. 207 00:10:26,800 --> 00:10:29,790 So, on the bottom, I have the non-negative integers. 208 00:10:29,790 --> 00:10:31,670 And on the top, I have the positive integers. 209 00:10:31,670 --> 00:10:33,850 So, I can get from the positive integers 210 00:10:33,850 --> 00:10:36,400 to the non-negative integers just by throwing in zero. 211 00:10:36,400 --> 00:10:38,320 So, that's where the plus one comes from. 212 00:10:38,320 --> 00:10:39,960 Here's a nice infinite set. 213 00:10:39,960 --> 00:10:43,560 I add another element to it, and I get another infinite set, 214 00:10:43,560 --> 00:10:46,146 but they are the same size. 215 00:10:46,146 --> 00:10:47,770 I have to show a bijection between them 216 00:10:47,770 --> 00:10:48,740 to show they're the set size. 217 00:10:48,740 --> 00:10:50,281 Well, you know what the bijection is. 218 00:10:50,281 --> 00:10:53,990 Map 0 to 1, 1 to 2, 2 to 3. 219 00:10:53,990 --> 00:10:57,170 This is a bijection which you know as the add one function. 220 00:10:57,170 --> 00:11:00,670 The add one function maps the non-negative integers 221 00:11:00,670 --> 00:11:04,030 to the positive integers, and it's a perfect bijection. 222 00:11:04,030 --> 00:11:07,840 Therefore, adding one element to the non-negative integers-- 223 00:11:07,840 --> 00:11:10,670 to the positive integers does not get me a larger set, 224 00:11:10,670 --> 00:11:12,780 it gets me another set of the same size. 225 00:11:12,780 --> 00:11:15,560 And this argument actually generalizes 226 00:11:15,560 --> 00:11:17,370 to any infinite set. 227 00:11:17,370 --> 00:11:19,340 If you throw in one extra element, 228 00:11:19,340 --> 00:11:22,500 you could still find a bijection between the original set 229 00:11:22,500 --> 00:11:25,870 and the set with one extra element. 230 00:11:25,870 --> 00:11:29,110 So, N is the same size as the positive integers. 231 00:11:29,110 --> 00:11:32,530 Well, in fact, let's look at this one. 232 00:11:32,530 --> 00:11:36,340 I can enumerate on the top all the integers, 233 00:11:36,340 --> 00:11:37,730 both positive and negative. 234 00:11:37,730 --> 00:11:40,590 0, 1, minus 1, 2, minus 2, and so on. 235 00:11:40,590 --> 00:11:43,730 And that gives me the set consisting of all the integers. 236 00:11:43,730 --> 00:11:45,750 And over here, I can have 0, 1, 2, 237 00:11:45,750 --> 00:11:47,400 just the non-negative integers. 238 00:11:47,400 --> 00:11:49,770 And you can see the orderly way in which I've 239 00:11:49,770 --> 00:11:53,150 listed the integers at the top. 240 00:11:53,150 --> 00:11:54,980 That implicitly defines a bijection. 241 00:11:54,980 --> 00:11:59,840 I'm going to map zero to the zeroeth element of the sequence 242 00:11:59,840 --> 00:12:00,340 above. 243 00:12:00,340 --> 00:12:03,880 1 to 1, 2 to minus 1, 3 to 2, 4 to minus 2. 244 00:12:03,880 --> 00:12:07,410 And in this way, I have actually defined 245 00:12:07,410 --> 00:12:11,370 a bijection between the non-negative integers and all 246 00:12:11,370 --> 00:12:12,120 the integers. 247 00:12:12,120 --> 00:12:15,852 In other words, you take half of the integers, namely 248 00:12:15,852 --> 00:12:17,560 the non-negative integers, and it's still 249 00:12:17,560 --> 00:12:19,390 the same size as all of them. 250 00:12:19,390 --> 00:12:23,080 There's a bijection between N and Z. 251 00:12:23,080 --> 00:12:26,000 Now, you could write a formula, actually, 252 00:12:26,000 --> 00:12:29,580 if you were trying to figure out what does the number N go to? 253 00:12:29,580 --> 00:12:32,130 What positive or negative integer? 254 00:12:32,130 --> 00:12:34,770 There's some not very hard formula involving 255 00:12:34,770 --> 00:12:36,999 dividing N by two and rounding. 256 00:12:36,999 --> 00:12:38,040 But, that doesn't matter. 257 00:12:38,040 --> 00:12:41,100 Once I've figured out some sensible way 258 00:12:41,100 --> 00:12:44,760 to list all the elements of the integers in a row, 259 00:12:44,760 --> 00:12:47,480 then I can wind them up against the non-negative integers. 260 00:12:47,480 --> 00:12:51,310 And that listing, in effect, defines the mapping 261 00:12:51,310 --> 00:12:55,370 in a perfectly clear way without necessarily having a formula.