The Puzzle Collector’s Problem1

Photograph of four hands holding out individual blank puzzle pieces that might fit together, over an unfocused pattern rug."Co-creation and sharing of knowledge," Jorge Franganillo, CC By 2.0.

Suppose that over the course of a game, jigsaw puzzle pieces are given out one-by-one, randomly, as rewards. Perhaps the finished puzzle is a useful item in-game, or it contains information that can be worked from partially or incompletely. How many pieces would a player need before they can start assembling the puzzle?

This resembles, in some ways, the birthday problem. Except that this is a birthday problem “without replacement:” we can’t have the same “birthday” twice so instead we’re concerned with consecutive “birthdays.” This may not be a directly useful analog, except for the realization that we don’t want to worry about the pieces drawn themselves, but their combinatorial potential with all the other pieces already drawn.

So we can instead consider that every time we draw a new piece, we’re actually adding new possible connections between pieces. Some connections are “valid” (which is to say, the pieces actually connect) and some are not. With this framing, the solution should behave as a hypergeometric distribution.

P(k)=(Kk)(N′−Kn′−k)(N′n′);k=0,1,2,…,min(K,n′)P(k) = \frac{\binom{K}{k}\binom{N'-K}{n'-k}}{\binom{N'}{n'}} ; k=0,1,2,\ldots,min(K,n')

Where:

n′=(n2)=n!2!(n−2)!=n(n−1)2n'=\binom{n}{2}=\frac{n!}{2!(n-2)!}=\frac{n(n-1)}{2}

And:

N′=(N2)=N!2!(N−2)!=N(N−1)2N'=\binom{N}{2}= \frac{N!}{2!(N-2)!}=\frac{N(N-1)}{2}

Here:

  • NN is the number of pieces in the puzzle
  • nn is the number of pieces drawn
  • KK is the number of valid connections between pieces
  • kk is the number of valid connections that can be made between nn pieces
  • N′N' is the number of possible pairs of NN pieces (including valid connections)
  • n′n' is the number of possible pairs of nn pieces (including valid connections)

When No Pieces Fit

We are mostly only concerned with P(k=0)P(k=0), which is the probability that, given NN and KK, there are no valid connections in nn pieces.

P(k=0)=(K0)(N′−Kn′−0)(N′n′)=(N′−Kn′)(N′n′)P(k=0) = \frac{\binom{K}{0}\binom{N'-K}{n'-0}}{\binom{N'}{n'}} \\ = \frac{\binom{N'-K}{n'}}{\binom{N'}{n'}} \\

This simplified form in the case of k=0k=0 will be easier to calculate. The hope is that the following rearrangements will be easier to compute when the numbers start to get large.

=(N′−K)!n′!(N′−K−n′)!N′!n′!(N′−n′)!=(N′−K)!n′!(N′−K−n′)!×n′!(N′−n′)!N′!=(N′−K)!(N′−K−n′)!×(N′−n′)!N′!= \frac{\frac{(N'-K)!}{n'!(N'-K-n')!}}{\frac{N'!}{n'!(N'-n')!}} \\ = \frac{(N'-K)!}{n'!(N'-K-n')!}\times\frac{n'!(N'-n')!}{N'!} \\ = \frac{(N'-K)!}{(N'-K-n')!}\times\frac{(N'-n')!}{N'!}

We can further rearrange:

=(N′−K)!(N′−K−n′)!×N′−n′N′×(N′−n′−1)!(N′−1)!=N′−n′N′×(N′−K)n′×N′(n′)= \frac{(N'-K)!}{(N'-K-n')!}\times\frac{N'-n'}{N'}\times\frac{(N'-n'-1)!}{(N'-1)!} \\ = \frac{N'-n'}{N'}\times(N'-K)_{n'}\times N'^{(n')}

Where (A)B(A)_B denotes the falling factorial and A(B)A^{(B)} denotes the rising factorial. But this last rearrangement is not particularly useful.

Diagram of a blank rectangular 8x8 jigsaw puzzle.Jigsaw puzzle outline, Don F Becker, CC By-SA 3.0.

Estimating KK

Assume that our puzzle is a p×qp×q grid of NN square pieces. We can say that each piece connects (uniquely) to its right and to its bottom, except at those edges. The number of valid connections is then:

K=2pq−p−qK = 2pq-p-q

Unfortunately, puzzles are not commonly sold with pp and qq specified. We can further assume that our rectangular puzzle is a square, which gives us a minimal perimeter.2 Where our assumption is wrong, we will have under-counted edge pieces and so over-estimated the number of connections, but at least we will have a consistent and known error versus other possible methods. However, NN is not often a square number, so we may need to round kk (in this case down, since we know it’s likely an overestimate).3

p=q=Np = q = \sqrt{N}

K≈⌊2N−2N⌋=⌊2(N−N)⌋K \approx \lfloor2N - 2\sqrt{N}\rfloor = \lfloor2(N-\sqrt{N})\rfloor

As an aside, the maximum perimeter (and fewest connections) is a single row of NN pieces:

K=2N−N−1=N−1K = 2N-N-1 = N-1

I expect this choice would behave poorly for our use case, but could be helpful in testing some limits or considering some other problem (maybe related to assembling a straight of cards or similar).

The nominal size, NN, of a puzzle is usually only approximate. In order to achieve a desirable aspect ratio, a 500-piece puzzle may be 513 or 529 pieces exactly. Finding these “puzzle numbers” is an interesting topic, but here I am limiting myself to attested sizes to quickly see how far off I might be.

NN (Nom.) NN (True) pp qq KK (Nom.) KK (Est.) KK (True)
6 6 3 2 7 N/A 7
8 8 4 2 10 N/A 10
12 12 4 3 17 N/A 17
20 20 5 4 31 N/A 31
50 49 7 7 85 84 84
300 324 18 18 565 612 612
500 513 27 19 955 980 980
1000 1026 38 27 1936 1987 1987

Here, KK (Nom.) is our estimated KK value, using the assumption of squareness, based on the nominal puzzle size. KK (Est.) is the same estimate applied to the true puzzle size, where known, and KK (True) is the actual K value derived from pp and qq. What’s remarkable, is that the assumption of squareness doesn’t seem to have caused any significant error. There is unfortunately little that can be done about the discrepancies in labeling.

Painting of a young girl with glasses, head bent over scattered puzzle pieces.Assembling the Pieces, Stephanie Deshpande, CC By-SA 4.0.

Assembling Answers

Now we can attempt to answer our earlier question: given a puzzle of NN pieces, how many pieces nn must we draw before it is more likely than not that we can make a connection?

This means for a given NN we want to find the smallest nn such that:4

1−P(k=0)>0.51-P(k=0) > 0.5

Or, equivalently, the smallest nn such that:

P(k=0)<0.5P(k=0)<0.5

Writing a little python script, I calculated this value for a handful of common puzzle sizes. (The code is in a loose text file until I work out a better way to migrate away from GitHub.)

NN nn
4 2
6 3
8 3
10 3
12 3
20 4
36 5
50 5
64 6
100 7
150 8
200 10
300 11
500 14
750 17
1000 20
1500 24
2000 28
3000 34
5000 43

Utility

As with the birthday problem, the number of pieces need to begin making connections is surprisingly small. If the whole puzzle is necessary for game purposes then obviously concern for the total size should dominate. But if incomplete solutions are still useful then larger puzzle sizes could be feasible.

Painting of a hand in a blue sleeve with a lace cuff holding a single puzzle piece. It is shaped like a country, maybe Austria? (c.1783, ofc.)Detail from Luis María de Borbón y Vallabriga, Francisco de Goya, 1783.

Further Work

What is the largest number of pieces nmaxn_\text{max} we can draw without making any connections? This is the largest nn such that P(k=0)<1P(k=0) < 1, however unlikely. In practice, each piece can only have 2, 3, or 4 connections, and this constraint may ultimately need to be worked into our assumptions for a correct answer. Without it, for example, our assumptions could also describe a puzzle of one giant piece with a single connection to all the others, and these less likely configurations may dominate when we start calculating at the extremes. It is also possible that this constraint would change the solutions reached above, so let me know if you work it out.


Because of the substitutions n→n′n \rightarrow n' and N→N′N \rightarrow N', a few of the expected hypergeometric properties look different. The expected (mean) number of connections kˉ\bar{k} in a sample of nn pieces is

kˉ=n′KN′=Kn(n−1)N(N−1)\bar{k} = n' \frac{K}{N'} = K \frac{n(n-1)}{N(N-1)}

So kˉ∝n2−n\bar{k} \propto n^2-n instead of nn.


Each time we draw a piece i=0,1,…,Ni = 0, 1, \ldots, N, we can say that if it connects to any other pieces we’ve drawn earlier, then experiment XiX_i is a success (Xi=1X_i=1). It should be apparent that P(Xi)P(X_i) depends on the results of experiments X0,X1,…,Xi−1X_0, X_1, \ldots, X_{i-1}. What connections you can make between pieces depends on what pieces you’ve already drawn. But they are exchangeable, a weaker but still useful property. If this were a regular hypergeometric distribution, it should then be possible to calculate ex ante P(Xi)P(X_i), which is to say, the probability that the ithi^\text{th} trial is a success in any given run of experiments, before knowing anything else about it.5 I leave the proof and derivation of this as an exercise to the reader.

Photograph of a double door painted with a jigsaw-patterned picture of a door with windows. While the top of the jigsaw is complete, it is less complete by the bottom, creating the impression of black voids in the door. An arm reaches through one of the voids towards the (real) doorknob. “art” “open” and “door” are written in red in the black voids.doors of the "ArT of opEN doors" project by Travessa João Caetano, H. Zell, CC By-SA 3.0.


  1. After the coupon collector’s problem, of course.↩︎

  2. An even more minimal perimeter per area could of course be achieved by assuming e.g. a circular puzzle, but then we’d have to work out a new derivation of KK. Maybe something with Centered Polygonal Numbers could work.↩︎

  3. It’s OK that we’ve lost our exact orderly grid of pieces now, since it was a somewhat poor assumption to begin with. As we will soon see, the geometry of a puzzle is much more fluid than that.↩︎

  4. Since kk is the number of connections, if we find P(k=1)P(k=1), for example, that excludes the possibility of making 2 or more connections. We could compute ∑k=1min(K,n′)P(k)>0.5\sum_{k=1}^{min(K,n')}P(k) > 0.5, but that’s’ annoying.↩︎

  5. It may sound like I just said we couldn’t do this. If I deal out a pack of cards, the last card dealt is red half the time. But if I’ve already dealt all 26 red cards, you wouldn’t bet the last one is still red.↩︎



Date
September 5, 2026



Comment