Shuffling |
---|
From formal point of view, the shuffle product of two sets of strings is just the Cartesian product of labeled structures. We utilize a special symbol, ш, for this operation. This symbol is the Russian letter "sha," which also resembles the Hebrew "shin." Two sets L1 and L2 are shuffled by creating all the word pairs from both: they merged but keeping internal order.
Given a deck of n cards, how many times must we shuffle it to make it “random”? Of course, the answer depends upon the method of shuffling which is used and what we mean by “random.” We shall begin the study of this question by considering a standard model for the riffle shuffle.
We begin with a deck of n cards, which we will assume are labelled in increasing order with the integers from 1 to n. A riffle shuffle consists of a cut of the deck into two stacks and an interleaving of the two stacks. For example, if n = 6, the initial ordering is (1,2,3,4,5,6), and a cut might occur between cards 2 and 3. This gives rise to two stacks, namely (1,2) and (3,4,5,6). These are interleaved to form a new ordering of the deck. For example, these two stacks might form the ordering (1,3,4,2,5,6). In order to discuss such shuffles, we need to assign a probability distribution to the set of all possible shuffles. There are several reasonable ways in which this can be done. We will give several different assignment strategies, and show that they are equivalent. (This does not mean that this assignment is the only reasonable one.) First, we assign the binomial probability b(n,1/2, k) to the event that the cut occurs after the k-th card. Next, we assume that all possible interleavings, given a cut, are equally likely. Thus, to complete the assignment of probabilities, we need to determine the number of possible interleavings of two stacks of cards, with k and n - k cards, respectively.
We begin by writing the second stack in a line, with spaces in between each pair of consecutive cards, and with spaces at the beginning and end (so there are n − k + 1 spaces). We choose, with replacement, k of these spaces, and place the cards from the first stack in the chosen spaces. This can be done in
We define a rising sequence in an ordering to be a maximal subsequence of consecutive integers in increasing order. For example, in the ordering
It is now easy to assign a probability distribution to this sample space. Each ordering with two rising sequences is assigned the value
Suppose, for example, that an interleaving came about as the result of choosing cards from the two stacks in some order. The probability that this result occurred is the product of the probabilities at each point in the process, since the choice of card at each point is assumed to be independent of the previous choices. Each factor of this product is of the form
We now turn to the question of what happens when we riffle shuffle s
times. It should be clear that if we start with the identity ordering, we
obtain an ordering with at most 2s rising sequences, since a
riffle shuffle creates at most two rising sequences from every rising sequence
in the starting ordering. In fact, it is not hard to see that each such
ordering is the result of s riffle shuffles. The question becomes,
then, in how many ways can an ordering with r rising sequences come
about by applying s riffle shuffles to the identity ordering? In order
to answer this question, we turn to the idea of an a-shuffle.
- V. Dobrushkin, Methods in Algorithmic Analysis, CRC Press, 2010.
- M. Lothaire, Combinatorics on Words, Cambridge University Press (1997) ISBN 0-521-59924-5
- Shuffle Algebra Encyclopedia of Mathematics.
- Shuffle product of words Sage manual.
- Marni Mishna, Mike Zabrocki. Analytic aspects of the shuffle product. Susanne Albers, Pascal Weil. STACS 2008, Feb 2008, Bordeaux, France. IBFI Schloss Dagstuhl, pp.561-572, 2008.
- Brad Mann, How many times should you shuffle a deck of cards?, Harvard University.
- Seven shuffles math Fun Facts.
- Dave Bayer and Persi Diaconis, Trailing the Dovetail Shuffle to its Lair, The Annals of Applied Probability, 1992, Vol. 2, No. 2, 294--313.