[Math] How many ways are there to place $2$ identical kings on an $8\times 8$ chessboard so that the kings are not in adjacent squares

combinatoricsdiscrete mathematics

This problem needs also to be extended to $n*m$ chessboard. I tried to think like this:

First I choose a place for the first king in $64$ ways. Then I have a choice $64-5 = 59$ squares for the second king . But this solution is not right because this is not the case if I place the first king in the sidemost layers of squares. Then I have $64-4 = 60$ squares for the other king. How can I solve this problem?

Best Answer

The first King could be on a corner square($4$ ways), leaving $60$ other squares for the next King.

The first King could be on a edge square($24$ ways), leaving $58$ other squares for the next King.

The first King could be on a central square($36$ ways), leaving $55$ other squares for the next King.

This will double count the configurations, so we have $(4 \times 60 + 24 \times 58 + 36 \times 55)/2 =\color{red}{1806}$.