The Best (and Worst) Ways to Shuffle Cards – Numberphile

Question is How many times do you have to shuffle the cards – a deck of cards – to mix it up I mean by shuffling probably what you mean by shuffling Cut ’em about in half; you go like that; you push ’em together Right and how many times do you have to do that til the cards get all mixed up and uhh.. There’s a practical answer The answer’s about 7 And uh.. And it’s not “I think it” or “it feels that way” It’s a theorem In contrast There’s another way that people shuffle cards Uh.. They shuffle cards this way You’ve seen people shuffle cards that way (Brady: That’s how I shuffle cards) Ok well uh.. And in India, they do it this way It’s the same – you can see it’s the same Little – dropping little clumps one after another And so lots of – some – people shuffle that way And the answer to “how many of those shuffles does it take to mix up cards?” is about 10,000 So It makes a difference Uh.. (Brady: yes) It makes a difference There’s a 3rd way of shuffling cards that is used in tournament poker games And is used in Monte Carlo I call that “Smooshing” So that’s This method of shuffling cards You’ve probably seen somebody do that You might have done it yourself And then you gather them up and hope for the best If you smoosh for a minute uhh.. It passes all the tests we’ve ever thrown at it um.. If you smoosh for 30 seconds It’s sort of on the edge But seems ok And less than that uh.. It starts failing tests And somebody could make money against you Or guess cards right Suppose you had a scheme for shuffling cards One of these schemes And you wanted to think about “Is it working? Is it random? Or What am I talking about?” If it was a few cards Suppose you had 4 cards And you had some scheme for shuffling them I don’t know – some specific scheme You could just try it a lot With 4 cards there are only 24 possibilities The top card could be any of 4 cards The next could be any of 3 That’s 4 times 3 is 12 Times 2 is 24 And then this is forced to go So you could just do it 1000 times And see Do all 24 possibilities occur about equally likely But with 52 cards There are about 10^68 arrangements of a deck of 52 cards It’s more than the number of particles in the universe Ok so one way of defining randomness is to say all arrangements should be about equally likely I’ll say a sort of more practical version of it Suppose that you had a scheme for shuffling cards And then we were playing a card game And you had to guess at the cards 1 at a a time as I turned them over So for example Y’know Take a guess – what do you think the top card is (Brady: 6 of spades) Uh.. maybe upside down Not so bad, Brady, not so bad Uh.. y’know 6, 9, could be Ok, but suppose As in a card game or in a casino The cards were turned up 1 at a time And somebody tried to guess what they were Now We know now That the 9 of spades is out of the deck So you’re not gonna guess that again What do you think the next card is (Brady: Jack of diamonds) mm… not so good ok So No, but of course it’s not so good Your chance of being right on the first card is 1/52 If the cards were perfectly mixed Your chance of being right on the next card is 1/51 Then 1/50 if you have a good memory And if you have a really good memory, if the cards were all turned face up you would know what the last card is for sure It’s the matching 9 If the cards were perfectly shuffled um.. you expect to get 1/52 + 1/51 + 1/50 etc. Right and going through the deck 1 at a time And that adds up to about 4 and a half So, if somebody could remember and was guessing but the cards were well mixed you could get about 4 and a half right on average If you don’t riffle shuffle enough if you riffle shuffle 4 or 5 times somebody can get 9 or 10 cards right on average Anybody would say that’s not random Riffle shuffle is this guy You riffle ’em together is the way we say it They sometimes do it on the table this way Y’know Casino dealer will do..will do that That’s riffle This is called overhand and the other one I call smooshing I wanted to say it’s not just experimental that gives us these numbers I gave you 7 shuffles It’s math and I wanted to try to explain a theorem and I think this is one that I can explain without writing anything down Let’s see if I make it I’m gonna take A very simple shuffle Which is take the top card off And put it in at random You might put it back on top You might put it back 2nd from the top You might put it on the bottom It’s intuitively obvious that if you did that alot The cards would get all mixed up I mean it’s a silly way of shuffling But it is like a riffle shuffle where you just happen to have cut off 1 card Y’know I’m riffle shuffling this 1 card into this big deck Putting it in at random The deck starts out in order Yknow ace of spades, 2 of spades, 3 of spades whatever and there’s some card at the bottom I’m gonna suppose it’s the king of hearts so the deck is in order, you know the order of the deck It’s in order (Brady: that’s how it came from the pack) yes, yes or you might have written them down the guys in casinos, y’know, record them as they come off right how it came from the pack And now, you’re taking the top card off the and poking it in at random and just do that a lot ok, uh huh, poke poke poke now eventually because of the rules some card will go underneath that original bottom card the king of hearts there it is on the botom eventually if you wait long enough, a card goes under the bottom card how long does that take? well, the chance of a card going underneath the bottom card is 1/52 Because there are 52 places it can go So the chance of that then happening is 1/52 Therefore it takes about 52 pokes on the average to have that happen ok and now , keep going like an idiot and eventually a 2nd card goes underneath the king of hearts when I put that 2nd card underneath the king of hearts so there are 2 card there even if I told you “hey it’s on poke 503” I just poked the 2nd card underneath the king of hearts it’s equally likely that the 2 cards underneath the king of hearts are in order low-high or high-low because I’m poking the card in at random I could have put it above the card that’s on the bottom or below it I’m poking them in at random now, keep poking, eventually a 3rd card goes underneath the king of hearts there are 2 cards previously this one there are 2 cards this one goes in here, here, or here at random so all 6 orders are equally likely every time you put a card in given, as long as you’re putting it in at random the cards underneath the king of hearts are in a completely random order I hope that’s intuitive and it’s true (Brady: that’s make sense) it makes sense and now look at what happens; keep poking the king of hearts slowly moves up it never goes down it might stay where it is if I put a card above it it stays where it is but if i put a card below, it moves up 1 so eventually the king of hearts comes up to the top by induction, by the argument we’ve been doing all the 51 cards are in random order when i put the king of hearts in at random, the whole deck is random exactly random at that moment every arrangement is equally likely so that is not only intuitive it is an exact mathematical fact i hope it makes sense, i think it makes sense and now, you can just ask “how long does that take?” well, it takes 52 pokes for the 1st card to go under there’s the king of hearts on the bottom then i put a card underneath it so now there are 2 places where the next card can go so it’s it it’s 2/52 So it takes 52/2 pokes and then it takes 52/3 pokes for the 3rd card to go under so it’s 52 +52/2 +52/3 and that answer is well it’s – what is it – it’s 52 times log of 52 which is around 200 or so so it takes about 200 of these pokes if you shuffle fewer times if you shuffle 5 or 6 times it really somebody could really make money against you in a card guessing experiment if you shuffle 10 or 11 times it’s not worth the wear and tear on your shoe leather standing there in the casino if you’re counting cards it’s just as close to random as it could be of course it’s never perfectly random y’know we’d have to shuffle infinitely often to make it there’s still some trace of the original order but it vanishes exponentially fast So wonderful question; let me try to match you with an answer the model that the 7 shuffle is based on i’m gonna say it as a slightly more mathy thing