A scanning code consists of a grid of squares, with some of its squares colored black and the rest colored white. There must be at least one square of each color in this grid of squares. A scanning code is called if its look does not change when the entire square is rotated by a multiple of counterclockwise around its center, nor when it is reflected across a line joining opposite corners or a line joining midpoints of opposite sides. What is the total number of possible symmetric scanning codes?
- A)
- B)
- C)
- D)
- E)
Answer
B
Key insight
All the rotations and flips together fold the grid onto one triangular slice, one-eighth of the square, holding 10 cells. Color those freely: 2^10 ways, minus all-black and all-white.
Solution
A symmetric code looks the same after every rotation and every flip. So once you color a few cells, all the cells they get moved onto must have the same color. The job is to find how many cells you can choose freely.
1. Set up labels. Put the center cell at and label each cell by how far it is right and up from the center, from to in each direction.
2. Which cells must match? Rotating by and flipping across the middle lines and diagonals can move a cell to any cell whose two coordinates are the same two sizes, in either order and with any signs. For example, must match , , , , and so on: cells in all.
3. Pick one cell from each matching group. Every group has exactly one cell with . These cells form a triangular slice, one-eighth of the square:
- : . cell.
- : . cells.
- : . cells.
- : . cells.
That is cells.
4. Count the colorings. Each of the cells can be black or white, and the choice for the slice decides the whole grid. That gives symmetric grids.
5. Remove the one-color grids. The code must use both colors, so take away all-black and all-white: .
The answer is .
Why this works
When a pattern must look the same under several moves, cells that the moves carry onto each other are tied together and must share a color. Count the groups of tied cells, not the cells. The four rotations and four flips of a square cut it into eight matching slices, so one slice (with its edges) holds exactly one cell from each group. The "at least one of each color" rule is a small subtraction at the end.
Alternative approach
Check the count of groups by adding up group sizes. The center is alone ( cell). Each cell like on a middle line is tied to cells, and there are such groups ( cells). Each cell like on a diagonal is tied to cells, groups ( cells). The cells , , each lead a group of ( cells). Total , the whole grid, in groups.
The trap
Using a quarter of the grid (a 4 by 4 corner, 16 cells) instead of the one-eighth slice, which ignores the diagonal flips and gives a far too large count.
Concise solution
The required symmetries (four rotations and four reflections) are all the symmetries of a square. A symmetric code is determined by the colors in one fundamental wedge: the triangle bounded by a vertical line through the center and a diagonal, one-eighth of the grid. Every other cell is carried onto a wedge cell by some symmetry and must match its color.
Count the wedge cells with the center at and coordinates . Choose the wedge :
- : , the center. cell.
- : . cells.
- : . cells.
- : . cells.
That is independent cells, each freely black or white, so symmetric colorings.
The code must use both colors, so remove the all-white and all-black grids: .
The answer is .
Review in the AoPS books
- Introduction to Counting & Probability, Chapter 5: More With Combinations (§5.2)
- Introduction to Geometry, Chapter 16: The More Things Change. . . (§16.1, §16.2, §16.3, §16.4)
- Introduction to Counting & Probability, Chapter 1: Counting Is Arithmetic
- Introduction to Algebra, Chapter 22: Special Manipulations (§22.3)
Techniques
Map the objects to something easier to count · Exploit symmetry to reduce work or pair up objects