Prove that a NxN grid can be colored using n colors such that each color appear once each row and column

303 Views Asked by At

Just like a simpler Sudoku game, given n, show that nxn grid can be colored using n colors so that each color appears once for each row/column.

I see that each row/column forms a complete graph so that we need at least n colors for each row/column. But I'm stuck at bringing those together and show that n is also the maximum color needed to color the grid.

Any hint? Thanks!

EDIT: I forgot to add 1 more constraint that I would need to prove also for the case that k (k less than n) row is already given. I think in that case the shifting answer would not be correct right?

3

There are 3 best solutions below

0
On BEST ANSWER

Give the squares of the grid coordinates $(x,y)$ where $0 \leq x, y \leq n-1$. Give the square $(x,y)$ colour $i$ where $0\leq i \leq n-1$, and $x+y \equiv i \pmod n$. This colouring satisfies the conditions required.

0
On

Find solutions for $n = 2$ and $3$. Then try for $n=4$. (Starting with simple cases is always a good strategy.)

Hint in general. Fill in the first row any way you like. Then think about a shift to the right.

0
On

What about:

$$\begin{matrix} 1 & 2 & \cdots & n-1 & n\\ 2 & 3 & \cdots & n & 1\\ 3 & 4 & \cdots & 1 & 2\\ \vdots & \vdots & \cdots & \vdots & \vdots\\ n & 1 & \cdots & n-2 & n-1\\ \end{matrix}$$