## Wednesday, May 19, 2010

### Cut the Deck

A card-shuffling machine always rearranges cards in the same way relative to the original order of the cards. All of the hearts, arranged in order from ace to king, were put into the machine. The cards were shuffled and then put into the machine again. After this second shuffling, the cards were in the following order: 10, 9, Q, 8, K, 3, 4, A, 5, J, 6, 2, 7. What order were the cards in after the first shuffle?

1. 9,A,4,Q,J,7,3,2,10,5,K,8,6

2. You got it Heather. After the first shuffle, the order was 9, A, 4, Q, J, 7, 3, 2, 10, 5, K, 8, 6.

Want to share how you figured it out?

3. I'm terrible at explaining these things, but I'll give it a try. I don't know that it can really count as much more than lucky trial and error in this case. If the shuffling was done the same way every time, then shifting the Ace one slot (to the 2nd spot) would tell you where the 2 would have to go in the second shuffle (namely, to the 8th spot). The position of the 2 in the 3rd shuffle would tell you where the 8 would have to go in the second, and so on... Since, in this example, the Ace only moved one space on the first shuffle, the first run through worked.

4. We will first assume the ace was in the second slot after the first shuffle. So the shuffling algorithm would always place the card in the first slot into the second slot. Therefore, the 9 must have been the first card after the first shuffle, or it couldn't have ended up as the second card after the second shuffle.

Now that we know that the 9 must have been the first card after the first shuffle, we know that the shuffling algorithm takes the card in the ninth slot and puts it into the first slot. So after the first shuffle, the 10 must have been in the ninth slot, or the 10 would never have ended up as the first card after the second shuffle.

We follow this logic pattern until our knowledge of the order of the cards after the first shuffle is complete. It turns out that this is the correct answer. If we assume the ace to be in any other position other than the second, then we will eventually encounter a contradiction, where two cards must go into the same slot.

So the final ordering is: 9, A, 4, Q, J, 7, 3, 2, 10, 5, K, 8, 6.

Leave your answer or, if you want to post a question of your own, send me an e-mail. Look in the about section to find my e-mail address. If it's new, I'll post it soon.

Please don't leave spam or 'Awesome blog, come visit mine' messages. I'll delete them soon after.

Enter your Email and join hundreds of others who get their Question of the Day sent right to their mailbox