How to perfectly shuffle a deck of cards
- But there's one question we still haven't answered. When playing Solitaire, how did Ulam know his cards were perfectly shuffled? I mean, how many shuffles does it take to get a completely random arrangement of cards? - If you have a deck of cards, you need to shuffle it, right? How often, if you're shuffling, like, you know, you split it in half, and then you do the (cards riffling). How often do you have to shuffle it to make it completely random?
- Two. - Two? I'm going with 26. - Yeah, four times. - Four times? - I don't know, 52 times? - Okay. Okay. It's not a bad guess. - Seven? - It is seven. - Really? - Yeah. So you can think of card shuffling as a Markov chain where each deck arrangement is a state, and then each shuffle is a step. And so for a deck of 52 cards, if you riffle shuffle it seven times, then every arrangement of the deck is about equally likely, so it's basically random.
But I can't shuffle like that. So for me, what I do is I do it like this. How many times do you think you have to shuffle like this to get it random? (beeping) - What do you think? And perhaps more importantly, how would you go about working it out? Well, that's where today's sponsor Brilliant comes in. Brilliant is a learning app that gets you hands-on with problems just like this. Whether it's math, physics, programming, or even AI, Brilliant's interactive lessons and challenges let you play your way to a sharper mind.
You can discover how large language models actually work from basic Markov chains to complex neural networks, or dig into the math behind this shuffling question. It's a fun way to build knowledge and skills that help you solve all kinds of problems, which brings us back to our shuffle. So Casper, what actually is the answer? - It's actually over 2,000. - What? - Over- - Crazy, right? - Yeah. - So the next time someone offers to shuffle before a game, make sure they're doing it right, seven riffles or it doesn't count.
But the interesting part isn't just knowing that, it's understanding why and seeing how a simple question can lead you to some surprisingly complex mathematics. And that's what Brilliant is all about. So to try everything Brilliant has to offer for free for a full 30 days, visit brilliant.org/veritasium, click that link in the description or scan this handy QR code. And if you sign up, you'll also get 20% off their annual premium subscription. So I wanna thank Brilliant for sponsoring this video and I wanna thank you for watching. (upbeat music) - Easy. (light music)