11.07.2015 Views

Perfect Shuffles: A Shortest Sequence to Move a Card Katie Glacey ...

Perfect Shuffles: A Shortest Sequence to Move a Card Katie Glacey ...

Perfect Shuffles: A Shortest Sequence to Move a Card Katie Glacey ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Perfect</strong> <strong>Shuffles</strong>: A <strong>Shortest</strong> <strong>Sequence</strong> <strong>to</strong> <strong>Move</strong> a <strong>Card</strong><strong>Katie</strong> <strong>Glacey</strong>Master’s Exposi<strong>to</strong>ry PaperIn partial fulfillment of the MAT DegreeDepartment of MathematicsUniversity of Nebraska-LincolnJuly, 2011


A deck of cards can be found in many households in the world. The earliestreference <strong>to</strong> playing cards can be dated <strong>to</strong> the year 1377. The ubiqui<strong>to</strong>us nature ofcards leads some <strong>to</strong> take the card shuffling for granted.The fascination with card shuffling is not a recent occurrence but has beenstudied for many years. The study of card shuffling has enveloped the minds ofmagicians, mathematicians, and even a rancher. Magician and mathematician PersiDiaconis wanted <strong>to</strong> determine the perfect number of shuffles for a deck of cards. Hedetermined that seven shuffles was the perfect amount. Mathematical writer MartinGardner pondered an efficient algorithm <strong>to</strong> bring any card <strong>to</strong> the <strong>to</strong>p of a deckthrough a combination of shuffles. Even a Nebraska rancher was enthralled with theidea of card shuffling. Rancher Fred Black practiced shuffling on horseback andgained recognition by Ripley’s Believe It or Not for his ability <strong>to</strong> deal four Bridgehands, collect them, shuffle the deck, cut and shift the deck, and deal identical hands<strong>to</strong> the same players in less than one minute.When one shuffles cards the goal is <strong>to</strong> randomize the cards, but in fact thecards permute in a systematic fashion. The randomizing of a deck of cards can bedone improperly or precisely, and that knowledge can be used <strong>to</strong> either theshuffler’s disadvantage or advantage. A card dealer in a casino would receive thedisadvantage of an improper card shuffle, because a very astute gambler can use theknowledge <strong>to</strong> his or her advantage. A magician can take advantage of a card shuffledone is a precise manner. The magician is actually employing mathematics <strong>to</strong>amaze the audience.The <strong>Card</strong>s and the <strong>Shuffles</strong>This examination of card shuffling employs a deck of 2n cards. The positionsof the cards are labeled 0 through 2n-1. Position 0 is the <strong>to</strong>p position in the deck.The bulk of the analysis of shuffling revolves around two very precise variations of ashuffle referred <strong>to</strong> as the riffle shuffle: the perfect in-shuffle and the perfect outshuffle.In the perfect in-shuffle, a deck is cut in half in<strong>to</strong> stacks of n cards andinterlaced with each other so the original <strong>to</strong>p card moves in<strong>to</strong> the second position of


the shuffled pile. In the perfect out-shuffle, the two stacks of n cards are interlacedso that the original <strong>to</strong>p card of the deck remains in the <strong>to</strong>p position after shuffling.The Position FunctionsTo begin this investigation, I observed the nature of the cards when shuffling,<strong>to</strong> develop position functions <strong>to</strong> help determine the position of a card originally in xposition <strong>to</strong> describe its position after one perfect in-shuffle and one perfect outshuffle.The <strong>Perfect</strong> In-ShuffleGiven a stack of cards with 2n = 12, I observed and noted the shift in positions asseen below.Position 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> A B C D E F G H I J K LAfter one perfect in-shufflePosition 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> G A H B I C J D K E L FNumberofPositions<strong>Move</strong>d+6 -1 +5 -2 +4 -3 +3 -4 +2 -5 +1 -6I noticed that after one in-shuffle that the movement of the cards created a mirrorimage of movement. After n cards the pattern of movement begins <strong>to</strong> reflect butwith opposite signs. To create a function <strong>to</strong> describe the movement in position, Ihad <strong>to</strong> consider two separate cases based on where the card was originally in thedeck.


Case One: x < nWhen x < n, a card’s position will move down 2x + 1 positions after oneperfect in-shuffle.Observe:Position 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> A B C D E F G H I J K LAfter one perfect in-shufflePosition 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> G A H B I C J D K E L FAfter one perfect in-shuffle, a card originally in the second position will be in thefifth position.The variables used in the function <strong>to</strong> describe this movement are:x = card’s positionf(x) = card’s new position after one perfect shuffleThe function <strong>to</strong> describe this movement is: f(x) = 2x + 1 when x < n.Case Two: n < x < 2n-1When n < x < 2n-1, a card’s position moves up the difference between 2x and2n in the shuffled pile after one perfect in-shuffle.


Observe:Position 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> A B C D E F G H I J K LAfter one perfect in-shufflePosition 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> G A H B I C J D K E L FAfter one perfect in-shuffle, a card originally in the seventh position will be in thesecond position, which is a movement of five places from its original position.The variables used in the function <strong>to</strong> describe this movement are:x = card’s position2n = the <strong>to</strong>tal number of cards in a deckf(x) = card’s new position after one perfect shuffleThe function <strong>to</strong> describe this movement is: f(x) = 2x – 2n when n < x < 2n-1.The <strong>Perfect</strong> Out-ShuffleGiven a stack of cards with 2n = 12, I observed and noted the shift in positions asseen below.Position 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> A B C D E F G H I J K L


After one perfect out-shufflePosition 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> A G B H C I D J E K F LNumberofPositions<strong>Move</strong>d0 +5 -1 +4 -2 +3 -3 +2 -4 +1 -5 0I noticed that after one out-shuffle that the movement of the cards created a mirrorimage of movement. After n cards the pattern of movement begins <strong>to</strong> reflect butwith opposite signs. Also, the positions of the first and last card do not change afterone perfect out-shuffle. To create a function <strong>to</strong> describe the movement in position, Ihad <strong>to</strong> consider two separate cases based on where the card was originally in thedeck.Case One: x < nout-shuffle.When x < n a card’s position will move down 2x positions after one perfectObserve:Position 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> A B C D E F G H I J K LAfter one perfect out-shufflePosition 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> A G B H C I D J E K F L


After one perfect out-shuffle, a card originally in the second position will be in thefourth position.The variables used in the function <strong>to</strong> describe this movement are:x = card’s positionf(x) = card’s new position after one perfect shuffleThe function <strong>to</strong> describe this movement is: f(x) = 2x when x < n.Case Two: n < x < 2n-1When n < x < 2n-1, a card’s position moves up the difference between 2x and2n+1 in the shuffled pile after one perfect out-shuffle.Observe:Position 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> A B C D E F G H I J K LAfter one perfect out-shufflePosition 0 1 2 3 4 5 6 7 8 9 10 11<strong>Card</strong> A G B H C I D J E K F LAfter one perfect out-shuffle, a card originally in the seventh position will be in thethird position, which is a movement of four places from its original position.The variables used in the function <strong>to</strong> describe this movement are:x = card’s position2n = the <strong>to</strong>tal number of cards in a deckf(x) = card’s new position after one perfect shuffle


The function <strong>to</strong> describe this movement is: f(x) = 2x – 2n + 1 when n < x < 2n-1.<strong>Shortest</strong> Possible <strong>Sequence</strong>In the paper “Moving <strong>Card</strong> i <strong>to</strong> Position j with <strong>Perfect</strong> <strong>Shuffles</strong>” by SarnathRamnath and Daniel Scully, the authors used the pic<strong>to</strong>rial representation of trees <strong>to</strong>present perfect shuffles. The trees create a visual path <strong>to</strong> follow <strong>to</strong> get a card fromone position <strong>to</strong> another. The authors used the following functions in base 2 <strong>to</strong>create the trees.They then let Dm(x) = 2x mod 2n and Em(x) = (2x + 1) mod 2n. Starting at position 0they applied the functions branching out <strong>to</strong> create the following.


In this diagram in order <strong>to</strong> go from position 0 <strong>to</strong> position 4, the cards must beshuffled by applying one Em followed by two Dm’s.To streamline the process, the authors decided it was unnecessary <strong>to</strong> construct thewhole tree but only <strong>to</strong> construct the outermost path from a position i <strong>to</strong> a position jsince dealing with a standard 52 card deck would result in a giant tree. To constructthe outermost path the following is used:(Dm(i), D 2 m (i), . . . D t m(i) and Em (i), E 2 m (i),. . . E t m(i)) until j falls in the interval[D t m(i), E t m(i)]. (In Z2n , [a, b] = {a, a + 1. b} if a < b, and [a, b] = {a, a + 1. 2n - 1, 0, 1,... bif b < a.)


ExampleIn the following example, I will illustrate moving a card from i <strong>to</strong> j using thetheorem and steps set forth by Ramnath and Scully. i = 10 and j = 33.In the article the authors illustrated the theorem: Label the positions in adeck of 2n cards 0 through 2n – 1 consecutively with 0 representing the <strong>to</strong>p position.To determine the shortest possible sequence of perfect in and out shuffles that willmove a card in position i <strong>to</strong> position j, proceed as follows:1. Calculate the sequences Dm(i), D 2 m(i), . . ., D t m(i) and Em(i), E 2 m(i), . . ., E t m(i) until j ∈[D t m(i), E t m(i)]The number 33 falls between the interval [28, 35] in Z52. I had <strong>to</strong> apply the function3 times <strong>to</strong> find the interval that contains j so t = 3.2. Let s = (j – D t m (i))mod 2n and write s as a t-digit base two numeral s1s2. . . st.s = (j – D t m (i))mod 2n = (33-28) mod 52 = 5 mod 52 = 5This now needs <strong>to</strong> be written as a 3-digit base two numeral so it becomes 101.3. Reading the digits s1 s2. . . . st from left <strong>to</strong> right, apply consecutively Dm <strong>to</strong> i if sk is0 and Em if sk is 1.


So 101 becomesEmDmEm4. Make the translation Dm = O if Dm is being applied <strong>to</strong> an integer in [0, n-1] and Dm = Iif applied <strong>to</strong> an integer in [n, 2n - 1]. Similarly, Em = I in [0, n - 1] and Em = O in [n, 2n -1]. The resulting sequence of in and out shuffles (I's and O's) moves the card in positioni <strong>to</strong> position j in a minimum number of perfect shuffles.<strong>Card</strong>’s Position 10 21 42 33Function Applied <strong>to</strong> Achieve Position Em Dm EmTranslation of Position and Applied Function In Out OutSo <strong>to</strong> move a card in the 10 th position <strong>to</strong> the 33 rd position in the least amoun<strong>to</strong>f perfect shuffles, apply one perfect in-shuffle followed by two perfect out-shuffles.A Classroom ActivityThe activity of card shuffling can be brought in<strong>to</strong> the classroom through thestudy of modular arithmetic. I teach fifth and sixth grade, so this activity is geared<strong>to</strong>ward the intermediate level (grades 3 through 6) of elementary school.The activity begins with an introduction of modular arithmetic through thestudy of time on a clock.1) Ask students what time it will be 3 hours after noon? 10 hours afternoon? 14 hours after noon? 28 hours after noon?2) Ask student <strong>to</strong> explain how they were able <strong>to</strong> arrive at the variousanswers.3) Focus on the remainder and introduce the notation for modulararithmetic.Once the ideas of modular arithmetic and correct notation have been established,shift <strong>to</strong> the everyday object of cards.


4) Explain the concept of perfect in-shuffle.5) Distribute <strong>to</strong> the students 10 playing cards.6) Students work and apply perfect in-shuffles <strong>to</strong> their 10-card deck of cards.Students record the movement of the cards in<strong>to</strong> chart.7) Discuss results.8) Wrap up with describing movement of cards in modular arithmetic form.


ReferencesS. Ramnath and D. Scully, Moving <strong>Card</strong> I <strong>to</strong> Position j with <strong>Perfect</strong> <strong>Shuffles</strong>,Mathematics Magazine, Volume 69, Number 5 (1996), pp. 361-365.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!