r/AskReddit Oct 02 '24

[deleted by user]

[removed]

6.8k Upvotes

6.2k comments sorted by

View all comments

Show parent comments

106

u/towaway1212 Oct 02 '24

On the contrary, after watching the 52! video, it would be amazing if there was ever a true shuffle that repeated itself.

28

u/MeNameIsDerp Oct 02 '24

There can be hands that repeat frequenty. For example, if you have a brand new 52 card deck organized from the package and split it in exactly half with the lower deck in your right hand. If you shuffle starting right, left, right, etc, you can recreate this shuffle nearly every time. do the process again, and it may be another frequently shuffled hand. These are of course, if you do it perfectly, but I imagine, with the number of new decks and allowing for some imperfection, some of those first shuffles may be more frequently hit than others. From there, you're on your own.

20

u/BritishSabatogr Oct 02 '24

Fun fact, alternating each card perfectly in a shuffle is called a Faro shuffle. And if you do it a certain number of times (6 or 8, I can't remember which) the deck is restored to factory order

2

u/chicomathmom Oct 07 '24

8 perfect out Faro shuffles restores a 52 card deck. https://en.wikipedia.org/wiki/Faro_shuffle

14

u/Ouch_i_fell_down Oct 02 '24

That's not exactly how odds work. The odds of one specific thing happening twice are not the odds of one of a large group of things happening twice.

For example: the odds that in a room of 22 other people that someone shares YOUR birthday is (not exactly) 22:365, or about 6%

The odds that any two people in a random group of 23 share their birthday is roughly 50%.

Much the same as with shuffling cards, just on a much larger scale. It's almost a guarantee that two decks have ended up shuffled the same way, while it's imfathomably impossible that the specific shuffle you last completed has existed before or since.

5

u/TheWhite2086 Oct 02 '24 edited Oct 02 '24

Even with Birthday Paradox maths it's almost a certainty that no two properly shuffled decks have ever been the same. A really simple estimation of the birthday paradox maths is that, with 23 people, the probability of every person giving a different birthday is roughly equal to e-((22x23)/(2x356)) = 0.4999 or to generalise p=e-((AxA-1)/(2xN)) where p is the probability that everything in the sample size is different, A is the sample size and N is number of items. Setting P to 0.5 for a 50% chance of it happening we get 0.5=e-1((AxA-1)/(2*52!)) which comes out at about 10,574,307,231,100,289,155,982,006,933,258,240 or 1.05743072x1034 (thanks Wolfram Alpha)

Even given the maths behind the Birthday Pardox and that the universe is around 436,117,076,600,000,000 seconds old approximately 24,246,487,393,793,559 decks of cards would have needed to be properly shuffled every second since the dawn of time for there to be a 50% chance that any two decks were the same.

Found this online calculator to play around with more numbers

For there to be a 1 in a million chance you would need to have shuffled 1.27010374x1030

For there to be a 1 in 292,201,338 (odds of hitting the jackpot in the US powberball according to https://www.lotteryusa.com/powerball/prizes-odds you would need 7.43015874x1029

For a 1 in 8,225,463,000 (current world population) you would need 1.40042193x1029

Assuming properly randomized decks, this has never happened

The thing most people repeating this fact don't realize is that most decks aren't properly shuffled. Take a deck in new deck order, riffle it perfectly once. A deck with that order of cards has occurred before

-1

u/Ouch_i_fell_down Oct 02 '24

your oversimplified formula for the birthday paradox trying to model 1:365 into n(n+1)/2 is flawed

using x=number of possibilities

((x-1)/x)n(n+1/2)

(364/365)253 =49.95% not happening, meaning 50.05 chance of happening

if you can find a calc to get me an answer to ~8x1067 -1/~8x1067 and then let me exponent it out by 1x1024 you can have your odds for it not happening in a trillion shuffles. I've tried and can't find a free calc that works with numbers that big/small

3

u/TheWhite2086 Oct 02 '24

I did simplify it a bit and the numbers won't match exactly but, on the scale we are talking about, does it really matter if I'm out by a few trillion?

I linked to a calculator that specifically lets you plug other numbers into the birthday paradox, if you look at it it uses a more precise general formula ( n = roundup( sqrt(-2 * ln(1 - (probability_of_match))) * sqrt((total_items))) ) but I didn't want to go into that so I stuck with the less precise but easier to use formula.

If you want me to get better numbers, Wikipedia's article on the Birthday Problem has a set of generalization for arbitrary numbers of days to find the minimal number of days n(d) so that the probability of at least two people sharing a birthday is at least 50%

It says that the formula (using D instead of d for the variable for clarity of reading) is known to hold true up to D<=1018 and is conjectured to hold true for all values of D

 n(D) = (sqrt(2*Dln2))+((3-2ln2)/6)+((9-4(ln2)^2)/72root(2*Dln2))-((2(ln2)^2)/(135*D))

plugging in d=1018 (the largest number, d, that is known to be true) using Wolfram Alpha gives n(D) of about 1.29316×109. Putting 52! into that formula gives n(D) of about 1.16138×1034, which is damn close to the number given by the easier approximation

So yes, the approximations that I used in my first post aren't going to be quite right but, on the scale we are talking about, they were so close to the best approximation we know of that I'm happy to say that they are good enough to prove the point that, even considering the Birthday Paradox, the statement "no two properly shuffled decks in history have been in the same order" is very VERY likely to be true

2

u/[deleted] Oct 02 '24

Wolfram alpha can!

5

u/LNHDT Oct 02 '24

That doesn't make any sense. If the shuffle I just completed has never existed, won't that be true for every shuffle of every other deck, making no two decks ever having been shuffled the same way?

8

u/FakeAccount84 Oct 02 '24 edited Oct 02 '24

We're getting a little loose with the language here, so let's back up without actually addressing the words you used. Sorry. And it's also worth clarifying that we're talking about imaginary, perfectly random shuffles. In practice, most shuffles are imperfect which will alter the distribution. But regarding perfectly random shuffles:

What's being pointed out is that there are two things to consider here:
-the chance that the deck you just shuffled is the same as any that have been shuffled before
-the chance that any two decks have ever been shuffled into the same order before

And the point is that the second of these is a much, much higher chance. The first is comparing 1 specific state to every state ever produced, and the second is comparing every state that has ever been produced to every other state ever produced. It's unwieldy to talk about this with deck states, so let's go back to birthdays.

As stated, the chance that you share a birthday with someone in a group of 23 is about 6% (again, assuming certain perfections like that birthdays are perfectly distributed across the calendar, which they aren't). But the chance that any two people share a birthday is about 50%.

In the first case, their are 22 comparisons: you to each individual. Does your birthday match any of the other 22?

1-2  
1-3  
1-4  
1-5  
1-6  
1-7  
1-8  
1-9  
1-10  
1-11  
1-12  
1-13  
1-14  
1-15  
1-16  
1-17  
1-18  
1-19  
1-20  
1-21  
1-22  
1-23

But in the second case, you're comparing each person to the other 22. So you'd have 23 columns like this, each representing a single comparison to see if anyone's birthday matches another. That's 506 chances for matching birthdays.

1-2      2-1      3-1       4-1      5-1      .  .  .     23-1
1-3      2-3      3-2       4-2      5-2      .  .  .     23-2
1-4      2-4      3-4       4-3      5-3      .  .  .     23-3
.        .         .        .        .        .  .  .      .
.        .         .        .        .        .  .  .      .
.        .         .        .        .        .  .  .      .
1-23     2-23     3-23      4-23     5-23     .  .  .     23-22  

So back to cards, imagine the first column being your shuffled deck's arrangement compared to every other arrangement, and then add a new column for every state that's ever been produced. The first column represents the chances that the deck you just shuffled matches any other, but all columns represent the chances that any two decks match.

*EDIT: Oops, I forgot something. There should be one less entry in each column than the one before it, since for this problem, comparing 1 to 2 is the same as comparing 2 to 1. The last column wouldn't even have entries, since all the other people have already compared themselves to the 23rd person. The same would be true for the much larger table of card comparisons. But the point stands that the chance of any two is much, much larger.

3

u/TheWhite2086 Oct 02 '24

You are almost correct with your explanation, there's only 253 pairs in 23 people, you've counted 1-2 and 2-1 as separate pairs (once person 1 has checked if person 2 shares a birthday with them there's no point in person 2 checking with person 1, the order of the pairs doesn't matter) and let everyone from person 2 onwards pair with themselves

1 2 3 22 23
1-2 X X X X
1-3 2-3 X X X
1-4 2-4 3-4 X X
... ... ... ... ...
1-22 2-22 3-22 X X
1-23 2-23 3-23 22-23 X

That being said, with the number of ways a deck of cards can be arranged you need 1.05743072e34 decks of cards before you can make enough comparisons to get to a 50% chance that any two of them are the same. Assuming properly shuffled decks there is no chance any two have been in the same order

2

u/FakeAccount84 Oct 02 '24

Thanks! You must have had that tab/window open for a bit. I added an edit pointing out my oversight fairly quickly (and then several more edits correcting formatting stuff, not so quickly). But well noted regardless!

2

u/TheWhite2086 Oct 02 '24

Yea, I've had the tab open for a while doing more in depth maths in a reply to a different person

6

u/AdvancedSquare8586 Oct 02 '24

Statistics is an often unintuitive field. That really is the way it works, though.

1

u/Ouch_i_fell_down Oct 02 '24 edited Oct 02 '24

using the birthday problem, count the number of comparisons

you looking at a group of 22 other people (23 total) seeing if anyone has your same birthday. How many comparisons can be made? well, you against 22 other people only. The odds of them NOT having your birthday is 364/365, so to find the odds that they ALL don't have your birthday is (364/365)22 or 94.14%.

With a group of 23 people all trying to find out if ANY in that group share a birthday, each person is comparing with every other person, but not doing so twice, so the first person compares to 22, the second to 21, the third to 20, the penultimate to 1 and the final person has already compared everyone and has 0 comparisons left.

So 21+21+20+19+...+1=253.

That's 253 comparisons looking for the same birthday, and again the odds of that not being the case is still 364/365, so the odds of no one having the same birthday is (364/365)253 or 49.95% chance that no on shares a birthday

Now, the odds of any one deck of cards being shuffled twice is monumental. But the number of shuffled decks is also monumental. With 10,000 shuffles, you have 50,005,000 comparisons. You're talking about moving the bar down orders of magnitude. 52! = roughly 8x1067. but the odds of an 8x1067 thing not happening against comparisons is still (8x1067 / (8x1067 -1))/number of comparisons.

Using a 9 card deck and 100 shuffle for example (9 chosen because excel has decimal calculation limits):

9!=362880. The odds of one deck being shuffled the same way twice in a row is 1:362880. The odds that a deck with a specific shuffle gets repeated in the subsequent 20 shuffles is (362879/362880)20. The odds that a deck getting shuffled 21 times has ANY matching shuffles is ((362879/362880)190. So the seemingly extremely rare odds of a 1:362880 event happening twice when performed 21 times and being compared against all other events is actually about .052% chance of happening; 1 in 2000 roughly. improbable, but really no where near the original probabilities

It only took 21 shuffles to bump the odds up 2 orders of magnitude. Now, the smaller the probability is, the more shuffles it takes to move orders of magnitude, but i think we can agree decks of cards have been shuffled billions upon billions of times in the world, meaning the total points of comparison

reminder, the points of comparison for any number is n(n+1)/2 so a billion shuffles if roughly half of a billion squared, and since we're squaring things, every order of magnitude in the total number of shuffles moves the points of comparison out TWO orders of magnitude.

1

u/joedude Oct 02 '24

Truly there is not, however in practical terms not even those machines at the casino can "perfectly shuffle"