# How Many Purchasing do You Need to Gather All Collection of Gifts?

We often find interesting marketing strategy of some cereal manufacture, that is providing some “action figures” in the box wrap. Of course there are many collection of the figure gifts, and yet you can not confirm what kind of figure you will get whenever you buy a box until you purchase it and open the seal. Suppose there are 10 kinds of figure collection. If you are lucky enough, you may gather all of the collection in 10 purchasing in a row, or that means that you always get a different collection every time you buy a cereal! What a lovely event! However, you may also experience some frustrating moment where you have gather 9 collections and you never get the 10th, although you have purchased a numerous cereals (and unfortunately, the cereal is never get eaten!). You buy a cereal and you think that this time you must get the 10th one, but that is not happening! Damn! The company is cheating me! How many more I should buy to get the 10th one? Does that 10-different-gifts-in-row event that rare? Can I be that lucky one?

These questions give us a very interesting mathematical problem, namely * coupon collector problem*. Suppose there are collection of figure. How many purchasing do you expect to collect all the collection? In the calculation of the expectation, we may find many interesting combinatorial properties involving in the progress. OK, let us start!

First, we define a sequence of event for each represent an event of in the n-th purchasing, for the first time you gather every collections. Let be the probability of the event , which is . Well, the event is completely the event you really want to experience. Clearly that if we have the event , then the number of purchasing we need is . It would be very nice if is as small as possible. However, we are about to calculate for which value of in which most likely everybody experience the event ? By the basic statistics, we have the expectation of the number of purchasing needed to collect all the collection is .

Next, how would we calculate the value of ? To begin this, we introduce the notion , which denote the **Stirling number of the second kind**.

= number of partitions of into exactly class.

For example, if and , then we are about to collect every possible partitions of into exactly 2 class. Below is the lists of every possible partitions:

This means that . Note that the order of the classes in the partition is not considered significant. Well, now we are ready to calculate the value of .

The sample space of the event in this context is the set of all possible outcomes in the sequence of purchasing. For every purchase, we have possibilities of outcomes. Therefore the size of the sample space is . Now we move into how many possible outcomes in which the event happen. Suppose we have the event occurred, means that when you purchase the n-th cereal, for the first time, you get the last collection (one thing you’d die for) which you have not owned yet before. Surely this must be the very condition, right? So, we can partition the times of purchasing, , into exactly classes, which means that if belongs to the class , then in the purchasing of , you got the collection number . Of course you can not have a class of size zero, since you have to gather every collection in the purchasing. And also, must be in a class having no other else in that class, i.e must be a single class. This means, we should not worry about the class of , since it always to be solitary. However, we still deal with those purchasing before the last one over the choices of collectibles. So in order to produce the partition, we have types of partitions. Moreover, since the order of the partition is such a matter for us, we multiply again this number to , as we have classes in the partition.

Therefore,

However, how would we calculate the mean of number of purchasing? First we define a probability generating function of , which is

By some combinatorial analysis, (I wouldn’t talk about this in this post, maybe later :D), we can get the formula of the GF:

However, we can compute the expectation by . Therefore, by differentiating the generating function, we can get

where is the harmonic number and therefore **the average number of purchasing so that you can collect every collectibles is .** (You could check by yourself if you want!) Seems not friendly enough to understand? Okay, let say . Then the average number is 10(1+1/2+1/3+…+1/10)=29.2897. This means most people complete the collections after the 29th purchasing. So, if you have bought 20 boxes, and you still have 7 collection, that’s fine. Everybody experience the same, you should ‘try’ harder! So, hey, what if the number of collectibles is not 10? Yes, you can compute the expected number by yourself. It’s easy enough to do naive computation by calculator. So, are you hunting for those gifts? You’d better check your lucky number!

Have fun with mathematics! Good luck!

Reference: Wilf, Herbert S. *Generatingfunctionology. *Academic Press. 1994