1 00:00:00,499 --> 00:00:02,830 The following content is provided under a Creative 2 00:00:02,830 --> 00:00:04,350 Commons license. 3 00:00:04,350 --> 00:00:06,680 Your support will help MIT OpenCourseWare 4 00:00:06,680 --> 00:00:11,050 continue to offer high quality educational resources for free. 5 00:00:11,050 --> 00:00:13,670 To make a donation or view additional materials 6 00:00:13,670 --> 00:00:17,547 from hundreds of MIT courses, visit MIT OpenCourseWare 7 00:00:17,547 --> 00:00:18,172 at ocw.mit.edu. 8 00:00:24,730 --> 00:00:28,910 PROFESSOR: We're going to talk about inclusion-exclusion which 9 00:00:28,910 --> 00:00:31,800 is a generalization of what we did 10 00:00:31,800 --> 00:00:37,250 at the end of last lecture, which was about the sum rule. 11 00:00:41,550 --> 00:00:43,890 Everybody's still talking I hear. 12 00:00:43,890 --> 00:00:48,290 Anyway, the inclusion-exclusion principle is very important. 13 00:00:48,290 --> 00:00:54,680 And the best way to explain this is by using Venn diagrams. 14 00:00:54,680 --> 00:00:56,540 So let's do this. 15 00:00:56,540 --> 00:00:57,890 So what did we do before? 16 00:00:57,890 --> 00:01:00,620 When we worked on a sum rule, we saw 17 00:01:00,620 --> 00:01:06,940 that if we count the union of a whole collection of sets that 18 00:01:06,940 --> 00:01:10,170 are all disjoints, then we can just some all the cardinalities 19 00:01:10,170 --> 00:01:12,290 of each of the members. 20 00:01:12,290 --> 00:01:17,110 So in the case where we have intersections-- so sets are not 21 00:01:17,110 --> 00:01:20,440 disjoint-- well, if you just count all the cardinalities-- 22 00:01:20,440 --> 00:01:22,500 all of the sizes of the sets together-- 23 00:01:22,500 --> 00:01:25,190 you'll start to do some double counting. 24 00:01:25,190 --> 00:01:27,600 So with the inclusion-exclusion principle, 25 00:01:27,600 --> 00:01:33,130 we can actually exactly compute the cardinality 26 00:01:33,130 --> 00:01:34,300 of the union of sets. 27 00:01:37,910 --> 00:01:40,020 And you will see that this principle can 28 00:01:40,020 --> 00:01:45,010 be used in plenty of examples, including some of them that 29 00:01:45,010 --> 00:01:46,050 are on the problem set. 30 00:01:49,740 --> 00:01:51,740 So how does it work? 31 00:01:51,740 --> 00:01:54,950 So let's set take an example where we just have two sets 32 00:01:54,950 --> 00:01:57,050 and they have an intersection. 33 00:01:57,050 --> 00:02:01,550 So say this is one set which we call M, and say here 34 00:02:01,550 --> 00:02:07,450 is another set which we call E. Well, they 35 00:02:07,450 --> 00:02:10,530 have an intersection-- there's some overlap over here. 36 00:02:10,530 --> 00:02:12,650 So if you would like to write out 37 00:02:12,650 --> 00:02:15,720 the different areas over here, what 38 00:02:15,720 --> 00:02:19,870 they were equal to, well, this is everything that is in M, 39 00:02:19,870 --> 00:02:29,610 but we exclude what is in E. So you write it M backslash E. 40 00:02:29,610 --> 00:02:32,940 This part over here is the intersection 41 00:02:32,940 --> 00:02:35,910 of-- this maybe is a little bit too small-- so this is 42 00:02:35,910 --> 00:02:37,335 the intersection of both sets. 43 00:02:42,320 --> 00:02:44,710 And over here we have everything that's 44 00:02:44,710 --> 00:02:49,330 in E but excluding what is in M. So if you just write out 45 00:02:49,330 --> 00:02:50,960 the cardinalities of the different sets 46 00:02:50,960 --> 00:02:52,543 that we're interested in-- so we would 47 00:02:52,543 --> 00:02:56,680 like to compute the cardinality of the union of M and E. 48 00:02:56,680 --> 00:03:01,490 So let's have a look how the cardinality of M 49 00:03:01,490 --> 00:03:02,590 itself can be computed. 50 00:03:02,590 --> 00:03:08,890 Well, if you use the sum rule which says that we can simply 51 00:03:08,890 --> 00:03:14,120 add the two disjoint sets that make up set M-- 52 00:03:14,120 --> 00:03:16,560 we can count each of those cardinality-- 53 00:03:16,560 --> 00:03:21,510 so we have M consisting of this part, which is M excluding E, 54 00:03:21,510 --> 00:03:25,550 plus the part that is right here which is the intersection. 55 00:03:25,550 --> 00:03:29,900 So we use the sum rule and conclude 56 00:03:29,900 --> 00:03:36,670 that we have the sum of everything that's 57 00:03:36,670 --> 00:03:39,980 in M excluding E plus the cardinality 58 00:03:39,980 --> 00:03:42,020 of the intersection. 59 00:03:42,020 --> 00:03:45,560 Now, for set E we can do something completely similar. 60 00:03:45,560 --> 00:03:47,920 So we will have everything that's 61 00:03:47,920 --> 00:03:52,190 in E excluding what is in M. And then 62 00:03:52,190 --> 00:03:55,540 we still have the intersection. 63 00:03:55,540 --> 00:04:01,810 Now we are interested in the union of the sent M and E. 64 00:04:01,810 --> 00:04:05,440 And now we need to add this one this one and this 65 00:04:05,440 --> 00:04:06,220 once together. 66 00:04:06,220 --> 00:04:07,280 So what do we see? 67 00:04:07,280 --> 00:04:09,970 We see that this is actually equal to everything 68 00:04:09,970 --> 00:04:13,630 that is in M but not in E, everything that 69 00:04:13,630 --> 00:04:17,294 is in their intersection, plus everything 70 00:04:17,294 --> 00:04:20,810 that's in E but not in M. 71 00:04:20,810 --> 00:04:25,110 So we have these equations that we can directly derived 72 00:04:25,110 --> 00:04:27,150 from the sum rule. 73 00:04:27,150 --> 00:04:31,900 And, well, now we can see here that if we 74 00:04:31,900 --> 00:04:36,330 are going to simply add-- that's what the sum rule would say-- 75 00:04:36,330 --> 00:04:40,340 simply add the cardinality of M and of E, 76 00:04:40,340 --> 00:04:42,520 well, if we add those two together, 77 00:04:42,520 --> 00:04:45,240 we will count the intersection double. 78 00:04:45,240 --> 00:04:48,680 So we'll need to cancel that because it's only counted once 79 00:04:48,680 --> 00:04:50,780 in the union. 80 00:04:50,780 --> 00:04:56,400 So if we combine those three over here-- those three 81 00:04:56,400 --> 00:05:06,850 equations-- then we can conclude that this counts the set 82 00:05:06,850 --> 00:05:10,320 M intersecting with E twice. 83 00:05:10,320 --> 00:05:14,770 So we have that the union is really 84 00:05:14,770 --> 00:05:18,980 equal to the cardinality of M plus that 85 00:05:18,980 --> 00:05:23,280 of E minus their intersection. 86 00:05:23,280 --> 00:05:25,650 Now we can generalize this. 87 00:05:25,650 --> 00:05:27,460 And we will give one more example 88 00:05:27,460 --> 00:05:34,240 where we have three sets and it will give the general equation. 89 00:05:34,240 --> 00:05:37,780 So suppose you have three sets now. 90 00:05:37,780 --> 00:05:42,840 Like one, another one, and another one over here. 91 00:05:42,840 --> 00:05:48,790 So we have M, E, and, say, the set S. Well, 92 00:05:48,790 --> 00:05:52,880 let's have a look how many times these different areas-- 93 00:05:52,880 --> 00:05:56,380 they're all disjoint-- how many times they 94 00:05:56,380 --> 00:06:04,100 are counted when me add the three cardinalities together. 95 00:06:04,100 --> 00:06:08,760 So we have M plus the cardinality of E 96 00:06:08,760 --> 00:06:11,600 plus the cardinality of S. Well, if you 97 00:06:11,600 --> 00:06:14,430 do that then we count this area exactly 98 00:06:14,430 --> 00:06:19,020 once because it's in M, this area we count once because it's 99 00:06:19,020 --> 00:06:23,360 in M and another time because it's in E-- so it's twice-- 100 00:06:23,360 --> 00:06:25,820 this particular area is only counted once 101 00:06:25,820 --> 00:06:28,080 in this sum over here. 102 00:06:28,080 --> 00:06:31,160 And similarly, we have two times over here, two times here, 103 00:06:31,160 --> 00:06:32,980 and one times over here. 104 00:06:32,980 --> 00:06:36,840 And this intersection of all of the three, 105 00:06:36,840 --> 00:06:39,580 well, it's counted when we count elements in M 106 00:06:39,580 --> 00:06:41,445 but also when we count elements in E 107 00:06:41,445 --> 00:06:43,870 and also when we count elements in S. 108 00:06:43,870 --> 00:06:47,700 So this is counted three times. 109 00:06:47,700 --> 00:06:50,260 So let's have a look. 110 00:06:50,260 --> 00:06:53,460 It seems like we want to do exactly the same as what 111 00:06:53,460 --> 00:06:55,390 we did before. 112 00:06:55,390 --> 00:07:01,532 We like to subtract an intersection of M and S. 113 00:07:01,532 --> 00:07:02,240 That's this part. 114 00:07:02,240 --> 00:07:05,440 It cancels the double counting in this area, right? 115 00:07:05,440 --> 00:07:08,490 We can subtract this intersection such that this 116 00:07:08,490 --> 00:07:10,520 part is cancelled. 117 00:07:10,520 --> 00:07:12,340 The double counting here is canceled. 118 00:07:12,340 --> 00:07:14,290 And similarly, we want to subtract 119 00:07:14,290 --> 00:07:17,750 the intersection between E and S which would 120 00:07:17,750 --> 00:07:19,300 eliminate this double counting. 121 00:07:19,300 --> 00:07:22,090 But now we can see that we start to subtract 122 00:07:22,090 --> 00:07:29,030 too much because this central area here will be-- well, 123 00:07:29,030 --> 00:07:31,000 it's part of each of those intersections 124 00:07:31,000 --> 00:07:35,130 so it's actually eliminated. 125 00:07:35,130 --> 00:07:38,310 All of it is subtracted. 126 00:07:38,310 --> 00:07:41,490 So let's create the same diagram. 127 00:07:41,490 --> 00:07:47,370 But now when we count the sum of all those intersections-- 128 00:07:47,370 --> 00:07:52,840 so we have the intersection of M intersect 129 00:07:52,840 --> 00:07:58,450 with E, the intersection of M with S, 130 00:07:58,450 --> 00:08:01,480 and we also want to figure out how many times elements 131 00:08:01,480 --> 00:08:09,570 are counted in the set E intersects with S. 132 00:08:09,570 --> 00:08:10,490 So let's have a look. 133 00:08:10,490 --> 00:08:13,830 Well, this area here is counted zero times. 134 00:08:13,830 --> 00:08:17,330 It's not part of any of these intersections 135 00:08:17,330 --> 00:08:21,950 because it-- this part is only in M and not in S or E. 136 00:08:21,950 --> 00:08:25,020 So this is counted zero times. 137 00:08:25,020 --> 00:08:27,530 And here we have the same. 138 00:08:27,530 --> 00:08:29,530 Well, this part over here is exactly once 139 00:08:29,530 --> 00:08:31,980 in this intersection between those two sets. 140 00:08:31,980 --> 00:08:35,710 It's not in this one so this is counted once. 141 00:08:35,710 --> 00:08:39,030 So we have by symmetry that for all the others. 142 00:08:39,030 --> 00:08:42,809 This area, however, is in both this intersection as well as 143 00:08:42,809 --> 00:08:44,200 this one and also this one. 144 00:08:44,200 --> 00:08:47,270 So it's counted three times. 145 00:08:47,270 --> 00:08:51,540 So now we can easily start to combine all these together. 146 00:08:51,540 --> 00:08:58,490 And you can see, if we take this sum and we subtract this, 147 00:08:58,490 --> 00:09:00,020 then the middle area is cancelled. 148 00:09:00,020 --> 00:09:03,180 So we have to still add the intersection of the three sets. 149 00:09:03,180 --> 00:09:07,030 The intersection of M, E and S together. 150 00:09:07,030 --> 00:09:11,060 So in a formula that would look like this. 151 00:09:11,060 --> 00:09:15,040 So we are interested in the union. 152 00:09:17,930 --> 00:09:20,540 And this can now be written as, well, 153 00:09:20,540 --> 00:09:26,000 the sum of the cardinalities of the individual sets. 154 00:09:26,000 --> 00:09:32,830 And we subtract the intersections 155 00:09:32,830 --> 00:09:34,160 that we have up there. 156 00:09:34,160 --> 00:09:38,743 So M intersect E minus M intersect 157 00:09:38,743 --> 00:09:44,780 with S and minus E intersect with S. 158 00:09:44,780 --> 00:09:48,256 Now we have eliminated-- if you look at this Venn diagram 159 00:09:48,256 --> 00:09:49,755 over here-- this diagram over here-- 160 00:09:49,755 --> 00:09:52,950 we've eliminated everything that's in the middle area. 161 00:09:52,950 --> 00:09:56,130 So we still need to add intersection-- everything that 162 00:09:56,130 --> 00:10:02,220 is counted in the intersection of M, E, as well as S. 163 00:10:02,220 --> 00:10:03,940 So we have this equation. 164 00:10:03,940 --> 00:10:07,390 And now you can see why we call this the inclusion-exclusion 165 00:10:07,390 --> 00:10:08,700 principle. 166 00:10:08,700 --> 00:10:15,510 Here we include all the elements in M, E and S. 167 00:10:15,510 --> 00:10:18,800 Now we have to exclude what we counted too much. 168 00:10:18,800 --> 00:10:22,310 So we have exclusion over here. 169 00:10:22,310 --> 00:10:24,830 And now we, again, have to include some stuff 170 00:10:24,830 --> 00:10:29,080 because we excluded too much. 171 00:10:29,080 --> 00:10:31,430 And then we keep on going like this. 172 00:10:31,430 --> 00:10:39,420 So, in general, we get the following theorem 173 00:10:39,420 --> 00:10:43,640 that says that, if you look at the cardinalities-- 174 00:10:43,640 --> 00:10:48,770 of the cardinality of the union of a whole bunch of sets-- 175 00:10:48,770 --> 00:10:54,490 say we have n sets-- then this is actually equal to-- well, 176 00:10:54,490 --> 00:10:59,900 we first include the sums of all the individual cardinalities. 177 00:10:59,900 --> 00:11:08,960 Which is from I equals 1 to n cardinality of Ai minus-- now 178 00:11:08,960 --> 00:11:11,270 we have to, again, we have to eliminate 179 00:11:11,270 --> 00:11:16,820 all the double counting-- so we look at every pair of sets 180 00:11:16,820 --> 00:11:19,580 indexed by i1 and i2. 181 00:11:19,580 --> 00:11:22,690 And we look at their intersection 182 00:11:22,690 --> 00:11:26,320 and we take that out using this minus sign. 183 00:11:26,320 --> 00:11:27,430 We exclude this. 184 00:11:30,240 --> 00:11:31,350 And we continue like this. 185 00:11:31,350 --> 00:11:35,250 So we add now-- because we have excluded too much, 186 00:11:35,250 --> 00:11:39,850 we have to include some more-- we 187 00:11:39,850 --> 00:11:45,860 look at all triples of sets indexed by i1, i2-- oops-- 188 00:11:45,860 --> 00:11:46,650 and i3. 189 00:11:49,820 --> 00:11:54,110 And now we look at the intersection of those sets. 190 00:11:58,400 --> 00:12:02,030 And we continue like this all the way 191 00:12:02,030 --> 00:12:09,170 until we look at the very last intersection that you can have, 192 00:12:09,170 --> 00:12:12,830 which is intersection of all the sets. 193 00:12:12,830 --> 00:12:17,790 And it depends on whether n is even or add whether we 194 00:12:17,790 --> 00:12:20,040 have to include or exclude it. 195 00:12:20,040 --> 00:12:24,520 So we have a minus 1 to the power n plus 1. 196 00:12:24,520 --> 00:12:29,950 And then we have the intersection of all of these. 197 00:12:29,950 --> 00:12:34,900 Now, we can write this out in a more elegant formula 198 00:12:34,900 --> 00:12:40,690 where we just put all this what I wrote here in a sum. 199 00:12:40,690 --> 00:12:42,010 And then it looks like this. 200 00:12:42,010 --> 00:12:47,310 It's the sum over k equals 1 to n minus 1 201 00:12:47,310 --> 00:12:49,460 to the power k plus 1. 202 00:12:49,460 --> 00:12:51,540 So depends whether k is even or odd 203 00:12:51,540 --> 00:12:55,570 whether we do an inclusion or an exclusion in this sum. 204 00:12:55,570 --> 00:13:03,870 And we look at all the subsets that our subsets of the index 205 00:13:03,870 --> 00:13:11,220 set 1 up to n such that the cardinality of the set S 206 00:13:11,220 --> 00:13:13,440 is equal to k. 207 00:13:13,440 --> 00:13:18,430 And now we need to look at the cardinality of all-- 208 00:13:18,430 --> 00:13:23,880 of the intersection of all the sets that are indexed by S. 209 00:13:23,880 --> 00:13:31,265 So that's-- so I run-- I put i-- so do the intersection of all i 210 00:13:31,265 --> 00:13:34,630 in S of the sets Ai. 211 00:13:34,630 --> 00:13:39,430 So this general formula is the inclusion-exclusion principle. 212 00:13:39,430 --> 00:13:40,930 And this is the way how we can think 213 00:13:40,930 --> 00:13:42,980 about it how to derive it. 214 00:13:42,980 --> 00:13:45,140 Of course, this is not a proof. 215 00:13:45,140 --> 00:13:48,250 But you could do this yourself by using induction. 216 00:13:48,250 --> 00:13:50,700 And you can use induction on n. 217 00:13:50,700 --> 00:13:55,250 So that's a pretty straightforward exercise. 218 00:13:55,250 --> 00:13:55,750 OK. 219 00:13:55,750 --> 00:13:57,385 So let's give an example. 220 00:14:00,180 --> 00:14:04,630 Let's do that over here. 221 00:14:04,630 --> 00:14:07,480 You will have a problem that's similar on the problem set. 222 00:14:10,290 --> 00:14:11,540 And it's goes like this. 223 00:14:16,190 --> 00:14:20,540 You would like to know how many permutations are there 224 00:14:20,540 --> 00:14:21,740 with a special property. 225 00:14:21,740 --> 00:14:31,930 So how many permutations do I have of the set 0, 226 00:14:31,930 --> 00:14:35,420 1 all the way up to 9. 227 00:14:35,420 --> 00:14:38,120 So all the digits. 228 00:14:38,120 --> 00:14:47,140 And that have consecutive-- so I put this in brackets just 229 00:14:47,140 --> 00:14:51,945 to clarify-- so consecutive either a 4 and a 2 right next 230 00:14:51,945 --> 00:14:52,570 to one another. 231 00:14:52,570 --> 00:14:56,940 So remember, a permutation is a sequence that has each 232 00:14:56,940 --> 00:14:59,900 of those digits exactly once. 233 00:14:59,900 --> 00:15:03,420 And I like to count those permutations that 234 00:15:03,420 --> 00:15:06,980 have a 4 and a 2 next to one another in this way. 235 00:15:06,980 --> 00:15:08,270 So we have 4, 2. 236 00:15:08,270 --> 00:15:16,800 Or the permutation may have a 0, 4 or a 6, 0. 237 00:15:16,800 --> 00:15:19,725 So I'm very curious, how many permutations do I have? 238 00:15:19,725 --> 00:15:21,810 And I'm going to use this principle that I just 239 00:15:21,810 --> 00:15:22,310 described. 240 00:15:24,730 --> 00:15:29,970 So how do we need to go ahead with this? 241 00:15:29,970 --> 00:15:33,960 Well, this-- so I'm interested in the permutations that have 242 00:15:33,960 --> 00:15:36,110 a 4 and 2 next to one another. 243 00:15:36,110 --> 00:15:38,770 So that could be my first set, say, M. 244 00:15:38,770 --> 00:15:40,611 And then I have a set that I want 245 00:15:40,611 --> 00:15:42,860 to count that has the 0 and the 4 next to one another. 246 00:15:42,860 --> 00:15:44,920 That could be my E. And the S could 247 00:15:44,920 --> 00:15:48,210 be those permutations that have the 6 and a 0 next to one 248 00:15:48,210 --> 00:15:48,830 another. 249 00:15:48,830 --> 00:15:51,480 So then I would like to use that rule over here. 250 00:15:51,480 --> 00:15:55,130 So I would also need to count all the intersections and so 251 00:15:55,130 --> 00:15:55,630 on. 252 00:15:55,630 --> 00:15:57,010 So let's do this. 253 00:15:59,960 --> 00:16:03,780 Let me first give an example of such a permutation. 254 00:16:03,780 --> 00:16:07,250 So for example, I could have the permutation 255 00:16:07,250 --> 00:16:13,570 that is the sequence 7, 2, 5, 6, 0, and the 4, 256 00:16:13,570 --> 00:16:19,420 for example, 3, 5, 1 and 9. 257 00:16:19,420 --> 00:16:22,720 So I have all the digits that are in the-- contained 258 00:16:22,720 --> 00:16:23,680 in the set. 259 00:16:23,680 --> 00:16:26,940 And I see that, actually, this particular permutation 260 00:16:26,940 --> 00:16:28,760 has a 6 and a 0 next to one another. 261 00:16:28,760 --> 00:16:31,900 So it's in this particular-- the set of permutations 262 00:16:31,900 --> 00:16:33,460 that have a 6 and a 0. 263 00:16:33,460 --> 00:16:35,710 I can also see it has a 0 and a 4. 264 00:16:35,710 --> 00:16:38,000 So it's also in the set of permutations that have a 0 265 00:16:38,000 --> 00:16:40,560 and a 4 next to one another. 266 00:16:40,560 --> 00:16:41,060 OK. 267 00:16:41,060 --> 00:16:46,260 So now I'm going to define these different sets 268 00:16:46,260 --> 00:16:50,530 and then we're going to start counting these. 269 00:16:50,530 --> 00:16:53,450 And this is the type of counting that you're 270 00:16:53,450 --> 00:16:55,740 doing in this problem set. 271 00:16:55,740 --> 00:16:59,210 And the intuition that you create 272 00:16:59,210 --> 00:17:02,390 by doing that you can use later on when 273 00:17:02,390 --> 00:17:03,740 we study probability theory. 274 00:17:07,390 --> 00:17:07,890 OK. 275 00:17:12,460 --> 00:17:19,760 So let's define the set P4, 2 as all the permutations 276 00:17:19,760 --> 00:17:27,980 that have-- so it's the set of permutations with 4, 2. 277 00:17:27,980 --> 00:17:33,380 And similarly, we have P0, 4 which is the same thing but now 278 00:17:33,380 --> 00:17:35,320 with 0, 4. 279 00:17:35,320 --> 00:17:40,680 P6, 0, the set of full permutations with 6, 0. 280 00:17:40,680 --> 00:17:44,030 So let's have a look at what the sizes of an individual 281 00:17:44,030 --> 00:17:45,900 set of permutations. 282 00:17:45,900 --> 00:17:47,310 How can we do this? 283 00:17:47,310 --> 00:17:58,270 So let's have a look at the size of, say, this one, P60. 284 00:17:58,270 --> 00:18:02,410 Well, what kind of trick can I do in order to count this? 285 00:18:02,410 --> 00:18:07,520 So we have learned a few rules last time. 286 00:18:07,520 --> 00:18:09,565 And what I would like to do is, well, this 287 00:18:09,565 --> 00:18:12,460 is a slightly more complex structure, 288 00:18:12,460 --> 00:18:15,330 so I would like to map this to a set 289 00:18:15,330 --> 00:18:18,710 by means of a bijection That will be great. 290 00:18:18,710 --> 00:18:22,480 Then to do some kind of other sets 291 00:18:22,480 --> 00:18:24,520 that is easy to count for me. 292 00:18:24,520 --> 00:18:26,480 So then, by the bijection rule, I 293 00:18:26,480 --> 00:18:30,100 will be able to figure out what the cardinalities of this set. 294 00:18:30,100 --> 00:18:34,060 So the trick here is to find such a bijection. 295 00:18:34,060 --> 00:18:38,380 And the idea is that you could actually treat the 6 and the 0 296 00:18:38,380 --> 00:18:40,540 as one unique symbol. 297 00:18:40,540 --> 00:18:42,350 So let's see how it works. 298 00:18:42,350 --> 00:18:45,710 So what I could do is I can have, from the set 299 00:18:45,710 --> 00:18:49,860 of-- from P60-- so all the permutations that 300 00:18:49,860 --> 00:18:52,450 have 6 and a 0 next to one another-- I 301 00:18:52,450 --> 00:19:03,390 can find a bijection to the permutations of the set that 302 00:19:03,390 --> 00:19:07,371 have 6, 0 as a single symbol. 303 00:19:07,371 --> 00:19:09,870 And then I have all the other symbols, all the other digits. 304 00:19:09,870 --> 00:19:19,400 So 1, 2, 3, 4, 5, 7, 8, and 0. 305 00:19:19,400 --> 00:19:24,776 So let's have an example of-- we have one up here, actually. 306 00:19:29,890 --> 00:19:32,240 So how would I map this? 307 00:19:32,240 --> 00:19:36,250 This would be mapped according to that definition. 308 00:19:36,250 --> 00:19:40,370 To 7, 2, 5. 309 00:19:40,370 --> 00:19:45,380 And now I combine 6 and 0 into one symbol in my sequence. 310 00:19:45,380 --> 00:19:46,580 And then I have the rest. 311 00:19:46,580 --> 00:19:50,890 4, 3, 5, 1, and 9. 312 00:19:55,840 --> 00:19:57,760 Now this is easy for me to count, right? 313 00:19:57,760 --> 00:20:00,690 So this is a bijection. 314 00:20:00,690 --> 00:20:04,180 And by the bijection rule, the cardinality of this set 315 00:20:04,180 --> 00:20:09,270 is equal to the total number of permutations on this set. 316 00:20:09,270 --> 00:20:11,690 Now, this set has exactly eight elements 317 00:20:11,690 --> 00:20:13,820 so I know how many there are. 318 00:20:13,820 --> 00:20:18,740 So I know that the cardinality is equal to 8 factorial. 319 00:20:18,740 --> 00:20:23,370 Because there are 8 factorial permutations on sets of size 8. 320 00:20:23,370 --> 00:20:25,560 We saw that last time. 321 00:20:25,560 --> 00:20:28,430 So that's the trick or-- 322 00:20:28,430 --> 00:20:29,070 AUDIENCE: Nine. 323 00:20:29,070 --> 00:20:30,153 PROFESSOR: Oh, is it nine? 324 00:20:30,153 --> 00:20:33,210 Oh, yeah, you're right. 325 00:20:33,210 --> 00:20:34,440 Great. 326 00:20:34,440 --> 00:20:35,220 So this is 9. 327 00:20:39,460 --> 00:20:42,940 And similarly, in the same way, we can also count these, right? 328 00:20:42,940 --> 00:20:47,700 We can treat 0, 4 as one symbol or 4, 2 as one symbol. 329 00:20:47,700 --> 00:20:50,390 So I also know that the cardinalities of these 330 00:20:50,390 --> 00:20:55,435 are also equal to 9 factorial. 331 00:20:55,435 --> 00:20:57,560 Now, when I use the inclusion-exclusion principle-- 332 00:20:57,560 --> 00:20:59,190 so now I've computed those three, 333 00:20:59,190 --> 00:21:02,240 essentially-- I need to subtract their intersections. 334 00:21:02,240 --> 00:21:04,340 So let's compute the intersections. 335 00:21:10,500 --> 00:21:17,090 And if you do that, we're going to use the exact same trick. 336 00:21:17,090 --> 00:21:21,580 So we're going to find the bijection to permutations 337 00:21:21,580 --> 00:21:23,640 of a set of symbols. 338 00:21:23,640 --> 00:21:27,280 And we just have to specify those. 339 00:21:27,280 --> 00:21:31,470 So let's do this together and take, for example, 340 00:21:31,470 --> 00:21:41,130 the intersection of P42 with P60. 341 00:21:41,130 --> 00:21:44,450 So what kind of a bijection could I have? 342 00:21:44,450 --> 00:21:50,770 So it will be all-- to all the permutations 343 00:21:50,770 --> 00:21:53,860 on what kind of a set? 344 00:21:53,860 --> 00:21:57,680 So I use the exact same trick here. 345 00:21:57,680 --> 00:22:02,400 So I'm going to treat 4 and 2 as one symbol and 6, 0 as one 346 00:22:02,400 --> 00:22:03,700 symbol. 347 00:22:03,700 --> 00:22:08,630 So I have 4, 2, 6, 0 and then all the other digits. 348 00:22:08,630 --> 00:22:14,410 So it's the 1, 3, 5, 7, 8, and 9. 349 00:22:14,410 --> 00:22:17,650 You can count that this number is 8. 350 00:22:17,650 --> 00:22:20,990 So by the bijection rule, we have 351 00:22:20,990 --> 00:22:22,880 that the cardinality of this intersection 352 00:22:22,880 --> 00:22:25,810 is equal to 8 factorial. 353 00:22:25,810 --> 00:22:28,830 And we continue like this to compute 354 00:22:28,830 --> 00:22:30,480 all the other intersections. 355 00:22:30,480 --> 00:22:32,780 And they do look a little bit different sometimes. 356 00:22:32,780 --> 00:22:40,580 So for example, if I have 6, 0 and P 0, 4-- 357 00:22:40,580 --> 00:22:48,110 so let me define the permutation first-- or the bijection first. 358 00:22:48,110 --> 00:22:50,899 So how do we do this one? 359 00:22:50,899 --> 00:22:51,565 Any suggestions? 360 00:22:54,870 --> 00:22:58,860 So what kind of a set can I find a permutation to? 361 00:22:58,860 --> 00:23:04,130 If I look-- so over here I have a permutation in which 6 and 0 362 00:23:04,130 --> 00:23:06,520 are next to one another. 363 00:23:06,520 --> 00:23:09,550 But this is also a permutation in which 0 and 4 364 00:23:09,550 --> 00:23:10,790 are next to one another. 365 00:23:10,790 --> 00:23:12,699 AUDIENCE: [INAUDIBLE]. 366 00:23:12,699 --> 00:23:13,740 PROFESSOR: Yeah, exactly. 367 00:23:13,740 --> 00:23:18,900 So 3, 6, 0 and 4 is one symbol because permutation 368 00:23:18,900 --> 00:23:22,740 is right in here has a 6 and 0 next to one another. 369 00:23:22,740 --> 00:23:25,950 And the 0 should also be next to the 4 because it's in this set 370 00:23:25,950 --> 00:23:27,180 as well. 371 00:23:27,180 --> 00:23:29,930 So we know that every permutation in here 372 00:23:29,930 --> 00:23:34,250 has a sub sequence of 6, 0, 4 next to one another. 373 00:23:34,250 --> 00:23:36,680 So we can treat this as one symbol. 374 00:23:36,680 --> 00:23:38,180 And then we have all the other ones. 375 00:23:43,010 --> 00:23:47,520 And again, this is-- these are 8 elements. 376 00:23:47,520 --> 00:23:51,330 So we have that also, for this intersection, 377 00:23:51,330 --> 00:23:54,340 the cardinality is equal, by the bijection rule, 378 00:23:54,340 --> 00:23:56,460 as the total number of permutations 379 00:23:56,460 --> 00:23:59,375 on a set of eight elements, which is 8 factorial. 380 00:24:08,900 --> 00:24:15,930 So for the last one, we also have similar-- so 381 00:24:15,930 --> 00:24:17,680 let me see which one I need to do. 382 00:24:17,680 --> 00:24:23,460 So I have 4, 2 and 0, 4. 383 00:24:23,460 --> 00:24:26,900 Well, again, I do the same trick. 384 00:24:26,900 --> 00:24:29,820 Now I have a symbol that has-- well, the permutation here 385 00:24:29,820 --> 00:24:32,280 has a 0 and a 4 next to one another, 386 00:24:32,280 --> 00:24:35,530 and the 4 is next to a 2. 387 00:24:35,530 --> 00:24:38,780 So I treat this as one symbol. 388 00:24:38,780 --> 00:24:45,260 So if the permutations on the set 0, 4, 2, and then 389 00:24:45,260 --> 00:24:52,450 1, 3, 5, 7-- oh, and 6 as well-- 8 and nine. 390 00:24:52,450 --> 00:24:59,235 So the cardinality of this set is also equal to 8 factorial. 391 00:25:02,140 --> 00:25:05,410 So now we still have to look at the intersection of all 392 00:25:05,410 --> 00:25:09,480 of those three in order to use the inclusion-exclusion 393 00:25:09,480 --> 00:25:11,140 principle. 394 00:25:11,140 --> 00:25:16,640 And, well, the same trick can be used over here. 395 00:25:16,640 --> 00:25:22,980 So we look at the intersection of P60 with P04 396 00:25:22,980 --> 00:25:26,400 and the permutations that have 4 and 2 next to one another. 397 00:25:26,400 --> 00:25:28,467 So what does that mean? 398 00:25:28,467 --> 00:25:30,300 It means that the permutation that's in here 399 00:25:30,300 --> 00:25:33,260 has a 6, 0 and then a 4 and then a 2. 400 00:25:33,260 --> 00:25:37,190 So these are all the permutations with a 6, 0, 4, 401 00:25:37,190 --> 00:25:40,160 2 next to one another. 402 00:25:40,160 --> 00:25:46,630 And this can map easily to the sets 403 00:25:46,630 --> 00:25:50,040 where we treat this as one symbol-- 6042-- 404 00:25:50,040 --> 00:25:55,470 and then we have 1, 3, 5, 7, 8, and 9. 405 00:25:55,470 --> 00:26:01,720 This set has seven elements, so the intersection of these three 406 00:26:01,720 --> 00:26:04,630 is equal to 7 factorial. 407 00:26:04,630 --> 00:26:08,540 And now we can use the inclusion-exclusion principle 408 00:26:08,540 --> 00:26:12,450 using this over here. 409 00:26:12,450 --> 00:26:16,600 And when we plug everything in here, 410 00:26:16,600 --> 00:26:20,750 we can see that the intersection-- that the union-- 411 00:26:20,750 --> 00:26:27,850 when we count the union of P60 which P04 and P42 is actually 412 00:26:27,850 --> 00:26:32,480 equal to 9 factorial for these, 8 factorials for those, 413 00:26:32,480 --> 00:26:33,930 and a 7 factorial for these. 414 00:26:33,930 --> 00:26:39,990 So it's 3 times 9 factorial minus 3 times 8 factorial 415 00:26:39,990 --> 00:26:43,962 plus 1 times a 7 factorial. 416 00:26:43,962 --> 00:26:46,295 So this is how we can use inclusion-exclusion principle. 417 00:26:51,900 --> 00:26:55,140 So this generalized the sum rule. 418 00:26:55,140 --> 00:26:58,220 And now we have a whole set of rules 419 00:26:58,220 --> 00:27:00,819 already discussed since last time. 420 00:27:00,819 --> 00:27:02,360 We continue with the bookkeeper rule. 421 00:27:02,360 --> 00:27:04,340 You have already seen it during recitation 422 00:27:04,340 --> 00:27:07,990 so I will only write it out once more. 423 00:27:07,990 --> 00:27:11,570 And all these rules together we will then 424 00:27:11,570 --> 00:27:13,670 use in a set of examples. 425 00:27:19,070 --> 00:27:21,060 So what was the bookkeeper rule? 426 00:27:21,060 --> 00:27:34,600 We have that-- so the bookkeeper rule is, 427 00:27:34,600 --> 00:27:41,050 if I have distinct copies of letters-- so distinct copies 428 00:27:41,050 --> 00:27:56,170 of letters l1, l2, l3 and lk, well, then 429 00:27:56,170 --> 00:28:01,830 the number of sequences that have 430 00:28:01,830 --> 00:28:05,010 exactly n1 letters of the type l1 431 00:28:05,010 --> 00:28:08,610 and n2 letters of the type l2 and so on, well, we 432 00:28:08,610 --> 00:28:10,120 can count those. 433 00:28:10,120 --> 00:28:24,080 So sequences with n1 copies of l1 and n2 copies of l2, 434 00:28:24,080 --> 00:28:32,200 and then we continue like this until we have nk copies of lk. 435 00:28:32,200 --> 00:28:33,800 Well, we can count this. 436 00:28:33,800 --> 00:28:35,840 So these copies can be in an arbitrary 437 00:28:35,840 --> 00:28:37,480 order in the sequence. 438 00:28:37,480 --> 00:28:43,140 And we saw in recitation that this can be written as n plus 1 439 00:28:43,140 --> 00:28:50,350 plus n2 all the way up to nk factorial. 440 00:28:50,350 --> 00:28:55,440 And we divide out the product that starts with n1 factorial 441 00:28:55,440 --> 00:29:02,040 times n2 factorial up to nk factorial. 442 00:29:02,040 --> 00:29:06,470 And this we also can write as what-- well, 443 00:29:06,470 --> 00:29:08,440 this is actually the definition of what we call 444 00:29:08,440 --> 00:29:09,900 the multinomial coefficient. 445 00:29:09,900 --> 00:29:14,740 So you've already seen the binomial coefficients, which 446 00:29:14,740 --> 00:29:16,530 is a special case of this one. 447 00:29:16,530 --> 00:29:23,030 So we write this as n1 plus up to nk. 448 00:29:23,030 --> 00:29:26,190 And then we have n1, n2, and we just 449 00:29:26,190 --> 00:29:29,770 repeat all of those in here. 450 00:29:29,770 --> 00:29:38,800 If we have k equals 2, then we get the binomial coefficient. 451 00:29:38,800 --> 00:29:43,310 And if k equals this 2, we also often just forget 452 00:29:43,310 --> 00:29:45,060 about the last term. 453 00:29:45,060 --> 00:29:47,930 So we would get expressions that look 454 00:29:47,930 --> 00:29:54,390 like this, which is really equal to nk comma n minus k. 455 00:29:54,390 --> 00:29:54,890 OK. 456 00:29:54,890 --> 00:29:59,220 So this is some-- these are some definitions. 457 00:29:59,220 --> 00:30:02,660 And we can apply this bookkeeper rule. 458 00:30:05,480 --> 00:30:09,800 For example, last time in the lecture we were talking about 459 00:30:09,800 --> 00:30:15,000 the number of bit sequences of length 16 with four 1's. 460 00:30:15,000 --> 00:30:18,740 We wanted to count this because we found out that if you want 461 00:30:18,740 --> 00:30:25,660 to select 12 donuts of five varieties, 462 00:30:25,660 --> 00:30:29,270 we can find a mapping of bijection towards this set 463 00:30:29,270 --> 00:30:33,380 of bit sequences with 12 0's and four 1's. 464 00:30:33,380 --> 00:30:39,870 So the bookkeeper rule will tell us exactly how many there are. 465 00:30:39,870 --> 00:30:44,650 And that's the most basic example, essentially, 466 00:30:44,650 --> 00:30:49,300 of this way of counting. 467 00:30:49,300 --> 00:30:50,500 So what do we have? 468 00:30:53,250 --> 00:31:04,890 So the number of bit sequences of length 16 and with four 469 00:31:04,890 --> 00:31:09,160 1's-- well, is exactly equal to, according to this rule, 470 00:31:09,160 --> 00:31:15,440 as length 16 and we need to choose four 1's out of these 471 00:31:15,440 --> 00:31:15,990 16. 472 00:31:15,990 --> 00:31:18,180 And it's the binomial coefficients 473 00:31:18,180 --> 00:31:26,250 where we choose four out of the 16 symbols. 474 00:31:26,250 --> 00:31:30,180 And this is equal to 16 factorial divided by 4 475 00:31:30,180 --> 00:31:32,110 factorial times 12 factorial. 476 00:31:35,570 --> 00:31:43,730 Now we often also denote the following rule-- 477 00:31:43,730 --> 00:31:47,310 we sort of identify as a special case. 478 00:31:47,310 --> 00:31:53,740 We say that the number of k elements-- of k element 479 00:31:53,740 --> 00:32:06,420 subsets-- of an n element set is actually equal to n choose k. 480 00:32:09,840 --> 00:32:12,120 So this is an important rule to remember 481 00:32:12,120 --> 00:32:13,615 which will occur many times. 482 00:32:22,370 --> 00:32:23,780 OK. 483 00:32:23,780 --> 00:32:26,590 A theorem that we can have derived from all this stuff 484 00:32:26,590 --> 00:32:29,510 is what we call the binomial theorem. 485 00:32:29,510 --> 00:32:31,020 So we'll quickly go over that. 486 00:32:37,090 --> 00:32:41,580 The binomial theorem says that, for all integers n-- 487 00:32:41,580 --> 00:32:46,840 positive integers n-- we have a plus b to the power n equals 488 00:32:46,840 --> 00:32:52,320 to the sum where we take k from 0 to n 489 00:32:52,320 --> 00:32:57,250 and then we have the binomial where we 490 00:32:57,250 --> 00:32:58,900 have this expression over here. 491 00:32:58,900 --> 00:33:06,840 We choose k out of n and we choose, say, k 492 00:33:06,840 --> 00:33:08,982 times b in this expression. 493 00:33:08,982 --> 00:33:10,690 I will explain in a moment by an example. 494 00:33:10,690 --> 00:33:13,630 And n minus k ace. 495 00:33:13,630 --> 00:33:15,170 And this is the theorem. 496 00:33:15,170 --> 00:33:17,300 And I will just give an example just 497 00:33:17,300 --> 00:33:22,300 to show how we can think about this. 498 00:33:22,300 --> 00:33:23,510 So let me do that over here. 499 00:33:26,050 --> 00:33:31,595 So if you take n equals to 2, then we 500 00:33:31,595 --> 00:33:34,830 can see that we get all the combinations, essentially, 501 00:33:34,830 --> 00:33:36,380 of a and b of length 2. 502 00:33:36,380 --> 00:33:42,420 So you have a times a, a times b, b times a, and b times b. 503 00:33:42,420 --> 00:33:44,300 So what do we see? 504 00:33:44,300 --> 00:33:51,470 We see a squared plus ab plus ba plus b squared. 505 00:33:51,470 --> 00:33:56,980 Now we see that these have 1 times an a and 1 times a b. 506 00:33:56,980 --> 00:34:01,660 This one has 2 times an a and this one has 2 times a b. 507 00:34:04,420 --> 00:34:08,449 And this combines together as a squared plus 2 times 508 00:34:08,449 --> 00:34:11,340 ab plus b squared. 509 00:34:11,340 --> 00:34:16,179 Now, if you have n equals 3-- so we have a plus b to the power 510 00:34:16,179 --> 00:34:22,100 3-- you will get all the different products, 511 00:34:22,100 --> 00:34:26,889 all the different terms, that add up to this, 512 00:34:26,889 --> 00:34:29,940 are all the kinds of combinations of a's and b's. 513 00:34:29,940 --> 00:34:36,880 So for example, we have three a's-- so 3 times a-- but it can 514 00:34:36,880 --> 00:34:47,739 also have a squared times b plus aba plus b a squared. 515 00:34:47,739 --> 00:34:53,840 And those have exactly two times an a and one times a b. 516 00:34:53,840 --> 00:34:57,650 I can now look at all the others-- 517 00:34:57,650 --> 00:35:00,600 so I may have two times the b and one times the a. 518 00:35:00,600 --> 00:35:02,570 So what our those? 519 00:35:02,570 --> 00:35:11,570 We have a times b squared plus bab plus b squared a. 520 00:35:11,570 --> 00:35:16,550 So I count these as the same, right? 521 00:35:16,550 --> 00:35:19,340 They each have the same number of b's. 522 00:35:19,340 --> 00:35:22,510 Two times the b and one times the a. 523 00:35:22,510 --> 00:35:27,110 And then, finally, I have b to the power 3 524 00:35:27,110 --> 00:35:29,120 which counts three times the b. 525 00:35:29,120 --> 00:35:31,120 So these are all the possible terms that I have. 526 00:35:31,120 --> 00:35:32,510 There are eight in total. 527 00:35:32,510 --> 00:35:35,436 One, two, three, four, five, up to eight. 528 00:35:35,436 --> 00:35:36,310 And that fits, right? 529 00:35:36,310 --> 00:35:39,877 Because I can have a choice of an a and a b. 530 00:35:39,877 --> 00:35:40,960 And I do that three times. 531 00:35:40,960 --> 00:35:43,440 So 2 times 2 times 2 is equal to 8. 532 00:35:43,440 --> 00:35:45,090 So I have eight terms. 533 00:35:45,090 --> 00:35:50,170 And I can group them together by taking a to the power 3 534 00:35:50,170 --> 00:35:57,080 plus 3 times a squared b plus 3 times-- and now 535 00:35:57,080 --> 00:36:04,830 I have b squared a-- and finally, b to the power 3. 536 00:36:04,830 --> 00:36:06,980 So what do we see here? 537 00:36:06,980 --> 00:36:09,860 How many terms are their that have exactly two times 538 00:36:09,860 --> 00:36:11,630 an a and one times a b? 539 00:36:11,630 --> 00:36:17,370 Well, it's like we have a set of three elements, right? 540 00:36:17,370 --> 00:36:20,470 Or three positions. 541 00:36:20,470 --> 00:36:22,250 And I like two of them to be an a. 542 00:36:22,250 --> 00:36:24,580 So I choose two out of those three to be an a. 543 00:36:24,580 --> 00:36:30,870 So I use this subset rule to count how many times I 544 00:36:30,870 --> 00:36:35,270 see the same term back. 545 00:36:35,270 --> 00:36:42,650 So let's write this out so that is-- so 546 00:36:42,650 --> 00:36:50,960 the number of terms that have k times an a, 547 00:36:50,960 --> 00:36:56,120 and we have, say, n minus k times a b. 548 00:36:56,120 --> 00:36:58,680 So how many terms do I have? 549 00:36:58,680 --> 00:37:09,700 Well, that is the length of-- so the number of-- oops. 550 00:37:09,700 --> 00:37:10,280 Change that. 551 00:37:10,280 --> 00:37:16,320 So it's the number of length n sequences 552 00:37:16,320 --> 00:37:18,350 that have the following property. 553 00:37:18,350 --> 00:37:27,220 That these have k a's and n minus k b's. 554 00:37:27,220 --> 00:37:29,390 And that's easy to count. 555 00:37:29,390 --> 00:37:32,120 Which is equal to what we have done here before. 556 00:37:32,120 --> 00:37:36,700 We have the binomial n choose k. 557 00:37:36,700 --> 00:37:39,130 And that, if you plug that in over here, 558 00:37:39,130 --> 00:37:42,400 then we get this particular sum. 559 00:37:42,400 --> 00:37:44,980 So it is-- this is the binomial theorem. 560 00:37:44,980 --> 00:37:46,910 Very famous. 561 00:37:46,910 --> 00:37:49,960 And now we're going to use all this stuff 562 00:37:49,960 --> 00:37:51,660 to count some poker hands. 563 00:37:51,660 --> 00:37:55,440 So we have come to this part of the lecture. 564 00:37:55,440 --> 00:37:57,740 So we're going to do a bunch of examples 565 00:37:57,740 --> 00:37:59,830 that are similar to some of those 566 00:37:59,830 --> 00:38:01,460 that you will see in the problem set. 567 00:38:01,460 --> 00:38:03,145 And then at the end we go and continue 568 00:38:03,145 --> 00:38:07,190 with some-- with a different proof technique. 569 00:38:07,190 --> 00:38:16,260 So let's first define a deck of cards 570 00:38:16,260 --> 00:38:18,870 because that's what we are going to use now. 571 00:38:18,870 --> 00:38:26,430 So for this type of problems, we will 572 00:38:26,430 --> 00:38:34,810 use a deck which is actually a set of 52 cards. 573 00:38:34,810 --> 00:38:44,490 And a card itself actually has a suit. 574 00:38:44,490 --> 00:38:47,140 And the suit can be something that 575 00:38:47,140 --> 00:38:51,170 looks like this, which is called spades. 576 00:38:51,170 --> 00:38:52,970 S of spades. 577 00:38:52,970 --> 00:38:58,500 We have another symbol which is this, hearts. 578 00:38:58,500 --> 00:39:06,670 And we will have clubs and we have diamonds. 579 00:39:06,670 --> 00:39:10,970 And besides a suit, a card also has a value. 580 00:39:10,970 --> 00:39:21,030 And the values are arranged from 2, 3, 4, all the way up to 10. 581 00:39:21,030 --> 00:39:24,440 Then we have a special symbol-- special value-- 582 00:39:24,440 --> 00:39:26,600 which is called the Jack. 583 00:39:26,600 --> 00:39:31,030 We've got a Queen and a King and finally the Ace. 584 00:39:31,030 --> 00:39:35,930 And in total, we have 13 possible values. 585 00:39:35,930 --> 00:39:38,930 So you can see that we have four times, 586 00:39:38,930 --> 00:39:41,900 because of four different suits, 4 times 13 587 00:39:41,900 --> 00:39:46,330 is 52 different cards and that makes up a deck. 588 00:39:46,330 --> 00:39:49,450 So we're going to look at hands. 589 00:39:49,450 --> 00:39:55,605 And a hand is actually a collection-- a set 590 00:39:55,605 --> 00:39:57,720 of five cards. 591 00:39:57,720 --> 00:40:04,560 So it's a subset of the deck of five cards. 592 00:40:04,560 --> 00:40:09,310 And we do not worry about the order 593 00:40:09,310 --> 00:40:11,290 of the cards in your hand. 594 00:40:11,290 --> 00:40:13,210 They can be permuted, if you want. 595 00:40:13,210 --> 00:40:15,480 So the order's not important. 596 00:40:15,480 --> 00:40:19,750 So it's a subset of five cards. 597 00:40:19,750 --> 00:40:21,460 So how many hands do I have? 598 00:40:24,130 --> 00:40:26,550 Well, how many ways are there to choose 599 00:40:26,550 --> 00:40:31,740 a subset of five cards out of a deck of 52 cards? 600 00:40:31,740 --> 00:40:33,900 Well, we can use a subset through 601 00:40:33,900 --> 00:40:37,670 and we get the binomial 52 choose 5. 602 00:40:41,150 --> 00:40:44,900 Which is, by the way, a lot so let me write it out as well. 603 00:40:44,900 --> 00:40:47,710 It's about 2 and 1/2 million. 604 00:40:53,430 --> 00:40:57,280 So we are interested in, when we play poker-- 605 00:40:57,280 --> 00:41:01,450 if you do that-- in really good hands. 606 00:41:01,450 --> 00:41:03,920 So we like four of a kind, which means 607 00:41:03,920 --> 00:41:09,420 that we have four cards that actually have the same value. 608 00:41:09,420 --> 00:41:14,160 Or we have cards that-- hands that have 609 00:41:14,160 --> 00:41:15,270 what we call a full house. 610 00:41:15,270 --> 00:41:17,120 We will count those in a moment. 611 00:41:17,120 --> 00:41:20,240 Or other kinds of combinations. 612 00:41:20,240 --> 00:41:26,170 And the rarer the combination is in your hand, the higher 613 00:41:26,170 --> 00:41:29,820 or the better your hand is, and the more likely 614 00:41:29,820 --> 00:41:33,080 it is that you win the poker game. 615 00:41:33,080 --> 00:41:35,550 If you do not get left out. 616 00:41:35,550 --> 00:41:36,050 All right. 617 00:41:41,000 --> 00:41:48,030 So let's give an example of a four of a kind. 618 00:41:48,030 --> 00:41:49,840 So we're going to compute those and we 619 00:41:49,840 --> 00:41:52,350 will see that we need to do-- to use all the-- a combination 620 00:41:52,350 --> 00:41:53,183 for all these rules. 621 00:42:02,260 --> 00:42:04,600 OK. 622 00:42:04,600 --> 00:42:11,180 So four of a kind is the special hand 623 00:42:11,180 --> 00:42:19,245 where we have four of one kind of value. 624 00:42:23,210 --> 00:42:26,200 Notice, by the way, that the fifth card, because of this, 625 00:42:26,200 --> 00:42:28,440 must have a different value, right? 626 00:42:28,440 --> 00:42:31,780 Because there are only four cards 627 00:42:31,780 --> 00:42:34,090 that have, say, the value eight. 628 00:42:34,090 --> 00:42:37,030 Because there are only four different suits. 629 00:42:37,030 --> 00:42:38,540 So the fifth card will ultimately 630 00:42:38,540 --> 00:42:41,650 have a different value. 631 00:42:41,650 --> 00:42:49,310 So as an example, we will have the 8 of spades and then the 9 632 00:42:49,310 --> 00:42:52,930 of diamonds and all the other 8's-- the 8 of diamonds 633 00:42:52,930 --> 00:42:55,930 and the 8 of hearts and, say, the 8 of clubs. 634 00:42:58,440 --> 00:43:01,820 And how do we count these types of hands? 635 00:43:01,820 --> 00:43:04,620 We're going to look for a representation 636 00:43:04,620 --> 00:43:08,070 of how can you represent such hands, such objects? 637 00:43:08,070 --> 00:43:11,120 So we have to count a special type of object, 638 00:43:11,120 --> 00:43:13,310 a special kind of poker hand. 639 00:43:13,310 --> 00:43:15,800 And in order to do that, we're going 640 00:43:15,800 --> 00:43:20,190 to look for a way to represent these objects 641 00:43:20,190 --> 00:43:24,450 and in such a way that we can count them very easily. 642 00:43:24,450 --> 00:43:26,530 And that's really the trick in order 643 00:43:26,530 --> 00:43:29,500 to solve these kinds of counting problems. 644 00:43:29,500 --> 00:43:32,680 So the representation that we have here is-- 645 00:43:32,680 --> 00:43:36,420 well, we can choose-- first of all, 646 00:43:36,420 --> 00:43:46,430 we can choose the value of the four kinds-- of the four cards. 647 00:43:46,430 --> 00:43:49,970 So how many choices do I have? 648 00:43:49,970 --> 00:43:53,820 Well, I got any choice. 649 00:43:53,820 --> 00:43:57,990 There are 13 different values so I have 13 choices. 650 00:43:57,990 --> 00:44:01,260 So that's easy. 651 00:44:01,260 --> 00:44:06,510 Secondly, I can choose the value of the extra card. 652 00:44:10,920 --> 00:44:13,310 So how many choices do I have here? 653 00:44:13,310 --> 00:44:18,450 Well, the four of a kind already eliminates one kind of value 654 00:44:18,450 --> 00:44:19,100 completely. 655 00:44:19,100 --> 00:44:19,600 Right? 656 00:44:19,600 --> 00:44:25,020 So I have any of the other values is possible. 657 00:44:25,020 --> 00:44:27,370 Is equally likely, even. 658 00:44:27,370 --> 00:44:30,670 So I have 12 choices. 659 00:44:30,670 --> 00:44:35,870 And, lastly, I can represent-- I need to still represent 660 00:44:35,870 --> 00:44:37,280 the suit of the extra card. 661 00:44:37,280 --> 00:44:43,279 So I also want to know the suit of the extra card. 662 00:44:43,279 --> 00:44:44,570 And how many choices do I have? 663 00:44:44,570 --> 00:44:47,080 Well, I can choose any of those four. 664 00:44:47,080 --> 00:44:49,970 So that's four. 665 00:44:49,970 --> 00:44:52,110 So, essentially, what we constructed here 666 00:44:52,110 --> 00:44:57,830 is a mapping by using this representation. 667 00:44:57,830 --> 00:45:03,510 And the mapping tells us-- is as follows. 668 00:45:06,040 --> 00:45:07,292 Let's keep this up. 669 00:45:15,330 --> 00:45:21,390 So the mapping goes from poker hands-- from card-- from hands 670 00:45:21,390 --> 00:45:27,940 to-- from hands with four of a kind to this representation. 671 00:45:27,940 --> 00:45:29,480 So let's write it out. 672 00:45:29,480 --> 00:45:33,960 So we have four of a kind. 673 00:45:33,960 --> 00:45:36,080 And then we have a function-- a mapping 674 00:45:36,080 --> 00:45:39,240 f-- that goes to this representation. 675 00:45:39,240 --> 00:45:43,020 We will have the first entry-- the value 1 676 00:45:43,020 --> 00:45:45,795 and the value 2 and then a value 3. 677 00:45:48,930 --> 00:45:54,780 So for example, if you take this hands of cards, 678 00:45:54,780 --> 00:46:01,820 well, the first one, we see that the four of a kind has value 8. 679 00:46:01,820 --> 00:46:06,860 The value of the second card is the 9 of the 9 diamonds cards. 680 00:46:06,860 --> 00:46:08,520 So we have 9. 681 00:46:08,520 --> 00:46:11,580 And finally, the suit that I need to select for, 682 00:46:11,580 --> 00:46:13,910 the extra card is diamonds. 683 00:46:13,910 --> 00:46:15,031 So this is an example. 684 00:46:18,120 --> 00:46:21,940 And now we know, because this is a bijection, 685 00:46:21,940 --> 00:46:25,030 we know that the number of hands with four of a kind 686 00:46:25,030 --> 00:46:29,340 is equal to all these types of sequences, 687 00:46:29,340 --> 00:46:33,780 all these types of sequences that can-- 688 00:46:33,780 --> 00:46:37,860 that are chosen according to this representation. 689 00:46:37,860 --> 00:46:41,970 Well, we have 13 choices for the first value. 690 00:46:41,970 --> 00:46:46,060 And given this first value, we have 12 choices 691 00:46:46,060 --> 00:46:47,750 for the second value. 692 00:46:47,750 --> 00:46:53,840 And given those two, I have four choices for the very last entry 693 00:46:53,840 --> 00:46:55,870 in this sequence. 694 00:46:55,870 --> 00:46:59,100 So this is the generalized product rule that I'm using. 695 00:46:59,100 --> 00:47:05,950 So we see that the number of sequences is equal to 13 times 696 00:47:05,950 --> 00:47:08,170 12 times 4. 697 00:47:08,170 --> 00:47:10,650 Turns out this is equal to 624. 698 00:47:10,650 --> 00:47:15,250 Well, if you divide it over total number of cards. 699 00:47:15,250 --> 00:47:16,476 So how did we do this? 700 00:47:16,476 --> 00:47:18,017 This is the generalized product rule. 701 00:47:21,500 --> 00:47:24,560 If you divide this number of the total number of cards 702 00:47:24,560 --> 00:47:28,030 we could get the fraction of one over about 4,000. 703 00:47:28,030 --> 00:47:30,045 So it's really rare that you get four of a kind. 704 00:47:30,045 --> 00:47:33,321 So it's a really good hand. 705 00:47:33,321 --> 00:47:33,820 OK. 706 00:47:33,820 --> 00:47:36,280 Let's do a few more of these. 707 00:47:44,180 --> 00:47:47,520 We also like to know how many full houses there are. 708 00:47:47,520 --> 00:47:49,270 A full house is a special hand. 709 00:47:49,270 --> 00:47:54,740 It has three cards of one value and two cards of another value. 710 00:48:10,280 --> 00:48:12,290 So how many are there? 711 00:48:12,290 --> 00:48:15,115 So again, we are going to use the exact same principle. 712 00:48:15,115 --> 00:48:17,850 We're going to find a representation 713 00:48:17,850 --> 00:48:20,020 of this type of hand. 714 00:48:20,020 --> 00:48:30,340 So we have three cards of one value and two cards of another. 715 00:48:36,690 --> 00:48:42,990 So for example, we may have the hands that contain, 716 00:48:42,990 --> 00:48:46,060 say, three cards with value 2. 717 00:48:46,060 --> 00:48:50,970 A 2 clubs, a 2 spades, and also a 2 diamonds. 718 00:48:50,970 --> 00:48:55,520 And, say, a Jack club and a Jack of diamonds. 719 00:48:55,520 --> 00:49:01,330 And another example could be, say, a 5 of diamonds and a 5 720 00:49:01,330 --> 00:49:10,000 of hearts, 5 of clubs, 7 of hearts, and also a 7 of club. 721 00:49:10,000 --> 00:49:12,390 So now you can see that it's very easy to represent this. 722 00:49:12,390 --> 00:49:12,890 Right? 723 00:49:15,700 --> 00:49:18,020 We can start grouping things together. 724 00:49:18,020 --> 00:49:20,330 We can say, represent this by first 725 00:49:20,330 --> 00:49:27,810 taking the value of the three cards that I have here. 726 00:49:27,810 --> 00:49:29,630 So it's 2. 727 00:49:29,630 --> 00:49:33,330 Then I want to indicate in a second term in my sequence-- 728 00:49:33,330 --> 00:49:37,910 in my representation-- which suits did I use over here? 729 00:49:37,910 --> 00:49:40,490 Well, I used clubs, spades and diamonds. 730 00:49:40,490 --> 00:49:46,560 So it's a set club, spades and diamonds. 731 00:49:46,560 --> 00:49:49,180 And now I also have a pair. 732 00:49:49,180 --> 00:49:51,550 Like, two cards with the same value. 733 00:49:51,550 --> 00:49:52,960 What's the value? 734 00:49:52,960 --> 00:49:53,990 It's Jack. 735 00:49:53,990 --> 00:49:57,630 And what are the suits associated to these? 736 00:49:57,630 --> 00:50:00,870 Well, clubs and the diamonds. 737 00:50:00,870 --> 00:50:04,964 So I have not yet for-- given you the formal definition 738 00:50:04,964 --> 00:50:06,380 of the representation, but you can 739 00:50:06,380 --> 00:50:08,440 see that you could do something like this. 740 00:50:08,440 --> 00:50:11,100 So this is often how we start out on a piece of paper. 741 00:50:11,100 --> 00:50:17,390 You try to do something and hopefully it works. 742 00:50:17,390 --> 00:50:21,200 So we have-- here we have diamonds, hearts, and clubs. 743 00:50:23,850 --> 00:50:28,160 And then we have-- finally we have two cards 744 00:50:28,160 --> 00:50:30,150 with the same value 7. 745 00:50:30,150 --> 00:50:34,090 And they have the hearts and clubs as suits. 746 00:50:37,540 --> 00:50:39,170 OK. 747 00:50:39,170 --> 00:50:48,310 So the representation is defined as follows. 748 00:50:48,310 --> 00:50:59,830 It just started out with a first entry in my representation. 749 00:50:59,830 --> 00:51:03,250 And this is going to be the value of the triple. 750 00:51:06,670 --> 00:51:08,980 So how many choices do we have for this value? 751 00:51:08,980 --> 00:51:11,330 Well, I can choose any of the 13 possible values. 752 00:51:11,330 --> 00:51:14,890 So I have 13 choices. 753 00:51:14,890 --> 00:51:23,220 And the second part is the suits of the triple. 754 00:51:23,220 --> 00:51:28,450 Well, I have to choose a subset of the four 755 00:51:28,450 --> 00:51:30,300 possible suits of size three. 756 00:51:30,300 --> 00:51:33,870 So I need to have a subset of size three out of the four 757 00:51:33,870 --> 00:51:35,690 possible suits. 758 00:51:35,690 --> 00:51:38,830 And that will give me the proper representation. 759 00:51:38,830 --> 00:51:42,320 So how many choices do I have for such a subset? 760 00:51:42,320 --> 00:51:46,190 Well, there's three elements out of four. 761 00:51:46,190 --> 00:51:50,840 So we can use the subset rule and see that this has 762 00:51:50,840 --> 00:51:55,675 4 choose 3 equals four choices. 763 00:51:58,370 --> 00:52:02,560 Then the last part is to value of the pair 764 00:52:02,560 --> 00:52:06,230 that I have of the two cards that are having the same value. 765 00:52:09,240 --> 00:52:11,920 Now, how many choices do I have here? 766 00:52:11,920 --> 00:52:14,160 Well, I have to be a little bit careful, though. 767 00:52:14,160 --> 00:52:18,360 I just want to make sure that I do the right reasoning here. 768 00:52:18,360 --> 00:52:22,890 I know that there's still-- because I chose a triple 769 00:52:22,890 --> 00:52:26,310 of cards of the same value-- for example, 770 00:52:26,310 --> 00:52:31,600 over here I chose all these 2's-- but I still have one card 771 00:52:31,600 --> 00:52:34,120 in my deck which has a 2. 772 00:52:34,120 --> 00:52:36,400 Actually, here I've chosen clubs, spades and diamonds. 773 00:52:36,400 --> 00:52:39,910 So the one that is missing is the 2 of hearts. 774 00:52:39,910 --> 00:52:42,910 So I could possibly choose the 2 of hearts. 775 00:52:42,910 --> 00:52:43,710 But wait a minute. 776 00:52:43,710 --> 00:52:47,306 If I choose the 2 of hearts, how can I make a pair? 777 00:52:47,306 --> 00:52:48,430 That's not possible, right? 778 00:52:48,430 --> 00:52:51,970 Because I've already chosen all the other 2's 779 00:52:51,970 --> 00:52:55,440 so there's no other 2 to match to find a pair. 780 00:52:55,440 --> 00:53:01,360 So I actually cannot choose this particular value of this triple 781 00:53:01,360 --> 00:53:03,640 for the pair. 782 00:53:03,640 --> 00:53:05,970 But all the other values are possible. 783 00:53:05,970 --> 00:53:09,450 So I have 12 choices. 784 00:53:09,450 --> 00:53:12,960 One less than the one that I've already chosen for the triple. 785 00:53:15,930 --> 00:53:21,370 Now, and then similarly, I can choose suits of the pair. 786 00:53:21,370 --> 00:53:23,810 And how many choices do I have? 787 00:53:23,810 --> 00:53:27,230 Well, look at every possible subset 788 00:53:27,230 --> 00:53:31,230 that I can have of size two out of the four suits. 789 00:53:31,230 --> 00:53:35,160 So I use the subset rule and find that this is 4 790 00:53:35,160 --> 00:53:40,780 choose 2 which is equal to 6. 791 00:53:40,780 --> 00:53:44,180 So now we're going to multiply all of these together. 792 00:53:44,180 --> 00:53:47,030 We use the generalized product rule again. 793 00:53:47,030 --> 00:53:52,640 So we have found a mapping from hands with a full house 794 00:53:52,640 --> 00:53:55,070 to these types of representations-- 795 00:53:55,070 --> 00:53:57,040 to this representation. 796 00:53:57,040 --> 00:53:59,450 And this mapping is bijective. 797 00:53:59,450 --> 00:54:03,210 So the number of full house is exactly equal to the number 798 00:54:03,210 --> 00:54:06,940 of these representations. 799 00:54:06,940 --> 00:54:08,530 And by the generalized product rule, 800 00:54:08,530 --> 00:54:12,210 I can choose the first entry of such a sequence in 13 ways. 801 00:54:12,210 --> 00:54:15,960 The second one, given the first one, in four ways. 802 00:54:15,960 --> 00:54:19,400 This one I can choose in 12 ways given I've 803 00:54:19,400 --> 00:54:20,760 already chosen my triple. 804 00:54:20,760 --> 00:54:21,730 And so on. 805 00:54:21,730 --> 00:54:23,580 So by the generalized product rule, 806 00:54:23,580 --> 00:54:26,290 I know now that the product of those four 807 00:54:26,290 --> 00:54:30,740 is equal to the total number of full house hands. 808 00:54:30,740 --> 00:54:31,940 So how much is that? 809 00:54:31,940 --> 00:54:39,710 It's 13 times 4 choose 3 times 12 times 4 choose 2. 810 00:54:39,710 --> 00:54:44,910 And this turns out to be equal to 3,744. 811 00:54:44,910 --> 00:54:49,410 Which is a factor six bigger than a four of a kind. 812 00:54:49,410 --> 00:54:52,060 So it's much more likely that you get one of those. 813 00:54:52,060 --> 00:54:53,790 And that's the reason why four of a kind 814 00:54:53,790 --> 00:55:01,410 has more worth-- is worth much more than a full house. 815 00:55:01,410 --> 00:55:06,670 So let's do another example, a hand with two pairs, 816 00:55:06,670 --> 00:55:09,190 and see whether we can continue this type of reasoning. 817 00:55:09,190 --> 00:55:11,010 It's going pretty well. 818 00:55:11,010 --> 00:55:15,626 And maybe we can do the same thing. 819 00:55:20,940 --> 00:55:24,190 We'll see that, in counting, you really 820 00:55:24,190 --> 00:55:26,260 have to take a lot of care. 821 00:55:26,260 --> 00:55:28,630 So maybe you can already see what's 822 00:55:28,630 --> 00:55:32,300 happening when I start reasoning in the exact same way as 823 00:55:32,300 --> 00:55:34,130 before. 824 00:55:34,130 --> 00:55:36,950 So let me first define what I want to count. 825 00:55:36,950 --> 00:55:43,750 It's a hand that have exactly two pairs. 826 00:55:43,750 --> 00:55:44,850 So what does that mean? 827 00:55:44,850 --> 00:55:53,680 It means that there is-- that we have two cards of one value 828 00:55:53,680 --> 00:55:56,870 and another two cards of another value. 829 00:56:07,900 --> 00:56:12,190 So let's start out as before. 830 00:56:12,190 --> 00:56:14,820 We're going to write out a representation 831 00:56:14,820 --> 00:56:18,660 and see whether we can do this properly. 832 00:56:18,660 --> 00:56:25,470 So we're going to use the exact same technique. 833 00:56:25,470 --> 00:56:28,150 So first of all, we're going to choose 834 00:56:28,150 --> 00:56:30,380 the value of the first pair. 835 00:56:37,080 --> 00:56:40,580 Now, how many ways can I do this? 836 00:56:40,580 --> 00:56:42,770 Well, I can do this in 13 ways. 837 00:56:42,770 --> 00:56:44,350 Any possible value is possible. 838 00:56:48,320 --> 00:56:52,810 I need to choose the suits of the first pair. 839 00:56:56,280 --> 00:56:57,740 And how many ways can I do this? 840 00:56:57,740 --> 00:56:59,670 Well, I use the same techniques as over here, 841 00:56:59,670 --> 00:57:04,500 so it's any possible way to choose two elements out 842 00:57:04,500 --> 00:57:09,260 of a set of four which represent all the suits. 843 00:57:09,260 --> 00:57:12,300 So that's 4 choose 2. 844 00:57:19,140 --> 00:57:21,350 Then, three, we're going to choose 845 00:57:21,350 --> 00:57:24,520 the value of the second pair. 846 00:57:28,340 --> 00:57:31,600 Well, that's easy because the second pair, by definition, 847 00:57:31,600 --> 00:57:36,050 must have a different value than the one in the first pair. 848 00:57:36,050 --> 00:57:38,330 Well, I've already chosen one value 849 00:57:38,330 --> 00:57:41,780 so I have 12 choices left. 850 00:57:41,780 --> 00:57:43,518 So that's no problem. 851 00:57:49,870 --> 00:57:53,430 And now we can continue and do the same thing. 852 00:57:53,430 --> 00:57:55,850 So we're going to count the number of suites that are 853 00:57:55,850 --> 00:57:58,420 possible for the second pair. 854 00:58:01,310 --> 00:58:06,870 And it's the same number as we have for the first pair. 855 00:58:06,870 --> 00:58:10,820 So we have a number of suits of the second pair. 856 00:58:10,820 --> 00:58:14,490 Again, we need to choose two suits out 857 00:58:14,490 --> 00:58:18,470 of the complete set of suits, which has four possibilities. 858 00:58:18,470 --> 00:58:20,790 So it's 4 choose 2. 859 00:58:20,790 --> 00:58:25,870 And now we can have still a choice for the last cards. 860 00:58:25,870 --> 00:58:27,510 We have now two pairs. 861 00:58:27,510 --> 00:58:29,220 We still have a fifth card. 862 00:58:29,220 --> 00:58:31,230 The fifth card also has a value. 863 00:58:33,800 --> 00:58:35,560 Actually, I did not write it down, 864 00:58:35,560 --> 00:58:38,660 but if we talk about a hand with two pairs, 865 00:58:38,660 --> 00:58:42,640 we mean two cards of one value, two cards of another value, 866 00:58:42,640 --> 00:58:47,000 and the fifth card-- the extra card-- has yet another value. 867 00:58:47,000 --> 00:58:49,370 Because otherwise you would have a full house 868 00:58:49,370 --> 00:58:52,610 and we have already counted those. 869 00:58:52,610 --> 00:58:53,110 OK. 870 00:58:53,110 --> 00:58:58,140 So value of the extra card. 871 00:58:58,140 --> 00:59:00,230 Well, I've chosen already two values. 872 00:59:00,230 --> 00:59:03,110 The one for the first pair, the one of the second pair, 873 00:59:03,110 --> 00:59:05,830 so there are 11 choices left. 874 00:59:05,830 --> 00:59:10,390 And finally, I can choose a suit of the extra card. 875 00:59:10,390 --> 00:59:16,320 Well, I have one out of four choices for my suit. 876 00:59:16,320 --> 00:59:19,900 So again we can use the generalized product rule 877 00:59:19,900 --> 00:59:26,690 and we can say that we have 30 choices for my first entry 878 00:59:26,690 --> 00:59:28,500 in my presentation. 879 00:59:28,500 --> 00:59:29,000 Right? 880 00:59:29,000 --> 00:59:32,980 For the first choice. 881 00:59:32,980 --> 00:59:34,970 Then given the first choice, I have 4 choose 882 00:59:34,970 --> 00:59:37,190 2 choices for the second. 883 00:59:37,190 --> 00:59:39,936 And then 12 choices for the third 884 00:59:39,936 --> 00:59:41,580 if I've already chosen the first two. 885 00:59:41,580 --> 00:59:42,750 And so on. 886 00:59:42,750 --> 00:59:47,090 So I can use the generalized product rule 887 00:59:47,090 --> 00:59:50,520 and count these representations. 888 00:59:50,520 --> 00:59:54,980 So the number of representations is actually 889 00:59:54,980 --> 01:00:01,720 equal to 13 times 4 choose 2 times 12 times 890 01:00:01,720 --> 01:00:07,241 4 choose 2 again times 11 times 4 choose 1. 891 01:00:10,130 --> 01:00:15,230 So is this a number of the hands with two pairs? 892 01:00:15,230 --> 01:00:16,930 So this seems to be pretty reasonable. 893 01:00:16,930 --> 01:00:23,780 But can you see something that has happened here that we also 894 01:00:23,780 --> 01:00:25,290 saw actually last lecture? 895 01:00:27,810 --> 01:00:32,520 Like, do I know for sure that the hands with two pairs 896 01:00:32,520 --> 01:00:38,820 is-- well, that are this number of hands with two pairs. 897 01:00:38,820 --> 01:00:43,100 What do I need to check in order to make sure that that is true? 898 01:00:43,100 --> 01:00:47,800 Well, I need to make-- I need to prove, essentially, 899 01:00:47,800 --> 01:00:49,690 that this representation is actually 900 01:00:49,690 --> 01:00:52,340 bijection from the hands with two pairs 901 01:00:52,340 --> 01:00:55,470 to this types of sequences. 902 01:00:55,470 --> 01:00:57,740 So is that true? 903 01:00:57,740 --> 01:01:00,495 Or does this mapping have a different property? 904 01:01:03,100 --> 01:01:06,988 Any ideas? 905 01:01:06,988 --> 01:01:07,488 Yeah? 906 01:01:07,488 --> 01:01:09,396 Over there. 907 01:01:09,396 --> 01:01:10,247 AUDIENCE: No. 908 01:01:10,247 --> 01:01:10,830 PROFESSOR: No? 909 01:01:10,830 --> 01:01:12,505 You don't want to answer? 910 01:01:12,505 --> 01:01:13,990 OK. 911 01:01:13,990 --> 01:01:22,270 Well, let me-- when we talked about the chess game last time, 912 01:01:22,270 --> 01:01:25,620 or with the rooks, we could essentially 913 01:01:25,620 --> 01:01:28,800 had two rooks that we could choose and put them 914 01:01:28,800 --> 01:01:33,950 on different positions with no shared rows or shared columns. 915 01:01:33,950 --> 01:01:39,780 And here we have two pairs with no shared suit-- with no shared 916 01:01:39,780 --> 01:01:41,080 values. 917 01:01:41,080 --> 01:01:42,640 But what can we do? 918 01:01:42,640 --> 01:01:46,850 We can actually interchange the first and the second pair. 919 01:01:46,850 --> 01:01:54,340 So as an example, we can have two representations 920 01:01:54,340 --> 01:01:55,730 that map to the same hand. 921 01:01:55,730 --> 01:01:56,880 So let me give an example. 922 01:01:56,880 --> 01:01:59,300 So for example, suppose you choose the value 923 01:01:59,300 --> 01:02:02,810 3 for the first pair and then I'm 924 01:02:02,810 --> 01:02:08,730 choosing the set diamonds and clubs for the suits of those. 925 01:02:08,730 --> 01:02:15,020 And say the second pair is a queen of diamonds and hearts. 926 01:02:15,020 --> 01:02:18,370 And finally, I have an ace of clubs. 927 01:02:18,370 --> 01:02:22,090 Well, this would be a proper sequence according 928 01:02:22,090 --> 01:02:24,070 to this representation. 929 01:02:24,070 --> 01:02:26,210 But this maps to a hand that does also 930 01:02:26,210 --> 01:02:30,540 map to if we interchange the first and the second pair. 931 01:02:30,540 --> 01:02:36,020 We can also start off with the queen for the first pair 932 01:02:36,020 --> 01:02:38,500 and we have diamonds and hearts. 933 01:02:38,500 --> 01:02:44,515 And we have three for the second pair with diamonds and clubs. 934 01:02:47,440 --> 01:02:50,110 And then we finally have the fifth card which 935 01:02:50,110 --> 01:02:52,820 is the same, the ace of clubs. 936 01:02:52,820 --> 01:02:57,730 Now these map to exactly the same hand. 937 01:02:57,730 --> 01:03:00,495 We just need to change the first and the second pair. 938 01:03:00,495 --> 01:03:10,020 Now this is a kind of problem or a mental sort of confusion 939 01:03:10,020 --> 01:03:11,760 that very easily happened. 940 01:03:11,760 --> 01:03:14,920 This is a rather easy example where you can see it. 941 01:03:14,920 --> 01:03:17,860 But if you do counting, we really 942 01:03:17,860 --> 01:03:22,660 have to take care that we make sure that each 943 01:03:22,660 --> 01:03:26,920 of the sequences in this representation 944 01:03:26,920 --> 01:03:32,450 are really represented by, say, one hand, in this case, 945 01:03:32,450 --> 01:03:34,000 with two pairs. 946 01:03:34,000 --> 01:03:36,430 But how can we remedy this? 947 01:03:36,430 --> 01:03:42,570 It turns that we can-- by interchanging these two pairs, 948 01:03:42,570 --> 01:03:46,000 these two sequences are the only two sequences 949 01:03:46,000 --> 01:03:47,990 that map to the same hand. 950 01:03:47,990 --> 01:03:50,200 So we know that this is not a bijection 951 01:03:50,200 --> 01:03:54,090 but it is a 2-to-1 mapping. 952 01:03:54,090 --> 01:03:59,590 So now we can choose-- we can use the division rule. 953 01:03:59,590 --> 01:04:06,220 And by the division rule we now know 954 01:04:06,220 --> 01:04:14,530 that the number of hands with two pairs 955 01:04:14,530 --> 01:04:20,070 is actually equal to this whole thing over here divided by 2 956 01:04:20,070 --> 01:04:23,448 because we have a 2-to-1 function. 957 01:04:23,448 --> 01:04:25,810 Now, this is really something that 958 01:04:25,810 --> 01:04:27,310 is pretty disturbing because we have 959 01:04:27,310 --> 01:04:29,340 a near miss in our reasoning. 960 01:04:32,770 --> 01:04:34,510 And therefore, it is important to keep 961 01:04:34,510 --> 01:04:38,250 in mind the following guidelines when we do counting. 962 01:04:44,170 --> 01:04:47,230 It's very important to, first of all, check 963 01:04:47,230 --> 01:04:49,060 whether it's truly a bijection. 964 01:04:49,060 --> 01:04:55,970 And you need to know how many sequences or maps to the same-- 965 01:04:55,970 --> 01:04:57,350 to the same hand. 966 01:04:57,350 --> 01:05:01,612 So the guidelines are as follows. 967 01:05:01,612 --> 01:05:05,330 They're pretty straightforward actually. 968 01:05:05,330 --> 01:05:09,420 First of all, if we have a function 969 01:05:09,420 --> 01:05:14,470 f that maps from A to B, then we would really 970 01:05:14,470 --> 01:05:19,250 like to check very carefully whether the number-- what 971 01:05:19,250 --> 01:05:24,580 is the number of elements of A that are 972 01:05:24,580 --> 01:05:38,380 mapped to each element of B? 973 01:05:38,380 --> 01:05:43,080 So we check how many to one of a mapping this really is. 974 01:05:43,080 --> 01:05:47,760 And after this we will then apply the division rule. 975 01:05:51,710 --> 01:05:53,870 It's very important to check this. 976 01:05:53,870 --> 01:05:56,980 But very often, we're making mistakes. 977 01:05:56,980 --> 01:05:58,920 For example, right now I'm doing some research 978 01:05:58,920 --> 01:06:01,030 and I've been counting something. 979 01:06:01,030 --> 01:06:06,689 Turns out it-- if I use a different method 980 01:06:06,689 --> 01:06:08,730 to count the same thing I get a different answer. 981 01:06:08,730 --> 01:06:10,820 So I made a mistake somewhere. 982 01:06:10,820 --> 01:06:13,590 So that's the second guideline. 983 01:06:13,590 --> 01:06:17,360 So what you want to do is you want to try 984 01:06:17,360 --> 01:06:19,704 and solving a problem in multiple ways. 985 01:06:23,420 --> 01:06:27,680 So try solving a problem in a different way. 986 01:06:27,680 --> 01:06:30,010 And especially with counting this is very helpful. 987 01:06:33,290 --> 01:06:36,420 So this will lead to an extra check. 988 01:06:36,420 --> 01:06:38,545 So we will do that for this particular example. 989 01:06:42,340 --> 01:06:44,270 And it generally would always like 990 01:06:44,270 --> 01:06:49,780 to find multiple ways to prove things, I would say, 991 01:06:49,780 --> 01:06:55,160 because at least you want to have multiple-- maybe not 992 01:06:55,160 --> 01:06:57,630 a complete proof but subparts of proofs-- 993 01:06:57,630 --> 01:07:00,480 you may want to find different ways why that is true. 994 01:07:00,480 --> 01:07:05,380 So that's how I usually do my proofing of things. 995 01:07:05,380 --> 01:07:11,370 So let's find a second way to count this over here, 996 01:07:11,370 --> 01:07:13,720 to do the double check. 997 01:07:13,720 --> 01:07:18,220 So we're going to create a different representation that 998 01:07:18,220 --> 01:07:22,750 should actually lead to a bijection. 999 01:07:22,750 --> 01:07:24,675 So I want to find a representation that's 1000 01:07:24,675 --> 01:07:29,020 a bijection, a 1-to-1 mapping. 1001 01:07:29,020 --> 01:07:31,730 So how do we do this? 1002 01:07:31,730 --> 01:07:41,090 I can-- let me see where I am. 1003 01:07:41,090 --> 01:07:41,590 OK. 1004 01:07:41,590 --> 01:07:48,470 So what I could do is, first of all, 1005 01:07:48,470 --> 01:07:54,260 I can choose the values of the two pairs. 1006 01:07:54,260 --> 01:07:59,220 So in this case, I have the values 3 and the queen. 1007 01:07:59,220 --> 01:08:01,700 So how many choices do I have? 1008 01:08:01,700 --> 01:08:04,000 Well, I can choose two out of 13 choices. 1009 01:08:06,790 --> 01:08:11,340 Secondly, I'm going to describe the suit of the smaller 1010 01:08:11,340 --> 01:08:15,920 pair which is uniquely defined because they have two values. 1011 01:08:15,920 --> 01:08:18,430 One is smaller and the suit of the smaller 1012 01:08:18,430 --> 01:08:27,500 pair I can choose by taking one out the four-- two out of four 1013 01:08:27,500 --> 01:08:32,950 choices because I need to choose two suits for the smaller pair. 1014 01:08:32,950 --> 01:08:34,840 For the larger pair, I do the same. 1015 01:08:38,020 --> 01:08:41,680 And I get 4 choose 2. 1016 01:08:41,680 --> 01:08:45,936 Now, again, I have the value of the extra card. 1017 01:08:49,359 --> 01:08:51,399 And I have 11 choices. 1018 01:08:51,399 --> 01:08:56,090 I have already chosen two so there are 11 choices left. 1019 01:08:56,090 --> 01:09:00,600 And finally, the suit for the extra card 1020 01:09:00,600 --> 01:09:03,660 can be done in 4 choose 1 ways. 1021 01:09:03,660 --> 01:09:06,290 So if you multiply those together, 1022 01:09:06,290 --> 01:09:10,990 we get 13 times 12 divided by 2. 1023 01:09:10,990 --> 01:09:18,310 And then we get times 4 choose 2 times 4 choose 2 times 11 times 1024 01:09:18,310 --> 01:09:19,779 4 choose 1. 1025 01:09:19,779 --> 01:09:22,359 And we can see that that's exactly the same 1026 01:09:22,359 --> 01:09:25,390 as this whole product divided by 2. 1027 01:09:25,390 --> 01:09:27,490 We actually have a bijection. 1028 01:09:27,490 --> 01:09:30,870 This particular representation is a 1-to-1 mapping. 1029 01:09:30,870 --> 01:09:33,290 So it's always good to find a second way 1030 01:09:33,290 --> 01:09:49,910 to prove the same result. 1031 01:09:49,910 --> 01:09:50,410 OK. 1032 01:09:54,104 --> 01:09:54,895 Let me do one more. 1033 01:09:59,660 --> 01:10:00,660 Let's do that over here. 1034 01:10:05,480 --> 01:10:08,870 Just to make sure that you really understand this stuff, 1035 01:10:08,870 --> 01:10:15,030 I'm going to count hands that have each suit in it. 1036 01:10:15,030 --> 01:10:21,450 So I want to count the hands with every suit. 1037 01:10:24,710 --> 01:10:38,020 So as an example, I can have, say, the 7 of diamonds, 1038 01:10:38,020 --> 01:10:44,080 the King of clubs, the 3 of diamonds, the Ace of hearts, 1039 01:10:44,080 --> 01:10:46,090 and the 2 of spades. 1040 01:10:46,090 --> 01:10:47,710 Why is this a proper hand? 1041 01:10:47,710 --> 01:10:51,470 Because I can see the diamonds, the clubs, the hearts, 1042 01:10:51,470 --> 01:10:52,200 and the spades. 1043 01:10:52,200 --> 01:10:56,725 So I have a hand in which every suit is represented. 1044 01:10:59,370 --> 01:11:02,520 So what do I do for my representation? 1045 01:11:02,520 --> 01:11:15,150 Well, I can have the values of each suit 1046 01:11:15,150 --> 01:11:17,870 and I assign a specific order to those. 1047 01:11:17,870 --> 01:11:23,090 So I want to represent for the diamonds and the clubs 1048 01:11:23,090 --> 01:11:25,830 and the heart and the spade. 1049 01:11:25,830 --> 01:11:29,440 I want to find out what values do I really have. 1050 01:11:29,440 --> 01:11:41,320 So values of each suit in the order D, C, hearts and spades. 1051 01:11:41,320 --> 01:11:43,610 And how many ways do I have? 1052 01:11:43,610 --> 01:11:47,876 Well, I have 13 values for the 7, 1053 01:11:47,876 --> 01:11:51,330 I have 13 values for the King-- for this one, 1054 01:11:51,330 --> 01:11:54,210 for this value, 13 values for that one and 13 1055 01:11:54,210 --> 01:11:56,690 values for this one. 1056 01:11:56,690 --> 01:12:00,430 So that is pretty straightforward. 1057 01:12:00,430 --> 01:12:02,130 Now, we still have the extra card. 1058 01:12:02,130 --> 01:12:10,340 And the extra card has a suit which 1059 01:12:10,340 --> 01:12:14,950 I can do in four ways because of four choices. 1060 01:12:14,950 --> 01:12:18,540 And finally, it also has a value. 1061 01:12:21,500 --> 01:12:27,520 And the value is-- it's actually-- so how much is this? 1062 01:12:27,520 --> 01:12:29,430 Can this be 13? 1063 01:12:29,430 --> 01:12:31,920 Are there 13 values? 1064 01:12:31,920 --> 01:12:32,910 No, not really, right? 1065 01:12:32,910 --> 01:12:37,580 Because for each possible given suit that I've chosen, 1066 01:12:37,580 --> 01:12:43,880 I already chose a value before when 1067 01:12:43,880 --> 01:12:48,610 I chose a value for the suit that I did over here. 1068 01:12:48,610 --> 01:12:52,030 So for example, this one cannot be the 7, 1069 01:12:52,030 --> 01:12:53,330 it has to be something else. 1070 01:12:53,330 --> 01:12:55,100 There are 12 choices. 1071 01:12:55,100 --> 01:12:57,550 If I would have chose a different suit, 1072 01:12:57,550 --> 01:12:59,400 for example hearts, then I would not 1073 01:12:59,400 --> 01:13:01,800 be able to choose the Ace because I already have chosen 1074 01:13:01,800 --> 01:13:04,050 the Ace in the first step. 1075 01:13:04,050 --> 01:13:07,890 So I have 12 possibilities here. 1076 01:13:07,890 --> 01:13:11,260 So this is not 13. 1077 01:13:11,260 --> 01:13:13,630 You may want to check that again. 1078 01:13:13,630 --> 01:13:19,690 So now let's give the representation for this one. 1079 01:13:19,690 --> 01:13:23,180 So I can have diamonds, clubs-- so let's see, in the order 1080 01:13:23,180 --> 01:13:24,260 of diamonds, clubs. 1081 01:13:24,260 --> 01:13:28,640 So I have the 7, I have a King, I 1082 01:13:28,640 --> 01:13:34,000 have for hearts I have an Ace, for spades I have a 2. 1083 01:13:34,000 --> 01:13:38,450 Then I have the suit for the extra card which is a diamonds. 1084 01:13:38,450 --> 01:13:42,990 And then a value which is a 3. 1085 01:13:42,990 --> 01:13:44,960 Now we are going to check according 1086 01:13:44,960 --> 01:13:49,080 to our guidelines over here. 1087 01:13:49,080 --> 01:13:51,370 We're going to check the number of elements 1088 01:13:51,370 --> 01:13:55,160 that are-- the number of sequences that 1089 01:13:55,160 --> 01:13:59,940 map to the same hand over here. 1090 01:13:59,940 --> 01:14:02,830 So is this a bijection? 1091 01:14:02,830 --> 01:14:03,690 It's not, right? 1092 01:14:07,100 --> 01:14:09,200 So why is this not a bijection? 1093 01:14:09,200 --> 01:14:14,450 Well, we can also have the following situation 1094 01:14:14,450 --> 01:14:18,340 where we swap the 3 diamonds and the 7 diamonds around. 1095 01:14:18,340 --> 01:14:21,800 So we choose the 3 for the diamonds 1096 01:14:21,800 --> 01:14:25,440 and then we have the King, the Ace and the 2. 1097 01:14:25,440 --> 01:14:28,070 then we have the fifth card which is also diamonds, 1098 01:14:28,070 --> 01:14:31,530 but now it's the 7. 1099 01:14:31,530 --> 01:14:37,720 Well, this one also maps to this particular hand. 1100 01:14:37,720 --> 01:14:41,370 So we have a 2-to-1 mapping. 1101 01:14:41,370 --> 01:14:45,420 And we conclude that the total number of hands, 1102 01:14:45,420 --> 01:14:50,630 where every suit is represented, is 13 to the power 4 times 1103 01:14:50,630 --> 01:14:54,600 4 times 12 by the generalized product rule. 1104 01:14:54,600 --> 01:14:58,970 And now by the division rule, we have to still divide by 2. 1105 01:14:58,970 --> 01:15:00,376 So that's the total number. 1106 01:15:03,120 --> 01:15:03,620 OK. 1107 01:15:03,620 --> 01:15:07,950 So now we come to combinatorial proofs. 1108 01:15:07,950 --> 01:15:12,095 So this is a new proof technique. 1109 01:15:17,382 --> 01:15:18,840 And what we're going to do is we're 1110 01:15:18,840 --> 01:15:22,610 going to count a set in two different ways. 1111 01:15:22,610 --> 01:15:27,440 And that will lead to a combinatorial equation. 1112 01:15:27,440 --> 01:15:32,890 So the whole idea is as follows. 1113 01:15:32,890 --> 01:15:34,680 So let me give an example first. 1114 01:15:39,640 --> 01:15:44,270 So for a combinatorial proof, for example, 1115 01:15:44,270 --> 01:15:51,460 suppose I have n shirts and I want 1116 01:15:51,460 --> 01:16:01,760 to choose-- I want to keep k and I want to trash n minus k. 1117 01:16:01,760 --> 01:16:07,050 So how do I count the number of choices that I have? 1118 01:16:07,050 --> 01:16:10,916 Well, I can choose, out of n, I can choose the k keepers. 1119 01:16:13,490 --> 01:16:15,460 But I also can count it in a different way. 1120 01:16:15,460 --> 01:16:19,680 I can also count this as how many ways 1121 01:16:19,680 --> 01:16:22,390 I can select the trashers. 1122 01:16:22,390 --> 01:16:28,910 So there are n minus k out of n shirts that I will trash. 1123 01:16:28,910 --> 01:16:35,220 So there are two different ways to count the same choices 1124 01:16:35,220 --> 01:16:36,670 that I have. 1125 01:16:36,670 --> 01:16:42,130 So we have an equation over here. 1126 01:16:42,130 --> 01:16:45,040 And you already know this one because by the definition 1127 01:16:45,040 --> 01:16:48,540 of the binomial coefficient, we have 1128 01:16:48,540 --> 01:16:51,080 that this is equal to this. 1129 01:16:51,080 --> 01:16:53,000 And so it's pretty straightforward. 1130 01:16:53,000 --> 01:16:56,070 It's equal to this one over here. 1131 01:16:56,070 --> 01:16:58,990 But the idea is that we're going to count 1132 01:16:58,990 --> 01:17:00,510 a set in two different ways. 1133 01:17:00,510 --> 01:17:08,820 So another example is where we have the following. 1134 01:17:08,820 --> 01:17:18,660 We choose a team of k elements. 1135 01:17:26,790 --> 01:17:31,180 Of k elements out of-- oh, actually, I'm 1136 01:17:31,180 --> 01:17:32,280 talking about a team. 1137 01:17:32,280 --> 01:17:34,640 I was talking about students here. 1138 01:17:34,640 --> 01:17:35,655 Of k students. 1139 01:17:38,620 --> 01:17:40,750 Out of n students. 1140 01:17:40,750 --> 01:17:44,260 Now, how many ways can I do this? 1141 01:17:44,260 --> 01:17:47,450 Well, n choose k, right? 1142 01:17:47,450 --> 01:17:49,440 Well, there is a way to count this differently. 1143 01:17:49,440 --> 01:17:56,360 I could also say, well, let's first count the total number 1144 01:17:56,360 --> 01:18:02,980 of ways in which I choose k students that includes Bob. 1145 01:18:02,980 --> 01:18:05,260 So let's do that. 1146 01:18:05,260 --> 01:18:13,050 So Bob is one of the students, and if I 1147 01:18:13,050 --> 01:18:18,860 count the number of teams with Bob, 1148 01:18:18,860 --> 01:18:20,270 how many choices do I have? 1149 01:18:24,480 --> 01:18:25,590 I choose Bob. 1150 01:18:25,590 --> 01:18:29,650 I still need to choose k minus 1 students out of the remaining 1151 01:18:29,650 --> 01:18:30,770 n minus 1 students. 1152 01:18:30,770 --> 01:18:32,330 So I have taken out Bob. 1153 01:18:32,330 --> 01:18:34,700 So there are n minus 1 students left 1154 01:18:34,700 --> 01:18:36,935 and I still need to choose k minus 1 students. 1155 01:18:39,920 --> 01:18:45,820 The other possibility is that we have teams that-- in which 1156 01:18:45,820 --> 01:18:48,880 Bob is not represented. 1157 01:18:48,880 --> 01:18:54,310 So now we need to choose k students out 1158 01:18:54,310 --> 01:18:56,980 off all the students minus Bob. 1159 01:18:56,980 --> 01:19:01,190 So we have n minus 1 choose k. 1160 01:19:01,190 --> 01:19:05,350 So by the sum rule, we can just add those two together 1161 01:19:05,350 --> 01:19:09,050 and that should be equal to all the possibilities 1162 01:19:09,050 --> 01:19:12,070 to choose team of k students. 1163 01:19:12,070 --> 01:19:12,990 So what do I see? 1164 01:19:12,990 --> 01:19:18,070 I see that n minus 1 choose k minus 1 plus n minus 1 choose 1165 01:19:18,070 --> 01:19:23,270 k should be equal to-- well, before I counted it 1166 01:19:23,270 --> 01:19:29,330 as this-- so it should be equal to n choose k. 1167 01:19:29,330 --> 01:19:32,495 And this is called Pascal's Identity. 1168 01:19:35,820 --> 01:19:39,110 And the general idea is is that we do the following. 1169 01:19:39,110 --> 01:19:46,710 So we are actually counting a set in two different ways. 1170 01:19:46,710 --> 01:19:49,990 That's what we did so far. 1171 01:19:49,990 --> 01:19:52,980 And when you solve these types of problems, 1172 01:19:52,980 --> 01:19:58,740 the difficulty is that you will need to define the set S. 1173 01:19:58,740 --> 01:20:00,240 So usually you get a problem, you 1174 01:20:00,240 --> 01:20:03,830 need to prove some equation like this. 1175 01:20:03,830 --> 01:20:07,790 So you define a set S. That's the hard part of it. 1176 01:20:07,790 --> 01:20:12,590 Then we are going to show that the cardinality of S 1177 01:20:12,590 --> 01:20:17,550 is some number n, say, in one way. 1178 01:20:17,550 --> 01:20:19,770 So we have one method to do this. 1179 01:20:19,770 --> 01:20:20,680 By counting. 1180 01:20:23,870 --> 01:20:33,210 And we will show that S is also equal to some other number-- 1181 01:20:33,210 --> 01:20:35,260 like, in this case, we had one number 1182 01:20:35,260 --> 01:20:38,600 and this was my second one-- also by counting. 1183 01:20:38,600 --> 01:20:43,270 And then we can conclude that n-- 1184 01:20:43,270 --> 01:20:47,532 so we conclude that n equals m. 1185 01:20:50,400 --> 01:20:52,440 So we're almost done because I'm going 1186 01:20:52,440 --> 01:20:58,980 to prove to you a very simple equation using this technique. 1187 01:20:58,980 --> 01:21:03,312 But it is not as trivial as the one that we saw just now. 1188 01:21:06,790 --> 01:21:08,570 What we do now is the following. 1189 01:21:08,570 --> 01:21:11,380 We want to prove a theorem that says 1190 01:21:11,380 --> 01:21:17,320 that if a sum r is 0 all the way up to n, then, 1191 01:21:17,320 --> 01:21:20,520 if you take the product of the following binomial coefficients 1192 01:21:20,520 --> 01:21:26,370 n choose r times 2n choose n minus r, 1193 01:21:26,370 --> 01:21:30,460 this is equal to 3n choose n. 1194 01:21:30,460 --> 01:21:32,670 We need to prove this. 1195 01:21:32,670 --> 01:21:34,950 So we need to find the proper set. 1196 01:21:34,950 --> 01:21:36,249 So how can we think about it? 1197 01:21:36,249 --> 01:21:37,790 Well, the idea is that we're probably 1198 01:21:37,790 --> 01:21:43,020 going to choose n elements out of 3n elements. 1199 01:21:43,020 --> 01:21:45,620 We're going to do it in a special way. 1200 01:21:45,620 --> 01:21:50,890 And so the proof will be as follows. 1201 01:21:50,890 --> 01:22:05,050 We take S to be all the subsets of n balls chosen 1202 01:22:05,050 --> 01:22:19,990 from a basket of n red balls and 2n green balls. 1203 01:22:19,990 --> 01:22:22,540 And this will do the trick. 1204 01:22:22,540 --> 01:22:25,310 So how do we do this? 1205 01:22:25,310 --> 01:22:32,690 We're going to first choose the red balls and then 1206 01:22:32,690 --> 01:22:35,110 the green balls. 1207 01:22:35,110 --> 01:22:40,360 So let's first count S in the very easy way. 1208 01:22:40,360 --> 01:22:44,570 Well, I just choose n balls out of a basket of 3n balls. 1209 01:22:44,570 --> 01:22:47,100 I don't care how many green or red balls I have. 1210 01:22:47,100 --> 01:22:51,465 So I have really 3n choose n choices. 1211 01:22:53,990 --> 01:23:09,660 This is the number of n element subsets from a 3n element set. 1212 01:23:09,660 --> 01:23:10,507 So that's easy. 1213 01:23:14,710 --> 01:23:16,860 Now, we can also count it in a different way. 1214 01:23:16,860 --> 01:23:22,480 We first of all wonder about the number of subsets 1215 01:23:22,480 --> 01:23:26,430 with exactly r red balls. 1216 01:23:26,430 --> 01:23:28,710 So how many are there? 1217 01:23:28,710 --> 01:23:32,220 Well, we choose r red balls so we have n red balls. 1218 01:23:32,220 --> 01:23:35,760 So we need to choose r out of those. 1219 01:23:35,760 --> 01:23:38,690 Now, in total, I need to choose n balls. 1220 01:23:38,690 --> 01:23:41,700 So I still need to choose n minus r balls out 1221 01:23:41,700 --> 01:23:43,830 of the set of green balls. 1222 01:23:43,830 --> 01:23:46,950 I have 2n green balls. 1223 01:23:46,950 --> 01:23:50,630 I'm going to choose n minus r green balls over here. 1224 01:23:50,630 --> 01:23:55,130 So these are the red balls that I select and here 1225 01:23:55,130 --> 01:23:57,420 are the green balls. 1226 01:23:57,420 --> 01:23:59,500 Now we'll use the sum rule. 1227 01:23:59,500 --> 01:24:01,760 And I add all the different possible subsets 1228 01:24:01,760 --> 01:24:05,310 with 0 red balls, with 1 red ball, 2 red balls, 1229 01:24:05,310 --> 01:24:07,960 all the way up to n red balls. 1230 01:24:07,960 --> 01:24:19,360 So essentially, I get the sum by the sum rule of r 0 1231 01:24:19,360 --> 01:24:25,330 all the way up to n where I count the number of subsets 1232 01:24:25,330 --> 01:24:27,730 with exactly r red balls. 1233 01:24:27,730 --> 01:24:31,110 So that means I can choose r out of the n red balls 1234 01:24:31,110 --> 01:24:37,190 and another n minus r out of the 2n balls-- 2n green balls. 1235 01:24:37,190 --> 01:24:39,360 So now we equate those two together 1236 01:24:39,360 --> 01:24:41,430 and that proves the theorem. 1237 01:24:41,430 --> 01:24:45,710 So the really hard part in this type of proofs 1238 01:24:45,710 --> 01:24:51,130 is that you need some creativity to find and define that set S 1239 01:24:51,130 --> 01:24:53,020 and see how that would work. 1240 01:24:53,020 --> 01:24:56,230 And the way to do that usually is to look at this equation 1241 01:24:56,230 --> 01:24:58,390 and then say, oh, wait a minute, I'm 1242 01:24:58,390 --> 01:25:02,860 going to talk about sets because I choose n out of 3n over here. 1243 01:25:02,860 --> 01:25:04,940 So out of 3n elements. 1244 01:25:04,940 --> 01:25:07,810 And maybe I can divide up the sets 1245 01:25:07,810 --> 01:25:09,780 in some kind of specific choice. 1246 01:25:09,780 --> 01:25:11,540 So tomorrow during recitation you 1247 01:25:11,540 --> 01:25:15,630 will also see combinatorial proof. 1248 01:25:15,630 --> 01:25:17,680 Thank you.