 # Is there an easy statistical formula for this?

And, no, it most definitely ain’t homework.

Let’s say you have X number of cards in some order, and you thoroughly shuffle them.

What are the odds that at least one is in its same position as before the shuffle?

Assuming that the cards and randomized there is a 1/52 chance of the card being in the same place, or a 51/52 that it is in a different place. You want to know what the odds are that one is in the same space, but it’s easier to calculate the odds that one won’t and subtract that from one. The odds that one card is not in the same spot is 51/52, for 52 cards it’s (51/52)[sup]52[/sup]. That comes out to 36.4%. That means there is a 63.6% chance that at least one card will be in the same spot.

My first instinct was the answer is 1 - [(1-1/x)^x]. This is line with the “lost key” problem" at http://wizardofodds.com/askthewizard/probability.html.

However, it is unclear to me whether that means two keys can get the same code… that is, is this invalid because two cards can’t land in the same slot. I also note that my formula predicts a 75% change with two cards, when the answer is clearly 100%. So I guess I’m saying I’m wrong and don’t know either! But I have a suspicion that my answer gets closer to the truth as x goes up.

…the answer is clearly 50% I mean. Good to see that treis is on the same wavelength as me.

The term to help you Google is “derangement.” (Specifically, you’re looking for the probability that the order is not a derangement.) Here’s a previous thread, containing a MathWorld link.

The answer differs from the ((X-1)/X)[sup]X[/sup] posted above, because the card positions are not independent (as muttrox noticed in the case X=2); in the limit of large X this probability tends to the same result, however.

This kind of shuffling is called a derangement. As the number of cards goes to infinity, the probability goes to 1/e =~ 36.8%.

I don’t recall the chance for “at least one”, but I do recall that, for any number of cards, the expected number of cards in the same position is exactly 1.

Among other things I have seen this stated as the drunken sailor probability problem.

A bunch of sailors all get “smashed” while on shore leave. They return to their ship and randomly choose to sleep in whatever bed they find. What are the odds that each sailor is in the wrong bed? As the number of sailors gets larger, the limit is 1/e or about .3678794412. So the probability of at least 1 sailor being in the correct bed is 0.6321205588 or 63.21205588%.

(I have also seen this stated as the secretary and the envelopes problem, whereby letters are inserted randomly into envelopes).

So, it seems I’m in agreement with treis, Omphaloskeptic and borschevsky.

Many thanks, all.