Combinatorics – Placing 5 Pieces on a 5×5 Grid Without Main Diagonal

combinatoricscontest-mathderangements

A $5\times5$ grid is missing one of its main diagonals. In how many ways can we place $5$ pieces on the grid such that no two pieces share a row or column?

Best Answer

In general, this number is equal to the number $D_n$ of derangements of $n$ elements: for any derangement $f:[1,n]\to[1,n]$ you get a placement $(i,f(i))$.
The known formulas for $D_n$ are: $$D_n=n!\sum_{j=0}^n\frac{(-1)^j}{j!}=\left\lfloor\frac{n!}e+\frac12\right\rfloor=\left[\frac{n!}e\right]$$ There is also a recursive formula, which one can easily prove: $$D_{n+1}=n\left(D_{n}+D_{n-1}\right)$$ In particular, $D_5=44$.