Thorp Shuffle Mixing Time: How OpenAI Solved the Whole-Deck Randomness Puzzle

After three Thorp shuffles, every card in an eight-card deck has exactly the right chance of occupying every position. Yet almost nine-tenths of all deck orders remain impossible. Each card looks innocent. The correlations give the game away.

The Thorp shuffle mixing time asks how quickly the entire deck becomes approximately uniform. OpenAI’s September 26, 2026 paper proves that, for n=2dn=2^d cards, the answer has order Θ(d)=Θ(logn)\Theta(d)=\Theta(\log n). Its explicit upper construction uses 1600d1600d complete shuffles, while counting possible outcomes forces a lower bound of 2d−O(1)2d-O(1). The achievement is matching growth rates for the full permutation, rather than merely scattering individual cards.

1. What OpenAI Proved About Thorp Shuffle Mixing Time

In Optimal-order mixing of the Thorp shuffle, let qdq_d denote one shuffle’s probability law and UnU_n the uniform law on all n!n! permutations. Theorem 1.1 states:

‖qd∗(1600d)−Un‖TV⟶0(d→∞).\left\|q_d^{*(1600d)}-U_n\right\|_{\mathrm{TV}}\longrightarrow0\quad(d\to\infty).

The star denotes convolution, meaning composition of independent random permutations. Total variation is the largest probability discrepancy over events. Consequently, closeness controls every test of the final deck, including tests involving many cards simultaneously. The switch-chain mixing problem uses the same distributional criterion for graphs.

1.1. Thorp Shuffle Mixing Time: Key Facts

Research DetailVerified Scope
Deck sizen=2dn=2^d labeled cards.
One time stepOne complete physical shuffle, using n/2n/2 fair bits.
Mixing criterionTotal-variation distance at most 1/41/4.
Upper conclusionDistance after 1600d1600d shuffles tends to zero as d→∞d\to\infty.
Necessary timeAt least 2d−O(1)2d-O(1) shuffles.
Not determined hereSharp leading constant and cutoff for this model.

OpenAI’s mathematics release announcement attributes the collection to an internal frontier model. The family 238 formalization scope explicitly reports the main optimal-order theorem, alongside separately scoped supporting results. This article explains the supplied manuscript and that documentation, without independently rebuilding Lean. Our Fermat formalization explainer explains why discovery and machine checking are different contributions.

2. How Does the Thorp Shuffle Actually Work?

	Thorp shuffle mixing time: eight cards reordered by four independent pairwise coin flips.
Thorp shuffle mixing time: eight cards reordered by four independent pairwise coin flips.

Split eight cards into equal halves: A, B, C, D and E, F, G, H. Pair corresponding positions: A with E, B with F, C with G, D with H. Flip four independent fair coins. Each coin decides which member of its pair comes first. Concatenate the four resulting pairs.

Four independent pair decisionsCorresponding cards from the two halves are paired. Keep A E, swap B F to F B, keep C G, and swap D H to H D. Concatenating outputs gives A E F B C G H D. One Eight-Card ShuffleInput pairCoinOutput pairA + EKeepA EB + FSwapF BC + GKeepC GD + HSwapH DRead outputs from top to bottom.
Worked example, not a typicality claim. “Keep” and “swap” each have probability one-half, independently for each pair.

That example produces A, E, F, B, C, G, H, D. A complete physical shuffle uses four coin flips here, generally n/2n/2. Repeat the same operation on the newly ordered deck, with fresh independent coins.

This differs from ordinary riffle shuffling, whose random cut and interleaving follow another probability model. A familiar bound for riffle shuffles cannot be imported into the Thorp model simply because both interleave cards. The transition rule determines the theorem.

3. Why Randomizing One Card Does Not Randomize the Deck

	Thorp shuffle mixing time: uniform card positions versus at most 4,096 reachable orders out of 40,320.
Thorp shuffle mixing time: uniform card positions versus at most 4,096 reachable orders out of 40,320.

Track one card through three shuffles of eight cards. Each shuffle refreshes one binary coordinate of its position. After three refreshes, its three-bit position is uniform over eight possibilities. This holds separately for every card.

The whole deck has a stricter requirement. Three shuffles consume twelve random bits, so they can produce at most 212=40962^{12}=4096 deck orders. There are 8!=403208!=40320 possible permutations. Thus at least 36,224 orders are unreachable, despite perfectly uniform single-card positions.

Uniform card positions do not imply a uniform deckEvery single-card position has probability one-eighth after three shuffles. A bar on a linear count scale shows at most 4096 reachable deck orders out of 40320, leaving at least 36224 unreachable. Single Cards Versus Full DeckOne card: eight possible positions12345678Each position has probability 1/8.Full deck: 40,320 possible ordersAt most 4,096 reachableAt least 36,224 unreachableAfter three complete shuffles.
Exact support-count bound: at most 10.16% of orders are reachable. Teal marks reachable possibilities; the pale remainder marks orders outside that bound. Total variation is at least 89.84%.

This is a distinction between marginals and their joint distribution. Cards share switches, and permutations forbid collisions. The resulting dependencies survive tests that examine only one card. Trace reconstruction offers a related lesson about information hidden in joint positional structure, although its deletion model is different.

4. The Original Problem and Why Earlier Proofs Fell Short

Edward Thorp introduced the model in his 1973 study of nonrandom shuffling and Faro. Its elementary rule left a difficult quantitative question: how long do dependencies across the complete permutation persist?

The manuscript traces successive improvements from Morris’s O(d44)O(d^{44}) bound to Montenegro and Tetali’s O(d29)O(d^{29}). Morris then developed entropy methods, first obtaining O((logn)4)O((\log n)^4) for every even deck size and later O(d3)O(d^3) for powers of two. These are upper guarantees, rather than measurements of typical simulations.

4.1. How the Proven Upper Bounds Changed

Method Or AuthorsUpper-Bound Order
Morris: evolving sets and chameleon processO(d44)O(d^{44}) for dyadic decks.
Montenegro–Tetali: refined analysisO(d29)O(d^{29}) for dyadic decks.
Morris: entropy methodsO((logn)4)O((\log n)^4) for even decks; later O(d3)O(d^3) for dyadic decks.
This manuscriptO(d)O(d) for dyadic decks.

Entropy measures departure from a reference distribution. Its usefulness across probability and information theory also appears in our Courtade–Kumar explainer, but the shuffle requires its own contraction argument.

Previous work also controlled large selections of cards without settling the complete permutation at logarithmic time. The new Thorp shuffle proof connects a conditional-flow estimate to a separate representation-theoretic argument. Sampling one valid object and sampling the right ensemble remain different achievements, as in counting perfect matchings.

5. Why the Mixing Time Cannot Beat 2d Minus a Constant

Every physical shuffle uses n/2n/2 independent bits. After tt shuffles there are only 2tn/22^{tn/2} possible coin strings. Different strings might coincide, so this is an upper bound on the number of reachable permutations, not an assumption that all outputs differ.

Let AA be that reachable set. The shuffle assigns probability one to AA, while uniform randomness assigns at most its size divided by n!n!. Therefore:

‖qd∗t−Un‖TV≥1−2tn/2n!.\left\|q_d^{*t}-U_n\right\|_{\mathrm{TV}}\ge1-\frac{2^{tn/2}}{n!}.

Distance at most one-quarter requires at least three-quarters of the permutation space to be reachable. Taking binary logarithms gives the necessary bound:

tmix(d)≥⌈2nlog2⁡(3n!4)⌉=2d−O(1).t_{\mathrm{mix}}(d)\ge\left\lceil\frac{2}{n}\log_2\!\left(\frac{3n!}{4}\right)\right\rceil=2d-O(1).

The paper obtains this order using elementary factorial inequalities. It counts available randomness, whereas logarithmic-space derandomization asks when algorithms can eliminate random choices. Having enough bits is necessary here, but does not establish that the shuffle uses them effectively.

6. Turning the Thorp Shuffle Into a Binary Hypercube

Write positions as binary strings in F2d\mathbb F_2^d, the set of length-dd bit vectors with addition modulo two. For eight cards these are 000 through 111. Paired positions differ in the first bit.

A physical shuffle first independently swaps or fixes each pair, then rotates the coordinates. Its position rule is:

(x1,u)⟼(u,x1+ξu).(x_1,u)\longmapsto(u,x_1+\xi_u).

Here uu contains the remaining bits and ξu\xi_u is that pair’s fair bit. Addition in the last coordinate is modulo two.

Undo the known rotation when describing the evolving deck. In this moving frame, successive updates become switches along successive cube coordinates. One full coordinate sweep takes dd physical shuffles. For example, the first-coordinate edge from 000 to 100 and the second-coordinate edge from 000 to 010 are different matching edges. A layer uses only one direction at a time, so each position belongs to exactly one active pair. This bookkeeping matters: the theorem counts physical shuffles, not sweeps. For eight cards, toggling the first, second, then third coordinate is three layers, not one operation. At a full sweep’s end, the accumulated rotation returns to its starting frame.

7. Conditional Probability Flow: Tracking the Unexposed Cards

Choose an ordered random list of labels independently of the shuffle. Reveal their complete paths one at a time. After exposing ℓ\ell cards, let BsB_s be the free positions at time ss, with constant size m=n−ℓm=n-\ell. The next, tagged card has conditional probabilities ps(x)p_s(x).

Subtract the uniform distribution on those free positions:

ws(x)=ps(x)−1m𝟏Bs(x).w_s(x)=p_s(x)-\frac{1}{m}\mathbf{1}_{B_s}(x).

The indicator equals one on free positions and zero elsewhere. Thus wsw_s sums to zero. It records excesses and deficits relative to the desired conditional distribution.

With two free endpoints, the switch coin is unexposed, so both probabilities average. With one free endpoint, an observed card’s path determines the switch, and the tagged-card probability follows the remaining route. Revealing feasible paths fixes exactly the coins those paths visited. Other coins remain independent and fair. This fact justifies conditioning on trajectories without quietly inventing independence between all remaining card positions.

Averaging versus forced transport of centered probabilityTwo free endpoints with centered masses plus 0.3 and minus 0.1 both become plus 0.1. With one free endpoint, an exposed card crossing in the opposite direction forces the free mass plus 0.3 to move unchanged. Crossing lines are separate routes, not a junction. Conditional Switch Updates Two free positions: average +0.3−0.1+0.1+0.1Average One free position: transport +0.3+0.3Open circle: free positionSolid circle: exposed cardDashed line: revealed card’s route
Schematic local centered masses, not complete probability distributions. A two-free switch averages. In the illustrated one-free switch, the exposed card’s revealed route forces transport of the free mass.

8. The One-Sweep Energy Identity That Makes the Proof Work

Let AiA_i average values across coordinate-ii pairs. The actual centered flow equals that ideal averaging plus conditional mean-zero noise from switches with one free endpoint. Noise here describes uncertainty revealed by observed paths, rather than extra randomness added to the shuffle.

Define Es=E‖ws‖22E_s=\mathbb E\|w_s\|_2^2, the expected sum of squared deviations. Let bsb_s be the expected sum of ws(x)2w_s(x)^2 over free positions whose partner in the next active direction is occupied by an exposed card. Lemma 3.2 gives, for t≥dt\ge d:

Et=∑j=1d2−jbt−j.E_t=\sum_{j=1}^{d}2^{-j}b_{t-j}.

This equality retains exactly one sweep of noise. Averaging through all coordinates erases the old mean-zero vector. Cross terms vanish because later noise has conditional mean zero. A noise contribution from jj layers ago spreads over disjoint subcubes, leaving the factor 2−j2^{-j} in squared energy.

The result is sharper than repeatedly bounding every update separately: it identifies precisely which recent obstructions still matter. The weights are not arbitrary discount factors fitted to data. They follow from how averaging spreads an edge-supported perturbation through the remaining coordinates. The proof therefore needs the prescribed coordinate order, rather than silently replacing it with randomly chosen directions.

9. How Independent Cube Halves Force the Energy to Contract

Before a coordinate becomes active again, the intervening d−1d-1 directions never cross its two opposite cube halves. Conditional on the earlier exposed history, the future switch arrays inside those halves are independent.

This separates a flow value in one half from the availability of its partner in the opposite half. It does not assert independence between flow and availability within the same half. That distinction is where a tempting shortcut would fail.

Averaging over random input lists leaves the free set uniformly distributed among subsets of its size. When at least n/8n/8 positions remain, concentration makes very sparse halves rare. Combining this with the energy identity gives, for t≥2dt\ge2d:

Et≤(3132)t−2d+32e−n/256.E_t\le\left(\frac{31}{32}\right)^{t-2d}+32e^{-n/256}.

The first term decays geometrically, while the second bounds exceptional configurations. Sequentially comparing each tagged card with a uniform free position converts energy into total variation. After 200d200d shuffles, the ordered positions of a uniformly chosen list of 7n/87n/8 cards have average error O(n−5/2)O(n^{-5/2}). “Average” matters: this intermediate guarantee is not stated uniformly over every prescribed list.

10. From Nearly Randomized Cards to the Entire Permutation

Knowing seven-eighths of the deck approximately does not automatically control the hidden eighth. Partition labels into eight equal blocks, each containing n/8n/8 cards. The averaged estimate guarantees a partition whose eight complementary marginals have small total error.

For each omitted block, permutations agreeing outside it form a coset of the subgroup that rearranges only that block. Remove cosets carrying excessive probability, doing all eight removals together. Conditioning on the retained set produces one nearby law, ν\nu, satisfying every coset cap simultaneously. Separate trimming for each marginal would not provide this common law.

Representation theory now decomposes permutation dependence into matrix-valued components. These are Fourier matrices on the symmetric group, rather than the scalar frequency coefficients familiar from the discrete Fourier transform.

The hook-length formula controls representation dimensions through Young diagrams. Restricting to the eight block subgroups exposes a small-dimensional factor. Controlling a vector’s orbit span, even when representations occur repeatedly, yields:

‖ν^(ρ)‖op≤AD−5/16.\|\widehat{\nu}(\rho)\|_{\mathrm{op}}\le A D^{-5/16}.

More concretely, within each tensor component the eight factor dimensions multiply to at most DD, so at least one is at most D1/8D^{1/8}. The orbit-span estimate then produces a squared-norm exponent of −5/8-5/8, hence −5/16-5/16 after taking square roots.

Here ρ\rho is irreducible, DD its dimension, the operator norm measures maximum amplification, and AA is an absolute constant.

11. Completing the Proof: Why Eight Blocks of 200d Shuffles Suffice

	Thorp shuffle mixing time proof connecting averaged marginals, eight complementary views, and 1600d shuffles.
Thorp shuffle mixing time proof connecting averaged marginals, eight complementary views, and 1600d shuffles.

Compose eight independent intervals, each lasting 200d200d physical shuffles. Convolution multiplies their Fourier matrices. The resulting dimension decay makes the sum of all nontrivial, nonsign contributions vanish, using the reciprocal-dimension estimate proved earlier. Specifically, eight factors and squared norms supply the exponent 2−16(5/16)=−32-16(5/16)=-3 in representation dimension. The remaining reciprocal-cube sum tends to zero. These eight time intervals are distinct from the eight label blocks used to establish each interval’s Fourier estimate.

Parity needs separate treatment because the sign representation has dimension one. In a positive-time original interval, flipping one final switch coin reverses permutation parity. Even and odd outcomes therefore balance exactly. Trimming introduces only a vanishing bias, which remains harmless after eight factors.

Replacing each trimmed interval with its original law costs at most its total-variation difference. Eight replacements still cost a vanishing amount. This completes the full-permutation comparison after 8×200d=1600d8\times200d=1600d shuffles, from every deterministic starting deck.

Once the full law is close, every fixed selection of cards is close too, because applying a deterministic observation cannot increase total variation. That stronger conclusion arrives at the end, rather than being assumed in the averaged intermediate estimate.

For developers, the theorem implies approximately uniform permutations using O(nlogn)O(n\log n) independent fair bits. It supplies no competitive implementation benchmark. As in log-concave sampling, an asymptotic guarantee must be read alongside the resource being counted. The paper’s dyadic proof does not establish the same bound for 52 or 100 cards, determine the sharp leading constant, or settle cutoff, an abrupt mixing transition. Nor does distributional mixing alone establish an efficient keyed cipher’s security, a distinction relevant to our AI cryptography coverage.

Thorp shuffle mixing time now has its optimal growth order. The lasting insight is how local conditional averaging, carefully preserved independence, and global algebra together control correlations invisible to single-card tests. Explore Binary Verse AI’s linked proof explainers to keep building that distinction between what a theorem proves and what an application still needs.

What is the mixing time of the Thorp shuffle?

For n=2dn=2^d cards, the paper proves mixing time Θ(d)=Θ(logn)\Theta(d)=\Theta(\log n), using total-variation distance one-quarter as its threshold. This concerns the entire permutation approaching uniform, rather than merely individual card positions.

Why is the result called optimal-order mixing?

The necessary lower bound is 2d−O(1)2d-O(1), and the sufficient upper bound is O(d)O(d). Both grow linearly with dd, although their constants differ. Optimal order does not mean an exact leading constant.

Does OpenAI’s proof establish that exactly 1600d shuffles are necessary?

No. The theorem shows that the distance from uniform after 1600d1600d shuffles tends to zero as d→∞d\to\infty. It does not assert that this many shuffles are necessary or give that numerical guarantee for every finite dimension. The sharp constant and cutoff remain separate questions.

Why can every card be uniformly distributed while the deck is not?

Uniform individual positions do not eliminate correlations between cards. After three shuffles of eight cards, every card is individually uniform, yet at most 4,096 of the 40,320 complete deck orders are reachable.

Is the Thorp shuffle the same as ordinary riffle shuffling?

No. The Thorp model pairs corresponding cards from two equal halves and independently chooses the order inside each pair. Ordinary riffle shuffling uses a different transition law. Its familiar seven-shuffle result should not be applied to this model.

Does the theorem apply to a standard 52-card deck or a 100-card deck?

Not directly. This optimal-order theorem concerns deck sizes 2d2^d. The manuscript does not establish the same quantitative result for arbitrary even deck sizes, including 52 and 100.

Does this proof immediately produce a practical secure block cipher?

No. It establishes full-permutation mixing under independent fair switch bits and has cryptographic relevance. It does not itself prove the security or practicality of a concrete efficient keyed cipher.

Leave a Comment