11

Hi I am a school student with interests in math and I have been tackling the problem stated above, the thing is that I want to generalize for 3 queens but I don`t know how because the problem becomes increasingly complex (I already have a solution for the two queens case) sorry for gramaticall mistakes and errors in the format, it is not my native language and its my first time using the page:

The solution for the two queens is given by the equation $\frac{-4}{n+1}+\frac{2}{3n}+1$ where $n$ is the board size, the solution is explained below:

For the first step, I had to make an equation that gave me the amount of non attacked squares according to the x,y position of the first queen, I made an equation that used minimums which was the following $\boxed{ F(n, x, y) = n^2 - 2n - \left[\min(x-1, y-1) + \min(n-x, n-y) + 1\right] - \left[\min(x-1, n-y) + \min(n-x, y-1) + 1\right] + 3 }$ this is because when you calculate the row and columns the queen attacks, it attacks 2n squares, then the first diagonal can be determined by this formula wich chooses the term with the minimun value $d_1 = \min(x-1, y-1) + \min(n-x, n-y) + 1$ and the second diagonal which has the following formula $d_2 = \min(x-1, n-y) + \min(n-x, y-1) + 1$, then adding all up we get the result seen above, the term n squared represents the whole board and the +3 represents the unecesary intersections.

Then, I realized that you want to sum this formula for all squares but this would be too complex so I realized that most of the squares are just reflections of the positions and the amount of attacked squares is the same, so I saw that you could arrage kind of a staircase pattern, the staircase is shown in the image bellow and each number represents the amount of reflections each square has, you also have to take in consideration that for an even or odd board (refering to the lenght of the board being divisible by 2 or not), the amount of reflections will vary and have a different pattern.

staircase pattern for odd and even board

Now, I realized that because the position x is always greater than y, I could cancel out some terms in the equation that used minimums, so I did it and it turns out that the equation leaves a nice compact expression and that the variable y disapears $n^2-3n+4-2x$.

Because of this, I saw that each columns could be added and the expresion would turn into a sum, in this case, the sum for an even board would be $\frac{\sum_{x=1}^{\frac{n}{2}}(n^{2}-3n+4-2x)(4n-8x+4)}{n^{4}-n^{2}}$, where the second parenthesis takes in account the sum of every reflection of the queens position in each column and the denominator has in account every possible arangement of queens in the board. This sum can then be evaluated to the following expression $\frac{3n^{4}-10n^{3}+9n^{2}-2n}{3n^{4}-3n^{2}}$, then, this can be reduced to the final expression $\frac{-4}{n+1}+\frac{2}{3n}+1$.

Now the interesting part is that if we repeat with an uneven board, we have to make another sum because the center square has no reflections and the overall sum of values in each column is different, so to take everything into account, we have the following expression: $\frac{(n^{2}-4n+3)+\sum_{x=1}^{\frac{x+1}{2}}(n^{2}-3n+4-2x)(4n+4-8x)}{n^{4}-n^{2}}$, this can be turned into a polynomial $\frac{n^{4}+3n^{2}-\frac{10n^{3}+2n}{3}}{3n^{4}-3n^{2}}$ and then be simplified to the same expression as the even board case $\frac{-4}{n+1}+\frac{2}{3n}+1$.

With this, we can conclude that this equation evaluates the probability of putting two queens at random and them not coliding, this can be proved with simulations which I have already done and the results match (you can prove it by comparing the solution to the first column of the image or by running your own simulation)

Results for the probability of putting 2 and 3 non coliding queens in an N x N chessboard

Values of the function for different N

now, would anyone have any suggestions or solutions to the same problem but for 3 queens?

This investigation would not be possible if I didn`t use wolfram alpha, desmos and mathgpt so this could be a tool that may help you to answer the question.

Eitan Amiel
  • 133
  • 4
  • 4
    This formula is wrong. Did you check the $n=2$ case? In that case it is impossible for two queens to not be attacking each other. – Gregory Jul 06 '25 at 20:12
  • thanks for the recomendation, i realized i made an error while typing, the formula had a minus signs that had to be a plus sign, i will correct it now. – Eitan Amiel Jul 06 '25 at 20:27
  • 1
    I can confirm your formula up to $n=100$ with a simple Python program. More generally, you can compute the exact probability for low $k$ and not too large $n$: the number of possible outcomes is $n^2\choose k$ and for the number of favorable outcomes you can do it in roughly $\dfrac{n^{2k}}{k!}$ loops (choose columns then rows and check the attack conditions). You might be able to find a formula for $3$ or $4$ using computed values. – Jean-Claude Arbaut Jul 07 '25 at 03:32
  • 3
    For what is worth, the number of favorable outcomes for $k=3$, for increasing $n$ starting at $n=3$: $0, 24, 204, 1024, 3628, 10320, 25096, 54400, 107880, 199400, 348020, 579264, 926324, 1431584, 2148048, 3141120, 4490256, 6291000, 8656860, 11721600, 15641340, 20597104, 26797144, 34479744, 43915768, 55411720, 69312516, 86004800$. It's OEIS A047659. See also OEIS A348129 and links from there for other values of $k$. THe closed form is given up to $k=6$, and of course it's increasingly complex. – Jean-Claude Arbaut Jul 07 '25 at 03:34
  • Thanks! Really usefull :) – Eitan Amiel Jul 07 '25 at 03:53
  • The title does not agree with the real question – leonbloy Jul 10 '25 at 10:44

1 Answers1

1

There are $n^2(n^2-1)$ ways to put two queens on the board. Let us count how many ”bad” configurations are there.

Let us go over all positions of the first queen. For each of them there are $2(n-1)$ bad positions for the other one if they are in the same row or column. The diagonals are trickier, but because of the symmetry we can consider just the diagonals which go NW-SE,i.e. where $i+j=x+y$, where $(i,j)$ and $(x,y)$ are the coordinates of the first (second resp.) queen.

It is easy to see that when $+j=k\le n+1$, the number of bad positions is $k-2$, with a similar formula above the main diagonal. Since there are $k-1$ positions where $i+j=k\le n+1$, the total number of bad positions for this direction is $$ 2(1\cdot 2+2\cdot3+. . . +(n-2)(n-1))+(n-1)\cdot n = \frac{ n(n−1)(2n−1)}3=:A $$ (the last term in the sum corresponds just to the main diagonal).

Hence the total number of bad positions is twice this (the other diagonal direction!) and $n^2$ of horizontal and vertical bad positions, $$ 2n^2(n-1)+2A=\frac{ 2n(n−1)(5n−1)}3. $$ To get the probability they do not attack, divide by $n^2(n^2-1)$, and subtract this from one, which is $$1- \frac{10n-2}{3n(n+1)}. $$

van der Wolf
  • 6,282