TITLE: Number of ways to set 3 queens to attack each other
QUESTION [5 upvotes]: We play chess and want to set 3 queens to attack each other. How many ways we can do it?

I know to solve this problem when I have 2 queens. I see the chess board as 4 squares, from an outer square (the 28 squares on the edges and corners) to the inner square, the 4 squares in the center of the board.

REPLY [2 votes]: $3$ queens on a chessboard attack each other if they are in the vertices of a right and isosceles triangle. There are three possibilities, according to the hypotenuse of such a triangle lying on a diagonal, a row or a column of the chessboard. Counting them is not so difficult:

hypotenuse being on the $a7-b8$ diagonal: $2$ possibilities (third queen on $a8$ or $b7$);
hypotenuse being on the $a6-c8$ diagonal: $2\cdot\binom{3}{2}$ possibilities;
$\ldots$
hypotenuse being on the $a1-h8$ diagonal: $2\cdot\binom{8}{2}$ possibilities;
htpotenuse being on the $b1-h7$ diagonal: same number of possibilities as $a2-g8$;
$\ldots$

So if the hypotenuse is along a diagonal we have
$$ 2\left(2\binom{2}{2}+2\binom{3}{2}+\ldots+2\binom{7}{2}+2\binom{8}{2}+2\binom{7}{2}+\ldots+2\binom{2}{2}\right) = 4\left(2\binom{9}{3}-\binom{8}{2}\right) = 560 $$
possibilities. Assume now that the hypotenuse is along a row: the endpoints of the hypotenuse must have the same colour, so we have:

along the $A$ or $H$ line : $2\binom{4}{2}$ possibilities;
along the $B$ or $G$ line : $2\binom{4}{2}+2\cdot 3$ possibilities;
along the $C$ or $F$ line : $2\binom{4}{2}+2\cdot (3+2)$ possibilities;
along the $D$ or $E$ line : $2\binom{4}{2}+2\cdot (3+2+1)$ possibilities;

so if the hypotenuse is along a row we have 
$$ 16\binom{4}{2}+4\cdot 3+4\cdot(3+2)+4\cdot(3+2+1) = 152 $$
possibilities and the total number of ways to place three queens on a chessboard such that they attack each other is given by:
$$ 560+2\cdot 152 = \color{red}{864}. $$