 Hi, I'm Zor. Welcome to Unisor Education. I would like to continue talking about combinations. This is part of the combinatorics part of this course. And as usually I do recommend you to watch this lecture on Unisor.com rather than just on YouTube or any other website because Unisor.com is an educational website which has notes for every lecture and it also allows you to organize the whole educational process around this course. Alright, so today's topic is combination with repetitions. Well, we have already covered the regular combinations and for the purposes of this lecture I would like to very, very briefly repeat how to come up with a formula for the number of regular combinations. So, assuming we have n different objects, all objects are different and we are picking k out of these n objects. The question is how many different ways of picking is possible. And one of the simplest methods is to build the following model of this process of picking the combination. So, first I assume that I put all my n objects into the roll in some particular order and there are, as we know, n factorial of different ways to position n objects in some specific order. Then I cut k objects from the beginning, leaving n minus k objects to the right. Let's call this head and this is tail of my ordered sequence. Now, obviously all the combinations within the head itself produce exactly the same picking. It's the same k objects which are picked no matter how many times I permute, I change the order within these k's. Similarly, no matter how many times I change the order here, I still have the same combination picked. But any other change when they are exchanging the objects does produce a different one. So, if every one of these combinations, permutations and every one of these combinations produce exactly the same pick out of n factorial, I have to basically divide it by k factorial and n minus k factorial to basically glue together, if you wish, all these permutations of the entire set into the groups when the result of picking is actually the same. So, it's k factorial of these permutations and n minus k factorial of these. So, any permutations within actually are producing the same combination which I have picked. Now, it's not just a repetition which is my purpose to derive this formula again. There is a, I would say, educational sense in repeating this. And what's the educational lesson? You have to pick the right model of the process which you are involved. So, in this particular process of picking up a certain number of objects out of a bigger set, I have chosen to model this process through putting in the order of the entire set, cutting off the head of this as my pick, and then analyzing each one of the parts which I am breaking the whole set in. And that actually allows me to derive the formula. Okay, now we will consider a different problem. It's also about combinations but it's a different kind of combinations which obviously doesn't really seem to be like producing a formula immediately right up front. You still have to do some clever modeling, if you wish. So, let me explain what I mean. Now, what is the combinations with repetition? Well, in the previous case, I had n different objects and as soon as I pick one, there is less left obviously, right? So, I picked the first k and there is n minus k left. Now, in this case, we can explain it in two different ways. One is, as soon as I pick an object, I record what exactly the object I picked and I put it back into the set. So, I always have exactly the same set of n different things to choose from. Now, it obviously completely changes the picture. Another explanation of exactly the same would be, instead of putting back the same object, I assume that there is some other object of the same type actually, replacing the one which I have picked. And the particular example which I am using in the notes for this lecture on Unizor.com is consider you are buying certain number of bottles of wine and you come to the store and let's just for simplicity, decide the following. The store has only three types of wine. Let's say red, white and sparkling. Well, that's just easier for the purpose of this. So, let's say we have only three types of wine and I have to pick up five bottles. Now, in the previous, in the regular combination, obviously I cannot pick more than I have. So, k was always restricted on the top by n. But in this case, since I'm returning back or I have an unlimited store, unlimited quantities of the wine of each type in the store. Well, presuming unlimited. Then, my k can be any number, can be greater than n in this case. So, in this case, n is equal to 3 and k number of picks which I have to make is 5. So, I have to make a pick of five different bottles of wine and I have these three different types of wine. So, obviously, whenever I pick the red wine, there is still some red wine left in the store. Well, that's what store is for, right? So, now I have to come up with the formula which gives me, again, the same thing as before, number of different combinations. Now, I can pick, let's say, one red, one white and three sparkling or three red, one white and white sparkling, etc. or no red, no white and all five bottles sparkling. I mean, there are all different combinations. The question is how many of them? Now, without the proper modeling, you cannot really approach this problem. And I'm sure there are different modeling and I'm suggesting right now something which is relatively typical in the combinatorial problems. And here is what I suggest. Let's designate a bottle of wine which I have chosen with the letter w, regardless of the type. So, I have five letter w, five bottles of wine. Now, I will use two slashes to separate. Let's say this and this. And I said that the first group is red, the second is white and the third is sparkling. So, in this case, this particular string of five letters w and two slashes represents a pig of two red, one white and two sparkling. Now, if I will put slashes, let's say here, that means I have no reds, no whites and all five sparkling. If I put slash one here and one here, it means no red, four whites and one sparkling, etc. So, as you see, these strings of seven characters, five w's and two slashes, completely cover all the different cases which are possible to pick different kinds of wine. So, this is the model which I'm choosing. And if I'm looking at the model in this way, it's actually much clearer how should I solve this particular problem. Because all I have to do is I have seven places and all I have to do is to pick two places to put slashes in or five places to put w's in, which is a regular problem with combinations. So, I have seven places and I have to choose two. Now, we have exactly the same regular combinations as before. So, if I choose, for instance, this and this, it means that the others are w's and these two are slashes. And that signifies two reds, no whites and three sparkling. Or whatever other two I choose out of seven. Or, symmetrically, and you know that combinations are symmetrical relative to k and n minus k. Choosing k actually is the same as choosing n minus k objects. So, in this case, my problem actually has been reduced using this particular model to a problem of how many combinations of two objects out of seven exist. So, let's generalize. Well, in this particular case, it's c seven two, which is seven factorial divided by two factorial and five factorial. Now, five factorial and this is seven, so I have six and seven left because everything from five will be reduced to this. So, six times seven is 42 divided by two, which is 21. So, I have 21 different combinations. Well, if you really want to, you can just try explicitly to write down all the different combinations and you should come up with 21. Anyway, it's time to generalize. So, let's again consider we have the same kind of problem as I said with wine. Now, we have, instead of three different types of wine, we have n different types of wine and we have to pick k bottles. Now, to pick k bottles means that now I have to pick n types of wine because there are unlimited quantities of wine of every type because that's the combination with repetition. Now, which means that my k bottles of wine, so these are my k bottles of wine, should be divided by how many separators I should actually put here to separate in n different groups. Well, obviously, to separate in two groups, I need one separator to separate in three groups as before in the previous problem. I need two separators to separate in n group. I need obviously n minus one separators. And they actually, some of them might be in front of the beginning or after the last one, which means that corresponding group will not have any representative in my combination. So, I have k objects and I have n minus one separators and out of the total number of characters in this case, which is k plus n minus one, I have to choose either k bottles or n minus one separators, which is exactly the same quantity, which is equal to k plus n minus one factorial divided by k factorial and n minus one factorial. So, that's the general formula. And what's very important, the lesson which you should really get from this is you have to think about how to cleverly model the problem which you have because if you forget about this particular representation as a string of characters like this, then it's not really easy to think about why this particular formula represents the number of combinations of k objects out of n different types, considering we have an unlimited number of representative of each type. So, that's not obvious. But with the proper modeling, again, I'm using the word clever. It's really a little sneaky, a little smart, basically based on some experience or previously solved problems. This is an approach. And coming up with this particular approach, that's the purpose of the whole course in combinatorics in particular because in combinatorics, as I was telling you before, the correct and incorrect solutions are very close to each other. It's very easy to make a wrong model or to miss some particular approach or combination, et cetera, and to come up with a different result, which is basically wrong. So, it's not like solving the equation. When you get the solution to the equation, you substitute it back and you don't see the identity. That means that you are wrong. Here it's not obvious when you are wrong. And if it's not obvious that you are wrong, what's very important is to come up with a proper modeling, the proper presentation of your problem. And in this case, the proper presentation seems to be not the unique one, but one of the proper representations is, as I was just saying to you. Okay. All right. So, let's consider a few trivial examples. Now, we have come up with this formula. And let me repeat it here. C of Nk plus N minus 1. By K equals K plus N minus 1 factorial N minus 1. Okay. Now, let's consider simple cases. And at least if we are correct in this particular formula, then in these simple cases, we might have the correct results, right? If we break some of the simple trivial case, means that we made a mistake and the formula is incorrect and our modeling is completely wrong, right? Okay. So, what simple cases I have? Example number 1 N equals to 1. So, I have only one type of objects. I have an unlimited number of these bottles of one particular type. And I have to pick K out of them. How many different ways to pick up K bottles of one and only one type? Well, there is only one type. So, there is no choice, basically. One and only one result should be, right? So, the quantity should be equal to 1. Well, let's check it out. Now, I have N is equal to 1, which means N minus 1 is 0. So, I have C of Kk on the left, right? Which is, let's put it here. It's K factorial divided by K factorial and 0 factorial. Now, 0 factorial, as we remember, is 1. So, we have 1. Well, then everything seems to be fine. Next case. Let's say N is equal to 2. So, I have two types. Again, back to the bottles of wine. So, I have two types of wine and I have to pick up K bottles, right? Now, what combinations I can have? Well, I can have zero bottles of one type and K bottles of another type or one bottle of one type and K minus one of another type, etc. K bottles of one and zero of another. So, these are all combinations which are possible. If I have only two types of wine and I need a set of K bottles, then these are combinations of two different types of wine among K bottles. Now, how many of those are? From 0 to K, it's K plus 1, right? Well, let's check it out. The formula for N is equal to 2. It's K plus 1 and N is 2. So, 2 minus 1, okay? So, it's 1 factorial divided by K factorial times 2 minus 1 is 1, 1 factorial. So, it's K plus 1 factorial divided by K factorial. Now, you remember, factorial is the product of all the numbers from 1 to this one. So, on the top, I have from 1 to K plus 1. On the bottom, I have from 1 to K. So, all of these from 1 to K are reducing to each other and the only thing which is left is the K plus 1 here. So, that's fine, too. Next. Next example. What if K is equal to 0? So, I have to pick up no bottles. Well, this is an empty set, right? How many different empty sets exist? Well, there is always one empty set which contains basically nothing. And so, my result should be equal to 1. Let's check it out. If K is equal to 0, I have N minus 1 factorial divided by 0 factorial is 1 and N minus 1 factorial, which is 1. Well, that's what we expected, right? And the last example, K is equal to 1. I have to pick only one bottle out of N different types, which means, obviously, it's supposed to be N different combinations, right? So, I have to have N different combinations. Let's check it out. If K is equal to 1, I have N factorial on the top. 1 is 1 factorial is 1 and N minus 1 factorial. Again, this is N factorial, so it's from N product from N to 1 and this is product from N minus 1 to 1. N is the only which is not reducible, so the result is N, which corresponds. So, as we see, in all the trivial cases, our formula is correct. Does it prove it? Well, obviously, it's not a proof. If you really want a proof, you might actually consider to prove this by induction or something like that. Well, I would like to just skip this particular part. Again, it's not my intention right now to get into a very, very rigorous presentation as long as... And by the way, it's not very difficult to come up with this formula using induction. So, let's not waste our time. Again, the most important thing is to come up with a model. As soon as you come up with the right model, like strings in this particular case, you'll be fine and you can derive the correct decision. Okay, that's all I wanted to say about combinations with repetitions. As always, if you go to Unizord.com site, you can engage into educational process by signing in, having a supervisor or a parent who enroll you in the class and you will be able to get through exams, check your results. The site is completely free and I welcome everybody over there. So, that's it for today. Thanks very much and good luck.