The partridge in the pear tree was feeling lonely so it decided to invite 7 of its partridge friends to join it for a festive dinner party. Of course, the dessert is poached pears in syrup, freshly picked from the tree.
The partridge host has prepared 12 pears to serve. She does not eat any pears. However her 7 guests are quite particular:
How many ways are there to distribute all the pears?
All the guests are distinguishable (so order matters) and yes, all the pears are served (whole).
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Interesting method! Nice idea to use generating functions!
First give all the partridges 2 , 2 , 1 , 1 , 1 , 1 , 1 pears each where we let the first two numbers be for the two particularly important partridges. This satisfies conditions 1 and 2.
Now all we need to do is to distribute the final three pears whilst satisfying condition 3. This can be done in three ways:
It is clear that this will cause this partridge to have four or more pears, so this case yields 0 possibilities.
We can only give two to one of the 5 partridges with 1 at the moment (as 2 + 2 = 4 which is not allowed). Then we can give one to any of the remaining partridges, of which there are 6 . This case yields 3 0 possibilities.
This is equivalent to choosing 3 out of 7 since any combination will work. So this case yields 3 5 possibilities.
There are no other cases and so there are 6 5 possible distributions of pears.
So close! I messed up case two and ended up 10 short. Oh well! But that makes sense.
Log in to reply
Unlucky! Yes, case two is probably the most tricky.
This is wrong. I got the right answer, but only after figuring out how you had likely messed it up. The problem is that you say in your last comment that "order matters". In other words, once you figure out the distribution of pears (i.e. how many each guest is going to get), you need to multiply by the number of ways there are to hand them out. For example, if you had 3 distinguishable guests, Alice, Bob, and Clara, each of whom were getting just one pear, there is only a single distribution (one each), but there would be 6 ways (3 factorial) of distributing them [(a,b,c), (a,c,b), (b,a,c), (b,c,a), (c,a,b), or (c,b,a)]. What you actually give as the correct answer above is the number of ways to distribute the pears independent of order . If you take order into account, you have to multiply by 7 factorial (5040), which gives 327,600.
Finally, is this really deserving of being a level 5 problem in combinatorics? It seems pretty straightforward to anyone who's even casually familiar with the rules for figuring out discrete probability distributions.
Log in to reply
Hi David. The problem is correct but in fact what you have assumed is that the pears themselves are distinguishable, but the problem implies that they are not. It is the guests that are distinguishable, otherwise the conditions would not make sense.
So yes, the phrase 'order matters' is very important and is used in the correct context here.
To further illustrate, say you had only 9 pears with the arrangement 2 , 2 , 1 , 1 , 1 , 1 , 1 . You cannot multiply by 7 factorial in this case, because in every other arrangement you are not giving the important partridges at least 2 pears.
Even if you have three distinguishable people and you give them one pear each, that is actually one distribution, not six. No matter how you swap the pears the distribution is the same! Remember, if you look at it from the three pears' point of view, ( 1 , 1 , 1 ) is the same distribution no matter to which permutation of people the pears are given.
On the other hand you may be correct in saying that the problem may not be a Level 5, but note that there are quite a few places where people may go wrong, and I am sure that Brilliant's levelling system is very good!
Hope this helps! If you are still not sure, please feel free to ask further.
Log in to reply
Ok .. I guess I can see what you meant by "order matters" now, you were talking about an abstract mathematical idea of order, not the time-sequence in which the pears are served, which is what you seemed to be saying (at least to me). If you think about how your example would be carried out, the hostess would have to choose which guest got their pear first, then second, and so on. If you mean to just consider the portions each guest receives, and not the time-sequence in which they are served, perhaps a clarification is in order.
Anyway, just to make sure it's clear the distinction I am making, if the order in which the guests receive their pears is distinguishable, then you do have to count that 2,2,1,1,1,1,1 distribution 7 factorial times. For example, say that we take the order of the numbers above as the order in which the guests are served their pears, so the important guests got theirs first. You could instead serve them last, generating a 1,1,1,1,1,2,2 arrangement (or one of 5038 other possibilities), which is distinguishable because it's a different time-sequence.
First a tutorial on the formula for the number of ways of distributing N objects among K people. The formula is by the way ( K − 1 N + K − 1 )
Start off with K=2 people, and say N=10.
Let's build an equivalence with 10+1=11 slots where one of them is to be chosen to be a partition slot. After choosing a slot to be a partition, the first block of slots belong to the first person, and the second block of slots belong to the second person.
OOOOOOXOOOO, where X marks the partition slot, this corresponds with N 1 =6, N 2 =4,
Try to see the correspondence between the number of ways to distribute the objects and the number of ways of choosing the slot.
Next we try K=3 people and N=10.
Now imagine there are 10+2=12 slots and you choose two of them to be partition slot. So once you choose the two slots, for example
OOOOOXOOXOOO, where X marks the partition slot, this corresponds with N 1 =5, N 2 =2, N 3 =3
See that there is a one to one correspondence between choosing the partition slots and the number of ways of distribution.
In general for N objects and K people, you begin with N+K-1 slots and you designate K-1 to be partition slots.
Hope this can convince you of the general formula of ( K − 1 N + K − 1 )
We will use this formula to solve our problem.
Given the first two constraints, namely:
We can see that the initial distribution is like this 2+2+1+1+1+1+1 (+3extra)
For this problem, we can ignore the initial distribution and assume we are dividing 3 pears among 7 guests who has none to begin with. So the formula for this will be ( 7 − 1 3 + 7 − 1 ) = 84.
Now we consider last constraint, we can list out the cases we don't want.
Group1:
4+2+1+1+1+1+1 (+1 extra) [2 of these]
2+4+1+1+1+1+1 (+1 extra)
Group2:
2+2+4+1+1+1+1 (+0 extra) [5 of these]
2+2+1+4+1+1+1 (+0 extra)
2+2+1+1+4+1+1 (+0 extra)
2+2+1+1+1+4+1 (+0 extra)
2+2+1+1+1+1+4 (+0 extra)
For group 1, the number of ways is equivalent to 1 object distributed among 7 people, ( 7 − 1 1 + 7 − 1 ) = 7. We have 2 of these, so 2*7=14 ways.
For group 2, the number of ways is equivalent to 0 object distributed among 7 people, ( 7 − 1 0 + 7 − 1 ) =1 way obviously. We have 5 of these, so 5*1=5 ways.
Finally, the required number of ways will be: 84-14-5=65 ways.
Nice approach indeed! At first I did a similar solution, but then posted a different one instead when I was checking that my answer was correct!
Because I had been recently working on Discrete Optimization Modelling (with MiniZinc) , I will take a different approach here and instead address what we needed to do if we needed to find enlist those solutions.
Here is the relevant MiniZinc model:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
Run it with:
1 |
|
Here are all the solutions.
Thanks for sharing this coding approach to listing out all possibilities.
Very nice! I had not heard of MiniZinc before and it looks very interesting; nice wiki too!
Log in to reply
Actually, the wiki isnt really complete. But thank you!
Problem Loading...
Note Loading...
Set Loading...
We can use generating functions.Hence we want coefficient of x^12 in ((x^2+x^3)^2)*((x+x^2+x^3)^5).Now this is straightforward and we get the coefficient as 65.