# Card Shuffling as a Dynamical System

## Presentation on theme: "Card Shuffling as a Dynamical System"— Presentation transcript:

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?   We learn about continuous systems .. We derive models by starting discrete .. We simulate using discrete … here we start discrete and generalize to continuous .. There are many continuous models .. But we will concentrate on discrete

Introduction History of the Faro Shuffle The Perfect Shuffle
Mathematical Models of Perfect Shuffles Dynamical Systems – The Logistic Model Features of Dynamical Systems Shuffling as a Dynamical System In this talk we will review some of the history and mathematics of the perfect shuffle. We will explore models of the perfect shuffle of a deck of arbitrary size, leading to a discrete dynamical system. In particular, we will look at the dynamics of the doubling map and the logistic map as a way of introducing standard notions from nonlinear dynamics, such as fixed points, periodic orbits, symbolic dynamics and chaos. This talk will be at a level accessible by undergraduates and is meant as an introduction to discrete dynamical systems via card shuffling

A Bit of History

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

The Game of Faro Decks shuffled and rules are simple
(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 19th 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 Players bet on 13 cards Lose Slowly! Copper Tokens – bet card to lose “Coppering”, “Copper a Bet” Analysis – De Moivre, Euler, …

The Game Wichita Faro http://www.gleeson.us/faro/

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

See! Period 18 and 35!

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

Mathematical Models

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

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

Generalization to n cards

The Out Shuffle

The In Shuffle

Representations for n Cards
In Shuffles Out Shuffles

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

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

The Orders of Perfect Shuffles
n o(O,n) o(I,n) n o(O,n) o(I,n) Demonstration

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

Shuffle Types All denominators are odd numbers.

Doubling Function

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

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

Example r=2.1 Sample orbit for r=2.1 and x0 = 0.5

Example r=3.5

Example r=3.56

Example r=3.568

Example r=4.0

Iterations More Iterations

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

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

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

Bifurcations r1 = 3.0 r2 = r3 = r4 = r5 = r6 = r7 = r8 =

Itineraries: Symbolic Dynamics
For G (x) = 4x ( 1-x ) Assign Left “L” and Right “R” Example: x0 = 1/3 x0 = 1/ => “L” x1 = 8/ => “LR” x2 = 32/ => “LRL” x3 = … => “LRL …” Example: x0 = ¼ { ¼, ¾, ¾, …}=>” LRRRR…” Subscripts, itinerary.mws???? Periodic Orbits “LRLRLR …”, “RLRRLRRLRRL …”

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

Demonstration

Iterations for 8 Cards

S3(x) vs S2(x) S3(x) vs S2(x)
How can we study periodic orbits for S(x)?

Binary Representations
=1(2-1)+0(2-2)+1(2-3)+1(2-4) = 1/2 + 1/8 + 1/16 = 10/16 = 5/8 xn+1 = S(xn), given x0 Represent xn’s in binary: x0 = Then, x1 = 2 x0 – 1 = – 1 = Note: S shifts binary representations! Repeating Decimals S( …) = … S( …) = …

Periodic Orbits Period 2 Period 3 Maple Computations
0.102, 0.012, = ? Period 3 0.1002, , = ? 0.1102, , = ? Maple Computations

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

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

Other Topics Cards Nonlinear Dynamical Systems
Alternate In/Out Shuffles k- handed Perfect Shuffles Random Shuffles – Diaconis, et al “Imperfect” Perfect Shuffles Nonlinear Dynamical Systems Discrete (Difference Equations) Systems in the Plane and Higher Dimensions Continuous Dynamical Systems (ODES) Integrability Nonlinear Oscillations MAT 463/563 Fractals Chaos Lyupanov exponents .. Period 3 => chaos, stability issues and other types of riffle shuffles

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

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

Websites Thank you ! http://i-p-c-s.org/history.html
Thank you !

Download ppt "Card Shuffling as a Dynamical System"

Similar presentations