AMC 10 Step by Step

2025 AMC 10B Problem 21

P21-25~12 minPrint

Each of the 99 squares in a 3×33 \times 3 grid is to be colored red, blue, or yellow in such a way that each red square shares an edge with at least one blue square, each blue square shares an edge with at least one yellow square, and each yellow square shares an edge with at least one red square. Colorings that can be obtained from one another by rotations and/or reflections are to be considered the same. How many different colorings are possible?

Log in to save your progress.
Show solution without answering

Key insight

Renaming colors red to blue, blue to yellow, yellow to red keeps every rule, so count only colorings with a red center and multiply by 3.

Solution

Write R, B, Y for the colors. The rules form a loop: R needs a B next to it, B needs a Y, and Y needs an R. "Next to" means sharing an edge.

Name the squares: the center; the four edge squares (top, right, bottom, left); and the four corners. A corner touches only two squares, both edge squares. For example, the top-right corner touches the top and right edge squares. Going around, top, right, bottom and left each share a corner with the next one; top and bottom do not share a corner.

Step 1: make the center red. Rename the colors R → B, B → Y, Y → R. The rule "R needs B" becomes "B needs Y", and so on, so a good coloring stays good. Rotations and flips never move the center, so they do not change its color. Renaming turns the red-center colorings into the blue-center ones, and again into the yellow-center ones, one for one. So
answer=3×(number of different colorings with a red center).\text{answer} = 3 \times (\text{number of different colorings with a red center}).
From now on the center is R.

Step 2: what each edge square needs. An edge square touches the center and two corners.
- A Y edge square needs an R: the center is R, so it is always fine.
- An R edge square needs a B. The center is R, so the B must be one of its corners. That B corner needs a Y next to it, and its only other neighbor is the next edge square around. So every R edge square shares a corner with a Y edge square.
- A B edge square needs a Y corner. That Y corner needs an R next to it, so every B edge square shares a corner with an R edge square.
- The center (R) needs a B, so at least one edge square is B.

Follow the chain: there is a B edge square, so there is an R one, so there is a Y one. The four edge squares use all three colors, with one color used twice.

Step 3: which edge patterns work? List the edge squares in order around the ring (top, right, bottom, left) and test the two rules from Step 2.

Repeated colorPlacedExample ringProblem?
RoppositeR, B, R, Ynone: works
Rside by sideR, R, B, Ythe second R has no Y beside it
BoppositeB, R, B, YR has no Y beside it
Bside by sideB, B, R, Ythe first B has no R beside it
YoppositeY, R, Y, BB has no R beside it
Yside by sideY, Y, B, Rnone: works

Only two edge patterns are possible.

Step 4: fill in the corners. A corner touches two edge squares, and it needs one of them to be "one step ahead" of its own color in the loop R → B → Y → R. That limits each corner to at most two colors.

Pattern 1: top R, right B, bottom R, left Y.
- Corners between R and B can be Y (served by R) or R (served by B). Corners between R and Y can be Y (served by R) or B (served by Y).
- The top square (R) needs a B corner. The top-right corner cannot be B, so the top-left is B. In the same way, the bottom-left is B.
- The right square (B) needs a Y corner: at least one of top-right and bottom-right is Y.

BR?YRBBR?? is Y or R, with at least one Y \begin{array}{|c|c|c|}\hline B & R & ? \\ \hline Y & R & B \\ \hline B & R & ? \\ \hline \end{array} \qquad ? \text{ is Y or R, with at least one Y}

The right corners can be (Y, Y), (Y, R) or (R, Y). Flipping the grid top-to-bottom keeps the edge pattern and swaps (Y, R) with (R, Y), so those two are the same coloring. Two different colorings.

Pattern 2: top Y, right Y, bottom B, left R.
- The top-right corner sits between two Y's, so it must be B.
- The bottom square (B) needs a Y corner. The bottom-right corner (between Y and B) can only be B or R, so the bottom-left is Y.
- The left square (R) needs a B corner. The bottom-left is Y, so the top-left is B.
- The bottom-right corner can be B (it has a Y beside it) or R (it has a B beside it), and every square is already served either way.

BYBRRYYB?? is B or R \begin{array}{|c|c|c|}\hline B & Y & B \\ \hline R & R & Y \\ \hline Y & B & ? \\ \hline \end{array} \qquad ? \text{ is B or R}

No rotation or flip keeps this edge pattern (it would have to keep the single B and the single R in place), so the two choices are different. Two different colorings.

Step 5: total. With a red center there are 2+2=42 + 2 = 4 different colorings. So the answer is 3×4=123 \times 4 = 12.

The answer is (C) 12\boxed{\textbf{(C)}\ 12}.

Why this works

Two ideas do the work. First, the three colors play the same role (they form a loop), so fixing the center's color and multiplying by 33 cuts the job to a third. Second, start with the squares that have the fewest neighbors: a corner touches only two squares, so it has very few choices, and that quickly forces the edge squares into just two patterns. When counting "the same up to rotations and flips", count patterns directly rather than dividing a total by 88, because symmetric colorings throw the division off.

Alternative approach

Count every coloring of the fixed grid and then group them. With a red center, Pattern 1 can be placed in 44 ways (R's on top and bottom or on left and right, and B on either remaining side), each with 33 corner fillings: 1212. Pattern 2 can be placed in 88 ways, each with 22 fillings: 1616. So 2828 colorings have a red center and 3×28=843 \times 28 = 84 in all. Grouping them: the Pattern 2 colorings fall into groups of 88 (16÷8=216 \div 8 = 2 groups), while the Pattern 1 colorings with (Y, Y) are each unchanged by a flip, so they form one group of 44, and the other 88 form one group of 88. That is again 44 groups per center color, and 1212 in total.

Concise solution

A shorter write-up, the way contest solutions are usually written. It may take a different route from the solution above.

Write red =0=0, blue =1=1, yellow =2=2, and read colours modulo 33. The three rules become a single rule:

> every square has a neighbour whose colour is one more than its own.

Name the cells: the centre MM; the four edge cells N,E,S,WN, E, S, W; and the four corners, each named by the two edge cells it sits between, so NENE lies between NN and EE, and so on. A corner touches only two edge cells; the centre touches only the four edge cells.

Step 1: what a corner can do. Let a corner lie between edge cells of colours aa and bb. Its own colour kk needs a neighbour k+1k+1, and its only neighbours are those two edge cells, so
k=a−1ork=b−1.k = a - 1 \quad\text{or}\quad k = b - 1 .
For that corner to be the neighbour required by the edge cell of colour aa, we would need k=a+1k = a+1. Since a+1≠a−1a+1 \ne a-1, this forces a+1=b−1a+1 = b-1, that is b=a−1b = a-1. So:

> a corner can serve an edge cell XX only when the edge cell on the corner's other side is coloured one less than XX, and in that case the corner's colour is forced to be x+1x+1.

The centre serves an edge cell XX exactly when M=x+1M = x+1, and the centre itself needs some edge cell coloured M+1M+1.

Step 2: all three colours appear among N,E,S,WN, E, S, W. Suppose a colour cc appears on an edge cell while c−1c-1 appears on none. By Step 1 no corner can serve those cells, so the centre must, giving M=c+1M = c+1; then the centre needs an edge cell of colour M+1=c+2M+1 = c+2.

  • If the edge cells use only one colour cc, then c−1c-1 is missing, so M=c+1M = c+1 and a cell of colour c+2c+2 is required — there is none.
  • If they use exactly two colours pp and qq, then p−1=qp-1 = q and q−1=pq-1 = p cannot both hold (they would give p=p+2p = p+2). So some used colour cc has c−1c-1 missing, forcing M=c+1M = c+1 and requiring an edge cell of colour c+2=c−1c+2 = c-1, which is missing.

Both are impossible, so the four edge cells carry all three colours: one colour rr twice and the other two once each.

Step 3: the centre is forced. There are two shapes.

rr on opposite edge cells. Say N=S=rN = S = r; then {E,W}={r+1,r+2}\{E, W\} = \{r+1, r+2\}, and by reflecting the picture take E=r+1E = r+1, W=r+2W = r+2. Both cells flanking EE and both flanking WW are coloured rr. A corner serves EE only if r=(r+1)−1r = (r+1)-1, which is true; it serves WW only if r=(r+2)−1=r+1r = (r+2)-1 = r+1, which is false. So WW must be served by the centre: M=W+1=rM = W + 1 = r. The centre then needs colour r+1r+1, supplied by EE.

rr on adjacent edge cells. Say N=E=rN = E = r, with SS and WW carrying the other two colours. A corner serves EE only if one of its flanking cells, N=rN = r or SS, equals r−1r-1, i.e. only if S=r−1S = r-1; likewise a corner serves NN only if W=r−1W = r-1. Exactly one of S,WS, W equals r−1r-1, so exactly one of N,EN, E must fall to the centre — and either way M=r+1M = r+1. The centre then needs colour r+2r+2, which is present.

Step 4: filling in the corners. Take r=0r = 0; the other two values of rr simply relabel the colours.

Opposite case: N=S=0N = S = 0, E=1E = 1, W=2W = 2, M=0M = 0. The allowed corner colours from Step 1 are
NE∈{2,0},SE∈{2,0},NW∈{2,1},SW∈{2,1}.NE \in \{2,0\},\quad SE \in \{2,0\},\quad NW \in \{2,1\},\quad SW \in \{2,1\}.
- N=0N = 0 needs a 11: not NENE, not M=0M = 0, so NW=1NW = 1. Similarly SW=1SW = 1.
- W=2W = 2 needs a 00: the centre supplies it.
- E=1E = 1 needs a 22: so at least one of NE,SENE, SE equals 22.
- M=0M = 0 needs a 11: EE supplies it.

Thus (NE,SE)(NE, SE) is (2,2)(2,2), (2,0)(2,0) or (0,2)(0,2): three colourings.

Adjacent case: N=E=0N = E = 0, S=1S = 1, W=2W = 2, M=1M = 1. The allowed corner colours are
NE∈{2},SE∈{2,0},SW∈{0,1},NW∈{2,1}.NE \in \{2\},\quad SE \in \{2,0\},\quad SW \in \{0,1\},\quad NW \in \{2,1\}.
- NN and EE are served by the centre, which is 11.
- S=1S = 1 needs a 22: only SESE can be, so SE=2SE = 2.
- W=2W = 2 needs a 00: only SWSW can be, so SW=0SW = 0.
- NENE is forced to 22; M=1M = 1 needs a 22, supplied by WW.
- NWNW is free: either 11 or 22.

Thus there are two colourings.

Step 5: dividing by the eight symmetries. Fix the repeated colour rr; there are 33 choices.

Adjacent case. The eight placements of the pattern (four rotations, then the mirror image S↔WS \leftrightarrow W) form one orbit, and no non-identity symmetry fixes a placement: such a symmetry would have to fix the two edge cells carrying the unrepeated colours separately, and the only symmetry fixing SS other than the identity is the reflection in the line NSNS, which moves WW. So the 8×2=168 \times 2 = 16 colourings split into 22 classes.

Opposite case. The four placements form one orbit, and each is fixed by exactly one non-identity symmetry: the reflection in the line EWEW, which swaps N↔SN \leftrightarrow S, hence NE↔SENE \leftrightarrow SE and NW↔SWNW \leftrightarrow SW. That reflection fixes the completion (NE,SE)=(2,2)(NE,SE) = (2,2) and interchanges (2,0)(2,0) with (0,2)(0,2), so the 4×3=124 \times 3 = 12 colourings split into 22 classes.

Each choice of rr therefore gives 2+2=42 + 2 = 4 classes, and
3×4=12.3 \times 4 = 12 .

The answer is (C) 12\boxed{\textbf{(C)}\ 12}.

Review in the AoPS books

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.