duaLab Contribute

Perfect shuffle

Projects: Topoi of automata · Topos-theoretic dynamical system theories

Contents

A perfect shuffle cuts a deck of $2k$ cards into two halves and interleaves them. For $2^n$ cards it is the cyclic shift of binary digits, and as a dynamical system it is isomorphic to the Frobenius on the field with $2^n$ elements. The Frobenius generates the Galois group of this field over $\mathbb F_2$. In the limit over $n$, the Frobenius on $\overline{\mathbb F_2}$ is isomorphic to the rotation of primitive words over $\mathbb F_2$.

1. Idea

The perfect shuffle of $2^n$ cards has four descriptions, as four isomorphic discrete dynamical systems. The last three have a limit as $n$ grows. What the limit of the perfect shuffle itself should be is a question of the note [Hor25, §4]; see the infinite perfect shuffle. In the table, $1+X$ is the disjoint union of a fixed point and a system $X$, and $\mathbb Z_{(2)}$ is the ring of the fractions with odd denominator.

$$\begin{array}{l|l|l} & 2^n\text{ cards} & \text{limit}\\ \hline \text{cards} & \text{perfect shuffle of }\{0,\dots,2^n-1\} & \text{a question}\\ \text{binary digits} & \text{cyclic shift of }\mathbb F_2^n & \text{shift of periodic }\mathbb F_2\text{-sequences}\\ \text{field} & \text{Frobenius of }\mathbb F_{2^n} & \text{Frobenius of }\overline{\mathbb F_2}\\ \text{doubling} & 1+(\mathbb Z/(2^n-1)\mathbb Z,\times2) & 1+(\mathbb Z_{(2)}/\mathbb Z,\times2) \end{array}$$

2. Definition

We number the positions of a deck of $2k$ cards by $0,1,\dots,2k-1$ from the top.

Definition 2.1 (Perfect shuffle)

The perfect shuffle (faro shuffle) of $2k$ cards is the map on $\{0,1,\dots,2k-1\}$ that sends $x$ to $2x$ if $x<k$ and to $2(x-k)+1$ otherwise. So the cards of the top half go to the even positions, and the cards of the bottom half go to the odd positions, in the same order.

Example 2.2 (Eight cards)

The perfect shuffle of $8$ cards moves the card at each position of the top row to the position below the arrow.

[column sep=small, row sep=huge] 0 \arrow[d] & 1 \arrow[dr] & 2 \arrow[drr] & 3 \arrow[drrr] & 4 \arrow[dlll] & 5 \arrow[dll] & 6 \arrow[dl] & 7 \arrow[d] \\ 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7

It fixes $0$ and $7$ and has the two cycles $1\mapsto2\mapsto4\mapsto1$ and $3\mapsto6\mapsto5\mapsto3$. In binary digits these cycles are $001\mapsto010\mapsto100$ and $011\mapsto110\mapsto101$, the rotation orbits of the primitive words of length $3$ over two letters.

3. Properties

We first describe the perfect shuffle by binary digits, then compare it with the Frobenius of a finite field, and finally let the number of cards grow.

Fact 3.1 (Binary digits)

The perfect shuffle of $2k$ cards fixes $0$ and $2k-1$ and acts as $i\mapsto 2i \bmod (2k-1)$ on the rest. For $2^n$ cards this is the cyclic shift of binary digits: it sends the number with the binary digits $b_{n-1}b_{n-2}\cdots b_0$ to the number with the binary digits $b_{n-2}\cdots b_0b_{n-1}$. So it preserves the nim-sum, the addition of binary digits without carry.

See Stone 1971; Diaconis–Graham–Kantor 1983.

Example 3.2 (Frobenius)

By the normal basis theorem, there is $\beta\in\mathbb F_{2^n}$ such that $\beta^{2^{n-1}},\dots,\beta^2,\beta$ is a basis of $\mathbb F_{2^n}$ over $\mathbb F_2$. In the coordinates of this basis, the Frobenius $x\mapsto x^2$ is the cyclic shift. So the perfect shuffle of $2^n$ cards is isomorphic as a discrete dynamical system to the Frobenius on $\mathbb F_{2^n}$, and hence to $1+(\mathbb Z/(2^n-1)\mathbb Z,\times2)$, the disjoint union of a fixed point and the multiplication by $2$ on $\mathbb Z/(2^n-1)\mathbb Z$.

See [Hor25, §§2–4].

Example 3.3 (Colimit of Frobenius maps)

Let $\mathbb Z_{(2)}$ be the localization of $\mathbb Z$ at the prime ideal $(2)$. In the colimit over $n$, ordered by divisibility, three systems are isomorphic: the shift on periodic $\mathbb F_2$-sequences, which is the set $\mathrm{PW}_{\mathbb F_2}$ of primitive words with rotation; the Frobenius $(\overline{\mathbb F_2},x\mapsto x^2)$; and $1+(\mathbb Z_{(2)}/\mathbb Z,\times2)$.

See [Hor25, §4]. The note states the two isomorphisms and sketches a proof only for the first, between the shift and the Frobenius.

Example 3.4 (Compatible embeddings)

For $n\mid m$, the map from $2^n$ cards to $2^m$ cards

$$x\mapsto x\cdot\frac{2^m-1}{2^n-1},$$

which repeats the $n$ binary digits of $x$, commutes with the perfect shuffles. It corresponds to $\mathbb F_{2^n}\subset\mathbb F_{2^m}$ under normal bases compatible with the trace.

Example 3.5 (Infinite perfect shuffle)

In the colimit along the compatible embeddings, card $x$ of $2^n$ cards is the point $r=x/(2^n-1)$, the deck is $\mathbb Z_{(2)}\cap[0,1]$, and the perfect shuffle of $2^\infty$ cards is

$$r\mapsto\begin{cases}2r&(r<\tfrac12),\\2r-1&(r>\tfrac12).\end{cases}$$

That is, it is the doubling map of $[0,1]$ restricted to its periodic points.

Remark 3.6 (Answer to a question)

The note [Hor25, §4] asks what the perfect shuffle of $2^\infty$ cards should be. The infinite perfect shuffle is an answer.

4. Examples

The Frobenius is a field automorphism. So the isomorphism with the Frobenius gives the deck of $2^n$ cards a field structure that the perfect shuffle preserves, and we compare it with the nim-product.

Example 4.1 (Not the nim-product)

For $n\ge2$, the field structure on $\{0,1,\dots,2^n-1\}$ transported from $(\mathbb F_{2^n},x\mapsto x^2)$ is not the nim-product. Its unit is a fixed point of the perfect shuffle, hence $0$ or $2^n-1$, while the perfect shuffle sends the unit $1$ of the nim-product to $2$.

Not yet checked by Hora.

Remark 4.2 (Answer to a question)

The note [Hor25, §3] asks whether this field structure is the nim-product. The example above answers the question.

6. References

Last edited