card shuffling as a dynamical system dr. russell herman department of mathematics and statistics...
TRANSCRIPT
Card Shuffling as a Card Shuffling as a Dynamical SystemDynamical System
Dr. Russell HermanDepartment 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?
IntroductionIntroduction
History of the Faro ShuffleHistory of the Faro ShuffleThe Perfect ShuffleThe Perfect ShuffleMathematical Models of Perfect Mathematical Models of Perfect
ShufflesShufflesDynamical Systems – The Logistic Dynamical Systems – The Logistic
ModelModelFeatures of Dynamical SystemsFeatures of Dynamical SystemsShuffling as a Dynamical SystemShuffling as a Dynamical System
A Bit of HistoryA Bit of History
History of the Faro ShuffleHistory of the Faro Shuffle CardsCards
Western Culture - 14Western Culture - 14thth Century CenturyJokers – 1860’sJokers – 1860’sPips – 1890’s added numbersPips – 1890’s added numbersFirst Card tricks by gamblersFirst Card tricks by gamblers
Origins of Perfect Shuffles not Origins of Perfect Shuffles not knownknown
Game of FaroGame of Faro1818thth Century France Century FranceNamed after face cardNamed after face cardPopular 1803-1900’s in the West Popular 1803-1900’s in the West
The Game of FaroThe Game of FaroDecks shuffled and rules are simpleDecks 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 cardsPlayers bet on 13 cardsLose Slowly!Lose Slowly!Copper Tokens – bet card to lose Copper Tokens – bet card to lose
““Coppering”, “Copper a Bet”Coppering”, “Copper a Bet”Analysis – De Moivre, Euler, …Analysis – De Moivre, Euler, …
The GameThe Game
http://www.bcvc.net/faro/rules.htm
Wichita Faro http://www.gleeson.us/faro/
Perfect (Faro or Weave) ShufflePerfect (Faro or Weave) Shuffle
Problem: Problem: Divide 52 cards into 2 equal piles Divide 52 cards into 2 equal piles Shuffle by interlacing cards Shuffle by interlacing cards Keep top card fixed (Out Shuffle)Keep top card fixed (Out Shuffle)8 shuffles => original order8 shuffles => original order
What is a typical Riffle shuffle?
What is a typical Faro shuffle?
See!See!
Period 2 @ 18 and 35!Period 2 @ 18 and 35!
History of Faro ShuffleHistory of Faro Shuffle1726 – Warning in book for first time1726 – Warning in book for first time1847 – J H Green – Stripper (tapered) 1847 – J H Green – Stripper (tapered)
CardsCards1860 – Better description of shuffle1860 – Better description of shuffle1894 – How to perform1894 – How to perform
Koschitz’s Manual of Useful InformationKoschitz’s Manual of Useful InformationMaskelyne’s Maskelyne’s Sharps and FlatsSharps and Flats – 1 – 1stst Illustration Illustration
1915 – Innis – Order for 52 Cards1915 – Innis – Order for 52 Cards1948 – Levy – O(p) for odd deck, cycles1948 – Levy – O(p) for odd deck, cycles1957 – Elmsley – Coined In/Out - shuffles1957 – Elmsley – Coined In/Out - shuffles
Mathematical ModelsMathematical Models
A Model for Card ShufflingA Model for Card ShufflingLabel the positions 0-51Label the positions 0-51ThenThen
0->0 and 26 ->10->0 and 26 ->11->2 and 27 ->31->2 and 27 ->32->4 and 28 ->52->4 and 28 ->5… … in general?in general?
2 0 25( )
2 51 26 51
x xf x
x x
Ignoring card 51: Ignoring card 51: f(x) = 2x f(x) = 2x modmod 51 51Recall Congruences:Recall Congruences:
2x 2x modmod 51 = 51 = remainder upon division by remainder upon division by 5151
The Order of a ShuffleThe Order of a Shuffle Minimum integer Minimum integer kk such that such that 2 2 k k x = x x = x modmod 51 51
for all for all xx in {0,1,…,51} in {0,1,…,51}
True for True for x = 1 x = 1 !!
Minimum integer Minimum integer kk such that such that 2 2 k k - 1= 0 - 1= 0 modmod 51 51
Thus,Thus, 51 51 dividesdivides 2 2 k k - 1 - 1 k= 6, 2 k= 6, 2 k k - 1 = 63 = 3(21)- 1 = 63 = 3(21) k= 7, 2 k= 7, 2 k k - 1 = 127 - 1 = 127 k= 8, 2 k= 8, 2 k k - 1 = 255 = 5(51)- 1 = 255 = 5(51)
Generalization to Generalization to nn cardscards
The Out ShuffleThe Out Shuffle
The In ShuffleThe In Shuffle
In ShufflesIn Shuffles
Out ShufflesOut Shuffles
Representations for n Representations for n CardsCards
mod 1, even( ) 2 1
mod , odd
n nI p p
n n
0 1p n
mod 1, even and 0 1( ) 2
mod , odd and 0 1
n n p nO p p
n n p n
Order of ShufflesOrder of Shuffles8 Out Shuffles for 52 Cards8 Out Shuffles for 52 Cards In General?In General?
o o (O,2(O,2nn-1) = -1) = o o (O,2(O,2nn) ) o o (I,2(I,2nn-1) = -1) = o o (O,2(O,2nn))
=> => o o (O,2(O,2nn-1) = -1) = o o (I,2(I,2n-1n-1) ) o o (I,2(I,2n-2n-2) = ) = o o (O,2(O,2nn))
Therefore, only need Therefore, only need o o (O,2(O,2nn))
o o (O,2(O,2nn) =) = Order for 2Order for 2nn CardsCards
One Shuffle: O(One Shuffle: O(pp) = 2) = 2pp mod (2 mod (2nn-1), -1), 00<<p<N-1p<N-1
2 2 shuffles: shuffles: O O22((pp) = 2 O() = 2 O(p)p) mod (2 mod (2nn-1) = 2-1) = 222 pp mod (2 mod (2nn-1)-1)
kk shuffles: O shuffles: Okk((pp) = 2) = 2kkpp mod (2 mod (2nn-1)-1)
Order: o Order: o (O,2(O,2nn) = smallest ) = smallest kk for 0 for 0 << p p < 2< 2n n such thatsuch that OOkk((pp) = ) = pp mod (2 mod (2nn-1)-1)
Or, 2Or, 2kk = 1 mod (2= 1 mod (2nn-1) => -1) => (2(2n n – 1) | (2– 1) | (2kk – – 1) 1)
The Orders of Perfect The Orders of Perfect ShufflesShuffles
n o(O,n) o(I,n) n o(O,n) o(I,n)
2 1 2 13 12 12
3 2 2 14 12 4
4 2 4 15 4 4
5 4 4 16 4 8
6 4 3 17 8 8
7 3 3 18 8 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
DemonstrationDemonstration
Another Model for 2n Another Model for 2n CardsCards
Example: Card 10 of 52: x = 9/51Example: Card 10 of 52: x = 9/51
0 1 2 2 10 , , , , 1.
2 1 2 1 2 1 2 1
n
n n n n
1 2 2, , , .
2 1 2 1 2 1
n
n n n In ShuffleIn Shuffle
Label positions with rationalsLabel positions with rationals
Out ShuffleOut Shuffle
Example: Card 10 of 52: x = 9/51Example: Card 10 of 52: x = 9/51
Shuffle TypesShuffle Types
Domain Endpoints Shuffle Deck Size
0 1 N -1, ,…, 0,1 out N = 2n
N -1 N -1 N -1
1 2 N, ,…, 1 in N = 2n -1
N N N
0 1 N -1, ,…, 0 out N = 2n -1
N N N
1 2 N, ,…, none in N = 2n
N +1 N +1 N +1
All denominators are odd numbers.
Doubling FunctionDoubling Function1
2 , 02( ) .
12 1, 1
2
x xS x
x x
Discrete Dynamical SystemsDiscrete Dynamical Systems
First Order System: First Order System: xxn+1n+1 = = f f ((xxnn))
Orbits: {Orbits: {xx00, , xx11, , … … }}Fixed PointsFixed PointsPeriodic OrbitsPeriodic OrbitsStability and BifurcationStability and BifurcationChaos !!!!Chaos !!!!
The Logistic MapThe Logistic MapDiscrete Population ModelDiscrete Population Model
PPn+1n+1 = a P = a Pnn
PPn+1n+1 = a = a22 P Pn-1n-1
PPn+1n+1 = a = ann P P00
a>1 => exponential growth!a>1 => exponential growth!CompetitionCompetition
PPn+1n+1 = a P = a Pnn - b P - b Pnn22
xxnn = (a/b)P = (a/b)Pnn, r=a/b => , r=a/b => xxn+1n+1 = r x = r xnn(1 - x(1 - xnn), x), xnn[0,1] and r[0,1] and r[0,4][0,4]
Example r=2.1Example r=2.1
Sample orbit for r=2.1 and x0 = 0.5
Example r=3.5Example r=3.5
Example r=3.56Example r=3.56
Example r=3.568Example r=3.568
Example r=4.0Example r=4.0
IterationsIterations
More IterationsMore Iterations
Fixed PointsFixed Pointsf(x*) = x*f(x*) = x*
x* = r x*(1-x*) x* = r x*(1-x*) => 0 = x*(1-r (1-x*) ) => 0 = x*(1-r (1-x*) ) => x* = 0 or x* = 1 – 1/r=> x* = 0 or x* = 1 – 1/r
Logistic Map - CobwebsLogistic Map - Cobwebs
Periodic Orbits for Periodic Orbits for f(x)=rx(1-x)f(x)=rx(1-x)
Period 2Period 2xx11 = r x = r x00(1- x(1- x00) and x) and x22 = r x = r x11(1- x(1- x11) = x) = x00
Or, f Or, f 2 2 (x(x00) = x) = x00
Period k Period k - smallest k - smallest k
such that f such that f k k (x*) = x*(x*) = x*Periodic CobwebsPeriodic Cobwebs
StabilityStability
Fixed PointsFixed Points|f’(x*)| < 1|f’(x*)| < 1
Periodic OrbitsPeriodic Orbits|f’(x|f’(x00)| |f’(x)| |f’(x11)| … |f’(x)| … |f’(xnn)| < 1)| < 1
BifurcationsBifurcations
BifurcationsBifurcationsr1 = 3.0r1 = 3.0
r2 = 3.449490 ...r2 = 3.449490 ...
r3 = 3.544090 ...r3 = 3.544090 ...
r4 = 3.564407 ...r4 = 3.564407 ...
r5 = 3.568759 ...r5 = 3.568759 ...
r6 = 3.569692 ...r6 = 3.569692 ...
r7 = 3.569891 ...r7 = 3.569891 ...
r8 = 3.569934 ...r8 = 3.569934 ...
Itineraries: Symbolic DynamicsItineraries: Symbolic Dynamics
Example: xExample: x00 = 1/3 = 1/3 xx00 = 1/3 => “L” = 1/3 => “L”
xx11 = 8/9 => “LR” = 8/9 => “LR”
xx22 = 32/81 => “LRL” = 32/81 => “LRL”
xx33 = … => “LRL …” = … => “LRL …”
Example: xExample: x00 = ¼ = ¼ { ¼, ¾, ¾, …}=>” LRRRR…”{ ¼, ¾, ¾, …}=>” LRRRR…”
For For G G ((xx) = 4) = 4x x ( 1-( 1-x x ) ) Assign Left “L” and Right Assign Left “L” and Right “R” “R”
Periodic Orbits Periodic Orbits ““LRLRLR …”, “RLRRLRRLRRL …”LRLRLR …”, “RLRRLRRLRRL …”
Shuffling as a Dynamical SystemShuffling as a Dynamical System1
2 , 02( ) .
12 1, 1
2
x xS x
x x
S(x) vs SS(x) vs S44(x)(x)
DemonstrationDemonstration
Iterations for 8 CardsIterations for 8 Cards
SS33(x) vs S(x) vs S22(x)(x)
SS33(x) vs S(x) vs S22(x)(x)
How can we study periodic orbits for How can we study periodic orbits for S(x)?S(x)?
Binary RepresentationsBinary Representations Binary RepresentationBinary Representation
0.10110.101122=1(=1(22-1-1)+0()+0(22-2-2)+1()+1(22-3-3)+1()+1(22-4-4) = ) = 1/2 + 1/8 + 1/16 = 10/16 = 5/81/2 + 1/8 + 1/16 = 10/16 = 5/8
xxn+1n+1 = S(x = S(xnn), given x), given x00
Represent xRepresent xnn’s in binary: x’s in binary: x00 = 0.101101 = 0.101101Then, xThen, x11 = 2 x = 2 x0 0 – 1 = 1.01101 – 1 = 0.01101– 1 = 1.01101 – 1 = 0.01101Note: S shifts binary representations! Note: S shifts binary representations!
Repeating DecimalsRepeating DecimalsS(0.101101101101…) = 0.011011011011…S(0.101101101101…) = 0.011011011011…S(0.011011011011…) = 0.110110110110…S(0.011011011011…) = 0.110110110110…
Periodic OrbitsPeriodic OrbitsPeriod 2Period 2
S(0.10101010…) = 0.01010101…S(0.10101010…) = 0.01010101…S(0.01010101…) = 0.10101010…S(0.01010101…) = 0.10101010…0.0.101022, 0., 0.010122, 0., 0.11112 2 = ?= ?
Period 3Period 30.0.10010022, 0., 0.01001022, 0.00, 0.00112 2 = ?= ?0.0.11011022, 0., 0.01101122, 0.10, 0.10112 2 = ?= ?
Maple ComputationsMaple Computations
Card Shuffling ExamplesCard Shuffling Examples8 Cards – All orbits are period 38 Cards – All orbits are period 3
52 Cards – Period 2 52 Cards – Period 2
50 Cards – Period 3 Orbit (Cycle)50 Cards – Period 3 Orbit (Cycle)
Recall:Recall:Period 2 - {1/3, 2/3}Period 2 - {1/3, 2/3}Period 3 – {1/7, 2/7, 4/7} and {3/7, 6/7, Period 3 – {1/7, 2/7, 4/7} and {3/7, 6/7,
5/7}5/7}Out Shuffles – i/(N-1) for (i+1) st cardOut 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, {1/7, 2/7, 4/7} and {3/7, 6/7, 5/7} and {0/7, 7/7}7/7}
1/3 = ?/51 and 2/3 = ?/51 1/3 = ?/51 and 2/3 = ?/51
1/7 = ?/491/7 = ?/49
Finding Specific t-CyclesFinding Specific t-Cycles
Period k: 0.Period k: 0.000 … 0001000 … 0001 22-t-t + (2 + (2-t-t)2 + (2)2 + (2-t-t) 3 + … = 2) 3 + … = 2-t-t /(1- 2 /(1- 2-t-t ) ) Or, 0.Or, 0.000 … 0001000 … 0001 = 1/(2 = 1/(2tt -1) -1)
ExamplesExamples Period 2: 1/3Period 2: 1/3 Period 3: 1/7Period 3: 1/7
In general: Select Shuffle TypeIn general: Select Shuffle Type Rationals of form i/r => (2Rationals of form i/r => (2tt –1) | r –1) | r Example r = 3(7) = 21Example r = 3(7) = 21
Out Shuffle for 22 or 21 cardsOut Shuffle for 22 or 21 cards In Shuffle for 20 or 21 cards In Shuffle for 20 or 21 cards DemonstrationDemonstration
Other TopicsOther Topics CardsCards
Alternate In/Out ShufflesAlternate In/Out Shuffles k- handed Perfect Shufflesk- handed Perfect Shuffles Random Shuffles – Diaconis, et alRandom Shuffles – Diaconis, et al ““Imperfect” Perfect ShufflesImperfect” Perfect Shuffles
Nonlinear Dynamical SystemsNonlinear Dynamical Systems Discrete (Difference Equations)Discrete (Difference Equations)
Systems in the Plane and Higher DimensionsSystems in the Plane and Higher Dimensions Continuous Dynamical Systems (ODES)Continuous Dynamical Systems (ODES)
IntegrabilityIntegrabilityNonlinear OscillationsNonlinear OscillationsMAT 463/563MAT 463/563
FractalsFractals ChaosChaos
SummarySummary
History of the Faro ShuffleHistory of the Faro ShuffleThe Perfect Shuffle – How to do it!The Perfect Shuffle – How to do it!Mathematical Models of Perfect ShufflesMathematical Models of Perfect ShufflesDynamical Systems – The Logistic Dynamical Systems – The Logistic
ModelModelFeatures of Dynamical SystemsFeatures of Dynamical SystemsSymbolic DynamicsSymbolic DynamicsShuffling as a Dynamical SystemShuffling as a Dynamical System
ReferencesReferences
K.T. Alligood, T.D. Sauer, J.A. Yorke, K.T. Alligood, T.D. Sauer, J.A. Yorke, Chaos, Chaos, An Introduction to Dynamical SystemsAn Introduction to Dynamical Systems, , Springer, 1996.Springer, 1996.
S.B. Morris, Magic Tricks, S.B. Morris, Magic Tricks, Card Shuffling and Card Shuffling and Dynamic Computer MemoriesDynamic Computer Memories, MAA, 1998, MAA, 1998
D.J. Scully, D.J. Scully, Perfect Shuffles Through Perfect Shuffles Through Dynamical Systems, Dynamical Systems, Mathematics Magazine, Mathematics Magazine, 77, 200477, 2004
WebsitesWebsites
http://i-p-c-s.org/history.html http://i-p-c-s.org/history.html http://jducoeur.org/game-hist/seaan-cardhist.html http://jducoeur.org/game-hist/seaan-cardhist.html http://www.usplayingcard.com/gamerules/http://www.usplayingcard.com/gamerules/
briefhistory.html briefhistory.html http://bcvc.net/faro/ http://bcvc.net/faro/ http://www.gleeson.us/faro/ http://www.gleeson.us/faro/
Thank you !