Card Shuffling as a Dynamical System Dr Russell

  • Slides: 47
Download presentation
Card Shuffling as a Dynamical System Dr. Russell Herman Department of Mathematics and Statistics

Card Shuffling as a Dynamical System Dr. Russell Herman Department of Mathematics and Statistics University of North Carolina at Wilmington How does a magician know that the eighth card in a deck of 50 cards returns to it original position after only three perfect shuffles? How many perfect shuffles will return a full deck of cards to their original order? What is a "perfect" shuffle?

Introduction l History of the Faro Shuffle l The Perfect Shuffle l Mathematical Models

Introduction l History of the Faro Shuffle l The Perfect Shuffle l Mathematical Models of Perfect Shuffles l Dynamical Systems – The Logistic Model l Features of Dynamical Systems l Shuffling as a Dynamical System

A Bit of History

A Bit of History

History of the Faro Shuffle Cards l Western Culture - 14 th Century l

History of the Faro Shuffle Cards l Western Culture - 14 th Century l Jokers – 1860’s l Pips – 1890’s added numbers l First Card tricks by gamblers l Origins of Perfect Shuffles not known l Game of Faro l 18 th Century France l Named after face card l Popular 1803 -1900’s in the West l

The Game of Faro l Decks shuffled and rules are simple l (fâr´O) [for

The Game of Faro l Decks shuffled and rules are simple l (fâr´O) [for Pharaoh, from an old French playing card design], gambling game played with a standard pack of 52 cards. First played in France and England, faro was especially popular in U. S. gambling houses in the 19 th Century. Players bet against a banker (dealer), who draws two cards–one that wins and another that loses–from the deck (or from a dealing box) to complete a turn. Bets–on which card will win or lose– are placed on each turn, paying 1: 1 odds. Columbia Encyclopedia, Sixth Edition. 2001 l Players bet on 13 cards l Lose Slowly! l Copper Tokens – bet card to lose l “Coppering”, “Copper a Bet” l Analysis – De Moivre, Euler, …

The Game Wichita Faro http: //www. gleeson. us/faro/ http: //www. bcvc. net/faro/rules. htm

The Game Wichita Faro http: //www. gleeson. us/faro/ http: //www. bcvc. net/faro/rules. htm

Perfect (Faro or Weave) Shuffle Problem: l Divide 52 cards into 2 equal piles

Perfect (Faro or Weave) Shuffle Problem: l Divide 52 cards into 2 equal piles l Shuffle by interlacing cards l Keep top card fixed (Out Shuffle) l 8 shuffles => original order What is a typical Riffle shuffle? What is a typical Faro shuffle?

See! Period 2 @ 18 and 35!

See! Period 2 @ 18 and 35!

History of Faro Shuffle l 1726 – Warning in book for first time l

History of Faro Shuffle l 1726 – Warning in book for first time l 1847 – J H Green – Stripper (tapered) Cards l 1860 – Better description of shuffle l 1894 – How to perform l Koschitz’s Manual of Useful Information l Maskelyne’s Sharps and Flats – 1 st Illustration l 1915 – Innis – Order for 52 Cards l 1948 – Levy – O(p) for odd deck, cycles l 1957 – Elmsley – Coined In/Out - shuffles

Mathematical Models

Mathematical Models

A Model for Card Shuffling l Label the positions 0 -51 l Then l

A Model for Card Shuffling l Label the positions 0 -51 l Then l 0 ->0 and 26 ->1 l 1 ->2 and 27 ->3 l 2 ->4 and 28 ->5 l … in general? l Ignoring card 51: f(x) = 2 x mod 51 l Recall Congruences: l 2 x mod 51 = remainder upon division by 51

The Order of a Shuffle l Minimum integer k such that 2 k x

The Order of a Shuffle l Minimum integer k such that 2 k x = x mod 51 for all x in {0, 1, …, 51} l True for x = 1 ! l Minimum integer k such that 2 k - 1= 0 mod 51 l Thus, 51 divides 2 k - 1 k= 6, 2 k - 1 = 63 = 3(21) l k= 7, 2 k - 1 = 127 l k= 8, 2 k - 1 = 255 = 5(51) l

Generalization to n cards

Generalization to n cards

The Out Shuffle

The Out Shuffle

The In Shuffle

The In Shuffle

Representations for n Cards l In Shuffles l Out Shuffles

Representations for n Cards l In Shuffles l Out Shuffles

Order of Shuffles l 8 Out Shuffles for 52 Cards l In General? lo

Order of Shuffles l 8 Out Shuffles for 52 Cards l In General? lo (O, 2 n-1) = o (O, 2 n) l o (I, 2 n-1) = o (O, 2 n) l => o lo (O, 2 n-1) = o (I, 2 n-1) (I, 2 n-2) = o (O, 2 n) l Therefore, only need o (O, 2 n)

o (O, 2 n) = Order for 2 n Cards l One Shuffle: O(p)

o (O, 2 n) = Order for 2 n Cards l One Shuffle: O(p) = 2 p mod (2 n-1), 0<p<N-1 l 2 shuffles: O 2(p) = 2 O(p) mod (2 n-1) = 22 p mod (2 n-1) l k shuffles: l Order: o (O, 2 n) = smallest k for 0 < p < 2 n such that Ok(p) = p mod (2 n-1) l Or, 2 k = 1 mod (2 n-1) => (2 n – 1) | (2 k – 1) Ok(p) = 2 kp mod (2 n-1)

The Orders of Perfect Shuffles n o(O, n) o(I, n) 2 13 12 12

The Orders of Perfect Shuffles n o(O, n) o(I, n) 2 13 12 12 3 2 2 14 12 4 4 2 4 15 4 4 16 4 8 6 4 3 17 8 8 7 3 3 18 8 3 6 50 21 8 9 6 6 51 8 8 10 6 10 52 8 52 11 10 10 53 52 52 12 10 12 54 52 20 Demonstration

Another Model for 2 n Cards l Label positions with rationals l Out Shuffle

Another Model for 2 n Cards l Label positions with rationals l Out Shuffle l Example: Card 10 of 52: x = 9/51 l In Shuffle l Example: Card 10 of 52: x = 9/51

Shuffle Types All denominators are odd numbers.

Shuffle Types All denominators are odd numbers.

Doubling Function

Doubling Function

Discrete Dynamical Systems l First Order System: xn+1 = f l Orbits: {x 0,

Discrete Dynamical Systems l First Order System: xn+1 = f l Orbits: {x 0, x 1, … } l Fixed Points l Periodic Orbits l Stability and Bifurcation l Chaos !!!! ( xn )

The Logistic Map l Discrete Population Model l Pn+1 = a Pn l Pn+1

The Logistic Map l Discrete Population Model l Pn+1 = a Pn l Pn+1 = a 2 Pn-1 l Pn+1 = an P 0 l a>1 => exponential growth! l Competition l Pn+1 = a Pn - b Pn 2 l xn = (a/b)Pn, r=a/b => l xn+1 = r xn(1 - xn), xne[0, 1] and re[0, 4]

Example r=2. 1 Sample orbit for r=2. 1 and x 0 = 0. 5

Example r=2. 1 Sample orbit for r=2. 1 and x 0 = 0. 5

Example r=3. 5

Example r=3. 5

Example r=3. 56

Example r=3. 56

Example r=3. 568

Example r=3. 568

Example r=4. 0

Example r=4. 0

Iterations More Iterations

Iterations More Iterations

Fixed Points f(x*) = x* l x* = r x*(1 -x*) l => 0

Fixed Points f(x*) = x* l x* = r x*(1 -x*) l => 0 = x*(1 -r (1 -x*) ) l => x* = 0 or x* = 1 – 1/r l Logistic Map - Cobwebs

Periodic Orbits for f(x)=rx(1 -x) l Period 2 l x 1 = r x

Periodic Orbits for f(x)=rx(1 -x) l Period 2 l x 1 = r x 0(1 - x 0) and x 2 = r x 1(1 - x 1) = x 0 l Or, f 2 (x 0) = x 0 l Period k l - smallest k such that f k (x*) = x* l Periodic Cobwebs

Stability l Fixed Points l |f’(x*)| < 1 l Periodic Orbits l |f’(x 0)|

Stability l Fixed Points l |f’(x*)| < 1 l Periodic Orbits l |f’(x 0)| |f’(x 1)| … |f’(xn)| < 1 l Bifurcations

Bifurcations r 1 = 3. 0 r 2 = 3. 449490. . . r

Bifurcations r 1 = 3. 0 r 2 = 3. 449490. . . r 3 = 3. 544090. . . r 4 = 3. 564407. . . r 5 = 3. 568759. . . r 6 = 3. 569692. . . r 7 = 3. 569891. . . r 8 = 3. 569934. . .

Itineraries: Symbolic Dynamics l. For G (x) = 4 x ( 1 -x )

Itineraries: Symbolic Dynamics l. For G (x) = 4 x ( 1 -x ) Assign Left “L” and Right “R” l Example: x 0 = 1/3 l x 0 = 1/3 => “L” l x 1 = 8/9 => “LR” l x 2 = 32/81 => “LRL” l x 3 = … => “LRL …” l Example: x 0 = ¼ l { ¼, ¾, ¾, …}=>” LRRRR…” l. Periodic Orbits l“LRLRLR …”, “RLRRLRRLRRL …”

Shuffling as a Dynamical System S(x) vs S 4(x)

Shuffling as a Dynamical System S(x) vs S 4(x)

Demonstration

Demonstration

Iterations for 8 Cards

Iterations for 8 Cards

S 3(x) vs S 2(x) S 3(x) vs S 2(x) How can we study

S 3(x) vs S 2(x) S 3(x) vs S 2(x) How can we study periodic orbits for S(x)?

Binary Representations l Binary Representation l 0. 10112=1(2 -1)+0(2 -2)+1(2 -3)+1(2 -4) = l

Binary Representations l Binary Representation l 0. 10112=1(2 -1)+0(2 -2)+1(2 -3)+1(2 -4) = l 1/2 + 1/8 + 1/16 = 10/16 = 5/8 l xn+1 = S(xn), given x 0 l Represent xn’s in binary: x 0 = 0. 101101 l Then, x 1 = 2 x 0 – 1 = 1. 01101 – 1 = 0. 01101 l Note: S shifts binary representations! l Repeating Decimals l S(0. 101101…) = 0. 011011… l S(0. 011011…) = 0. 110110…

Periodic Orbits l Period 2 l. S(0. 1010…) = 0. 0101… l. S(0. 0101…)

Periodic Orbits l Period 2 l. S(0. 1010…) = 0. 0101… l. S(0. 0101…) = 0. 1010… l 0. 102, 0. 012, 0. 112 = ? l Period 3 l 0. 1002, 0. 0102, 0. 0012 = ? l 0. 1102, 0. 0112, 0. 1012 = ? l Maple Computations

Card Shuffling Examples l 8 Cards – All orbits are period 3 {1/7, 2/7,

Card Shuffling Examples l 8 Cards – All orbits are period 3 {1/7, 2/7, 4/7} and {3/7, 6/7, 5/7} and {0/7, 7/7} l 52 Cards – Period 2 1/3 = ? /51 and 2/3 = ? /51 l 50 Cards – Period 3 Orbit (Cycle) 1/7 = ? /49 l Recall: l Period 2 - {1/3, 2/3} l Period 3 – {1/7, 2/7, 4/7} and {3/7, 6/7, 5/7} l Out Shuffles – i/(N-1) for (i+1) st card

Finding Specific t-Cycles l Period k: 0. 000 … 0001 2 -t + (2

Finding Specific t-Cycles l Period k: 0. 000 … 0001 2 -t + (2 -t)2 + (2 -t) 3 + … = 2 -t /(1 - 2 -t ) l Or, 0. 000 … 0001 = 1/(2 t -1) l l Examples Period 2: 1/3 l Period 3: 1/7 l l In general: Select Shuffle Type Rationals of form i/r => (2 t – 1) | r l Example r = 3(7) = 21 l Out Shuffle for 22 or 21 cards l In Shuffle for 20 or 21 cards l Demonstration

Other Topics l Cards Alternate In/Out Shuffles l k- handed Perfect Shuffles l Random

Other Topics l Cards Alternate In/Out Shuffles l k- handed Perfect Shuffles l Random Shuffles – Diaconis, et al l “Imperfect” Perfect Shuffles l l Nonlinear Dynamical Systems l Discrete (Difference Equations) l l Systems in the Plane and Higher Dimensions Continuous Dynamical Systems (ODES) Integrability l Nonlinear Oscillations l MAT 463/563 l Fractals l Chaos l

Summary l History of the Faro Shuffle l The Perfect Shuffle – How to

Summary l History of the Faro Shuffle l The Perfect Shuffle – How to do it! l Mathematical Models of Perfect Shuffles l Dynamical Systems – The Logistic Model l Features of Dynamical Systems l Symbolic Dynamics l Shuffling as a Dynamical System

References K. T. Alligood, T. D. Sauer, J. A. Yorke, Chaos, An Introduction to

References K. T. Alligood, T. D. Sauer, J. A. Yorke, Chaos, An Introduction to Dynamical Systems, Springer, 1996. l S. B. Morris, Magic Tricks, Card Shuffling and Dynamic Computer Memories, MAA, 1998 l D. J. Scully, Perfect Shuffles Through Dynamical Systems, Mathematics Magazine, 77, 2004 l

Websites l l l http: //i-p-c-s. org/history. html http: //jducoeur. org/game-hist/seaan-cardhist. html http: //www.

Websites l l l http: //i-p-c-s. org/history. html http: //jducoeur. org/game-hist/seaan-cardhist. html http: //www. usplayingcard. com/gamerules/briefhistory. html http: //bcvc. net/faro/ http: //www. gleeson. us/faro/ Thank you !