Each person attending a party has been asked to bring a prize. The person planning the party has arranged to give out exactly as many prizes as there are guests, but any person may win any number of the prizes. If there are $n$ guests, in how many ways may the prizes be given out so that nobody gets the prize that they brought?
My answer was $(n-1)^n$, for I thought that there are $(n-1)$ possible prizes for each of the $n$ guests. However, my answer is wrong. I'm given a hint that it will involve with the inclusion-exclusion principle, I'm not sure how to interpret the problem in this direction.
Let's mark every prize from 1 to n,
p1, p2, p3, ... pnand the people at the guests at the partyg1, g2, g3, ... gn, wherepiis the prize from guestgi. Your goal is to make sure that you don't match the prizes with the guests that are having the same indices. In this case you need to make sure that: p1 doesn't go to g1, p2 doesn't go to g2, p3 doesn't go to g3, and so on. Let's consider|S|being the case where at least a guest is receiving the same prize. In this case we can write|S|like this: $$|S| = p1\cup p2\cup p3\cup ...\cup pn$$ This can be translated into "Present 1 goes to guest 1 or present 2 goes to guest 2 and so on". If we expand this, we have something like this: $$|S| = \binom{n}{1} - \binom{n}{2} + \binom{n}{3} + ... + (-1)^n\binom{n}{n}$$In your case, you need the opposite (the number of ways the people DON'T receive the same prize) so what you need to do is to subtract from the total ways you can distribute the prizes
|S|. Total number of ways to distribute the n prizes is $n^n$ (not n-1 since you need to count for the case when the person is not receiving anything. Hence:$$n^n - |S|$$