Shuffling Cards

Home Page > Fun Stuff > Shuffling Cards

Shuffling Cards

Every time you shuffle a deck of playing cards, it's likely that you have come up with an ordering of cards that is unique in human history. For example, I shuffled a deck of cards this afternoon, and my friend Adam split the deck, and this is the order that the cards came out it.

How many different orders are there?

There are 52 cards in a deck of cards. Imagine an "ordering of cards" as 52 empty spots to be filled:

How many different possibilities are there for what could go in the first spot? The answer is 52 - any of the 52 cards could go there. What about the second spot? Now that you've already chosen a card for the first spot, there are only 51 cards left, so there are only 51 different possibilities for the second spot. And for the third spot, we only have 50 choices.

If we stop there, and just fill up the first three spots, that's like asking how many different possibilites there are for dealing three cards in order. Here's one of the possibilites:

How many different possible combinations are there for three cards in order? We just multiply how many possibilities there were for the first position (52) with the possibilities for the second position (51) with the possibilities for the third position (50). So there are 52 • 51 • 50 = 132600 different possibilites for three cards in order.

What about a whole deck? We just multiply the possibilities for each of the 52 positions, which is 52 • 51 • 50 • 49 • 48 • 47 • 46 • 45 • 44 • 43 • 42 • 41 • 40 • 39 • 38 • 37 • 36 • 35 • 34 • 33 • 32 • 31 • 30 • 29 • 28 • 27 • 26 • 25 • 24 • 23 • 22 • 21 • 20 • 19 • 18 • 17 • 16 • 15 • 14 • 13 • 12 • 11 • 10 • 9 • 8 • 7 • 6 • 5 • 4 • 3 • 2 • 1. A mathematical way of representing all those numbers multiplied together is called the factorial (See description on MathWorld), so we could write this as 52!, which means the same thing. When you multiply all those numbers together, you get 80658175170943878571660636856403766975289505440883277824000000000000. That number is 68 digits long. We can round off and write it like this: 8.0658X1067.

How many times have cards been shuffled in human history?

That's an impossible number to know. So let's overestimate. Currently, there are between 6 and 7 billion people in the world. Also, the modern deck of 52 playing cards has been around since 1300 A.D. probably. If we assume that 7 billion people have been shuffling cards once a second for the past 700 years, that will be way more than the actual number of times cards have been shuffled. 700 years is 255675 days (plus or minus a couple for leap year centuries), which is 22090320000 seconds. Now, if 7000000000 people had been shuffling cards once a second for 22090320000 seconds, they would have come up with 7000000000 22090320000 different combinations, or orderings of cards. When you multiply those numbers together you get 154632240000000000000, or rounding off, 1.546X1020.

So, it's safe to say that in human history, playing cards have been shuffled in less than 1.546X1020 different orders.

Is this order unique in human history?

Probably so. When I shuffled the cards this afternoon, and came up with the order you see in the picture, that is one of  8.0658X1067 different possible orders that cards can be in. However, in the past 700 years since playing cards were invented, cards have been shuffled less than 1.546X1020 times. So the chances that one of those times they got shuffled into the same exact order you see here are less than 1 in 100000000000000000000000000000000000000000000000 (1 in 1047).

At what point do you say something is impossible? If the chances are 1 in 1000? 1 in a million?1 in ten trillion?1 in 1 in 1047? In the movie Dumb and Dumber (See IMDB Info), Lloyd asks Mary what the chances are of the two of them getting together. She replies "1 in a million." He responds, "so you're saying there's a chance?!"

So... if you think there's a chance that maybe, just maybe somebody, somewhere, at some time may have shuffled a deck of cards just like this ordering you see here, then you're like Lloyd Christmas in the movie.

Footnote

By the way, the actors who played Lloyd and Mary in the movie Dumb and Dumber, Jim Carey and Lauren Holly, did actually end up together. They were married September 23, 1996, and lived unhappily ever after, getting a divorce 309 days later, on July 29, 1997. Now, what are the chances of that???

Update, November 23, 2011:

This page was recently featured on Hacker News at http://news.ycombinator.com/item?id=3241092 (link opens new tab/window), and generated some good discussion. Here’s my summary of a couple of topics discussed:

  • A shuffled deck as a “hide in plain sight” cryptography key. You can also use a deck of cards to encrypt short messages. It’s tedious and slow, but you can do it without a computer.
  • Importance of the deck being “properly shuffled.” When you buy a brand new deck of cards, it usually comes in a standard order. You will have to shuffle it several times before it starts to obtain a truly random order. The common wisdom is that seven shuffles randomizes the cards, but there are some orderings that cannot be achieved in just seven shuffles (like exactly reversing the original order).

    For the ordering appearing in the image on this page, I used an old deck that was not in order then shuffled several dozen times using different types of shuffles, so I’m reasonably sure it had been completely randomized.
  • This specific order unique vs. any two shuffles being unique. Several people referenced the “birthday paradox” which isn’t really a paradox but an unintuitive result. If I walk in to a room which has 22 other people in it, the chances that one of those other people has the same birthday as me is fairly low. But the chances that any two of the 23 of us have the same birthday is above 50%. In my calculations above, I was just claiming that my specific ordering is probably unique in history.

    The question of whether any two (sufficiently shuffled) orders of cards have ever been the same in history is a different question. But it turns out that this also has a really low probability. Thanks to Michael Hartl for the proof below.

Update, October 29, 2013:

For six years, this page had a minor error that I didn't notice. In July 2013, I got a message from Scott, who wrote this:

Hi, Matthew. This is very cool. However, I believe there is a math error on this page (not changing the overall assessment). 7000000000 x 22090320000 is indeed 154632240000000000000, but that is 1.5E+20, not 1.5E+23. So it is even slightly less likely than you thought! :-)

He's right, I counted the zeros wrong, and I guess no one else ever bothered the check the math. Anyway, I've fixed the references above, so it now says 1.546X1020 for my over-estimation of the number of shuffles in human history instead of 1.546X1023. So the final number is 1 in 1047 (rather than 1 in 1044 as previously stated). It's been six years, but I might have intentionally multiplied by 1000, originally assuming that every human would shuffle 1000 times per second. In any case, since it's a wild overestimation anyway, and since I made the error in the right direction, my final answer is still correct.

But this is why, in the proof below, Hartl mentions the number 1.6X1023.

 


Comment?
From: (your name or email address, or anonymous)

Your message to Matthew:


Created and maintained by Matthew Weathers. Last updated Nov 23, 2011.