I keep reading about a proposed method of finding solutions to the $n$-queens problem using determinants, but I can't find any specific details anywhere. Can somebody explain to me how to find solutions to $n$-queens using determinants or point me in the right direction?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
It's in Glaisher's paper mentioned in the first comment by J.M., but I'll give it here for those who can't access the paper. We'll do the example in the $8 \times 8$ case, and it should be clear how to generalize it to $n \times n$.
Construct the following matrix, noting how the pattern of letters and numbers go.
If you construct $\det(A)$, and you strike out all terms in which the same letter or number appear more than once, then the terms that remain give exactly the solutions to the 8 queens problem.
So, why is this? Well, each term in $\det(A)$ has exactly one element from each row and each column, so using the determinant inherently eliminates board positions in which you have more than one queen in a row or column. Striking out all terms that have the same letter or number removes the board positions in which you have more than one queen in the same diagonal. What remains must be placements of 8 queens in which none are in the same row, column, or diagonal. (There's probably a better way to set up the matrix above, but this is how Glaisher does it. Also, there are going to be $n!$ terms in the determinant, making that computationally nasty, but Glaisher gives some ways to simplify the process.)
If you use the permanent rather than the determinant, strike out terms as above, and let all variables be 1, then you would have the number of solutions to the $n$ queens problem.
Added: I found a Google Books link to Glaisher's paper mentioned above and in J.M.'s first comment.