On this page
You sit in a circle with your friends, ready for a Secret Santa gift exchange. Everyone writes their name on a piece of paper, drops it into a hat, and then draws one out at random. The goal is to get a name that isn't yours. But what are the chances that the entire group successfully avoids drawing their own name?
This classic setup is known in mathematics as the derangement problem, or the hat-check problem. A derangement is a permutation of a set of elements where no element remains in its original position. While it might seem like the chance of success drops rapidly as more people join the game, the math reveals a surprising and elegant limit.
What is the probability nobody gets their own gift in Secret Santa?
If there are only two people in the group, the probability is 1/2, or 50%. With three people, the probability drops to 1/3, which is about 33.3%. For a group of four, it climbs slightly to 3/8, or 37.5%.
Instead of trending downwards to 0%, the probability quickly stabilises. As the number of people increases, the probability that nobody draws their own name converges rapidly to 1/e, which is approximately 0.3678, or 36.8%. This means that whether you have 10 people or 10,000 people in your gift exchange, the chance of a perfect draw is roughly 36.8%.
Why does the probability settle near 1/e?
The number of ways n people can draw names without any person getting their own name is denoted by Dₙ. The total number of possible random draws is n! (n factorial, which means n × (n−1) × (n−2) ... × 1). The probability of a completely successful Secret Santa exchange is simply Dₙ / n!.
To calculate Dₙ, mathematicians use the inclusion-exclusion principle. You start with the total number of permutations, subtract the times one person draws their own name, add back the times two people draw their own names (because they were subtracted twice), and so on.
The resulting formula for the probability is an alternating series: Probability = 1/2! − 1/3! + 1/4! − ... + (−1)ⁿ / n!
In calculus, this exact sequence is the Taylor series expansion for 1/e. Because factorials in the denominator grow extraordinarily fast (for example, 7! = 5040), the terms in the series become extremely small after just the first few steps. By the time your gift exchange reaches seven people, the calculated probability is already 0.36785, matching 1/e up to the fourth decimal place. This explains why the chance stops changing in any meaningful way, regardless of how large the party gets.
If you struggle to picture how these sequences converge and flatten out, the Fermi Simulation Lab runs interactive simulations for ideas that are easier to see than read. You can watch the graph level off as the variables change. For more on calculating distinct outcomes, you can also explore the differences between with and without replacement scenarios.
How can you run a probability nobody gets their own gift simulation?
You do not have to rely solely on the algebraic proof. You can predict the chance that in a Secret Santa draw nobody picks themselves, then simulate and watch it settle near 1/e using a short Python script. Simulating random draws is a great active learning strategy to test theoretical math.
Here is a script you can run on your computer:
```python import random
def secret_santa_simulation(trials=10000, people=10): success_count = 0
for _ in range(trials): names = list(range(people)) drawn = names.copy() random.shuffle(drawn)
# A successful trial means no one has drawn their own name if all(names[i] != drawn[i] for i in range(people)): success_count += 1
probability = success_count / trials return probability
print(f"Simulated probability: {secret_santa_simulation()}") ```
When you need to work through similar textbook problems, the Fermi Problem Library provides a step-by-step solver that explains the reasoning rather than just printing an answer. If you get stuck on the underlying combinatorics, Fermi's AI tutor can work out what you know and build a plan for the session.
Understanding derangements gives you a new lens on randomness. The next time you draw a name from a hat, you will know exactly what the math says about your odds—and you might even want to calculate odds in favour and odds against a perfect draw for your friends.



