Shuffling with ordered cards

Similar documents
b) Find all positive integers smaller than 200 which leave remainder 1, 3, 4 upon division by 3, 5, 7 respectively.

SOLUTIONS TO PROBLEM SET 5. Section 9.1

Graphs of Tilings. Patrick Callahan, University of California Office of the President, Oakland, CA

17. Symmetries. Thus, the example above corresponds to the matrix: We shall now look at how permutations relate to trees.

The mathematics of the flip and horseshoe shuffles

1.6 Congruence Modulo m

I.M.O. Winter Training Camp 2008: Invariants and Monovariants

Modular arithmetic Math 2320

The mathematics of the flip and horseshoe shuffles

University of British Columbia. Math 312, Midterm, 6th of June 2017

Mathematics Explorers Club Fall 2012 Number Theory and Cryptography

DE BRUIJN SEQUENCES WITH VARYING COMBS. Abbas Alhakim 1 Department of Mathematics, American University of Beirut, Beirut, Lebanon

Exam 1 7 = = 49 2 ( ) = = 7 ( ) =

An Analytical Study in Connectivity of Neighborhoods for Single Round Robin Tournaments

Number Theory. Konkreetne Matemaatika

Senior Math Circles February 10, 2010 Game Theory II

Distribution of Primes

Week 1. 1 What Is Combinatorics?

LINEAR EQUATIONS IN TWO VARIABLES

Some forbidden rectangular chessboards with an (a, b)-knight s move

arxiv: v1 [math.co] 24 Nov 2018

p 1 MAX(a,b) + MIN(a,b) = a+b n m means that m is a an integer multiple of n. Greatest Common Divisor: We say that n divides m.

The Mathematics of the Flip and Horseshoe Shuffles

To Your Hearts Content

Solutions for the 2nd Practice Midterm

Solutions to Exam 1. Problem 1. a) State Fermat s Little Theorem and Euler s Theorem. b) Let m, n be relatively prime positive integers.

Solutions for the Practice Final

Assignment 2. Due: Monday Oct. 15, :59pm

Chapter 4 Number Theory

MATH 13150: Freshman Seminar Unit 15

Walking on Numbers and a Self-Referential Formula

Math 127: Equivalence Relations

MATH 324 Elementary Number Theory Solutions to Practice Problems for Final Examination Monday August 8, 2005

Section 7.2 Logarithmic Functions

Square Roots and the Pythagorean Theorem

Carmen s Core Concepts (Math 135)

Fast Sorting and Pattern-Avoiding Permutations

NUMBER THEORY AMIN WITNO

ALGEBRA: Chapter I: QUESTION BANK

Modular Arithmetic. Kieran Cooney - February 18, 2016

Three of these grids share a property that the other three do not. Can you find such a property? + mod

1 = 3 2 = 3 ( ) = = = 33( ) 98 = = =

2.3 BUILDING THE PERFECT SQUARE

Solutions for the Practice Questions

COMBINATORICS AND CARD SHUFFLING

Edge-disjoint tree representation of three tree degree sequences

12. 6 jokes are minimal.

Circular Nim Games. S. Heubach 1 M. Dufour 2. May 7, 2010 Math Colloquium, Cal Poly San Luis Obispo

1111: Linear Algebra I

A STUDY OF EULERIAN NUMBERS FOR PERMUTATIONS IN THE ALTERNATING GROUP

Caltech Harvey Mudd Mathematics Competition February 20, 2010

6. Find an inverse of a modulo m for each of these pairs of relatively prime integers using the method

n! = n(n 1)(n 2) 3 2 1

November 11, Chapter 8: Probability: The Mathematics of Chance

4-7 Point-Slope Form. Warm Up Lesson Presentation Lesson Quiz

New designs from Africa

Mathematics Competition Practice Session 6. Hagerstown Community College: STEM Club November 20, :00 pm - 1:00 pm STC-170

Chained Permutations. Dylan Heuer. North Dakota State University. July 26, 2018

A construction of infinite families of directed strongly regular graphs

Math 1111 Math Exam Study Guide

Number Theory - Divisibility Number Theory - Congruences. Number Theory. June 23, Number Theory

Pattern Avoidance in Poset Permutations

ECS 20 (Spring 2013) Phillip Rogaway Lecture 1

Primitive Roots. Chapter Orders and Primitive Roots

Number-Theoretic Algorithms

Lesson 6.1 Linear Equation Review

Foundations of Cryptography

Permutations. = f 1 f = I A

CMPSCI 250: Introduction to Computation. Lecture #14: The Chinese Remainder Theorem David Mix Barrington 24 February 2012

Introduction to Modular Arithmetic

Two congruences involving 4-cores

Solving Equations and Graphing

Graphs of linear equations will be perfectly straight lines. Why would we say that A and B are not both zero?

Solutions to Problem Set 6 - Fall 2008 Due Tuesday, Oct. 21 at 1:00

37 Game Theory. Bebe b1 b2 b3. a Abe a a A Two-Person Zero-Sum Game

CMPSCI 250: Introduction to Computation. Lecture #14: The Chinese Remainder Theorem David Mix Barrington 4 October 2013

Notes for Recitation 3

CCO Commun. Comb. Optim.

Dyck paths, standard Young tableaux, and pattern avoiding permutations

Three Pile Nim with Move Blocking. Arthur Holshouser. Harold Reiter.

Permutation Generation Method on Evaluating Determinant of Matrices

Hamming Codes and Decoding Methods

Game Theory and Algorithms Lecture 19: Nim & Impartial Combinatorial Games

Combinatorics. PIE and Binomial Coefficients. Misha Lavrov. ARML Practice 10/20/2013

Introduction. and Z r1 Z rn. This lecture aims to provide techniques. CRT during the decription process in RSA is explained.

Constructions of Coverings of the Integers: Exploring an Erdős Problem

Theory of Probability - Brett Bernstein

Situations Involving Multiplication and Division with Products to 50

Degree project NUMBER OF PERIODIC POINTS OF CONGRUENTIAL MONOMIAL DYNAMICAL SYSTEMS

Tutorial 1. (ii) There are finite many possible positions. (iii) The players take turns to make moves.

Problem Set 8 Solutions R Y G R R G

MAT Modular arithmetic and number theory. Modular arithmetic

PART I: Emmett s teacher asked him to analyze the table of values of a quadratic function to find key features. The table of values is shown below:

On uniquely k-determined permutations

Situations Involving Multiplication and Division with Products to 100

You ve seen them played in coffee shops, on planes, and

Congruence. Solving linear congruences. A linear congruence is an expression in the form. ax b (modm)

Fermat s little theorem. RSA.

Curriculum links Maths: working mathematically, number, algebra.

Wilson s Theorem and Fermat s Theorem

Transcription:

Shuffling with ordered cards Steve Butler (joint work with Ron Graham) Department of Mathematics University of California Los Angeles www.math.ucla.edu/~butler Combinatorics, Groups, Algorithms and Complexity 23 March 200

Mathematics from cards and shuffling Cards make excellent motivation for mathematical problems (and can even lead to great mathematicians). Counting how many different hands are possible in a 52 card deck. (Combinatorics) Given what cards have already been played, finding the likelihood of a face card. (Probability) How many shuffles does it take to randomize a deck of cards. (Random walks on graphs) (Of course it depends on who is doing the shuffling!)

Perfect riffle shuffles A perfect riffle shuffle consists of splitting a deck of cards into two equal stacks and perfectly alternating the cards between the two stacks. In-shuffle Out-shuffle These two shuffles are generators for a group of how to get to all possible arrangements of cards I, O.

A new shuffle We consider a new shuffle of a deck where cards have ordered labels and where not only the position but also the label of the card is important. Again we split the deck into k equally sized stacks but now we use the label to determine which card drops first. (Larger labels want to drop down. When there is a tie then the order is unimportant.) 0 2 2 0 original stack 0 2 split into two substacks 2 0 0 2 2 0 shuffling

Suppose that we have N = kn labeled cards. Suppose the labels are a 0, a,..., a n, a n, a n+,..., a 2n, a 2n,..., a kn. Construct k n matrix filling rows left to right, top to bottom. a 0 a a n a n a n+ a 2n....... a kn Sort each column according to the ordering of the labels, b 0 b k b b k+....... b k b 2k b kn Concatenate the columns to form the labels for the shuffled cards b 0, b,..., b k, b k, b k+,..., b 2k, b 2k,..., b kn.

An example, N = 2, k = 3 Starting with a stack of labeled cards in order 0200220 then one shuffle gives the following. 0 2 0200220 0 0 2 2 0 2 2 2 0 2002020 0 0 0 Repeating we have 0200220 2002020 2200020 2002020

Observation Starting with a stack of cards then after finitely many shuffles we will enter into a periodic cycle. What periods are possible? How long does it take to get to the periodic stack? How do we find periodic stacks? How do we find fixed stacks? How many fixed stacks are there?

Where do the subscripts map? Returning to the case N = 2 and k = 3 we have: ( ) 0 2 3 4 5 6 7 8 9 0 0 2 3 4 5 6 7 8 9 0 This shows, for example, {a 2, a 6, a 0 } {b 6, b 7, b 8 } in some order, depending on the labels. We would like a rule for defining a map a i b j, i.e., i j, in some natural way.

Shuffling weight function A shuffling weight function is a map ϕ : {0,..., N } Z which satisfies the following two conditions for l {0,,..., n }: (i) { ϕ(l), ϕ(l + n),..., ϕ(l + (k )n) } = { ϕ(kl), ϕ(kl + ),..., ϕ(kl + (k )) }. (ii) ϕ(kl) < ϕ(kl + ) < < ϕ(kl + (k )). Theorem A shuffling weight function ϕ exists for each N = kn and k.

A shuffling weight function for N = 2, k = 3 n 0 2 3 4 5 6 7 8 9 0 ϕ(n) 0 2 0 2 0 2 0 2 Replacing n by ϕ(n) our previous diagram becomes the following. ( ) 0 2 0 2 0 2 0 2 0 2 0 2 0 2 0 2

Constructing the shuffling poset We now construct a directed graph by letting n m where ϕ(n) = ϕ(m). By defining properties of weight we have in-degree=out-degree= at each vertex (so graph consists of directed cycles). Place into a poset with the cycle containing n at height ϕ(n). 5 8 2 4 7 0 0 9 3 6

Add to this edges (oriented downwards) between all elements in the same column. 5 8 2 4 7 0 0 9 3 6 Observation Shuffling can be done using this poset as follows: Place cards according to their position. Using vertical directed edges swap cards so no vertical edge has a high card above a low card. Using horizontal directed edges move each card to next entry. Pick up cards according to their position.

The shuffling poset is useful! Since we can use the shuffling poset to do the shuffling then this structure gives a lot of information about what happens in the shuffling process. 5 8 2 4 7 0 0 9 3 6 Observation The possible periods are divisors of the least common multiple of the cycle lengths in the rows of this poset.

A special case Suppose that N = kn = k t q and that gcd(k, q) =. A shuffling weight function Let the base k expansion of A be... A t A t... A 0. Then ϕ(a) = A 0 +... + A t is a shuffling weight function. The mapping given by the weight function Let the base k expansion of A be... A t A t... A 0. Then A ka + A t (mod N).

Cycle lengths when gcd(q, k) = Theorem Let N = k t q with gcd(k, q) =, and let order k (s) denote the multiplicative order of k modulo s. Then the length of a cycle in the shuffling poset when we divide N into k equal stacks is a divisor of order k (N q). Further, there is a cycle of length order k (N q). Example If N = 2 = 3 4 and k = 3 then gcd(3, 4) =. So periods are divisors of order 3 (2 4) = order 3 (8) = 2.

Proof Suppose we start our cycle at x with base k expansion... A t... A A 0, then we map t times. x kx + A t (mod N) k 2 x + ka t + A t 2 (mod N) k 3 x + k 2 A t + ka t 2 + A t 3 (mod N) t k t x + k i A i (mod N). i=0 } {{ } =A

Proof, continued Repeating this r times (for a total of rt steps) we have x k t x + A (mod N) k 2t x + k t A + A (mod N) k 3t x + k 2t A + k t A + A (mod N) r k rt x + k it A (mod N). i=0 For some r we will be back where we started if r k rt x + k it A x (mod N = k t q) i=0

Proof, continued r k rt x + k it A x (mod N = k t q) i=0 Multiply both sides by k t and simplifying we have (k rt ) ( x(k t ) + A ) 0 (mod (k t )k t q). We have x = A + mk t, substituting we have (k rt )k t( A + m(k t ) ) 0 (mod (k t )k t q) or (k rt ) ( A + m(k t ) ) 0 (mod (k t )q = N q).

Proof, concluded (k rt ) ( A + m(k t ) ) 0 (mod N q). If rt = order k (N q) then k rt 0 (mod (k t )q) and the above equation is satisfied. So after taking order k (N q) steps all elements are back to where they started so cycle lengths divide order k (N q). For the special case x = (A = and m = 0) this reduces to k rt (mod N q), So cycle containing must be of size order k (N q).

What happens when gcd(q, k)????? Example when N = 24 and k = 6 n 0 2 3 4 5 6 7 8 9 0 ϕ(n) 0 4 5 6 7 2 5 6 7 8 n 2 3 4 5 6 7 8 9 20 2 22 23 ϕ(n) 2 3 4 7 8 2 3 4 5 8 9 The resulting shuffling poset has cycles of lengths and 3.