Discord

INAIO Guide Stage 1 7Combinatorics and Discrete Reasoning

7.4 Parity and invariants

Track a quantity that every move preserves or predictably changes to prove that a target is impossible.

Some puzzles allow many moves, making it hard to list every reachable state. Instead, look for a feature that cannot change. If the starting state has one value of that feature and the target has another, no sequence of permitted moves can connect them. This is an invariant argument. Parity—whether an integer is even or odd—is often the simplest feature to test.

This is intermediate discrete reasoning. MIT's state-machine notes develop the invariant method, and its modular-arithmetic notes explain parity as a remainder. You only need the even/odd rules to begin.

A basic idea: what survives every move?

Colour a 4×44\times4 board like a chessboard. Every horizontal or vertical domino covers one dark and one light square, regardless of where it is placed. Remove two opposite corners. They have the same colour, so the board now has 66 squares of that colour and 88 of the other. Seven dominoes would have to cover seven of each. That cannot happen, even if you try many clever placements.

A four-by-four checkerboard has two same-colour opposite corners removed, leaving six marked squares and eight unmarked squares; a domino shown beside it covers one of each colour.A four-by-four checkerboard has two same-colour opposite corners removed, leaving six marked squares and eight unmarked squares; a domino shown beside it covers one of each colour.
The unequal colour counts rule out a complete domino tiling before any placement search.

A quick tour of the method

An integer's parity is its remainder after division by 22: even has remainder 00, odd has remainder 11. Adding an even number preserves parity; adding an odd number changes it. More generally, an invariant is a quantity or property that every allowed move preserves. To use one:

  1. Define the feature precisely for any state.
  2. Check every type of legal move, not just one example, preserves it.
  3. Compare the feature in the starting state and the proposed target.

Some features alternate rather than stay fixed. A single horizontal or vertical grid step changes x+yx+y by 11 or −1-1, so the parity of x+yx+y flips after every step. Knowing the number of steps then determines which colour of a checkerboard the walker can reach. This is still a useful state rule, but call it an alternating property rather than a preserved invariant.

An invariant can prove impossibility when the values disagree. Matching values do not prove that a path or tiling exists; other obstacles may remain.

Application 1: missing corners

Can seven 1×21\times2 dominoes tile a 4×44\times4 checkerboard after two opposite corners are removed?

  1. The original board has eight squares of each colour. Opposite corners on this even-sized board have the same colour.
  2. Removing them leaves 66 of that colour and 88 of the other.
  3. Each domino always covers one square of each colour. Seven dominoes would cover 77 and 77, so the tiling is impossible.

Application 2: an exact number of grid moves

A walker starts at (0,0)(0,0) and makes exactly 1111 moves, each one unit north, south, east, or west. Can it finish at (2,2)(2,2)?

  1. At the start, x+y=0x+y=0 is even. Each move flips its parity.
  2. After an odd number of moves, x+yx+y must be odd.
  3. At (2,2)(2,2), x+y=4x+y=4 is even. Therefore no route of exactly 1111 moves can end there. The point is reachable in four moves, but the specified move count is not.

Resources

SourceTitleWhy read it
MIT OpenCourseWareLecture 4: State MachinesStudy how invariants restrict reachable states.
MIT OpenCourseWareLecture 9: Modular ArithmeticReview even and odd values as remainders modulo two.

Finished this module? Mark it done.

Comments

Stuck on something, spotted a mistake, or found a resource that helped you? Tell us below.

Loading comments