The Puzzle Collector’s Problem1
"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.
Where:
And:
Here:
- is the number of pieces in the puzzle
- is the number of pieces drawn
- is the number of valid connections between pieces
- is the number of valid connections that can be made between pieces
- is the number of possible pairs of pieces (including valid connections)
- is the number of possible pairs of pieces (including valid connections)
When No Pieces Fit
We are mostly only concerned with , which is the probability that, given and , there are no valid connections in pieces.
This simplified form in the case of will be easier to calculate. The hope is that the following rearrangements will be easier to compute when the numbers start to get large.
We can further rearrange:
Where denotes the falling factorial and denotes the rising factorial. But this last rearrangement is not particularly useful.
Jigsaw puzzle outline, Don F Becker, CC By-SA 3.0.
Estimating
Assume that our puzzle is a grid of 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:
Unfortunately, puzzles are not commonly sold with and 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, is not often a square number, so we may need to round (in this case down, since we know it’s likely an overestimate).3
As an aside, the maximum perimeter (and fewest connections) is a single row of pieces:
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, , 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.
| (Nom.) | (True) | (Nom.) | (Est.) | (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, (Nom.) is our estimated value, using the assumption of squareness, based on the nominal puzzle size. (Est.) is the same estimate applied to the true puzzle size, where known, and (True) is the actual K value derived from and . 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.
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 pieces, how many pieces must we draw before it is more likely than not that we can make a connection?
This means for a given we want to find the smallest such that:4
Or, equivalently, the smallest such that:
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.)
| 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.
Detail from Luis María de Borbón y Vallabriga, Francisco de Goya, 1783.
Further Work
What is the largest number of pieces we can draw without making any connections? This is the largest such that , 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 and , a few of the expected hypergeometric properties look different. The expected (mean) number of connections in a sample of pieces is
So instead of .
Each time we draw a piece , we can say that if it connects to any other pieces we’ve drawn earlier, then experiment is a success (). It should be apparent that depends on the results of experiments . 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 , which is to say, the probability that the 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.
doors of the "ArT of opEN doors" project by Travessa João Caetano, H. Zell, CC By-SA 3.0.
After the coupon collector’s problem, of course.↩︎
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 . Maybe something with Centered Polygonal Numbers could work.↩︎
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.↩︎
Since is the number of connections, if we find , for example, that excludes the possibility of making 2 or more connections. We could compute , but that’s’ annoying.↩︎
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.↩︎