Queens on a Chessboard

A queen on an English chessboard is able to attack in the same row, column and diagonal. The probability that 2 randomly placed queens on an 8 by 8 chessboard will be able to attack each other can be expressed as a b \frac {a}{b} , where a a and b b are positive, coprime integers. What is the value of a + b a + b ?

Details and assumptions

The 2 queens will not be placed on the same square.


The answer is 49.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

25 solutions

Zk Lin
May 20, 2014

We spilt the chessboard into 4 regions.

For the first region which includes the outermost layer of 28 unit squares, we find that the queen always attack 21 units when it is placed on one of these 28 unit squares. The probability of this scenario happening is (28/64)(21/63) - since no two queens can be placed on the same unit square.

We define the second region as the layer of unit squares which are adjacent to the unit squares of the first region. There are 20 such unit squares. If the queen is placed on one if these 20 squares, the probability of its counterpart and it attacking each other is (20/64)(23/63) since the queen will attack exactly 23 unit squares if placed on one of the 20 squares.

The third region constitutes all unit squares which are adjacent to the second region, with the squares already belonged to region one being the only exceptions. There are 12 unit squares of such kind, and if the queen is placed on such a square, it attacks exactly 25 unit squares. If the queen is placed on such a square, the probability of its counterpart and it attacking each other is (12/64)(25/63).

The final region constitutes the four unit squares situated right at the centre of the board. The queen attacks 27 unit squares if placed on these 4 squares. If the queen is placed on one of these 4 squares, the probability of its counterpart and it attacking each other is (4/64)(27/63).

Summing up all the probabilities, we get [(28)(21)+(20)(23)+(12)(25)+(4)(27)]/(64)(63)= 13/36. 13+36=49, hence the solution.

Frank Fazekas
May 20, 2014

There is a 7/63+7/63=2/9 probability that the queens are in the same row or column (note that they cannot be in both). Now, using casework for the probability that they are on the same diagonal, we can see that there is a 1/16 probability that there are 13 possibilities, 3/16 that there are 11 possibilities, 5/16 that there are 9 possibilities, and 7/16 that there are 7 possibilities. (13/16+33/16+45/16+49/16)/63=5/36, and 5/36+2/9=13/36, which gives us our answer, 49.

Most people evaluated this as 1456 4032 \frac {1456}{4032} or 728 2016 \frac {728}{2016} . Here is a way which avoid the tedious computation.

Calvin Lin Staff - 7 years ago
Tim Vermeulen
Jul 29, 2013

Divide the 64 64 squares over four sets A , B , C , D A,B,C,D , where

  • A A contains all squares on the border of the chessboard,
  • B B contains all squares which are not in A A but are bordering squares in A A ,
  • C C contains all squares which are not in A A or B B but are bordering squares in B B ,
  • D D contains all remaining squares, i.e. the four middle ones.

Note that

A = 28 , B = 20 , C = 12 , D = 4. \begin{aligned} \lvert A \rvert &= 28,\\ \lvert B \rvert &= 20,\\ \lvert C \rvert &= 12,\\ \lvert D \rvert &= 4. \end{aligned}

Let N ( S ) N(S) be the number of squares a queen can attack if it is placed on a square in S S . Note that for all squares, there are 14 14 squares that the queen can attack either horizontally or vertically, but the number of squares the queen can attack diagonally depends on the set the square is in. By simple counting, we see that

N ( A ) = 14 + 7 = 21 , N ( B ) = 14 + 9 = 23 , N ( C ) = 14 + 11 = 25 , N ( D ) = 14 + 13 = 27. \begin{aligned} N(A) &= 14 + 7 = 21,\\ N(B) &= 14 + 9 = 23,\\ N(C) &= 14 + 11 = 25,\\ N(D) &= 14 + 13 = 27. \end{aligned}

Let P ( S ) P(S) be the probability that if the first queen is placed on a square in S S and the other queen is placed randomly on another square, then they can attack each other. We know that

P ( A ) = N ( A ) 63 = 21 63 , P ( B ) = N ( B ) 63 = 23 63 , P ( C ) = N ( C ) 63 = 25 63 , P ( D ) = N ( D ) 63 = 27 63 . \begin{aligned} P(A) &= \frac{N(A)}{63} = \frac{21}{63},\\ P(B) &= \frac{N(B)}{63} = \frac{23}{63},\\ P(C) &= \frac{N(C)}{63} = \frac{25}{63},\\ P(D) &= \frac{N(D)}{63} = \frac{27}{63}. \end{aligned}

Therefore, the probability that two randomly placed queens can attack each other is

P = A 64 P ( A ) + B 64 P ( B ) + C 64 P ( C ) + D 64 P ( D ) = 28 64 21 63 + 20 64 23 63 + 12 64 25 63 + 4 64 27 63 = 13 36 , \begin{aligned} P &= \frac{ \lvert A \rvert }{64} \cdot P(A) + \frac{ \lvert B \rvert }{64} \cdot P(B) + \frac{ \lvert C \rvert }{64} \cdot P(C) + \frac{ \lvert D \rvert }{64} \cdot P(D)\\ &= \frac{28}{64} \cdot \frac{21}{63} + \frac{20}{64} \cdot \frac{23}{63} + \frac{12}{64} \cdot \frac{25}{63} + \frac{4}{64} \cdot \frac{27}{63}\\ &= \frac{13}{36}, \end{aligned}

so a + b = 13 + 36 = 49 a+b=13+36=\boxed{49} .

This is a really well-written solution. Good job!

Mursalin Habib - 7 years, 10 months ago

Log in to reply

Thanks :)

Tim Vermeulen - 7 years, 10 months ago
Leo Lai
May 20, 2014
  1. Two queens are on the same row. There are 8 rows to choose from. In the chose row, select two location for the queens for a total of ( 8 2 ) = 28 \binom{8}{2}=28 choices. In total, the number of choices is 8 28 8\cdot 28
  2. Two queens are on the same column. This is the same as Case 1, so there are also 8 28 8\cdot 28 configurations.
  3. They are on the same diagonal. Consider one of the two possible directions for the diagonals and multiply the result by 2. For a diagonal of length n n , there are ( n 2 ) \binom{n}{2} arrangements. In total, there are 2 n = 1 7 ( n 2 ) + ( 8 2 ) = 2 ( 8 3 ) + 28 2\sum_{n=1}^7\binom{n}{2}+\binom{8}{2}=2\cdot\binom{8}{3}+28 allowed configurations for diagonals in one direction. I used the identity n = 1 r ( n k ) = ( r + 1 k + 1 ) \sum_{n=1}^r\binom{n}{k}=\binom{r+1}{k+1} In total, there are 2 8 28 + 2 ( 8 3 ) + 28 = 728 2\cdot8\cdot28+2\cdot\binom{8}{3}+28=728 legal arrangements. There are ( 64 2 ) = 2016 \binom{64}{2}=2016 ways of putting two queens on a chessboard, so the probability is 728 2016 = 13 36 \frac{728}{2016}=\frac{13}{36} . Therefore the answer is 13+36=49.

You are faboulous thanks

Ram Sita - 3 years, 3 months ago
Zi Song Yeoh
May 20, 2014

Divide the chessboard into 4 layers as follows:

Let the 1st layer be the 'outer ring', i.e. the side squares (including the corners.)., then create the 2nd layer by removing the 1st layer then the 2nd layer is the 'outer ring' of the new board. Similarly, we can create the last two layers. Note that the number of squares in the 1st, 2nd, 3rd, 4th layer is 28, 20, 12, 4 respectively. And note that if a queen is in the 1st, 2nd, 3rd, 4th layer respectively, then it controls 21, 23, 25 and 27 squares respectively. So if a queen stands in the squares that the first queen controls, it will be attacked. So, the probability is

28 64 × 21 63 + 20 64 × 23 63 + 12 64 × 25 63 \frac{28}{64} \times \frac{21}{63} + \frac{20}{64} \times \frac{23}{63} + \frac{12}{64} \times \frac{25}{63} + 4 64 × 27 63 = 13 36 + \frac{4}{64} \times \frac{27}{63} = \frac{13}{36} . (The denominator is 63 instead of 64 since the first queen occupied 1 square.)

Thus, a + b = 13 + 36 = 49 a + b = 13 + 36 = \boxed{49}

Lawrence Sun
May 20, 2014

We count the expected value of squares the queen attacks. Note that if a randomly placed queen attacks on average E E locations, then on average there are E E places to put a queen which attacked by the other queen. Thus it follows the answer should be E 63 \frac{E}{63} .

Now we compute E E . Note that horizontally and vertically the queen can always attack 14 14 squares. Now to count diagonally.

Counting across diagonals, the expected number of squares the queen can attack going on the diagonal which is right-down, we see it is 8 7 + 2 ( 7 6 + 6 5 + . . . + 2 1 ) 64 = 35 8 \frac{8 \cdot 7 + 2 \cdot (7 \cdot 6 + 6 \cdot 5 + ... + 2 \cdot 1)}{64} = \frac{35}{8}

Thus it follows : E = 14 + 2 35 8 = 91 4 E = 14 + 2 \cdot \frac{35}{8} = \frac{91}{4}

Therefore the probability is 91 4 63 = 13 36 \frac{\frac{91}{4}}{63} = \frac{13}{36} so we get 13 + 36 = 49 13 + 36 = 49 as the answer.

Ziwei Lu
May 20, 2014

Once the first queen is placed on the board, the second queen has 63 places to be placed. Regardless of where the first queen is placed, there are 14 squares in its row or column, where the second queen is able to attack the first.

Next, we'll look at the diagonal cases. If the first queen is placed on the outside rim of the chess board, there are 7 squares that are in its diagonal(s). There are 28 squares in the outer rim. In the next ring (edge of the 6 by 6 square centered at the center of the chess board), there are 9 squares in its diagonals. There are 20 squares in that ring. The next ring in has 12 squares, and 11 squares in its diagonals. Finally, the 4 center squares of the chess board has 13 squares in its diagonals.

Thus the probability is 28 64 21 63 + 20 64 23 63 + 12 64 25 63 + 4 64 27 63 = 13 36 \frac{28}{64}\cdot\frac{21}{63}+\frac{20}{64}\cdot\frac{23}{63}+\frac{12}{64}\cdot\frac{25}{63}+\frac{4}{64}\cdot\frac{27}{63}=\frac{13}{36} . So a + b = 49 a+b=49 .

Anderson Silva
May 20, 2014

Squares that are on the edge of the chessboard can hit 21 squares and there are 28 of these. Next consider the 6 × 6 chessboard that is obtained by removing the outer squares. The squares on the edge of this board can hit 23 squares and there are 20 of these. Consider the 12 squares on the boundary of the 4 × 4 chessboard left. Each of these squares can hit 25 squares. The remaining 4 can hit 27 squares. The probability then follows as 21 × 28 + 23 × 20 + 25 × 12 + 27 × 4 64 × 63 = 13 36 \frac{21×28+23×20+25×12+27×4}{64×63}=\frac{13}{36} . Thus, the answer is 49 49 .

Wilson Kan
May 20, 2014

There are 64C2 total possibilities. (2016)

2 queens can simultaneously be on row 1 is 8C2 ways so 2 queens can be simultaneously on any row is 8 (8C2) = 224 Similarly, 2 queens can be simultaneously on any column is 8 (8C2) = 224

2 queens can occupy the same diagonal going from bottom left to top right in a total of: 2C2+3C2+4C2+5C2+6C2+7C2+8C2+7C2+6C2+5C2+4C2+3C2+2C2 = 140

Same count for diagonals going from top left to bottom right.

So total ways = 140 + 140 + 224 + 224 = 728

Probability = 728/2016 = 13/36

Shubham Agarwal
May 20, 2014

For a chessboard (8x8) total no. of ways to place 2 queens is (64x63) = 4018(assume both queen are of different color). Now we have to count favorable no. of ways.

If the first queen is placed at out most square boundary (8x8) containing a total 28 place and to attack second queen there are a total 21 possible ways as (7,7,7) in horizontal, vertical, and in diagonal respectively. so no. ways are 28x21

Similarly for 1st innermost boundary queen1- 20 ways, queen2 - 23 ways Similarly for 2nd innermost boundary queen1- 12 ways, queen2 - 25 ways Similarly for last innermost boundary queen1- 4 ways, queen2 - 27 ways

hence favorable ways = 28x21 + 20x23 + 12x25 + 4x 27 = 1456 and probability = 1456 / 4018 = 13/36 a + b =49

Boy Totitot
May 20, 2014

All squares that are on the edge of the chessboard can hit 21 squares; there are 28 such squares. Now consider the 6 × 6 chessboard that is obtained by removing these bordering squares. The squares on the edge of this board can hit 23 squares; there are 20 of these squares. Now we consider the 12 squares on the boundary of the 4 × 4 chessboard left; each of these squares can hit 25 squares. The remaining 4 can hit 27 squares. The probability then follows as 21 × 28 + 23 × 20 + 25 × 12 + 27 × 4 64 × 63 = 13 36 \frac {21 × 28 + 23 × 20 + 25 × 12 + 27 × 4}{64 × 63}= \frac{13}{36} . Thus, 13 + 36 = 49 13+36=49 .

It can readily be seen that any square of the board is in the same row as 7 other squares, and similarly, any square is in the same column as 7 other squares. Hence every square of the board "attacks" at least 14 other squares. All that remains is to count the number of squares that are attacked diagonally.

Divide the board into four regions: (a) the 36 squares at the edges of the board; (b) the 20 squares adjacent to the first region; (c) the 12 squares adjacent to the second region; and (d) the four squares at the center of the board.

Each square in region (a) attacks 7 squares diagonally, for a total of 21 squares each: 36 × 21 = 756 36 \times 21=756 .

Each square in region (b) attacks 9 squares diagonally, for a total of 23 squares each: 20 × 23 = 460 20 \times 23=460 .

Each square in region (c) attacks 11 squares diagonally, for a total of 25 squares each: 12 × 25 = 300 12 \times 25=300 .

Each square in region (d) attacks 13 squares diagonally, for a total of 27 squares each: 4 × 27 = 108 4 \times 27=108 .

Hence the two queens can be placed on the board in 756 + 460 + 300 + 108 = 1624 756+460+300+108=1624 ways. The number of possible positions for the two queens is 64 × 63 = 4032 64 \times 63=4032 . We divide and simplify to obtain a b = 13 36 \frac {a} {b}=\frac {13} {36} , which indicates that a + b = 49 a+b=49 .

the chessboard can be divided into 4 square rings.

1. in the outermost square ring

probability of Q1 to be present in the outer ring = 28 / 64 28/64

28 since there are 28 boxes in the outer ring probability that Q2 will be attacked now= 21 / 63 21/63

21 since there are 21 boxes in the row ,column and diagonal of Q1 subject to her attack other than the box occupied by Q1

2. similarly, in the second outer ring.

P(Q1 present)= 20 / 64 20/64

P(Q2 being attacked by Q1)= 23 / 63 23/63

3. and in the inner square ring

P(Q1 present)= 12 / 64 12/64

P(Q2 being attacked by Q1)= 25 / 63 25/63

4. finally in the innermost square ring

P(Q1 present)= 4 / 64 4/64

P(Q2 being attacked by Q1)= 27 / 63 27/63

therefore, the probability of randomly placed Q1 and Q2 being able to attack each other is,

=sum of total probability of being able to attack each other when Q1 is placed in the 4 square rings of the chess boards

= 28 / 64 21 / 63 + 20 / 64 23 / 63 + 12 / 64 25 / 63 + 4 / 64 27 / 63 28/64 * 21/63 +20/64 * 23/63 +12/64 *25/63+4/64 * 27/63

= 13 / 36 13/36

i e , a = 13 , b = 36 ie, a=13,b=36

s o , a + b = 13 + 36 = 49 so, a+b=13+36=49

Thomas Beuman
Jul 29, 2013

I will consider the queens to be distinguishable; let's say one is white and the other is black (appropriately). Then there are 64 63 = 4032 64\cdot63 = 4032 ways in total in which the queens can be placed on the board.

There are two ways in which the queens can be attacking each other: they can be in the same row/column or on the diagonal. Note that it's not possible for the queens to be attacking each other "in multiple ways", so we can consider each case separately and add it all together without having to worry about duplicates.

For each row or column, there are 8 squares to choose from, hence 8 7 = 56 8\cdot7 = 56 ways in which to place the two queens on that row or column. With a total of 8 rows and 8 columns, we find a total of 16 56 = 896 16\cdot56 = 896 for this category.

On a diagonal of length k k , there are k ( k 1 ) k(k-1) ways to place the two queens on that diagonal. There are four diagonals of length k k for all k < 8 k < 8 , and two of length k = 8 k=8 . Adding all those contributions together gives 560 560 possibilities.

The requested probability is therefore p = 896 + 560 4032 = 13 36 p = \frac{896+560}{4032} = \frac{13}{36} , so a + b = 49 a+b = \boxed{49}

I really feel this one is much easier...

Yunhao King - 7 years, 9 months ago
Superman Son
May 20, 2014

first i place the first queen in the outermost square,with side 8 blocks.i see there are 21 ways in which it can eat the other queen.as the diagonally it is 7, horizontally 7, vertically 7 ways.to place the other queen,so that it can eat the other.

now i put it in the second square with side 6 blocks .now diagonally it can eat in 9 ways,and vertically 7 ways,and horizontally 7 ways.so in total 23 ways.to place the other queen.

now in the third square with side 4 blocks .diagonally it can eat in 11 ways,horizontally 7,and vertically 7 ways. so in total there are 25 ways.to place the other queen.

again in the smallest square with side 2 blocks.so it has 27 ways .as horizontally there are 7 ways,vertically 7 ways, diagonally 13 ways.to place the other queen.

now i do the sum algebricaly,probability in total will be( 21 28 + 23 20 + 25 12 + 27 4 ) / 64 63 as in the first case there are 28 blocks left, in the second 20 and so on...and in total there is a probability of 63 64.

it comes out to 1456/4032..........which is equal to 36/13 =49 (13 + 36 )

The first queen can be placed anywhere on the chess board. Now we only care about the position of the second queen. We can find the probability by adding up the individual probabilities of the first queen's range on each square and then dividing by 64 64 We then break it down into four cases: Case 1: The first queen is one on of the 28 outertmost squares, i.e. the ones surrounding the chessboard. If so, then the second queen has a 21 63 \frac {21}{63} of being in the range of the first queen. So the total probability for this case is: 588 63 \frac {588}{63} . Case 2: The first queen is one of the 20 second outtermost squares. Here, each square has a probability of 23 63 \frac {23}{63} and the total probability is: 460 63 \frac {460}{63} Case 3: The first queen is one of the 12 second innermost squares. Here, each square has a probability of 25 63 \frac {25}{63} and the total probability is: 300 63 \frac {300}{63} Case 4: The first queen is one of the 4 innermost squares. Here, each square has a probability of 27 63 \frac {27}{63} and the total probability is: 108 63 \frac {108}{63}

Adding0 all of these we get that the probability is: 588 63 + 46 63 + 300 63 + 108 63 64 = 1456 63 64 = 13 36 \displaystyle \frac {\frac {588}{63}+ \frac {46}{63}+\frac {300}{63}+\frac {108}{63}}{64}=\frac {\frac {1456}{63}}{64}=\frac {13}{36} . Hence the answer is 13 + 36 = 49 13+36=\fbox{49}

This is essentially how I did it- but you explained it much better than I could have. Well done!

Luke Vrotsos - 7 years, 10 months ago

Log in to reply

Thanks!

A Former Brilliant Member - 7 years, 10 months ago
Louie Tan Yi Jie
Aug 1, 2013

Draw up a 8x8 chessboard and count the number of possible "attacking" positions for each position. To simplify matters, there are always 14 positions in the same row and column; so we can skip to counting diagonals. Also, by symmetry, the value of a position can be mirrored horizontally and vertically. The table (counting diagonals only) looks like this.

7 7 7 7 7 7 7 7 7 9 9 9 9 9 9 7 7 9 11 11 11 11 9 7 7 9 11 13 13 11 9 7 7 9 11 13 13 11 9 7 7 9 11 11 11 11 9 7 7 9 9 9 9 9 9 7 7 7 7 7 7 7 7 7 \begin{matrix} 7 & 7 & 7 & 7 & 7 & 7 & 7 & 7 \\ 7 & 9 & 9 & 9 & 9 & 9 & 9 & 7 \\ 7 & 9 & 11 & 11 & 11 & 11 & 9 & 7 \\ 7 & 9 & 11 & 13 & 13 & 11 & 9 & 7 \\ 7 & 9 & 11 & 13 & 13 & 11 & 9 & 7 \\ 7 & 9 & 11 & 11 & 11 & 11 & 9 & 7 \\ 7 & 9 & 9 & 9 & 9 & 9 & 9 & 7 \\ 7 & 7 & 7 & 7 & 7 & 7 & 7 & 7 \\ \end{matrix}

The average of all the values is 8.75. Adding in the 14 possible horizontal and vertical positions, the expected number of valid positions are 22.75. Since there are 63 possible positions (same square is not allowed), required probability is: 22.75 63 = 13 36 \frac{22.75}{63}=\frac{13}{36}

David Vaccaro
Aug 1, 2013

Wherever the first queen is placed there are 14 remaining squares out of 63 in either the same row or the same column, So there is a 2 9 \frac{2}{9} probability of a rank or file attack.

If the first queen is in one of the central 4 squares then there are 13 remaining squares in the same diagonal, if it is one of the 12 squares surrounding the central 4 squares then there are 11 remaining squares in the same diagonal, in the next 20 squares there are 9 squares in the same diagonal, and in the 28 outside squares there are 7 squares in the same diagonal, so conditioning on the position of the first queen the probability of a diagonal attack is:

  • 1 16 13 63 + 3 16 11 63 + 5 16 9 63 + 7 16 7 63 = 5 36 \frac{1}{16}\frac{13}{63}+\frac{3}{16}\frac{11}{63}+\frac{5}{16}\frac{9}{63}+\frac{7}{16}\frac{7}{63}=\frac{5}{36}

The total probability of attacking queens is hence: 2 9 + 5 36 = 13 36 \frac{2}{9}+\frac{5}{36}=\frac{13}{36}

Sumit Goel
Jul 28, 2013

total no of ways the queen can be placed is 64C2.

ways in which the queens attack each other:-

8C1 8C2 + 8C1 8C2 + 2* (8C2) + 4*(7C2+6C2+5C2...2C2)

1st two terms are for same row or column attack

3rd term is for the two main diagonals attack

4th term is for the small diagonals attack

On calculating we get 13/36

Hungry Cap
Mar 22, 2014

We split the problem into two cases. The queens can attack each other via horizontal/vertical line or diagonal line. The former case can be computed in a straightforward way, (e.g. 64*14). The latter case can be computed by doing casework on diagonals with length 8, 10, 12, and 14. We take the sum of these and divide by 64C2 to obtain 728/64C2 = 13/36

Ondřej Chmelík
May 18, 2019

You need to know, that if two queens attack each other, then when you have one queen placed, the second queen is attacked if it's placed on one of the squares controlled by the first queen. So you need to calculate, how many squares can a queen attack on each square, as you can see on the picture.

So you have in total this number of squares:

28 21 + 20 23 + 12 25 + 8 27 = 1456 28·21+20·23+12·25+8·27=1456

You need to divide this number by 2, because every position will appear twice:

1456 : 2 = 728 1456:2=728

Now you have to find out, how many placements of two queens are possible at all. You can count this as a sum:

k = 1 N k = 1 + 2 + 3 + . . . + N = 1 2 N ( N + 1 ) \sum_{k=1}^{N}{k}=1+2+3+...+N=\frac{1}{2}·N(N+1)

1 2 63 64 = 2016 \frac{1}{2}·63·64=2016

So you have 2016 possible choices, how to put two queens on the board. Thus the probability, that two queens, randomly placed on the board, will attack each other can be expressed as:

a b = 728 2016 = 13 36 \frac{a}{b}=\frac{728}{2016}=\frac{13}{36}

Then just simply add these two numbers:

a + b = 13 + 36 = 49 a+b=13+36=\boxed{49}

The answer is 49.

Ram Sita
Mar 11, 2018

You all are great people .who have given their prestigious time in Representing your best answers for your junior learners . Who in future can represent their country in olympiads

Anubhav Balodhi
Nov 18, 2017

Let's call Queens Q1 and Q2 respectively. When we place a Queen at a1, there are 21 cells where we can place Q2. When we put it at b1, there are 20 cells for Q2.... Thus, for rank1, the total count comes out to be 140.
Similarly, for rank 2, it comes out to be 130. for rank 3, it comes out to be 118. for rank 4, it comes out to be 104. for rank 5, it comes out to be 88 for rank 6, it comes out to be 70. for rank 7, it comes out to be 50. for rank 8, it comes out to be 28. Adding these, gives 28+50+70+88+104+118+130+140 =728.

One important point to note is that we can exchange(pun certainly not intended) our Queens, so that gives 2 ways to permute the Queens.

Thus, the probability that Queens eliminate each other are:

2 728 64 63 \frac{2*728}{64*63}

13 36 \frac{13}{36}

13+36 gives 49.

Arjen Vreugdenhil
Jan 19, 2017

Two queen can be placed in N = ( 64 2 ) = 2016 = 2 5 3 2 7 N = \left(\begin{array}{c} 64 \\ 2 \end{array}\right) = 2016 = 2^5\cdot 3^2\cdot 7 different ways.

To find the number M M of ways in which they threaten each other, we count in how many ways they can be in the same row, same column, or same diagonal.

Same row : There are eight rows. Two queens can be placed in eight rows in ( 8 2 ) = 28 \left(\begin{array}{c} 8 \\ 2 \end{array}\right) = 28 different ways. That makes for M r = 8 × 28 = 224 M_r = 8\times 28 = 224 different ways.

Same column : In the very same way, M c = 224 M_c = 224 .

Same diagonal : Likewise, two queens can be placed on each of the two main diagonals in 28 different ways.

There are four diagonals right next to the main diagonals, each with seven squares. Two queens can be placed on one of these diagonals in ( 7 2 ) = 21 \left(\begin{array}{c} 7 \\ 2 \end{array}\right) = 21 ways. Subsequent diagonals have six, five, four, three, and two squares each. Adding all the possibilities together, we get M d = 2 × ( 8 2 ) + 4 × ( 7 2 ) + 4 × ( 6 2 ) + 4 × ( 5 2 ) + 4 × ( 4 2 ) + 4 × ( 3 2 ) + 4 × ( 2 2 ) = [ 4 × k = 2 8 ( k 2 ) ] 2 × ( 8 2 ) = 4 × ( 8 3 ) 2 × ( 8 2 ) = 4 × 84 2 × 28 = 280. M_d = 2\times \left(\begin{array}{c} 8 \\ 2 \end{array}\right) + 4\times \left(\begin{array}{c} 7 \\ 2 \end{array}\right) + 4\times \left(\begin{array}{c} 6 \\ 2 \end{array}\right) + 4\times \left(\begin{array}{c} 5 \\ 2 \end{array}\right) + 4\times \left(\begin{array}{c} 4 \\ 2 \end{array}\right) + 4\times \left(\begin{array}{c} 3 \\ 2 \end{array}\right) + 4\times \left(\begin{array}{c} 2 \\ 2 \end{array}\right) \\ = \left[4\times \sum_{k = 2}^{8} \left(\begin{array}{c} k \\ 2 \end{array}\right)\right] - 2\times \left(\begin{array}{c} 8 \\ 2 \end{array}\right) \\ = 4\times \left(\begin{array}{c} 8 \\ 3 \end{array}\right) - 2\times \left(\begin{array}{c} 8 \\ 2 \end{array}\right) \\ = 4 \times 84 - 2\times 28 = 280. (Note the use of the hockey stick theorem here.)

Total: The number of ways in which the queens can threaten each other is M = M r + M c + M d = 224 + 224 + 280 = 728 = 2 3 7 13. M = M_r + M_c + M_d = 224 + 224 + 280 = 728 = 2^3\cdot 7\cdot 13.

Thus, the probability is P = M N = 2 3 7 13 2 5 3 2 7 = 13 2 2 3 2 = 13 36 , P = \frac{M}{N} = \frac{2^3\cdot 7\cdot 13}{2^5\cdot 3^2\cdot 7} = \frac{13}{2^2\cdot 3^2} = \frac{13}{36}, so that a + b = 13 + 36 = 49 a + b = 13 + 36 = \boxed{49} .

Brock Brown
Dec 16, 2016
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
from itertools import product
from fractions import Fraction as frac

def attack(x1, y1, x2, y2):
    return x1 == x2 or y1 == y2 or \
        abs(x1 - x2) == abs(y1 - y2)

count = 0
samples = 0
for x1, y1, x2, y2 in product(range(8), repeat=4):
    if x1 == x2 and y1 == y2:
        continue
    if attack(x1, y1, x2, y2):
        count += 1
    samples += 1

prob = frac(count, samples)
answer = prob.numerator + prob.denominator
print("Answer:", answer)

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...