The Magic Café
Username:
Password:
[ Lost Password ]
  [ Forgot Username ]
The Magic Cafe Forum Index » » Magical equations » » Chances of flipping cards simultaneously from 2 decks, encountering a match? (0 Likes) Printer Friendly Version

scottds80
View Profile
Special user
Victoria, Australia
730 Posts

Profile of scottds80
Hi all,

I have been in penny for your thoughts forum and discussing a "coincidences" trick. One really stood out to me and I want to learn more.

Apparantly if you have 2 spectators shuffle their deck, and deal one card at a time simultaneously, the odds are you will encounter a matching card, suit & value.
Then you can use a special 3rd deck which most of us will know about, where that specific card is the only one face down.

People swear by it that most of the time you will get a match.
Is there an easy way to get accurate probabilities?
I would like to l ow the hit rate after 10,000 games of this, perhaps a programmer could help?

Thanks
Scott
"Great Scott the Magician", Gippsland
owen.daniel
View Profile
Inner circle
England
1048 Posts

Profile of owen.daniel
Hi Scott.

I just saw your question, and thought I might be able to help.
I am a maths postgraduate student in probability... so if anyone can help I guess I'm a likely candidate.

So here's the maths answer: the thing that you are trying to count is the probability that a permutation of 52 objects contains a fixed point. A permutation without fixed points is called a derangement, and there is a formula for these. In particular the probability that a permutation of n objects is a derangement approaches e^(-1) as n gets large. So using this approximation, the probability that it IS NOT a derangement is 1 - e^(-1), which is close to 0.63.

...Addendum: I just bothered to do the calculation explicitly, for a pack of 52 cards the probability of there being at least one fixed point is 0.63212..., so if that is a good enough success rate for you then go for it. This means that in 10,000 games you will be in a miracle position in 6,321 of them.

One way to improve this would be to include the jokers, if they are identical then this should improve the success rate by a non-negligible factor... perhaps I'll work that out later!

Best wishes.

Owen
0pus
View Profile
Inner circle
New Jersey
1738 Posts

Profile of 0pus
Can't you increase the success rate by having the specs alternate flipping cards rather than turning them over simultaneously?

Simultaneous flipping matches one card against one card.

Alternating effectively matches one card against two -- the one preceding the card in question and the one following it.

No?
owen.daniel
View Profile
Inner circle
England
1048 Posts

Profile of owen.daniel
Yes,

That will certainly help a considerably amount... Doesn't lend itself so well to probabilistic analysis (although undoubtably doable, it will not be simple). That type of approach is best calculated via running a moderate number of simulations.

These types of questions remind me of a trick in Giobbi's card college, Numerology, which he teaches in the context of the faro shuffle (though it is certainly not a necessity for the routine).

I actually believe this effect to be more powerful than the one described above. I think that finding a strong presentation for two spectators matching cards is harder: if you do not assert that it is magic then it looks like coincidence, if you assert that you are doing a trick and the odds work against you, then you need a very strong out.

In the effect Giobbi describes the probabilities of a match are greater, and if they don't get a match it is not so bad... The probabilistic part is done openly (the spectator is constructing a random number, at which their card will appear), and so if it fails, you just do it again, until a random number is achieved.

Best.

Owen
scottds80
View Profile
Special user
Victoria, Australia
730 Posts

Profile of scottds80
Thankyou owen & opus,

That's a lot of help and insight to this.
Check out this site,
http://www.random.org/playing-cards/

If you draw 104 cards (2 decks) and click the text only button, you can quickly test for yourself.
When you see a matching pair adjacent to each other, that's equivalent to opus' idea of alternate flipping.
"Great Scott the Magician", Gippsland
owen.daniel
View Profile
Inner circle
England
1048 Posts

Profile of owen.daniel
Interestingly having run a simulation the addition of the jokers has less impact than I was expecting, in particular with them included you would only get a match in 1 or 2 more tries in every 100. So not much of a difference there, although this is of course better than no difference!

Certainly the website you linked to gives a nice visual representation, but it makes it hard to come up with proper bounds on the relevant probability. As I said before, actually finding an explicit formula will be hard, though there might be some nice argument that finding a matching pair in the alternate flipping is equivalent to finding a fixed point in either the original permutation, or the permutation shifted by one place, and then using some nice conditioning argument. I'll have a think about clever approaches.

In the mean time, simulations suggest that the probability is around the 0.87 mark (I only ran 10^6 simulations so don't want to say anything too concretely, even after this number of samples the standard deviation seems relatively high, i.e. within +/- 1 percent).

But clearly this is now a much better situation than the original one. Adding back in the jokers appears to make little difference.

Addendum: In writing some code up to approximate the value for the alternating approach I did some reverse engineering, and tried to cheat my way to finding a formula for the probability. Ok, so to explain, I sampled the probability with varying deck sizes (i.e. packs using 1 card, then 2 cards, 3 cards, etc), and sampled the probability that the alternating method provides a match for each of these deck sizes. The first results are: 1, 1, 5/6, 21/24, 104/120, 624/720... the denominator of each of these is n! = n x (n-1) x (n-2) x ... 2 x 1, since that is the total number of permutations. Therefore the numerators (1, 2, 5, 21, 104, 624) give the number of permutations satisfying the desired property. Now I cheated a second time (the first cheat being that I sampled those values rather than calculating them), by visiting the online encyclopedia of integer sequences. Basically if these values were well known, and had a well established formula then they would be in that data base, and they're not... so for the time being we can just content ourselves with the approximate answer 0.87.

That last bit most likely wasn't of all that much interest to most, but I found it curious, and perhaps any other probabilists will too.

Owen
owen.daniel
View Profile
Inner circle
England
1048 Posts

Profile of owen.daniel
Ok...

So some more maths. It occurred to me over night that this probability can be approximated well without need for sampling.

As I said in the previous message, the probability we are now interested in is that in a permutation of 52 objects (lets say they are the integers 1,2,...,51,52) then there is a value k such that $perm(k) = k$ or $perm(k) = k-1$. Let event A = { there is a k st. perm(k) = k}, and let B = {there is a k st. perm(k) = k-1}. So the probability we want is Pr[ A v B] (the probability of either event happening). This satisfies

Pr[ A v B ] = Pr[ A ] + Pr[ B ] - Pr[ A n B ],
where the last one is the event that both happen. Now it is easily seen that Pr[ A ] = Pr[ B ], and further the events A and B are almost independent... suppose that A does happen, then the only effect this has on B is in one of the values in the permutation, and when there are 52 objects this is negligible. Hence the formula above is (closely) approximated by

(Pr[ A ] + Pr[A] ) - ( Pr[ A ] * Pr[ A ] ),
and from the fact that we know Pr[ A ] = 0.63212..., this means that the new probability is approximately 0.864...

Gosh, how happy I am to fill my time doing probability when the other option is packing boxes to move out of a house...
Hope that benefits at least someone.

Owen
owen.daniel
View Profile
Inner circle
England
1048 Posts

Profile of owen.daniel
Now this is getting too much, but I realised that the calculation is simple, and the formula above is correct.

Rather than approximating Pr[ A n B ] = Pr[A]*Pr[A] as I did above, you can use conditional probability which will say: Pr[ A n B ] = Pr[B |A]*Pr[A]. But now the probability of B given A is just the probability that in a pack of 51 cards there is a fixed point... and up to 15 decimal places (at least) these agree... the 15 is there because that's how many places my calculator gave it up to. So everything above is true, and 0.864 is the correct value (up to three dp).

Right... over and out!

Owen
landmark
View Profile
Inner circle
within a triangle
5195 Posts

Profile of landmark
scottds80
View Profile
Special user
Victoria, Australia
730 Posts

Profile of scottds80
Owen, thanks very much for your input! Of course to a non mathematician, we only understand the end result. But I'm staggered how much you went through for this!

On another note I think my post is a massive coincidence that somebody else asked the same question in 2003, then it was dug up out of the grave 2 days prior to me asking the same question. I promise I didn't see it!

This will be a new routine for my smaller shows
"Great Scott the Magician", Gippsland
The Magic Cafe Forum Index » » Magical equations » » Chances of flipping cards simultaneously from 2 decks, encountering a match? (0 Likes)
[ Top of Page ]
All content & postings Copyright © 2001-2025 Steve Brooks. All Rights Reserved.
This page was created in 0.03 seconds requiring 5 database queries.
The views and comments expressed on The Magic Café
are not necessarily those of The Magic Café, Steve Brooks, or Steve Brooks Magic.
> Privacy Statement <

ROTFL Billions and billions served! ROTFL