Here is a question that my friend shared:
n people put their name in a hat.
Each person picks a name out of the hat to buy a gift for.
If any of the first people pick out themselves they put the name back into the hat.
What is the probability of the last person has his name in the hat?
Some observations.
For , the probability is 0.
For , the cases are , and so the probability is .
As gets larger, the probability should be about , since any name "should" be equally likely. However, this is not a rigorous argument, and the probability could differ.
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
Here's Nathan's simplification of my approach:
Let an represent the number of sequences where the first n−1 people don't get their gift, and the nth person gets his gift. This is the positive cases in our probability.
Let bn represent the number of seqeuences where the first n−1 people don't get their gift, and the nth person does not get his gift. This is the negative cases in our probability.
We seek the value of an+bnan.
Clearly, bn represent a derangement on n objects, and so there are Dn of them.
Clearly, an represents a derangement on n-1 objects, so there are Dn−1 of them.
Hence, the probability that we are after is Dn+Dn−1Dn−1.
Here's my original convoluted approach:
How do we get a hold of the value of an? This can be hard to count directly, so let's play around with it.
Given any sequence in an, we can swap any of the first n−1 people with the nth person, and we clearly get a sequence in which no one gets their gift. This shows us that (n−1)an≤bn. Why do we have a ≤ sign? This is because we have only given an injective mapping from (n−1)an into bn, but we don't know that we have hit all possible objects in bn.
How do we continue from here? We have an≤n−1Dn. Can we get the exact value?
We will show that an=n−1Dn−(n−1)Dn−2. Note that by the derangement recurrence relation, this is equal to Dn−1 as pointed out above.
Given any sequence in an, we can swap any of the first n−1 people, with the last, to get a sequence in bn. However, given any sequence in bn, we may not be able to reverse this procedure to get something in bn (IE this map is not surjective). The cases that we miss out, are exactly the ones where person n gets gift i, and person i gets gift n. In this case, swapping gifts results in person i getting gift i. For each person i, we have a derangement on the other n−2 people, and hence the number is Dn−2. Multiplied by n−1 for any of the first n−1 people, we see that the cases that we are missing out on are (n−1)Dn−2. Hence, an=n−1Dn−(n−1)Dn−2.
Log in to reply
Why can't you just say that for an one fixed person gets their gift and the other n−1 are deranged hence an=Dn−1?
Log in to reply
Oh that's so true! How could I have missed that! This makes the argument much simpler. Thanks!!
The conversation that I was involved in got complicated quickly, with people running monte carlo simulations to attempt to arrive at the answer. However, because the probability wasn't something immediately recognizable, (i.e. not n1 ), we didn't know what form it had to take.
I had a nice argument that an=n−1dn−(n−1)dn−2, but I forgot that by the recurrence relation that is exactly equal to dn−1.
There are !n+!(n−1) ways to order the names, because they can either all have different peoples' names or the last person gets his own name. There are !(n−1) ways to order the names so the last person gets his own name.
Thus, the answer is !n+!(n−1)!(n−1)
It's funny, I proposed this problem on the Proofathon contest a while back. It didn't get chosen to be on the test, though. Interesting how a lot of people come up with the same ideas completely independently.
The probability would be d(n-1)/d(n) where d(n) represents the derrangement of n objects.
Log in to reply
Close, but not quite.
Log in to reply
Ohh yeah i just noticed i forgot to add the derrangement of (n-1) objects to the total possibilities lol