Calculators

Two Rooks Calculator

Count attacking and non-attacking placements of two rooks on a rectangular chessboard with exact browser-only arithmetic.

Count ways to place two indistinguishable rooks on distinct squares so neither attacks the other. Enter positive board dimensions of up to 100 digits. No other pieces or blocked squares are included. Results stay in your browser.

Enter the board dimensions.

How to count non-attacking rook placements

On an r-row by c-column board, N = rc squares give N(N − 1)/2 unordered pairs of distinct squares. Rooks attack along rows and columns. Row attacks contribute r × c(c − 1)/2 pairs; column attacks contribute c × r(r − 1)/2 pairs. These sets do not overlap for distinct squares, so attacking pairs A = rc(r + c − 2)/2. Non-attacking pairs equal N(N − 1)/2 − A, or r(r − 1)c(c − 1)/2. An 8 × 8 board has 2016 total pairs, 448 attacking pairs and 1568 non-attacking pairs. A 2 × 3 board has 15 total pairs, 9 attacking pairs and 6 non-attacking pairs. A one-row or one-column board has no non-attacking pairs; a single square has no placements. The rooks are indistinguishable; swapping them does not create a new placement. Assume an otherwise empty complete board without blocked squares or wrapping edges. This counts exactly two rooks, not full chess positions or placements of more pieces. Enter positive integers with up to 100 decimal digits per dimension. Leading zeros and surrounding whitespace are accepted; signs, decimals, separators and exponents are rejected. Closed formulas and BigInt arithmetic preserve every digit without visiting board squares. All processing stays in your browser.

Frequently Asked Questions

Everything you need to know about this tool, how it works, and privacy.

How many non-attacking rook pairs fit on an 8 × 8 board?

There are 1568 unordered non-attacking pairs: 2016 total pairs minus 448 attacking pairs.

How are attacking rook pairs counted?

Add pairs sharing a row and pairs sharing a column: rc(c − 1)/2 + cr(r − 1)/2 = rc(r + c − 2)/2.

Are the two rooks distinguishable?

No. Swapping the rooks counts as the same placement. For labeled rooks, double each pair count.

What happens on a one-row or one-column board?

Every pair of distinct squares is attacking. There are zero non-attacking pairs. A single-square board has no placements.

Does this calculate placements of many rooks?

No. The formula counts exactly two rooks on an otherwise empty rectangular board without blocked squares.