jeudi 15 avril 2010

Eight rooks (queens) on a chessboard

Probably, the chess game has the closest relation to elementary mathematics. The problem of eight rooks on a chessboard located as no any two of them can hit each other has an interpretation in the linear algebra. If we treat the 8x8 chessboard as an 8x8 matrix then the number of possible locations of eight rooks coincides with the number of summarized terms in the matrix determinant definition. Indeed, every term in determinant summation is a product of 8 (in our case) elements located in different rows and different columns. From that note it immediately follows that number of possible rooks locations is 8! = 40320.


The following complication is the eight queens, instead of rooks, located on a chessboard thus no two of them can hit each other.How many solutions exist? I did not think a lot and yesterday wrote a simple MATLAB program searching the all possible variants.
The answer is 92. If we treat any two solutions coinciding with the board rotation as one, the number of queens positions on board is 92/4 = 23. One of them you may see in the figure. This number should be well known but I did not know it before.

The corresponding flash game named "The eight queens" is here
http://www.novelgames.com/flashgames/game.php?id=57

dimanche 11 avril 2010

Small development of the chess knight solution

If we are able to construct the chess knight route where the first and the last knight positions are known we may easily create a route for any exotic chess boards combination (as in the picture above).

jeudi 8 avril 2010

Again about the cube Rubik


Again? You may exclaim.
Yes, since the cube Rubik invention in 1974 this plastic enigma became one of the most popular conundrum in the world. Thousands of papers were written proposing many fascinating solution algorithms.
I remember as in my secondary school the cube was an everybody's fad: the pupils spent all their free time in the cube's rotation, made ad-lib break competitions, solved the cube by shortest time, in blind etc.
Well, 36 years later the cube Rubik remains popular. It even seems the faded interest starts growing. At least the new generation takes an interest to the last century invention.
For 3x3x3 cube I recommend the solution at youcandothecube.com (www.youcandothecube.com). For 4x4x4 there are lots of excellent video tutorials at Utube.

Here I'd like to highlight some interesting facts from the cube Rubik's life.

1. The number of all 3x3x3 cube states is: (8!×3^{8−1})×(12!×2^{12−1})/2 = 43 252 003 274 489 856 000. How this number was obtained? The 3x3x3 cube consists of 8 angle elements, 12 edge elements and 6 centres. The centres cannot move relatively each other. So, the angle elements canbe located by 8!×3^8 ways and the edge elements by 12!×2^12 ways. This number counts the rotations of the cube as a solid body as well. So, 6 centres by 4 possible positions counted twice, so in 6x4/2 times the real number of the cube states is less than 8!×3^8×12!×2^12.

2. The most interesting observation is that not all of the possible states canbe reached by simple cube rotation from the original ordered state. Any cube's manipulation affects at least three elements. For example, if any of the cube's corners is 1/3 rotated, the cube cannot be solved. 8 angle elements by 2 their twisted positions give 16. Thus, the number of the cube states obtained from the ordered state at least in 16 times less than 43 252 003 274 489 856 000.

3. The cube maybe solved in blind! This is amazing thing when a human brain is able to keep in mind the current cube's configuration after each rotation. I met such pupils at school.

4. The solution of 4x4x4 cube implies several additional steps leading to 3x3x3 configuration when all edged elements are doubled and centers are in right places. But we may get a configuration which is impossible to solve by 3x3x3 methods without inevitable ungroup the doubled edge elements. In some sence our 4x4x4 cube comes to 3x3x3 configuration being 'turned inside out'.

mardi 6 avril 2010

Some chess knight problem complication

The previously posted message canbe slightly complicated namely: find a chess knight route starting from a fixed chess cell, ending in another one (also fixed) thus, the knight passes by every cell once and only once.


The solution also follows from cyclical route previously described. Indeed, if, say, the knight goes e5-d3 instead of e5-d7 and travels thereafter 64-63-62-...-48 (count down) the last point will be d7 in this case. It means, the last route cell is changeble. Repeating the procedure an many times as it is needed we may replace the end cell in any position of the chess board.

The proving is as follows: let us assume that there is a chess board cell where we cannot replace the knight route end by the procedure described above. Assume also that this cell has a number N in current route configuration. It means that from the cell number N-1 we are not able to go directly on 64. Hence, cell 64 cannot be in
two knight steps from the cell where the route end is impossible. In other words, if the knight route cannot end in one cell it cannot end in all cells of the same color.

dimanche 4 avril 2010

chess knight problem


Hello amateurs of elementary math, have you ever heard about chess knight problem?

Here it is:
One should find route of a knight starting from a fixed chess board (8x8) cell, passing every cell once and only once and
at the end, passed by every cell of the chess board.

I put in my blog the simplest solution. If we have in mind a cyclical route, that is, from 64th step the knight goes on 1st,
the solution for any cell of the board is given by simple going by circle.
Look, this is a fortran code realising this algorithm (23 lines):

program chess
integer X(8,8),Y(8,8)
integer k,l
data X/40,7,32,51,56,49,30,45,33,52,41,48,31,46,57,60,8,39,6,55,50
c,59,44,29,53,34,63,42,47,4,61,58,38,9,54,5,62,43,28,19,35,24,37,64
c,3,18,13,16,10,1,22,25,12,15,20,27,23,36,11,2,21,26,17,14/

1 write(*,*)'Enter origin knight coordinates (column row):'
read(*,*)k,l
if (k.ge.1.and.k.le.8.and.l.ge.1.and.l.le.8) goto 2
write(*,*)'Input error. Repeat last enter'
goto 1

2 continue
do 3,i=1,8
do 3,j=1,8
if (X(j,i).lt.X(k,l)) then
Y(j,i)=65+X(j,i)-X(k,l)
else
Y(j,i)=X(j,i)+1-X(k,l)
endif
3 continue
write(*,4) ((Y(j,i),j=1,8),i=1,8)
4 format(//,8(2X,I2))
end