[Math] Why is it that shuffling a deck so that all permutations are equally likely requires swapping only later elements

probability

Apparently, to shuffle a deck of cards so that all permutations are equally can be done by going through the deck in order and swapping the current card with cards that do not appear earlier than the current card.

Also apparently, if one just randomly swaps cards around, not all permutations of cards are equally likely to result from the shuffling. Why is this the case?

Best Answer

If you swap the top card with a card chosen randomly with uniform distribution (including the card itself, in which case the "swap" doesn't change anything), then the new top card is any one of the cards with equal probability. Thus every card also has the same probability of not being that card, that is, of being in the subdeck below the top card. Thus the deck will be properly shuffled if the rest of the procedure properly shuffles that subdeck. But the rest of the procedure is precisely the whole procedure applied to that subdeck, so the result follows by induction, the base case being a deck of $1$ card, which is always properly shuffled.

For the second part of the question, as Lopsy wrote, you'd have to say more about what you mean by "randomly swapping cards around".

Related Question