>>
|
No. 1779
[Edit]
>>1777
Not sure if I understand what you're getting at, but combinatorics is a field of math and I'd certainly put this in that category.
>My moment of genius was to realise that you could just take away all the possible male-male pairings
Yeah exactly! And your example actually *is* inclusion-exclusion applied to the case of n = 2 I think (expand out the summation and you should find that the terms match up)!
>do you think you could apply it to the scenario of a race with three sexes (but only a trio with one of each of the three sexes can produce a child)?
I'm not sure I understand what you meant. I'll give a concrete example for x = 3 bins and n = 4 balls though (so the number of ways to assign them is 3^4 = 81) (in your example I think this might correspond to each bin being one of the three genders). Also I'll stick to balls and bins if that's ok with you since that's a bit easier to visualize for me.
So we know that the number of ways to put 4 balls into 3 bins (with each ball going in only one bin and every ball going in some bin) is 3^4 (3 choices for the first ball * 3 choices for second ball * 3 choices for third ball * 3 choices for fourth ball). Now let's count this a different way. Form all possible ball/bin pairings:
ball 1 - bin 1
ball 1 - bin 2
ball 1 - bin 3
ball 2 - bin 1
ball 2 - bin 2
ball 2 - bin 3
ball 3 - bin 1
ball 3 - bin 2
ball 3 - bin 3
ball 4 - bin 1
ball 4 - bin 2
ball 4 - bin 3
There are 4*3 of these. Out of these, we pick 4 such pairings. There are (4*3 C 4) = 495 ways to do this.
Now every valid way to put the balls into the bins is included as part of this 495, but we've also included some invalid ways to do it (namely cases such as picking "ball 1 - bin 1" and "ball 1 - bin 2" and "ball 4 - bin 1") are illegal since we want each ball to land in only one bin. Particularly, we wanted each ball going in only one bin and every ball going in some bin, so the pairings we picked can be illegal if there is some ball going in more than 1 bin, or some ball that hasn't been picked at all.
The key insight is that the two illegal conditions are actually the same: because there are n balls and we've picked n pairings, if you pick a duplicate ball that means there must be some other ball that hans't been included in our pairing, and vice-versa. Or in other words, if a pairing is illegal because it has some ball going to multiple bins, it is also illegal for the reason that there is some ball that has not been included. So all we need to do is subtract out from 495 the number of pairings where at least one ball has not been included.
Now we apply the inclusion-exclusion principle to find the number of pairings where at least one ball has not been included. The number of pairings where at least one ball has not been included is the union of the pairings where ball 1 is not included, ball 2 is not included, ball 3 is not included, and ball 4 is not included.
By the inclusion-exclusion principle we have that
|A ∪ B ∪ C ∪ D| = |A| + |B| + |C| + |D| - |A ∩ B| - |A ∩ C| - |A ∩ D| - |B ∩ C| - |B ∩ D| - |C ∩ D| + |A ∩ B ∩ C| + |A ∩ B ∩ D| + |B ∩ C ∩ D| + |A ∩ C ∩ D| (where |A| the number of elements in the set A).
(Note that the above is just an extension of the simpler case |A ∪ B| = |A| + |B| - |A ∩ B| which should become clear if you stare at the venn diagram. Then you can extend it to 3 sets, and then 4).
Applied to our particular case, A is the set of all pairings where ball 1 is not included, B is the set of all pairings where ball 2 is not included, ..., D is the set of all pairings where ball 4 is not included. The number of pairings where ball 1 is not included is (12 - 3 C 4) (because we are excluded all pairings with ball 1, and there are 3 of those). Same for ball 2 .. ball 4. So the first term to subtract out is 4 * (12-3 C 4) = 9C4.
Now we add back in the number of pairings where ball 1 and ball 2 are both not included. This leaves (12-6 C 4). Same for all possible 2 ball combos. How many such two ball combos are there? 4 C 2 of course! So we add back in (4 C 2) * (12-6 C 4).
Then we subtract out the number of pairings where ball 1 and ball 2 and ball 3 are not included. This leaves (12-9 C 4). Same for all possible 3 ball combos. There are (4 C 3) such combos, so we subtract out (4 C 3) * (12-9 C 4).
So in total we have:
495 - 4 * (12-3 C 4) + (4 C 2) * (12-6 C 4) - (4 C 3) * (12-9 C 4) = 81.
Which is what we expected.
|