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.
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.
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
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
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$.
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.
5. Related concepts§
6. References§
- [Sto71] Harold S. Stone, Parallel processing with the perfect shuffle, IEEE Transactions on Computers C-20 (1971), 153–161.
- [DGK83] Persi Diaconis, R. L. Graham and William M. Kantor, The mathematics of perfect shuffles, Advances in Applied Mathematics 4 (1983), 175–196.
- [Hor25] Ryuya Hora, Some algebraic structures on the perfect shuffling, note for a meeting in Karuizawa, November 2025, unpublished.
- [Len85] Hendrik W. Lenstra, Jr., A normal basis theorem for infinite Galois extensions, Indagationes Mathematicae (Proceedings) 88 (1985).