Це відео не доступне.
Перепрошуємо.

The reason you should shuffle 7 times

Поділитися
Вставка
  • Опубліковано 2 сер 2024

КОМЕНТАРІ • 180

  • @greybeardmc
    @greybeardmc 2 місяці тому +83

    My grandfather theorized ages ago that if you did a perfect shuffle some number of times, you'd get back to the original order.
    Then I, back in the early 80s, wrote a program to confirm that, depending on which card you started with, it could take as few as 8 perfect shuffles to get back to the original.

    • @btf_flotsam478
      @btf_flotsam478 2 місяці тому +6

      Key word being perfect.

    • @where_is_sauce
      @where_is_sauce 2 місяці тому +4

      ​@@btf_flotsam478 it is based on skill though, so it can be done given enough time practicing

    • @waltlock8805
      @waltlock8805 Місяць тому +4

      It's called a Faro shuffle. Stage magicians use it all the time to do exactly that.

    • @brettstafford9665
      @brettstafford9665 Місяць тому +4

      This because repeating a perfect shuffle would be repeating the same permutation. Permutations form a finite group, thus any cyclic subgroup would be finite.

    • @dorbie
      @dorbie Місяць тому

      This is relatively common magician's knowledge using the Faro shuffle x 8. Some can pull it off reliably. You can see it done on UA-cam. ua-cam.com/video/5-7Yfzf3K1E/v-deo.html

  • @hithere-cz4oc
    @hithere-cz4oc 3 місяці тому +142

    Just so you know, the true crux of the statement “no two randomly shuffled decks of cards have never been seen before” comes down to the SQUARE ROOT of 52!. You can look up the birthday paradox, but essentially, 52! Is something like 10^54, so the square root is something like 10^27, meaning you have to shuffle around 10^27 times before you can say that there’s a good chance that two random decks have shuffled to be the same.
    It’s the same reason why a group of only 22 people are 50% likely to contain a birthday in common, even though it seems counterintuitive

    • @Tommy_007
      @Tommy_007 2 місяці тому +6

      23 :-)

    • @user-xj8wy4uu1q
      @user-xj8wy4uu1q 2 місяці тому +1

      Huh

    • @btf_flotsam478
      @btf_flotsam478 2 місяці тому +1

      It's proportional to that amount, not equal to it. That's why you need more than 20 (20^2=400>366).

  • @tomo9126
    @tomo9126 2 місяці тому +62

    If there's drinking involved and a real chatterbox is shuffling it will be shuffled 15-30 times every time they deal.

  • @smob0
    @smob0 3 місяці тому +64

    When I shuffle sleeved cards, I tend to be worse at mixing the cards near the top and bottom of the deck. So after 3 riffles, I will put the cards from the bottom on the top, and a few cards from the middle on top of those and continue riffling. It's like scraping the side of bowl when you're mixing things together. I find 9 total, breaking every 3, is enough to get a deck from newly built to being random enough to play.

    • @Pystro
      @Pystro 3 місяці тому +3

      You mean you do a cut and put the two stacks on top of each other in the opposite order? ...before you then cut them apart again (possibly in the exact same place).
      At first I was thinking that that doesn't seem to be doing ANYTHING., but I guess it actually will help a bit. But maybe not as much as you think it does.* Doing those extra (8th and 9th) shuffles is probably doing much more to fix your predictability than that "flip" operation.
      *Here's why:
      You are doing it to ensure that the bottom and top eventually get shuffled. But I will have to assume that it's about equally likely that the bottom few cards come from the left or right hand.** Then there's the same 50:50 chance that your bottom cards remain bottom cards, versus that they come from somewhere in the middle.
      **If instead you knew that for example your left hand often runs out faster than the right, then you'd want to put the sub-deck that has cards from near the cut (the middle of the deck) in your right hand. And if there is a predictability, but you don't know which hand is faster on a particular day, then you probably want to always cut the deck with the same motion, but for every second shuffle swap the sub-stacks between the hands.

    • @smob0
      @smob0 3 місяці тому +1

      @@Pystro My goal is to get the top and bottom into the middle where they will get mixed better. The problem is both hands tend to be inefficient near the top and bottom since you can't have quite the same technique as the shuffling in the video due to the cards being more bulky and slippery. A sleeved magic card is about 3 times as thick as a playing card. If you're not careful, you can also stick the corner of a card into a sleeve while shuffling and split the sleeve open. You also tend to be a little gentler when handling sleeved cards since they are often pretty expensive. Since there's a bunch of factors that make the shuffling less random, I add a few extra if my deck is somehow sorted before hand just to be safe.

    • @Pystro
      @Pystro 3 місяці тому +1

      @@smob0 " My goal is to get the top and bottom into the middle where they will get mixed better." I get that, but the middle is where you make the next cut, which puts the top and bottom back to the ends of the two half-stacks.
      I guess you could take the top quarter and bottom quarter and stick them with the previous ends against each other, and then riffle together with the half that came from the middle.

    • @smob0
      @smob0 3 місяці тому +2

      @@Pystro That makes sense, the bottom is likely to end up near the bottom again after the cut, so maybe I need to fix something. It's hard to explain exactly how I shuffle in text form, but I do usually find the top and bottom 5 cards or so tend to come mostly from one pile when I riffle, so there's roughly a 1 in 4 chance the top or bottom hasn't even really moved. It's also not really a true riffle, and more of taking two half decks, holding them slightly loose and forcing them to interweave. I'm pretty sure it follows the same logic as a riffle, outside the top and bottom problem, but could have issues I'm not considering. I probably need to aim the old top and bottom about 1/4 of the way into the deck so it's halfway through one of the piles. Maybe I should just riffle in the top and bottom into middle individually. 🤔

    • @Pystro
      @Pystro 3 місяці тому

      @@smob0 Ah, the "toddler-shuffle", as I call it. (Usually damages the edges more than a "bend-and-drop" shuffle.)
      "I probably need to aim the old top and bottom about 1/4 of the way into the deck" oh, that's also a good solution.

  • @oelboy
    @oelboy 2 місяці тому +17

    0:51 wouldn't that basically be a giant-sized Birthday Paradox? I feel like the odds of a truly shuffled deck to have been shuffled in the same order before is greater than you'd think. Still very small.

    • @jacobk846
      @jacobk846 Місяць тому

      Yes that's right. In his scenario, all those people have collectively shuffled into around 10^55 total arrangements across the last 13 billion years, which is about 0.00000000001% of all possible deck arrangements.
      Source: 10^55 / 52! * 100 = 1e-11%
      So the chance that after you shuffle, the new arrangement in your hands has ever happened before is crazy low.
      But if we adjust the birthday paradox to use 52! possible birthdays, what's the number of arrangements we need to get a 50/50 that ANY of their decks match ANY of the other decks ever shuffled? You'd need about 10^34 arrangements.
      Source: 1 - ( ( 52! - 1 ) / 52! ) ^ ( 10^34 + ... + 2 + 1 ) = 0.4620...
      So every second, there is a 46% chance that two of the 10^34 hypothetical people just simultaneously shuffled the same arrangement.

  • @andrewharrison8436
    @andrewharrison8436 3 місяці тому +51

    That's a nice flip, modelling a riffle shuffle is hard so model the process of unriffle shuffling. That's so elegant that I shall be mulling it over for quite a while.
    It's also inclusive, no longer are we concerned just with those card sharps who can do a perfectly interleaved riffle shuffle - this is cards for the rest of us, not the elite.

    • @DrTrefor
      @DrTrefor  3 місяці тому +12

      Ya sometimes doing things in reverse is way easier to understand

  • @samanthamagi6849
    @samanthamagi6849 2 місяці тому +8

    We always cut the deck in half, and 2 different people shuffle each half twice. Then they each cut their half in half and trade a half with the other. Shuffle again twice, combine it all, and mega shuffle once or twice. This way each card gets shuffled 5 or 6 times, but each person only has to shuffle 2 or 3 times.
    As i write this, i realize it sounds more complex than it is!

    • @Franimus
      @Franimus 2 місяці тому

      Very useful for large decks!

  • @MathDM329
    @MathDM329 2 місяці тому +6

    I remember coming across a paper about this a few years ago but I couldn’t understand the paper then. Thank you for explaining the math so well!

  • @cigmorfil4101
    @cigmorfil4101 2 місяці тому +4

    With perfect riffle shuffling it's impossible: 8 out shuffles will restore the order whilst 52 in suffles will restore the order. By varying between in and out perfect riffle shuffles you can put the top card at any position in the pack (and the bottom card at the same position from the other end of the pack).
    The best "real" shuffle is to put the deck face down spread out on the table and slide the cards around randomly.

    • @DrTrefor
      @DrTrefor  2 місяці тому +2

      Ya for sure, this works dependent on the model of a binomial distribution, perfect shuffles definitely aren’t that!

  • @sdspivey
    @sdspivey 3 місяці тому +298

    Shuffling is not enough. Cards on the top, tend to stay near the top and cards on the bottom tend to stay on the bottom. For a better mix, occasionally cut the cards distinctly not near the half, followed by more shuffles.

    • @DrTrefor
      @DrTrefor  3 місяці тому +84

      It's ok if most of the cuts are somewhere around the middle, if you think about where say the top card goes, you can get it all the way to the bottom card in a small number of shuffles.

    • @tolkienfan1972
      @tolkienfan1972 3 місяці тому +18

      ​@@DrTrefor I think you can say with confidence that the probability distribution of the location of the original top card won't be uniform after 7 rifles.

    • @ckq
      @ckq 3 місяці тому +28

      ​@@tolkienfan1972heres the math
      After 0 shuffles:
      guaranteed to be at the top (Average ~1)
      After 1:
      50% chance of #1, 25% of #2, etc. (Average ~2)
      After 2:
      ~25% chance of #1, Average (~4)
      .
      .
      .
      After 7:
      ~2% chance of #1 (Average ~26)
      In general note that the xth card goes to roughly the 2x + v (mod 52)th position where v is a random variable with mean zero and variance at least 1.
      Then by applying this 7 times, it gets spread roughly evenly across all 52 positions
      2(2x+v1)+v2.... done 7 times
      gives 128x + 64v1 + 32v2 + .... + v7
      That's essentially uniform

    • @ckq
      @ckq 3 місяці тому +5

      Might be easier to think of it as taking the transition matrix to the 7th power.
      I think you can write a program that determines the value of the transition probabilities under that model and takes it to the 7th power.

    • @jweipjklawe4766
      @jweipjklawe4766 3 місяці тому +12

      This was my intuition as well, but I ran a few simulations and the distribution is not skewed as I thought. All cards have a 1.8% - 2% of landing in each position as expected. This is remarkably consistent even with low unevenness (all splits are perfectly even), or low "stickiness" (5% chance that the next card is from the same side instead of interleave)
      Though it's true that the bottom and top cards exhibit outlier behaviors: top cards can get as high as 2.5% chance of staying at the top after shuffle, and bottom card tends to be at second bottom-most position around 3% of the time.

  • @VocalMabiMaple
    @VocalMabiMaple 2 місяці тому +6

    Cool video, but I have an easier method for random shuffle. Throw the cards around and play 52 card pickup. By the time you are done, you can give it a quick shuffle and have it be random, and also not want to play anymore.

    • @BradenBest
      @BradenBest 2 місяці тому

      Even better: Get 2 pads of paper, a pen, a coin, and a lot of counter space. Lay all 52 cards out in a long line in sequence. Place the coin above the first card. Pick an arbitrary number between 0 and 65535 and write it down on the pad. Let's call it S. If you are having a hard time choosing a random number, try flipping a coin 16 times, double the value for every flip and add it to your total if it is heads, starting with 1 as the adder and 0 as the total. So if you get HTTHHHTTTTTTHHTT that would be 1 + 8 + 16 + 32 + ... = 12345. Now on the other pad of paper, compute S * 13861 + 12345 (so 12345 * 13861 + 12345 in this case), and then perform long division: that number / 65536. The remainder is your result. If you are a filthy casual, you can repeatedly subtract 65536 on a calculator until you get a number less than 65536. 11894 is the result in this case. Write that number down on the first pad under the first number. How many times have you moved the coin so far? Compute 52 - that number. In this case, you've moved the coin zero times, so you get 52. Now take the number that you just wrote down, 11894, and long divide it by 52 to get the remainder (or subtract 52 from it until you get a number less than 52 if you are of weak constitution). You get 38. Starting from the first card (where the coin is), count moving your finger to the right until you reach that number and swap the card your finger lands on with the card the coin is on (if you counted 0 then leave the card where it is). In this case, you'll be swapping the first card with the 39th card, as it is 38 cards to the right of the first card. Advance the coin one card to the right. Now repeat the steps: take the number you wrote on the pad, which we're calling S, compute S * 13861 + 12345, divide by 65536 and write the remainder down. You've moved the coin once, so 52 - 1 = 51, and you'll divide the remainder you just wrote down by 51 and get the remainder. Starting from the coin and going right, count until you reach that number, swap the cards, and advance the coin. Repeat this until you have advanced the coin to the final card.
      Congratulations! You have just manually performed a Fisher-Yates shuffle using a 16-bit LCG seeded with 12345 as your source of randomness. There are exactly 65,536 different permutations that this method will give you starting from a sorted deck and doing only one shuffle, depending on the seed you choose. Shuffling the traditional way, there are only 51, as there are only 51 ways to cut a deck in half. If you think that's crazy, wait til I show you MT19937!

  • @danielpopp1076
    @danielpopp1076 3 місяці тому +2

    I had the privilege of attending a guest lecture from Diaconis last month, he was an absolute delight.

  • @DerpPickles
    @DerpPickles 2 місяці тому +1

    This is cool, I like how you explained and visualized it. I've played plenty of cards, so I knew about shuffling 7 times, but I never thought about why.

  • @shanehebert396
    @shanehebert396 3 місяці тому +3

    I remember going over the perfect shuffle back in Parallel Computer Architecture class in college way back in the day... fun times.

  • @alex_zetsu
    @alex_zetsu Місяць тому +1

    Got it, shuffle 6 times to be able to get all permutations, 7 times for practical randomness, and if you want to do half the work, 3 is enough like I always do.

  • @muskyoxes
    @muskyoxes 3 місяці тому +7

    This seems to answer the question "what if people split the cards unevenly" but doesn't answer the main question of "what if the cards fall in clumps". Was the total variation distance calculated from real shuffles by real people? None of the math leading up to it seems to acknowledge that a human riffle will drop five or six cards in a row from the same half much more often than random chance

    • @juliahenriques210
      @juliahenriques210 Місяць тому

      Yep. Which is why you use two or three shuffling styles for better effect, to work with clumps of different sizes each time and ensure nobody on the table can control the outcome.

  • @HienNguyenHMN
    @HienNguyenHMN 3 місяці тому +1

    Thank you for explaining it! I've only heard of the rule of thumb, but never an explanation.

  • @Jonas-ue6eh
    @Jonas-ue6eh 3 місяці тому +8

    I am having a seminar soon on mixing time of Markov chains and reading the Wikipedia this morning, I came across this exact fact and I got very curious. The probability that you made a video about it today also feels like 1/52! :)

    • @DrTrefor
      @DrTrefor  3 місяці тому +2

      Woah that’s cool!

  • @wyldanimal2
    @wyldanimal2 Місяць тому +1

    If you are able to do Perfect Shuffles, ( split the deck of 52 cards Evenly into two piles of 26 cards each, and then Interweave Every other card starting with the same pile 1st. )
    8 Shuffles returns you to the Starting Order.
    8 perfect Shuffles is a Continuous loop.

  • @taleladar
    @taleladar Місяць тому

    What I do when I shuffle cards, is a "normal shuffle", and then I start cutting smaller pieces off the top of that deck and scramble it into a new one. For example, say I take about an eighth off the top of the shuffled deck, put it in my other hand. Take the next eighth and put it below that piece. Take the next eighth and put it on top of all that. Take the next eighth and put it below everything. Etc. End with placing the last bits on top. Then after I've re-pieced the deck together with a bunch of mini cuts, I repeat the process at least two more times. I have been doing this for years, and I started doing that when I realized that cards near the top are going to stay near the top and cards near the bottom are going to stay near the bottom otherwise.

  • @VoidHybrid
    @VoidHybrid Місяць тому

    Bit of a ramble:
    It also depends how you end each shuffle. You could keep the same card on top of the deck no matter how many shuffles if you always make it the last card when shuffling.
    What I'd want to know with shuffling. Obviously there is distribution between how many cards are in each hand and how many cards come from which pile at a time, but if one were to do absolutely perfect shuffles over and over, a 52 card deck would eventually return to the exact same order of cards as it started with.
    I'll give two examples with 6 cards.
    In the first example, I'm always starting with the top half of the cut.
    In the second example I'm going back and forth between starting with the top half or bottom half.
    123456
    415263
    246135
    123456
    123456
    142536
    513462
    541632
    653421
    645231
    263415
    246135
    123456
    But after 4 or 9 shuffles either way of shuffling a perfectly cut deck of 6, you end up back at the same starting order.
    So my question is, how many perfect shuffles would be required for a 52 card deck to get back to its starting point (shuffling either back and forth, or always starting with the top half) because wouldn't the middle of the amount of shuffles needed be pretty random? Or, better question, how many shuffles done perfectly cut would be needed for outcome to be considered random. I mean, obviously there is a guaranteed order for the outcome if you shuffle this way, but when you're playing a game and never put the cards back in the same order, it will always be inherently random. Does the answer still come out to 7?
    My way of avoiding the perfect shuffle issue (i prefer to do perfect shuffles), is I'll shuffle two ways. Perfect shuffles, and throwing sections of the entire deck into my other hand a random amount of cards at a time. That way any cards that are kinda stuck on one side of the deck can get moved around quicker and gives higher chance of the cards that are stuck to come out sooner. Because if you only shuffle a deck perfectly, your cards on opposite sides of the deck are only going to move toward one another 1, 2, 4, 8, 16 cards at a time if you always shuffle the same way. And then back and forth a bit after it ends up on the bottom half. So I throw a wrench in my shuffling to really move the cards around randomly so they have equal chance of being at the bottom/top. It takes a minimum of 5 prefect shuffles to get the top card on the bottom half of a 52 card deck. But that doesn't give each card an equal chance of landing as the bottom card (or going the other way, as the top card)
    Even after 7 shuffles with starting with the top half of the cut, the original top card would go from position (1-26 at the top, 27-52 at the bottom):
    1. To 2. To 4. To 8. To 16. To 32. To 11. To 22. To 44. To 35. To 17. Etc. You can keep shuffling and it'll keep moving around, but it will take a lot of shuffles to get within the last few cards (again, opposite for bottom card coming to the top).
    Does every card have an equal chance to end up as the top card whilst perfect shuffling and random shuffling? Obviously yes, but how little shuffles is required for that?

  • @BloobleBonker
    @BloobleBonker 3 місяці тому +4

    Great graphics as always!

  • @zoonvanmichiel9045
    @zoonvanmichiel9045 3 місяці тому +4

    On the slide at 15:27 there is an off-by-one error.
    r rising sequences means r-1 cuts are predetermined.

    • @DrTrefor
      @DrTrefor  3 місяці тому +3

      Quite right - thank you!

  • @scottdobson1276
    @scottdobson1276 2 місяці тому +1

    I like to think of tracing the top card and where it might go.
    If you ripple perfectly, it's in one of the top 2 positions after 1 shuffle. After another it could be as low as 4. After n merges, the deepest it could be is 2*n. So it takes 5 for it to possibly be in the bottom half of the deck, one more for it to be at any position in the deck but there are likely significant differences in probability at different parts of the deck.
    A 7th merge would greatly equal out that probability

  • @hw2007
    @hw2007 Місяць тому

    I literally had a test on all of this earlier today, wish I had watched this earlier lol!

  • @iwersonsch5131
    @iwersonsch5131 3 місяці тому +1

    Suppose we started from a sorted deck, shuffled it 7 times, and dealt 2 cards each to 2 different hands.
    Then, suppose we dealt 5 more cards into the middle of the table, and determined the stronger hand according to Poker rules.
    How would the matchup probabilities between two specific hands shift compared to a truly random shuffle? Which matchups would shift the most?

  • @randyriegel8553
    @randyriegel8553 2 місяці тому

    We I play Texas holdem tournaments if our table needs a new deck from some reason (torn card, etc) the dealer will have all other dealers to freeze the table and stop the blind clock. They normally will "flip shuffle" like you did for 5-6 times... then do a "side shuffle" where you have 1/2 in your left hand and half in your right... where they just fall into place a few times. Then a couple more flip shuffles. Then the final shuffle is spreading cards out on table and the swirling them around into each other. Then he cuts. And back to cards.

  • @franks4973
    @franks4973 2 місяці тому +1

    You actually need to cut in thirds and restock prior to cutting in half for shuffling. That will reduce top and. Bottom portions that have less movement,ent.

  • @jmi967
    @jmi967 3 місяці тому

    Something like five years ago I made up a shuffling sequence that made the cards visually random fairly quickly most of the time. I’d have to look up the details of it if I still have my notes in storage. It only had two shuffles but had something do do with the cutting of the deck if I remember correctly.

  • @BryndanMeyerholtTheRealDeal
    @BryndanMeyerholtTheRealDeal 2 місяці тому

    Her: I only date bad boys.
    Him: shuffles deck of cards eight times

  • @riversarcadereview385
    @riversarcadereview385 2 місяці тому

    I've experimented with a 'set up deck' and shuffled with an exactly split deck and alternated cards left right and repeated and after 5 shuffles, the cards began returning to their original positions and after ten shuffles, they were back to the original set up

  • @danwylie-sears1134
    @danwylie-sears1134 2 місяці тому

    The way I've always thought of it is that when you have two cards adjacent to each other in the initial order (a card and the card that's one away from it), you put approximately one card in between them (so it's approximately two away). With the next shuffle, you put approximately one card in between each of the ones that are there from the first shuffle, so it's approximately four away, doubling with each shuffle. That got me to the same criterion of needing to have two to the number of shuffles exceed 52.

  • @alextsitovich9800
    @alextsitovich9800 2 місяці тому +1

    Shufflin'! Shufflin'! Every day I'm shufflin'!

  • @JobBouwman
    @JobBouwman 3 місяці тому +2

    Why didn't you explain this with convolutions? With each shuffling the cards have an expected position, combined with an stdev in its position. Then after 7 shuffles, the total stdev is sqrt(7) times the initial stdev.
    There is than still a lot of structure in the deck, however, we as humans don't recognize this structure anymore.

  • @bartsanders1553
    @bartsanders1553 3 місяці тому +1

    Not only is it likely to be in an order that has never occurred before, but in an order it will never be again.

  • @oliviermiakinen197
    @oliviermiakinen197 3 місяці тому +1

    12:00 your colors are most of the time in the order blue

  • @michaelturner2806
    @michaelturner2806 2 місяці тому +1

    I come from a trading card game background, where my deck contains 99 cards, with about 80 being unique and the rest being copies of the same 2 or 3 cards. (Magic the Gathering Commander format with basic lands.) Since it's 99 cards instead of 52, based on the math at the beginning, 8 shuffles should be plenty? (2^7 = 128 > 99)
    I also mash shuffle instead of riffle shuffle, but I don't think that makes a difference if done right.
    I know players often like to start off with a pile "shuffle", placing the cards in sequence into different piles, in my 99-card deck example usually 10 piles. This can feel like it kickstarts the randomizing process, but it's mainly a way to count the cards to make sure none have gone missing between games, like being dropped on the floor or an opponent accidentally taking one that was played on their board.
    Plus there's something I find satisfying about shuffling nearly 100 sleeved cards on a soft neoprene mat. If it were more portable I'd keep it as a fidget distraction.

  • @MrKfadrat
    @MrKfadrat Місяць тому +1

    Blokus, i really liked that game

  • @robertalvir7173
    @robertalvir7173 2 місяці тому +2

    Nice job of bending my brain … now I can go and play Pickleball 🏓🤣

  • @mongaelias7061
    @mongaelias7061 3 місяці тому +1

    Great skill there doctor!🎉

    • @DrTrefor
      @DrTrefor  3 місяці тому +2

      Thank you!

    • @mongaelias7061
      @mongaelias7061 3 місяці тому

      Much love from Makerere university ❤
      Tomorrow is my calculus 2 exam and am so motivated by you!!

  • @papalyosha
    @papalyosha 3 місяці тому +19

    Calculated total variation distance shows that 7 shuffle is not good at all! Quite the opposite: 0.334 means that there is a bet on deck of card, such that the difference of probability of winning when cards are shuffle perfectly, and when cards is shuffled 7 times is 33.4%. It is 1/3 for heaven's sake! It is not small at all, considering that probabilities usually lies between 0 and 1.
    For example, let's play the following game. We take the deck where the cards are sorted by values. Then we do riffle shuffle 7 times. Then we look for pairs of cards that were consecutive in the original order (like Queen and King of Clubs). For each such pair we see if these cards was switched after the shuffle. If the order was switched, then it's +1 point for you, if it is not, then it is -1 point. We count points for each of 53 pairs of consecutive cards. I win if you get negative points. In perfectly shuffled deck, you should win with probability exactly 50%. But in reality (i.e. with 7 shuffles according to Gilbert-Shannon-Reeds model), you lose with probability 80.7%. The difference if huge! I can even let you win if the final score is -1 or more. Then in theory (perfect shuffle), you should win with probability 68.4%. But in reality (7 shuffles) you win rate would be only 35.0%. The difference is 33.4% is exactly total variation distance. So how people can say that seven shuffles are good based on this data, is mysterious to me.
    P.S. I followed the link and read Bayer & Diaconis's paper. And no, they don't claim that 7 shuffles are enough. They are saying the opposite: "In studying these numbers, we were most struck by the results for many shuffles. Even at eight shuffles, it can still make a great bet: Betting even money on being able to pick the moved card with 26 guesses, one enjoys nearly a 10% advantage. This is startling, considering that people rarely shuffle eight times in practice."

    • @Fabelaz
      @Fabelaz 2 місяці тому +2

      Don't understand a word, will like regardless👍

    • @Franimus
      @Franimus 2 місяці тому +1

      That's not actually what total variation distance means. That .334 is the delta between a uniform distribution (2% chance for each position) and the curve from shuffling 7 times. In other words the curve is much flatter and closer to a uniform distribution.

    • @Franimus
      @Franimus 2 місяці тому

      The quote is also from the segment about a magic trick where a card is removed from the deck and replaced elsewhere, and identifying that card by **inspecting the entire deck face up**. With an infinitely shuffled deck, the process enables the magician to guess correctly 1.9% of the time on the first guess. That's the uniform distribution, 1/52 chance. Shuffling 7 times allows the magician to guess correctly 2.8% of the time. Not perfectly random, but good enough for gaming. 6 times is 4.2% and 8 times is 2.3%, so you can see how further shuffles get you only a little bit closer to that 1.9% uniform distribution after the 7th.

    • @papalyosha
      @papalyosha 2 місяці тому

      ​@@Franimus Well, 2.8% is 1.5 times more than 1.9%. I would not call this close. You can bet $1 against $51 that you guess the card correctly from the first attempt. It should be a fair game with uniform distribution. But after 7 shuffle, you would get average advantage of about 50 cents per 1 dollar of you bet. I would not say it's even close to a fair game.

    • @Franimus
      @Franimus 2 місяці тому

      @@papalyosha that makes no sense... A 2.8% chance of winning is 28 out of 1000 times. Not half.

  • @iceboundglaceon
    @iceboundglaceon 2 місяці тому

    if you only riffle shuffle from a perfect ascending order deck, the cards will still be in batches of ascending order. it will not be truly random. (the first ace will always be in the top 6 cards when only riffle shuffled 7 times)
    you have to shuffle overhand a few times first to break up the ascending order, then riffle shuffle an odd number more times. this properly breaks up the ascending order, making a more random deck.

  • @omgopet
    @omgopet 3 місяці тому

    14:40 - Either this is a mistake, or I misunderstood something. I'm pretty sure that for r sequences you need r-1 pre-determined cuts. If there is only one sequence, there are no pre-determined cuts, for r=2 (your example), you need 1 pre-determined cut etc.

  • @DaneBrooke
    @DaneBrooke 2 місяці тому +3

    You aren't the first to UA-cam in favor of 7 shuffles, tho I prefer your argument for it. The only hanging question is "why stop there"? Yes, the distance metric has gotten "pretty small" after 7 shuffles, but 8 (and subsequent) shuffles roughly halve the distance metric. Surely "more shuffles are better". I am asking "You haven't clarified the meaning of 'pretty small' enough for me to understand why you would be happy stopping at 7 shuffles instead of 8 or 9..."?

  • @ratamacue0320
    @ratamacue0320 3 місяці тому +2

    What if you mix in some overhand shuffles?

    • @DrTrefor
      @DrTrefor  3 місяці тому +2

      These are very inefficient, I saw diaconis say 20,000 of these are needed to get to random

    • @ratamacue0320
      @ratamacue0320 3 місяці тому

      @@DrTrefor personally, I use mostly riffle bridges. I just sprinkle in a few overhands.
      For instance, what if I do 1 or 2 riffles, then once through the deck with an overhand shuffle (e.g. in 6 chunks), then 2 to 4 more riffles? How does this compare in terms of randomness and efficiency? Or vary the number and order of various types of shuffles; can we achieve the same randomness with fewer than 7 total shuffles?
      My intuition is that a well-placed overhand shuffle(s) could breaking up the sequences...

  • @Krydax8
    @Krydax8 3 місяці тому +1

    I've always been curious, and, this has never been answered by any videos I've seen, what about crappy shufflers. People who flop sometimes blobs of 3, 4, even 5 cards at once as they're interleaving the cards? Most of these shuffle-math analyses look at 1 or 2 card groups being interleaved, but what if those are far higher? What number of shuffles do you need then?

    • @DrTrefor
      @DrTrefor  3 місяці тому +1

      This model assumes every way you can cut and shuffle is equally likely. If you want to tweak the distribution a bit so “good” shuffles are rare, I don’t think this will do that much. Groups of 5 are common in the distribution of this video.

  • @Wborogoal478
    @Wborogoal478 2 місяці тому +1

    Shuffle, cut 1/3, shuffle, cut 2/3, repeat.

  • @hippoAutwell
    @hippoAutwell 3 місяці тому +1

    What if I use 2 fifty-two decks. How many times must a person shuffle like the 7 times in the video?

  • @andrewharrison8436
    @andrewharrison8436 3 місяці тому

    So 52 coin flips determines a riffle shuffle. So take the 52 results, working forwards looking for heads put out cards 1, 2 etc. Then working backwards looking for tails put out cards 52, 51 etc. Physically tedious but easy to program.
    Of course once programmed you have to look at cumulative results!
    Doing this (I used Excel VBA macros) it's nice to see intuition confirmed in that 1 maps to 1 half the time, 2 a quarter the time etc. Very skew. Further down the numbers on average jump from n to 2n with a more symetrical distribution about that mean.
    The middle numbers split between the 2 ends, however the 2 parts are each part of a symetrical distribution so move the low part 52 places to the right and there is still that symetrical shape with a mean of 2n.
    All very elegant but I need a much wider screen (17% zoom to see it all at once is unreadable).
    Looking at mean and standard deviation, the mean is quite close to 2n for each start n, the standard deviation is 4 times as high for the middle numbers as for the end ones.
    This method can tell you probabilities of a card being somewhere but says very little about how correlated that is with the position of its neighbour.

  • @inordirection_
    @inordirection_ 2 місяці тому

    i wonder if there are other measures to judge the uniformity of the distribution of possible shuffles after m 2-shuffles. For instance, rather than total variational distance, I wonder how much the probabilities of the most and least likely permutations differ from their 1/52! probabilites under the uniform distribution. I don't really have an intuitive sense for why 0.33 is an acceptable TVD from uniform but 0.61 is not.

  • @Essman614
    @Essman614 2 місяці тому

    Really makes you think about lands in MTG

  • @Chiberia
    @Chiberia 2 місяці тому +1

    or just hand the deck to my toddler daughter, who will chuck them across the room - perfect shuffle.

  • @jacquespictet5363
    @jacquespictet5363 2 місяці тому

    Or use the most common method: lay cards on the table (face up) and mix them, then alternate cuts and shuffles. Much ado about little.

  • @maxscott3349
    @maxscott3349 3 місяці тому

    I have to do 20 to 30 for the games I play with my cards, but my area has really high humidity and they can stick together real bad sometimes.

  • @MasterHigure
    @MasterHigure 3 місяці тому +2

    It's always cool to see video adaptations of Proofs From The Book. There is a reason the proofs that are included in there are included in there.

  • @kucken64
    @kucken64 3 місяці тому +1

    That was really interesting Trefor. Okay, but what about pile shuffling? That's where a deck of cards in dealt into a set of separate piles (usually eight) and then those piles are combined and shuffled once or twice? I ask because this is a really common shuffling procedure in Magic the Gathering.

    • @Icapica
      @Icapica 3 місяці тому +1

      Pile shuffling isn't random at all. It's done in Magic: The Gathering to count your cards so you know your deck is legal before the game starts. A couple of times by pile shuffling I've noticed I was missing one card that had fallen somewhere to the side.
      After pile shuffling you should still shuffle properly (meaning quite many times) since pile shuffling isn't actually shuffling.
      Another reason why you might pile shuffle MTG cards is that if your sleeves aren't completely clean, they might stick together. Pile shuffling fixes that. Though if you notice that becoming a real problem, you should just buy new sleeves at least if you play in tournaments.

    • @DrTrefor
      @DrTrefor  3 місяці тому +2

      The cutting part of this procedure is going to do very little to making the deck random. It takes huge amounts of cuts (or overhand shuffles) to get to random.

    • @kucken64
      @kucken64 3 місяці тому +1

      @@DrTrefor Ah sorry to be clear the deck isn't cut into eight piles, it is dealt into eight piles, so card one goes into pile one card two into pile two card three to pile three and so forth. Then the deck is shuffled. The idea behind it is rapidly break up stacks of cards of a similar type.

    • @kucken64
      @kucken64 3 місяці тому +1

      @@Icapica I never said it was random. Its not just done in MtG to count cards, it's done to rapidly disperse groups of similar cards, i.e. mana, through the deck - effectively to break up structures in card order that have arisen from the previous game. What I am interested in is how that kind of procedure could have an impact on the processes described in Dr Trefor's video. If you do a pile shuffle does it take fewer shuffles to reach the point where all possible deck combinations are similarly probable?

    • @Icapica
      @Icapica 3 місяці тому +2

      @@kucken64 Yeah I know, but counting your cards is the only use for it that is actually accepted in the tournament rules. Because pile shuffling isn't random, it doesn't make it any faster to shuffle the deck properly. Basically, when you start shuffling (riffle or mash shuffle), it doesn't matter at all if you pile shuffled the deck before. Clumps do not matter at all. If the starting order of your deck matters after shuffling, it means you did not shuffle it enough.
      You can find Magic Tournament Rules online. Under MTR 3.10 "Card Shuffling", it says specifically:
      "Pile shuffling alone is not sufficiently random and may not be performed other than once each at the beginning of a game to count the cards in the deck."
      After saying that, it explains that pile shuffling isn't random and thus isn't shuffling at all. If you see someone pile shuffle and then not shuffle their deck enough, they're a cheater though possibly unintentionally. If you see someone pile shuffle more than once at the beginning of a game, call a judge. Also, be careful of players who seem to pile shuffle a lot and not shuffle much otherwise. Pile shuffling is a favorite tool of many cheaters since a skilled pile shuffler can stack their intentionally in an order that benefits them.
      A lot of MTG players just pile shuffle because they've seen other people do it but haven't learned why it's actually done. And in general, if you go online to talk about shuffling, you're going to get a lot of bad info from players with little knowledge of either randomness or the rules.

  • @mikeonthecomputer
    @mikeonthecomputer 2 місяці тому +1

    What's sort of funny is that I always do 8 shuffles, just because it suits my OCD tenancies better. In poker, it's good practice to cut before each shuffle (presumably to reduce the chance of stacking a deck), and after the 4th, the whole deck is cut into four pieces and stacked on each other, then more shuffles are done. Instead of doing just three after that point, I just go for a full four extra. It doesn't take much time.
    At any rate, I can be confident a deck is shuffled at that point. :)

    • @jeremyschulthess63
      @jeremyschulthess63 2 місяці тому +2

      I've played Caribbean Stud in cruise ship casinos before. I've know the minimum 7 shuffle thing for years and always watch how many times the dealer shuffles the deck (they don't have auto shufflers so it is all by hand). Inevitability every dealer has only shuffled 3 or 4 times and you can actually watch the hands move around the table. I know they have probably been instructed to do this so people lose more money (the casino on a cruise ship brings in more money than anything else).

    • @mikeonthecomputer
      @mikeonthecomputer 2 місяці тому +1

      @@jeremyschulthess63 If they set up the games properly, they wouldn't need to effectively cheat. Especially in poker, set the rakes to make as much profit as they want (without driving players away), and they needn't care about what's won at all. The rake guarantees a fixed amount going into the casino.
      Now, in house games like Blackjack, there does exist a risk of a big win, but the odds are still fairly well known, and casinos even have insurance companies willing to cover the lucky players.

    • @jeremyschulthess63
      @jeremyschulthess63 2 місяці тому +1

      @@mikeonthecomputer Caribbean Stud is a house game with a minimum qualification for the house to be in the hand. If the house doesn't qualify then you win like $5 instead of lets say $50 on a flush. The main thing is I'd say 90% of people don't know that you have to shuffle at least 7 times to randomize the deck. They see the dealer shuffling 3 or 4 times and think OK that works. Not to mention a lot of the players are probably quite drunk.

    • @mikeonthecomputer
      @mikeonthecomputer 2 місяці тому

      @@jeremyschulthess63 Thanks, I didn't know it was a house game. Even still, poker hand odds are well known to the point that they should be able to safely work from a real randomized deck.

    • @jeremyschulthess63
      @jeremyschulthess63 2 місяці тому +1

      @@mikeonthecomputer remember if people are getting some good hands they are more likely to bet bigger the next time. At the same time the people playing that I saw really didn't know what poker hand odds are.

  • @Ojasvi-dr7yb
    @Ojasvi-dr7yb 3 місяці тому +3

    Make a video on circle inversion

    • @DrTrefor
      @DrTrefor  3 місяці тому +2

      Oooh that would be a good one!

    • @Ojasvi-dr7yb
      @Ojasvi-dr7yb 3 місяці тому +1

      I would also recommend a video generating functions(especially exponential generating functions) and recurrence relations ​@@DrTrefor

    • @Ojasvi-dr7yb
      @Ojasvi-dr7yb 3 місяці тому +1

      Maybe this is too much but quaternions would also make a great video topic. I would be glad if you make a video on a topic in my recommendations​@@DrTrefor

  • @Nachiebree
    @Nachiebree 2 місяці тому

    Now I'm curious about shuffling MtG commander decks, 99 cards and shuffling being "take the stack and drop a few cards into the other hand at a time"

  • @keiraferrari7764
    @keiraferrari7764 3 місяці тому +9

    A perfect shuffle is NEVER random. So, you must be talking about imperfect shuffles.

    • @RepChris
      @RepChris 2 місяці тому +1

      depends on your definition of perfect. nothing in math is more important than semantics. you could also have perfect in the sense that it actually is good at shuffling the deck, which a completely deterministic shuffle isnt (fisher-yates is a classic example, but plenty of others exist; an imperfect faro shuffle shuffle isnt all that bad either). Of course this isnt the "perfect" definition thats most commonly used, although that one (for one of the two ways you could do it) leads to the card order being a cyclical group of order 8, which is neat (unless you want a shuffled deck). For the other option you get even more interesting group properties.

    • @readjordan2257
      @readjordan2257 2 місяці тому

      I could be wrong, but thats kind of like saying the perfect chef never washes his hands after he uses the bathroom. I mean, if we're talking waffle house then true facts...but if were talking literally anywhere else, im sorry but thats straight gross. This statement seems statistically sus.

  • @shawangconcertpianistyamah2756
    @shawangconcertpianistyamah2756 Місяць тому

    DS13 is trying to make a science fair topic out of this. Any possible angle to the topic you might be able to direct to?

  • @cogwheel42
    @cogwheel42 3 місяці тому

    It seems a 52-shuffle would create a uniform distribution. But is this equivalent to shuffling 52 times? Can the bias from the initial order ever be fully stamped out?

    • @DrTrefor
      @DrTrefor  3 місяці тому

      Right that would be truly random, because it presupposes you shuffle the 52 piles “randomly”. 52 2-shuffles is not quite the same, that still has a (tiny) asymmetry

  • @marcosettembre
    @marcosettembre 2 місяці тому

    Technically, even if they are all ordered by value and suit, that's still as random of an order as any other

  • @nicktyler9339
    @nicktyler9339 2 місяці тому

    Ok, now can you work out this problem with a Skip-bo pack please?

  • @anthonywarfield7348
    @anthonywarfield7348 2 місяці тому

    I like to shuffle 3 times followed by a rifle shuffle and then repeat. Don't know if that is good enough but if we are playing spades I always sneak a peak at the last 4 cards and make sure me and my p get the best ones.

  • @andyhughes8315
    @andyhughes8315 3 місяці тому +1

    If you do a perfect bridge/rifle shuffle 4 times you'll be one swap away from reversing the original order.

    • @DrTrefor
      @DrTrefor  2 місяці тому

      I want to learn how to do a perfect shuffle, would be a great party trick:D

  • @jimwinchester339
    @jimwinchester339 3 місяці тому +2

    It's really rather simple. The deck is "shuffled" by alternating a draw from two half-decks. Each time a card from a half-deck is merged, it has the opportunity to rise or fall by [at least] one spot in the deck. If shuffled twice, that card could advance two positions; once shuffled 3 times, +/- 4 spots, and so one. So it's really a powers/log problem: when do we get past 52? When does 2^x >= 52? 2^5=32, 2^6=64. And you have to start with x=0 (not x=1), because you begin with HALF-decks - - totally unshuffled. So, 0..6 is 7 times.

  • @RossMarsden
    @RossMarsden 2 місяці тому

    That is not the only way to shuffle.

  • @MoonLiteNite
    @MoonLiteNite 2 місяці тому

    I just do a wash.... so much quicker than 7 shuffles :D

  • @Logia_
    @Logia_ 2 місяці тому

    All you do is shuffle diferent, like with small cuts after the first 2 or 3 shuffles

  • @R.B.
    @R.B. 3 місяці тому +1

    The other way to get to 7, is that with 8 perfect rifles, you can get the cards back to order. 7 imperfect shuffles is just short of this, and it ensures the closest randomness, then have someone else cut the deck. Even if you always start the bridge shuffle with the same hand and manage to keep some cards together at the top or bottom of the deck, the cut folds those cards in and prevents someone from stacking the deck. This is a good strategy for beginning any game. At a minimum, 3 shuffles with a cut, it won't be completely random, but assuming that it wasn't already ordered, such as between hands, that should be sufficient for a shuffle between hands to make it a fair shuffle. The reasoning for this is in part why 7 shuffles is better than 8, in that cards naturally pick up a small order again at 4, and stopping just short makes the deck more fair, but takes half the time to prepare. It isn't ideal and completely random, but for most card games it will give you a good deck for between hands.

    • @Icapica
      @Icapica 3 місяці тому

      All of that assumes that those riffles are perfect though, and they're not supposed to be. If riffles aren't perfect, there is no point at which the deck becomes less random by shuffling it more.

    • @sevret313
      @sevret313 2 місяці тому +1

      If you're doing perfect shuffles, 7 would also be completely predictable if you've learnt the order of a 7 perfect shuffle sequence.

  • @troyfrei2962
    @troyfrei2962 2 місяці тому

    If you shuff 6 or 7 time it is back to the Original order

  • @anthonywarfield7348
    @anthonywarfield7348 2 місяці тому

    Just had another thought. I question the usefulness of this video because i can't imagine someone who doesn't already understand these concepts being able to follow along. I showed this to my wife and she quit in frustration the moment he started showing probability graphics. Just found it interesting. Im weird like that.

  • @Domo3000
    @Domo3000 3 місяці тому +1

    If you do 8 perfect riffle shuffles you are back at the exact order you started at. You shouldn't do that kind of shuffling to begin with, and especially not 7 times. You would have a more "random" arrangement by doing it 3 times.

    • @DrTrefor
      @DrTrefor  3 місяці тому +3

      That’s true. The results of this video depend on the distribution of shuffles that experimentally models normal shuffles, but fails miserably for people doing perfect shuffles

    • @Domo3000
      @Domo3000 3 місяці тому

      @@DrTrefor I'm just always suspicious of these kind of shuffles as I used to play poker with a friend that was a hobby magician and he learned to do them perfectly (or nearly perfectly almost all of the time) and once showed how easy it would be to just pretend to be shuffling.

    • @Pystro
      @Pystro 3 місяці тому +1

      I guess the only way to get rid of the possibility of perfect riffles is to have 2 different people control the different sides.
      Then again, in a game theory sense, that's also only true if at least one of them has an incentive to have the cards randomly shuffled. That shuffler can then vary the card dropping speed.
      Or if you don't want to do something quite as complicated, you could just have each of the 2 players riffle on their own but have each one do 4 of the riffles.

    • @UtterlyMuseless
      @UtterlyMuseless 3 місяці тому

      In-shuffling only at my poker table.

  • @DH_Arts9368
    @DH_Arts9368 3 місяці тому +2

    You perspective towards maths is amazing sir. We need teachers like you
    Love from India sir 🇮🇳❤❤
    I was already watching ur lecture on Taylor's theorum 😁

    • @DrTrefor
      @DrTrefor  3 місяці тому +2

      Thanks so much!!

  • @aaaaaaaaaaaaa172
    @aaaaaaaaaaaaa172 Місяць тому

    Just throw it on the table and try to put it together

  • @l8tbloomer
    @l8tbloomer 2 місяці тому

    Anyone in the casino business would laugh hysterically at the incompetence of this guy's shuffle analysis. If only from the horrendously bad shuffle he shows.
    Casinos do a strip between shuffles. And almost universally three shuffles for a single deck blackjack game. For texas holdem poker there is typically a wash first.
    The equal probably of left and right for each successive card is also total nonsense.

  • @acf2802
    @acf2802 2 місяці тому +1

    I think the riffle shuffle is worthless because if you are too good at it, there is absolutely nothing random about it.

    • @DrTrefor
      @DrTrefor  2 місяці тому

      Ya ultimately this model is only as good as the assumption people shuffle like the binomial distribution. While that is experimentally good in general, there are definitely outliers who can do perfect shuffles

  • @shirsenduroy19-7
    @shirsenduroy19-7 2 місяці тому

    Sir , would you please make a video about Liouvill's extension integration of Dirichlet theorem ?
    Why ,
    fff x^(l-1) y^(m-1) z^(n-1) F(x+y+z) dxdydz
    = ((gama l)*(gama m)*(gama n)/(gama(l+m+n)) *
    (integrate a to b of f(h) h^(l+m+n-1) dh)

  • @ayushprasad8207
    @ayushprasad8207 Місяць тому

    THALA for a reason

  • @mikelwrnc
    @mikelwrnc 3 місяці тому +1

    As a statistician, I hate when statements regarding stochastic processes fail to talk about the results as a distribution, as would be proper. Or at least detail the decision framework being used to summarize said distribution.

  • @schwamforfreedom
    @schwamforfreedom 2 місяці тому +1

    So, what percentage of possible card orders are possible with 7 shuffles? .334 may be a low number in that type of analysis but is meaningless to most viewers.

  • @christopherellis2663
    @christopherellis2663 3 місяці тому

    Þ3ri

  • @The_Commandblock
    @The_Commandblock 3 місяці тому +1

    Just say you shuffle the cards, the others choose their stack first and you get the remaining one. Noone gets an advantage

  • @mrosskne
    @mrosskne 3 місяці тому

    anything a human can do is governed by deterministic physics. unknowable by humans isn't the same thing as random.

    • @Pystro
      @Pystro 3 місяці тому +2

      Yes, but the factors going into the deterministic physics are different every time. Meaning you still get a different order every time you shuffle. (Until you start getting close to playing 52! games of course.)

    • @mrosskne
      @mrosskne 3 місяці тому

      @@Pystro and it's still not a random process.

    • @UtterlyMuseless
      @UtterlyMuseless 3 місяці тому

      Someone needs to study chaos theory and entropy.

    • @mrosskne
      @mrosskne 3 місяці тому

      @@UtterlyMuseless chaotic doesn't mean random and entropy has nothing to do with shuffling. you're just repeating words that you think make you sound smart. you're the one that needs to study.

    • @UtterlyMuseless
      @UtterlyMuseless 2 місяці тому

      @@mrosskne Sir, please. You're making a philosophical argument but are unwilling to grapple with the possible meanings of the words you're using. Chill.

  • @Michael-hw5wk
    @Michael-hw5wk Місяць тому

    I HATE cards and I HATE gambling. There's no reason I should be seeing this BS.

  • @scottyvalentine9811
    @scottyvalentine9811 3 місяці тому

    Yet another person making things harder then they need to be. Yeah 7 for a fresh open pack but card etiquette is 2 to 3 during the game. Plus 3 to 4 for two decks of cards. Don't forget letting someone other than the dealer cut the cards once. So ya made a video that has already been done, good work of originality. Thumbs down from me.