Answers.Body: <p><em>I am changing this to a community answer because the task is too daunting for me alone. Whoever can contribute, please do !</em></p>
  <p><strong>Answer in progress :</strong></p>
  <p><em>Assuming n&gt;=5</em></p>
  <ul>
  <li>bK not on the edge</li>
  </ul>
  <p>When the bK is not on the edge, all three white pieces must take part in the mating pattern. For example :</p>
  <pre><code>[FEN &quot;8/7R/1R2k3/8/4K3/8/8/8 w - - 0 1&quot;]
  </code></pre>
  <p>For that pattern the wK must be in opposition to the bK, so it has 4 possible spots if the bK is two squares away from any edge (e.g on c3, (n-4)² possibilities), 3 if the bK is one file away from exactly one edge (e.g. on b3, 4(n-4) possibilities), 2 if the bK is one square diagonally from the corner (e.g. b2, 4 possibilities)</p>
  <p>The rooks must then be on two adjacent lines (files or rows), one checking and one taking three escaping squares. There are n-3 possibilities for each rook that are out of reach from the bK, plus 2 positions were they are near the king but protect each other.</p>
  <p>So the number of mating positions with the bK not on the edge and the wK in opposition is:</p>
  <p>(4x(n-4)^2+3x4x(n-4)+2x4)x((n-3)^2+2) = 4 n^4 - 44 n^3 + 188 n^2 - 364 n + 264</p>
  <p>But the wK can also be one knight move away from the bK if the rooks cover one diagonal escape, e.g. :</p>
  <pre><code>[FEN &quot;8/3R4/3Rk3/8/5K2/8/8/8 w - - 0 1&quot;]
  </code></pre>
  <p>Such a position is uniquely determined by the kings' positions, and there are 8(n-4)² + 6x8 + 4x2 = 8(n²-8n+23) of them.</p>
  <p>Finally, the number of <strong>mating positions with the bK not on the edge</strong> is:</p>
  <p>4 n^4 - 44 n^3 + 196 n^2 - 380 n + 310</p>
  <ul>
  <li>bK on the edge but not in the corner</li>
  </ul>
  <p>Mate by 2 rooks</p>
  <p>Mate by K+R</p>
  <p>Mate by 3 pieces</p>
  <ul>
  <li>bK in the corner</li>
  </ul>
  <p>A. With a double check.
  Only possible with a rook-promotion discovery check, e.g.</p>
  <pre><code>[FEN &quot;kR6/2K5/8/8/R7/8/8/8 w - - 0 1&quot;]
  </code></pre>
  <p>2 possibilities for the wK, 6 for the vertically-checking rook, hence a grant total of 12 such positions.</p>
  <p>B. With a single check, wK involved</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-13T07:07:34.120Z
Answers.Text: For your To-Do-List: Illegal positions are the examples given in my comment, Ra1 Ra2 - Kb1 and the type (Ke6) Ra8 Rh8 - Ke8. Offhand, I don't see others.
Answers.UserDisplayName: Hauke Reddmann
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-13T09:09:07.697Z
Answers.Text: @HaukeReddmann there is also Kc3-Ra8-Rh1 vs Ka1. Your first type includes stuff like Ka2 Ra3 Rb3 vs Ka4.
Answers.UserDisplayName: Evargalo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-12T21:03:18.890Z
Answers.LastActivityDate: 2024-06-17T07:35:41.913Z
Answers.LastEditDate: 2024-06-17T07:35:41.913Z
Answers.UserDisplayName: Evargalo
Body: <p>Given an nxn chessboard, how many times can a black king get checkmated by 2 rooks (occassionally with the help of a white king)? Is there a mathematical formula that can be brought up?</p>
  <p>How many states of the board exists in such a way that the king is in mate. Say like a case of a lawn mower mate, it exists (n-2) x 2 positions for the rooks where it mates the black king, and it exists (n^2 - 2n) positions for the white king to not obstruct the mate. Different positions for a piece is a different state.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-06-12T02:27:36.053Z
Comments.Text: Hi, I don't understand how many times can it get checkmated because checkmate is supposed to end the game. Do you mean how many moves can it take or how many different configurations/ways to get checkmated, or something else (maybe if you define what happens after checkmate)?
Comments.UserDisplayName: alices_and_bobs
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-06-12T04:00:59.227Z
Comments.Text: @alices_and_bobs Hello thank you for your reply, i meant how many states of the board exists in such a way that the king is in mate. Say like a case of a lawn mower mate, it exists (n-2) positions for the rooks where it mates the black king, and it exists (n^2 - 2n) positions for the white king to not obstruct the mate. Different positions for a piece is a different state.
Comments.UserDisplayName: tend  tendonintendo
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-06-12T08:48:05.480Z
Comments.Text: Please add your clarification in comment in the body of the question.
Comments.UserDisplayName: Evargalo
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-06-12T09:49:58.363Z
Comments.Text: @Evargalo will do thank you
Comments.UserDisplayName: tend  tendonintendo
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-06-12T14:55:12.437Z
Comments.Text: at OP: Is legality an issue? Ka6 Ra7 Rb7 - Ka8 is mate but illegal (no last move). Kc8 Rb7 Rb8 - Ka8 is legal, though (last move a promo to R).
Comments.UserDisplayName: Hauke Reddmann
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-06-12T18:08:07.130Z
Comments.Text: @HaukeReddmann no illegal moves are not allowed
Comments.UserDisplayName: tend  tendonintendo
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-06-13T07:03:23.033Z
Comments.Text: @tendtendonintendo: ACK. You surely mean "illegal positions", since there are no moves involved. (Also suggestion: Ask for the "number of mate positions with ...".)
Comments.UserDisplayName: Hauke Reddmann
Tags: <mathematics>
Title: In how many ways can a black king get checkmated by 2 rooks?
ThreadText: # In how many ways can a black king get checkmated by 2 rooks?
  
  (Asked by: username_0 on 2024-06-12)
  
  Given an nxn chessboard, how many times can a black king get checkmated by 2 rooks (occassionally with the help of a white king)? Is there a mathematical formula that can be brought up?
  
  How many states of the board exists in such a way that the king is in mate. Say like a case of a lawn mower mate, it exists (n-2) x 2 positions for the rooks where it mates the black king, and it exists (n^2 - 2n) positions for the white king to not obstruct the mate. Different positions for a piece is a different state.
  
  **Tags:** mathematics
  
  > **Comments:**
  > **username_1**: Hi, I don't understand how many times can it get checkmated because checkmate is supposed to end the game. Do you mean how many moves can it take or how many different configurations/ways to get checkmated, or something else (maybe if you define what happens after checkmate)?  
  > **username_0**: @username_1 Hello thank you for your reply, i meant how many states of the board exists in such a way that the king is in mate. Say like a case of a lawn mower mate, it exists (n-2) positions for the rooks where it mates the black king, and it exists (n^2 - 2n) positions for the white king to not obstruct the mate. Different positions for a piece is a different state.  
  > **username_2**: Please add your clarification in comment in the body of the question.  
  > **username_0**: @username_2 will do thank you  
  > **username_3**: at OP: Is legality an issue? Ka6 Ra7 Rb7 - Ka8 is mate but illegal (no last move). Kc8 Rb7 Rb8 - Ka8 is legal, though (last move a promo to R).  
  > **username_0**: @HaukeReddmann no illegal moves are not allowed  
  > **username_3**: @tendtendonintendo: ACK. You surely mean "illegal positions", since there are no moves involved. (Also suggestion: Ask for the "number of mate positions with ...".)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2024-06-12. Score: 1
  
  I am changing this to a community answer because the task is too daunting for me alone. Whoever can contribute, please do !
  Answer in progress :
  Assuming n>=5
  
  bK not on the edge
  
  When the bK is not on the edge, all three white pieces must take part in the mating pattern. For example :
  [FEN "8/7R/1R2k3/8/4K3/8/8/8 w - - 0 1"]
  
  For that pattern the wK must be in opposition to the bK, so it has 4 possible spots if the bK is two squares away from any edge (e.g on c3, (n-4)² possibilities), 3 if the bK is one file away from exactly one edge (e.g. on b3, 4(n-4) possibilities), 2 if the bK is one square diagonally from the corner (e.g. b2, 4 possibilities)
  The rooks must then be on two adjacent lines (files or rows), one checking and one taking three escaping squares. There are n-3 possibilities for each rook that are out of reach from the bK, plus 2 positions were they are near the king but protect each other.
  So the number of mating positions with the bK not on the edge and the wK in opposition is:
  (4x(n-4)^2+3x4x(n-4)+2x4)x((n-3)^2+2) = 4 n^4 - 44 n^3 + 188 n^2 - 364 n + 264
  But the wK can also be one knight move away from the bK if the rooks cover one diagonal escape, e.g. :
  [FEN "8/3R4/3Rk3/8/5K2/8/8/8 w - - 0 1"]
  
  Such a position is uniquely determined by the kings' positions, and there are 8(n-4)² + 6x8 + 4x2 = 8(n²-8n+23) of them.
  Finally, the number of mating positions with the bK not on the edge is:
  4 n^4 - 44 n^3 + 196 n^2 - 380 n + 310
  
  bK on the edge but not in the corner
  
  Mate by 2 rooks
  Mate by K+R
  Mate by 3 pieces
  
  bK in the corner
  
  A. With a double check.
  Only possible with a rook-promotion discovery check, e.g.
  [FEN "kR6/2K5/8/8/R7/8/8/8 w - - 0 1"]
  
  2 possibilities for the wK, 6 for the vertically-checking rook, hence a grant total of 12 such positions.
  B. With a single check, wK involved
  
  > **Comments:**
  > **username_3**: For your To-Do-List: Illegal positions are the examples given in my comment, Ra1 Ra2 - Kb1 and the type (Ke6) Ra8 Rh8 - Ke8. Offhand, I don't see others.  
  > **username_2**: @HaukeReddmann there is also Kc3-Ra8-Rh1 vs Ka1. Your first type includes stuff like Ka2 Ra3 Rb3 vs Ka4.  
  
  ---
  
  