# Reply to comment

## Deranged santa solution

## Deranged Santa

It is Christmas Eve, and Santa is getting ready to deliver presents to children all round the world. He has a little glass of the season's spirits, and one thing leads to another, and before he knows it he is thoroughly "confused"... and he has completely mixed up all the labels with the children's names on, and put them randomly on the presents!

Supposing he has one parcel each for *N* children, what is the probability that every child gets presents intended for someone else?

## The solution

You may wonder why we gave this puzzle such a strange name - the reason is that a way of muddling up all the presents so that every child gets someone else's presents is called a*derangement*. We need to find the total number of derangements of

*N*items.

The total number of ways Santa can give presents to children is

Let's start by counting the ways Santa can give **one particular** child the correct present. This is easy - it is just . So if we write for the collection of ways Santa can deliver the presents, giving the correct present to the th child, then has members.

We want to know the number of ways he can deliver the presents, that are not in *any* . The trouble is, the overlap - there are ways Santa can get it wrong for two children, or three children, and so on. So we can't find the total number of wrong ways just by adding the number of wrong ways in and so on all the way up to . We have to take account of the overlap.

Let’s write for the collection of all the ways Santa can deliver the presents, giving the correct present to the th child AND the th child, and for the collection of all the ways Santa can deliver the presents, giving the correct present to the th child AND the th child AND the th child, and so on.

Then we can find the number of ways in which Santa gets it right for some child, somewhere (and subtract this from the total number of ways he can mix up the presents) like this:

- Let's add the sizes of all the way up to . This includes all the ways Santa can give at least one child the right present - but lots of ways of delivering the presents have been counted more than once.
- Now we'll subtract the sum of all the ways Santa can deliver the presents, getting the right present to at least TWO children - this will get rid of all the overcounting in the first step, but unfortunately, lots of ways of delivering the presents will have been taken away too many times! For this step, we have to find the sum of the sizes of all the - for every pair .
- So now we add back in all the ways Santa can deliver the presents, getting the right present to at least THREE children - but once again, we've added too much back in, and lots of ways of delivering the presents have been counted more than once again. This means finding the sum of the sizes of all the - for every possible choice of three children and .
- So we'll subtract the sum of all the ways Santa can deliver the presents, getting the right present to at least FOUR children - but now we've taken off too much again!
- We continue like this until we're up to the number of ways Santa can deliver the presents, getting the right present to EVERY SINGLE CHILD.

So what are these numbers we’re adding? There are ways of choosing the number , so adding together all the gives .

Next we have to find the sum of the sizes of all the - for every pair . It’s easy to see that there are ways of delivering presents to all the children so that two particular children get the right present - so has size . How many ways of choosing the two children and are there? This is easy too - it’s - so this term is

Remember,

Similarly, the next term is, and so on, until the last term is (Actually, we could have worked the last term out directly, because there’s only one way Santa can give the right present to every single child!)

We subtract the second term, then add the third term, and so on, to find that the number of ways Santa can get it right for at least one child is

Since there are N! ways in total of delivering the presents, the number of ways Santa can get it wrong for every single child is

and finally, the chance that Santa gets it wrong is this number divided by - the answer to the puzzle is

If you've made it this far down the page - Happy New Year from the *Plus* team!

Back to main puzzle page