## quinta-feira, 19 de maio de 2016

### Papai Noel preguiçoso

No Natal do ano passado, durante uma longa noite de entrega de presentes, o Papai Noel chegou, muito cansado, a uma rua com 7 casas. Então, ele resolveu atirar todos os 7 presentes aleatoriamente. Dado que cada casa recebe um presente, e que os presentes são todos diferentes entre si, qual é a probabilidade de o Papai Noel preguiçoso atirar pelo menos dois presentes nas casas corretas?

(In Christmas last year, during a long night of gift delivering, Santa Claus arrived, very tired, at a street with 7 houses. Then, he decided to throw all the 7 gifts randomly. Given that each house receives one gift, and that the gifts are all different from each other, what is the probability that lazy Santa Claus throws at least 2 gifts to the correct houses?)

PCFilho

#### 7 comentários:

1. Since Santa is distributing the presents randomly, and that there are 7 presents distributed this way, that means that for each present distributed the probability that it's the correct present for that house is 1/7. The probability of all the gifts being distributed incorrectly is (6/7)^7. The probability of only one house receiving the correct present is 7*(1/7)*(6/7)^6. So, the probability of at least 2 houses receiving the correct present is 1-(6/7)^7-(6/7)^6, or approximately 26.4%.

1. I expect that there were five children who had a very disappointing Christmas that year. XD

2. Hopefully the neighbors are good friends and will exchange the wrong gifts. HA HA HA!

2. Well done, Jake!! I calculated it in a different way, counting the possibilities, but fortunately we got the same result. :)

The total number of possibilities of gift distributions is 7! = 5040.

The number of possibilities in which all gifts were thrown to the wrong houses is !7 = 1854.

The number of possibilities in which only one gift was thrown to the correct house is 7*(!6) = 7*265 = 1855.

The possibilities in which at least two gifts were thrown to the correct houses is, therefore: 5040 - 1854 - 1855 = 1331.

The probability of throwing at least two gifts to the correct houses is, therefore, 1331/5040. Or approximately 26.4%. :)

1. Note: by !n, I mean the number of derangements of n. A derangement is a permutation of the elements of a set, such that no element appears in its original position.

There are different ways of counting the number of derangements. Starting with n = 2, the numbers of derangements of n are:
n = 2: 1
n = 3: 2
n = 4: 9
n = 5: 44
n = 6: 265
n = 7: 1854
n = 8: 14833
n = 9: 133496
n = 10: 1334961
n = 11: 14684570
n = 12: 176214841
n = 13: 2290792932

And so on. In the On-line Encyclopedia of Integer Sequences, it is the sequence A000166.

2. PS: I have already posted a problem of counting derangements here in the blog: Amigo oculto.

3. Here is a way to calculate the number of derangements, recursively:

D[N]=(N-1)*(D[N-1] + D[N-2])

D[1] = 0
D[2] = 1
D[3] = 2*(D[2] + D[1]) = 2*(1 + 0) = 2
D[4] = 3*(D[3] + D[2]) = 3*(2 + 1) = 9
D[5] = 4*(D[4] + D[3]) = 4*(9 + 2) = 44
D[6] = 5*(D[5] + D[4]) = 5*(44 + 9) = 265
D[7] = 6*(D[6] + D[5]) = 6*(265 + 44) = 1854

And so on...

Regras para postar comentários:

I. Os comentários devem se ater ao assunto do post, preferencialmente. Pense duas vezes antes de publicar um comentário fora do contexto.

II. Os comentários devem ser relevantes, isto é, devem acrescentar informação útil ao post ou ao debate em questão.

III. Os comentários devem ser sempre respeitosos. É terminantemente proibido debochar, ofender, insultar e/ou caluniar quaisquer pessoas e instituições.

IV. Os nomes dos clubes devem ser escritos sempre da maneira correta. Não serão tolerados apelidos pejorativos para as instituições, sejam quais forem.

V. Não é permitido pedir ou publicar números de telefone/Whatsapp, e-mails, redes sociais, etc.

VI. Respeitem a nossa bela Língua Portuguesa, e evitem escrever em CAIXA ALTA.

Os comentários que não respeitem as regras acima poderão ser excluídos ou não, a critério dos moderadores do blog.