The Black and White Stones Puzzle

The puzzle consists of sixteen small squares, each with a different patterns of black and white stones. The question asks which of the four options on the right is the answer for the last square.

If you're interested, don't read ahead just yet—try to solve it yourself first.


Before solving this puzzle, let's look at another one.

The Kids and Apples Distribution Puzzle

This is a puzzle that has been circulating online recently: "There are seven children and three apples. Please make four cuts so that the children won't fight over the apples."

The standard answer is on the next page. If you're interested, you can try solving it first.

The "Standard Answer" to the Apples Puzzle

Three apples divided among seven children means each child should get 37\frac{3}{7} of an apple.

The first cut slices each apple in half horizontally, and then each half is cut at an angle of 17\frac{1}{7}.

The 37\frac{3}{7} portions are given to the first six children, and the remaining six small pieces add up to 37=1146\frac{3}{7} = \frac{1}{14} * 6.


Katana (The Samurai Sword)

Wait a minute, the puzzle didn't say we could slice multiple apples at once, nor were we told that we have access to high-precision tools. Most of us don't have that kind of cutting skills, like a Katana expert.
Katana
Well, with access to an Katana expert, we can have much a simpler solution.

The "Katana Solution" to the Apples Puzzle

Now that we have a Katana, we can cut beyond just apples.

Actually, if you "cut" the first child, I believe the remaining children won't dare to complain regardless of how you distribute the apples. Goal achieved, puzzle solved. :)

These types of "math" puzzles often suffer from loosely defined rules and conditions.


Back to the Stones Puzzle

For the sake of discussion, I've added red annotations.

Stones Puzzle Solution 1: The "Standard" Solution (Answer is x)

The standard answer is x. The logic is: after adding x, if we swap the colors of the black and white stones in each square, we can find a matching square elsewhere. For example, reading b2b2 clockwise from the top-left gives "empty, empty, white, black". If we swap the colors, it becomes "empty, empty, black, white", which matches d1d1.

Pairing them up:

(a1,a3),(a2,d3),(a4,c4),(b2,d1),(b3,c2),(b4,c1),(c3,d2)(a1, a3), (a2, d3), (a4, c4), (b2, d1), (b3, c2), (b4, c1), (c3, d2)

The only one left is b1b1, which is "white, empty, white, black". After swapping, it becomes "black, empty, black, white", which is exactly x.

But this is just one possible logic.


Solution 2: Equal Number of Go Stones (Answer can be x or y)

Let's change the logic: make the total number of black and white stones on the board equal. Currently, there are 23 black stones and 24 white stones on the board.

So we can add y, bringing both black and white stones to 24 each.

Or we can add x, bringing both black and white stones to 25 each.

Solution 3: Equal Weight (Answers w, x, y, z are all valid)

We can change the logic again to make any answer correct.

For example, let's set the rule: draw a diagonal line from top-right to bottom-left, such that the total weight of the black and white stones on both sides is equal.

The stones directly on the line are divided equally between both sides, so they can be ignored.

For the rest, the top-left triangle has 9 black stones and 12 white stones; the bottom-right triangle has 11 black stones and 8 white stones.

Answer is w

If we want the answer to be w, placing w makes the top-left triangle have 9 black stones and 12 white stones; the bottom-right triangle will have 13 black stones and 8 white stones.

Let each black stone weigh 4 grams and each white stone weigh 5 grams, and it balances: 94+125=134+859*4+12*5 = 13*4+8*5

So we can state: when every black stone on this board weighs 4 grams and every white stone weighs 5 grams, the last square must be w for the total weight of the stones on the top-left and bottom-right of the blue line to balance.

Answer is x

Similarly, if we want x, the top-left triangle has 9 black stones and 12 white stones; the bottom-right triangle will have 13 black stones and 9 white stones. If black stones weigh 3 grams and white stones weigh 4 grams, it balances: 93+124=133+949*3+12*4 = 13*3+9*4

Answer is y

For y, the top-left triangle has 9 black stones and 12 white stones; the bottom-right triangle will have 12 black stones and 8 white stones. If black stones weigh 4 grams and white stones weigh 3 grams, it balances: 94+123=124+839*4+12*3 = 12*4+8*3

Answer is z

For z, the top-left triangle has 9 black stones and 12 white stones; the bottom-right triangle will have 12 black stones and 10 white stones. If black stones weigh 2 grams and white stones weigh 3 grams, it balances: 92+123=122+1039*2+12*3 = 12*2+10*3


Therefore, whatever answer you want, you just come up with a different weight ratio.


Solution 4: Leverage

If we want to factor in the leverage length based on the position of each stone, we can even balance it around the center point.

This solution is similar to the previous one, except each stone has a weighting coefficient (its perpendicular distance from the center line; the original squares can be subdivided into a 3x3 grid, calculate the center coordinates using trigonometry, and then use the Pythagorean theorem for the distance). In short, you just solve a two-variable equation to find the required weight ratio for the black and white stones. I will skip the details here.



Solution 5: Polynomial Solution (I must have had too much time on my hand)

This method uses a high-degree polynomial. Again, any answer can be achieved. However, for the brevity, we won't consider y, which is the only option with a dot in the center (if you wanted to consider it, you could treat the exact center of all other squares as empty, similar to the pip arrangement on a standard six-sided die).

Let's just pick z as the answer and see how the rules change.

Encoding

To use polynomials, we first need to convert each square into a numerical value. To ensure uniqueness, we encode all possibilities. Take b1 as an example; starting from the top left and reading clockwise, this square is "white, empty, white, black". We replace these with numbers: empty=0, white=1, black=2, giving us 1012. This is a base-3 number, which converts to 32 in decimal.

IndexSquareContentBase-3Decimal
1a1black, white, black, black212271
2a2empty, empty, white, white00114
3a3white, black, white, white121149
4a4white, black, empty, empty120045
5b1white, empty, white, black101232
6b2empty, empty, white, black00125
7b3black, white, black, white212170
8b4white, white, black, black112244
9c1black, black, white, white221176
10c2white, black, white, black121250
11c3white, black, black, white122152
12c4black, white, empty, empty210063
13d1empty, empty, black, white00217
14d2black, white, white, black211268
15d3empty, empty, black, black00228
16d4?????????
wblack, black, empty, empty220072
xblack, empty, black, white202161
zempty, white, black, white012116

Actually, any encoding method is fine, as long as there is a one-to-one mapping between the number and the square. You could list all possibilities and arbitrarily assign unique numbers.

Here, we're just taking advantage of the convenience of the Ternary numeral system.

Additionally, once encoded, you could actually use any machine learning (ML) method to solve it. However, while many ML methods can find a solution, the resulting models are not intuitive and their underlying principles are hard to explain. Therefore, we avoid probability-based ML models here (like neural networks).

The Crazy Polynomial

Okay, the solution is simple: just plug it into this polynomial:

96419n15326918592000+367963n14968647680083433193n1337362124800+76018199n129580032003905893151n112052864000+2834174039n1087091200748402863991n91828915200+780710080883n820321280035360802693773n71306368000+6209534662753n64354560056937672552137n5102643200+186397079118703n41197504004585643519077501n31513512000+289798498820219n275675600125147426197n145045+857840\begin{aligned} & - \frac{96419 n^{15}}{326918592000} + \frac{367963 n^{14}}{9686476800} - \frac{83433193 n^{13}}{37362124800} + \frac{76018199 n^{12}}{958003200} \\ & - \frac{3905893151 n^{11}}{2052864000} + \frac{2834174039 n^{10}}{87091200} - \frac{748402863991 n^{9}}{1828915200} \\ & + \frac{780710080883 n^{8}}{203212800} - \frac{35360802693773 n^{7}}{1306368000} + \frac{6209534662753 n^{6}}{43545600} \\ & - \frac{56937672552137 n^{5}}{102643200} + \frac{186397079118703 n^{4}}{119750400} - \frac{4585643519077501 n^{3}}{1513512000} \\ & + \frac{289798498820219 n^{2}}{75675600} - \frac{125147426197 n^{1}}{45045} + 857840 \end{aligned}

Here, nn represents the position index, as shown in the image:

"Are You Kidding Me?"

Seriously, the polynomial above can accurately calculate the content of every square.

For example, take the 10th square, which is the original c2 (white, black, white, black, which is 1212 in base-3), and the resulting decimal value should be 50 (see the encoding table). Substitute n=10n=10 into the polynomial above, and the calculated result is exactly 50.

964191015326918592000+3679631014968647680083433193101337362124800+760181991012958003200390589315110112052864000+28341740391010870912007484028639911091828915200+780710080883108203212800353608026937731071306368000+62095346627531064354560056937672552137105102643200+18639707911870310411975040045856435190775011031513512000+2897984988202191027567560012514742619710145045+857840\begin{aligned} & - \frac{96419 * 10^{15}}{326918592000} + \frac{367963 * 10^{14}}{9686476800} - \frac{83433193 * 10^{13}}{37362124800} \\ & + \frac{76018199 * 10^{12}}{958003200} - \frac{3905893151 * 10^{11}}{2052864000} + \frac{2834174039 * 10^{10}}{87091200} \\ & - \frac{748402863991 * 10^{9}}{1828915200} + \frac{780710080883 * 10^{8}}{203212800} \\ & - \frac{35360802693773 * 10^{7}}{1306368000} + \frac{6209534662753 * 10^{6}}{43545600} \\ & - \frac{56937672552137 * 10^{5}}{102643200} + \frac{186397079118703 * 10^{4}}{119750400} \\ & - \frac{4585643519077501 * 10^{3}}{1513512000} + \frac{289798498820219 * 10^{2}}{75675600} \\ & - \frac{125147426197 * 10^{1}}{45045} + 857840 \end{aligned}

Note: If you don't want to verify it by hand, you can paste the expression below into an online Full Precision Calculator.

-96419*10^15/326918592000+367963*10^14/9686476800-83433193*10^13/37362124800+76018199*10^12/958003200-3905893151*10^11/2052864000+2834174039*10^10/87091200-748402863991*10^9/1828915200+780710080883*10^8/203212800-35360802693773*10^7/1306368000+6209534662753*10^6/43545600-56937672552137*10^5/102643200+186397079118703*10^4/119750400-4585643519077501*10^3/1513512000+289798498820219*10^2/75675600-125147426197*10^1/45045+857840

Let's look at another example: square 2 (a2), substitute n=2n=2:

-96419*2^15/326918592000+367963*2^14/9686476800-83433193*2^13/37362124800+76018199*2^12/958003200-3905893151*2^11/2052864000+2834174039*2^10/87091200-748402863991*2^9/1828915200+780710080883*2^8/203212800-35360802693773*2^7/1306368000+6209534662753*2^6/43545600-56937672552137*2^5/102643200+186397079118703*2^4/119750400-4585643519077501*2^3/1513512000+289798498820219*2^2/75675600-125147426197*2^1/45045+857840

The calculated total is 4 in decimal. Converting this to base-3 yields 11, and padding it with leading zeros gives 0011, which translates to "empty, empty, white, white". This is indeed the content of a2.

Now, z

Lastly, let's calculate the 16th square. Substitute n=16n=16, and the result is the decimal value 16. Converting this to base-3 gives 121, padding it with a zero yields 0121, or "empty, white, black, white". This is exactly the content of z.

-96419*16^15/326918592000+367963*16^14/9686476800-83433193*16^13/37362124800+76018199*16^12/958003200-3905893151*16^11/2052864000+2834174039*16^10/87091200-748402863991*16^9/1828915200+780710080883*16^8/203212800-35360802693773*16^7/1306368000+6209534662753*16^6/43545600-56937672552137*16^5/102643200+186397079118703*16^4/119750400-4585643519077501*16^3/1513512000+289798498820219*16^2/75675600-125147426197*16^1/45045+857840

Where Did the Polynomial Come From?

Although the dimension and coefficients of the polynomial look intimidating, it's actually not that big of a deal. The entire solution is just solving the following system of equations:

f(n)=An15+Bn14+Cn13+Dn12+En11+Fn10+Gn9+Hn8+In7+Jn6+Kn5+Ln4+Mn3+Nn2+On1+Pn0f(n)=A*n^{15}+ B*n^{14}+ C*n^{13}+ D*n^{12}+ E*n^{11}+ F*n^{10}+ G*n^{9}+ H*n^{8}+ I*n^{7}+ J*n^{6}+ K*n^{5}+ L*n^{4}+ M*n^{3}+ N*n^{2}+ O*n^{1}+ P*n^{0}

Substitute n from 1 to 16 respectively, and according to the decimal values in the original encoding table, we get the following sixteen equations:

f(1)=71;f(2)=4;f(3)=49;;f(15)=8;f(16)=16f(1) = 71; f(2)=4; f(3)=49; \dots; f(15)=8; f(16)=16 (decimal value for z)

By solving this system of sixteen equations, we can calculate the sixteen coefficients A,B,C,,PA, B, C, \dots, P.

The Matrix Method

We can rewrite the above system of equations into the following matrix format. Substitute XX for the desired answer (if the answer is z, plug in X=16X=16 calculated from the table), and we can solve for the coefficients A,B,C,,PA, B, C, \dots, P.

[115114113112111110191817161514131211102152142132122112102928272625242322212031531431331231131039383736353433323130415414413412411410494847464544434241405155145135125115105958575655545352515061561461361261161069686766656463626160715714713712711710797877767574737271708158148138128118108988878685848382818091591491391291191099989796959493929190101510141013101210111010109108107106105104103102101100111511141113111211111110119118117116115114113112111110121512141213121212111210129128127126125124123122121120131513141313131213111310139138137136135134133132131130141514141413141214111410149148147146145144143142141140151515141513151215111510159158157156155154153152151150161516141613161216111610169168167166165164163162161160][ABCDEFGHIJKLMNOP]=[71449453257044765052637688X]\begin{bmatrix} 1^{15} & 1^{14} & 1^{13} & 1^{12} & 1^{11} & 1^{10} & 1^{9} & 1^{8} & 1^{7} & 1^{6} & 1^{5} & 1^{4} & 1^{3} & 1^{2} & 1^{1} & 1^{0} \\ 2^{15} & 2^{14} & 2^{13} & 2^{12} & 2^{11} & 2^{10} & 2^{9} & 2^{8} & 2^{7} & 2^{6} & 2^{5} & 2^{4} & 2^{3} & 2^{2} & 2^{1} & 2^{0} \\ 3^{15} & 3^{14} & 3^{13} & 3^{12} & 3^{11} & 3^{10} & 3^{9} & 3^{8} & 3^{7} & 3^{6} & 3^{5} & 3^{4} & 3^{3} & 3^{2} & 3^{1} & 3^{0} \\ 4^{15} & 4^{14} & 4^{13} & 4^{12} & 4^{11} & 4^{10} & 4^{9} & 4^{8} & 4^{7} & 4^{6} & 4^{5} & 4^{4} & 4^{3} & 4^{2} & 4^{1} & 4^{0} \\ 5^{15} & 5^{14} & 5^{13} & 5^{12} & 5^{11} & 5^{10} & 5^{9} & 5^{8} & 5^{7} & 5^{6} & 5^{5} & 5^{4} & 5^{3} & 5^{2} & 5^{1} & 5^{0} \\ 6^{15} & 6^{14} & 6^{13} & 6^{12} & 6^{11} & 6^{10} & 6^{9} & 6^{8} & 6^{7} & 6^{6} & 6^{5} & 6^{4} & 6^{3} & 6^{2} & 6^{1} & 6^{0} \\ 7^{15} & 7^{14} & 7^{13} & 7^{12} & 7^{11} & 7^{10} & 7^{9} & 7^{8} & 7^{7} & 7^{6} & 7^{5} & 7^{4} & 7^{3} & 7^{2} & 7^{1} & 7^{0} \\ 8^{15} & 8^{14} & 8^{13} & 8^{12} & 8^{11} & 8^{10} & 8^{9} & 8^{8} & 8^{7} & 8^{6} & 8^{5} & 8^{4} & 8^{3} & 8^{2} & 8^{1} & 8^{0} \\ 9^{15} & 9^{14} & 9^{13} & 9^{12} & 9^{11} & 9^{10} & 9^{9} & 9^{8} & 9^{7} & 9^{6} & 9^{5} & 9^{4} & 9^{3} & 9^{2} & 9^{1} & 9^{0} \\ 10^{15} & 10^{14} & 10^{13} & 10^{12} & 10^{11} & 10^{10} & 10^{9} & 10^{8} & 10^{7} & 10^{6} & 10^{5} & 10^{4} & 10^{3} & 10^{2} & 10^{1} & 10^{0} \\ 11^{15} & 11^{14} & 11^{13} & 11^{12} & 11^{11} & 11^{10} & 11^{9} & 11^{8} & 11^{7} & 11^{6} & 11^{5} & 11^{4} & 11^{3} & 11^{2} & 11^{1} & 11^{0} \\ 12^{15} & 12^{14} & 12^{13} & 12^{12} & 12^{11} & 12^{10} & 12^{9} & 12^{8} & 12^{7} & 12^{6} & 12^{5} & 12^{4} & 12^{3} & 12^{2} & 12^{1} & 12^{0} \\ 13^{15} & 13^{14} & 13^{13} & 13^{12} & 13^{11} & 13^{10} & 13^{9} & 13^{8} & 13^{7} & 13^{6} & 13^{5} & 13^{4} & 13^{3} & 13^{2} & 13^{1} & 13^{0} \\ 14^{15} & 14^{14} & 14^{13} & 14^{12} & 14^{11} & 14^{10} & 14^{9} & 14^{8} & 14^{7} & 14^{6} & 14^{5} & 14^{4} & 14^{3} & 14^{2} & 14^{1} & 14^{0} \\ 15^{15} & 15^{14} & 15^{13} & 15^{12} & 15^{11} & 15^{10} & 15^{9} & 15^{8} & 15^{7} & 15^{6} & 15^{5} & 15^{4} & 15^{3} & 15^{2} & 15^{1} & 15^{0} \\ 16^{15} & 16^{14} & 16^{13} & 16^{12} & 16^{11} & 16^{10} & 16^{9} & 16^{8} & 16^{7} & 16^{6} & 16^{5} & 16^{4} & 16^{3} & 16^{2} & 16^{1} & 16^{0} \end{bmatrix} \begin{bmatrix} A \\ B \\ C \\ D \\ E \\ F \\ G \\ H \\ I \\ J \\ K \\ L \\ M \\ N \\ O \\ P \end{bmatrix} = \begin{bmatrix} 71 \\ 4 \\ 49 \\ 45 \\ 32 \\ 5 \\ 70 \\ 44 \\ 76 \\ 50 \\ 52 \\ 63 \\ 7 \\ 68 \\ 8 \\ X \end{bmatrix}

Using the matrix to solve the system, the resulting values for A,B,C,,PA, B, C, \dots, P are the polynomial coefficients we listed earlier. A is the first term's coefficient 96419326918592000\frac{-96419}{326918592000}, P is the last term's coefficient 857840857840, and so on.

96419n15326918592000+367963n14968647680083433193n1337362124800+76018199n129580032003905893151n112052864000+2834174039n1087091200748402863991n91828915200+780710080883n820321280035360802693773n71306368000+6209534662753n64354560056937672552137n5102643200+186397079118703n41197504004585643519077501n31513512000+289798498820219n275675600125147426197n145045+857840\begin{aligned} & - \frac{96419 n^{15}}{326918592000} + \frac{367963 n^{14}}{9686476800} - \frac{83433193 n^{13}}{37362124800} + \frac{76018199 n^{12}}{958003200} \\ & - \frac{3905893151 n^{11}}{2052864000} + \frac{2834174039 n^{10}}{87091200} - \frac{748402863991 n^{9}}{1828915200} \\ & + \frac{780710080883 n^{8}}{203212800} - \frac{35360802693773 n^{7}}{1306368000} + \frac{6209534662753 n^{6}}{43545600} \\ & - \frac{56937672552137 n^{5}}{102643200} + \frac{186397079118703 n^{4}}{119750400} - \frac{4585643519077501 n^{3}}{1513512000} \\ & + \frac{289798498820219 n^{2}}{75675600} - \frac{125147426197 n^{1}}{45045} + 857840 \end{aligned}

In summary, whatever answer you want for the final square, just encode it into a decimal representation, plug it into the matrix as XX, calculate the coefficients, and then you can use the resulting polynomial to calculate the content of any of the sixteen squares.

Epilogue

If a puzzle's conditions and rules are incompletely defined, the answer can be anything at all, even totally arbitrary without breaking any rules. Most puzzles found online, and even many exam questions in schools, suffer from this flaw. Asking people to guess which of the many possible solutions the author had in mind is quite meaningless. However, asking the solver to explain their thought process can be a good exercise for developing analytical skills, imagination, and rigorous execution.

Using a high-degree polynomial to capture the puzzle and its desired solution is actually a bit like cheating. Frankly, it's just encoding a massive amount of information into these coefficients. It offer a description for a phenomenon, not an explanation for it, and is likely against the Occam's razor principle.

By the way, in machine learning, this is called over-fitting; meaning the model perfectly captures observed phenomena, but will fail miserably when predicting unobserved ones. For example, using this polynomial, we can even calculate the base-3 value for the 100th square:

-221102221101221221122102022021222022122010021211

But it's meaningless, because our roots were only defined up to the 16th square, and we didn't specifically model relationships like sequence or adjacency between the squares. Therefore, any result after the 17th square has nothing to do with our puzzle.

Anything Goes

I wrote the original post in Chinese, and its title was simply "Any solution works". However, I use the famous musical number's title here because its melody does remind me of an intricate puzzle.

Its simple pentatonic notes (and the simple chords in this old recording) are paired with a highly syncopated rhythm, just as a simple puzzle can be approached by very complex solutions.