Riffle shuffle permutation

From Infogalactic: the planetary knowledge core
(Redirected from (p,q) shuffle)
Jump to: navigation, search

In the mathematics of permutations and the study of shuffling playing cards, a riffle shuffle permutation is one of the permutations of a set of n items that can be obtained by a single riffle shuffle, in which a sorted deck of n cards is cut into two packets and then the two packets are interleaved (e.g. by moving cards one at a time from the bottom of one or the other of the packets to the top of the sorted deck).

As a special case of this, a (p,q)-shuffle, for numbers p and q with p + q = n, is a riffle in which the first packet has p cards and the second packet has q cards.[1]

Combinatorial enumeration

Since a (p,q)-shuffle is completely determined by how its first p elements are mapped, the number of (p,q)-shuffles is

\binom{p+q}{p}.

The wedge product of a p-form and a q-form can be defined as a sum over (p,q)-shuffles.[1]

However, the number of distinct riffles is not quite the sum of this formula over all choices of p and q adding to n (which would be 2n), because the identity permutation can be represented in multiple ways as a (p,q)-shuffle for different values of p and q. Instead, the number of distinct riffle shuffle permutations of a deck of n cards, for n = 1, 2, 3, ..., is

1, 2, 5, 12, 27, 58, 121, 248, 503, 1014, ... (sequence A000325 in OEIS)

More generally, the formula for this number is 2n − n; for instance, there are 4503599627370444 riffle shuffle permutations of a 52-card deck.

The number of permutations that are both a riffle shuffle permutation and the inverse permutation of a riffle shuffle is[2]

\binom{n+1}{3}+1.

For n = 1, 2, 3, ..., this is

1, 2, 5, 11, 21, 36, 57, 85, 121, 166, 221, ... (sequence A050407 in OEIS)

and for n = 52 there are exactly 23427 invertible shuffles.

Random distribution

The Gilbert–Shannon–Reeds model describes a random probability distribution on riffle shuffles that is a good match for observed human shuffles.[3] In this model, the identity permutation has probability (n + 1)/2n of being generated, and all other riffle permutations have equal probability 1/2n of being generated. Based on their analysis of this model, mathematicians have recommended that a deck of 52 cards be given seven riffles in order to thoroughly randomize it.[4]

Permutation patterns

A pattern in a permutation is a smaller permutation formed from a subsequence of some k values in the permutation by reducing these values to the range from 1 to k while preserving their order. Several important families of permutations can be characterized by a finite set of forbidden patterns, and this is true also of the riffle shuffle permutations: they are exactly the permutations that do not have 321, 2143, and 2413 as patterns.[2] Thus, for instance, they are a subclass of the vexillary permutations, which have 2143 as their only minimal forbidden pattern.[5]

Perfect shuffles

A perfect shuffle is a riffle in which the deck is split into two equal-sized packets, and in which the interleaving between these two packets strictly alternates between the two. There are two types of perfect shuffle, an in shuffle and an out shuffle, both of which can be performed consistently by some well-trained people. When a deck is repeatedly shuffled using these permutations, it remains much less random than with typical riffle shuffles, and it will return to its initial state after only a small number of perfect shuffles. In particular, a deck of 52 playing cards will be returned to its original ordering after 52 in shuffles or 8 out shuffles. This fact forms the basis of several magic tricks.[6]

See also

  • Gilbreath permutations, the permutations formed by reversing one of the two packets of cards before riffling them

References

  1. 1.0 1.1 Weibel, Charles (1994). An Introduction to Homological Algebra, p. 181. Cambridge University Press, Cambridge.
  2. 2.0 2.1 Lua error in package.lua at line 80: module 'strict' not found..
  3. Lua error in package.lua at line 80: module 'strict' not found..
  4. Lua error in package.lua at line 80: module 'strict' not found..
  5. Lua error in package.lua at line 80: module 'strict' not found..
  6. Lua error in package.lua at line 80: module 'strict' not found..