2023 AMC 10A Problem 20
Each square in a grid of squares is colored red, white, blue, or green so that every square contains one square of each color. One such coloring is shown on the right below. How many different colorings are possible?

Show solution without answering
Key insight
The center square is in all four 2 by 2 blocks, so pick it first. The four edge-middle squares then use the other three colors, and each corner is forced.
Solution
Start with the square that has the most rules on it, then work outward to the squares with fewer rules.
1. The center. The center square is inside all four blocks. So no other square can have its color. Choose the center's color: ways. The other eight squares use the remaining colors.
2. The edge-middle squares. Call them Top, Right, Bottom, Left. Each block contains two of them that are next to each other around the center: Top and Left, Top and Right, Right and Bottom, Bottom and Left. Those two must have different colors. Top and Bottom are never in the same block, so they may match; the same goes for Left and Right.
3. Count colorings of these four squares with colors. Can all four be different? No, there are only colors. So at least one opposite pair matches.
- Both pairs match (Top = Bottom and Left = Right): pick a color for Top and Bottom ( ways) and a different color for Left and Right ( ways). That gives .
- Only Top = Bottom: pick their color ( ways). Left and Right must use the other two colors, one each, in either order ( ways). That gives .
- Only Left = Right: the same count, .
Total: .
4. The corners. Each corner is in just one block, together with the center and two edge-middle squares next to each other. Those three already have three different colors, so the corner must take the fourth color. No choice is left.
5. Multiply: .
The answer is .
Why this works
When squares share rules, fill in the most restricted one first (the center is in every block), then the next most restricted (edge-middles are in two blocks each), and let the least restricted squares (corners, one block each) be decided last. Here the corners turn out to have no choice at all, so all the counting happens in the middle ring.
Concise solution
A shorter write-up, the way contest solutions are usually written. It may take a different route from the solution above.
The center square belongs to all four blocks, so no other square may share its color. Choose the center's color: ways. The remaining eight squares use only the other colors.
Label the edge-middle squares (top), (right), (bottom), (left). Each block contains two of them that are adjacent around the ring ( with , with , with , with ), and those two must differ. Opposite squares ( and , or and ) share no block and may match. So we need colorings of a -cycle with colors where neighbors differ:
- Both opposite pairs equal (, , different colors): .
- Exactly one opposite pair equal: choose which pair (), its color (), then the other two squares take the remaining two colors in either order (): .
- Neither pair equal: impossible, since would need colors with and and all four neighbors distinct, requiring colors.
That gives ring colorings.
Each corner lies in exactly one block, together with the center and two adjacent ring squares, all three of different colors; the corner must take the fourth color, so it is forced.
Total: .
The answer is .
Review in the AoPS books
- Introduction to Counting & Probability, Chapter 5: More With Combinations (§5.2)
- Introduction to Counting & Probability, Chapter 2: Basic Counting Techniques (§2.5)
- Introduction to Algebra, Chapter 22: Special Manipulations (§22.3)
- Introduction to Counting & Probability, Chapter 3: Correcting for Overcounting (§3.2, §3.4)
Similar problems
Problem © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. Solution and commentary are original to this site.