Search code examples
mathoptimizationcombinatoricsn-queens

maximum number of non attacking pairs of queens in 8 queens


Maximum number of non-attacking pairs of queens in 8-Queens problem is given by 8 × 7/2 = 28. Can someone explain how it is 8x7/2?


Solution

  • A non attacking pair is when two queens don't attack each other.For max condition no queen attacks any other queen, so number of non attacking pairs

    1st queen would have = 7 2nd queen would have = 6 (exclude the pair with the 1st queen as its already counted in step 1)

    Similarly, 3rd queen would have = 5

    Thus, total number of non attacking pairs for 8 queens would be = 7+6+5+4+3+2+1+0 =28