Maths in chess
Maths in chess
We estimate that chess is more than 1,000 years old. However, with chess being as old as it is, people have
gone beyond playing the game as it was originally intended. Generations of people have been fascinated in
the mathematics deeply rooted in the game. For example, something as simple as deciding whether to make
a trade or not involves doing maths. By working out the relative value of your pieces compared to your
opponent’s, you can make an informed decision after some basic arithmetic.
The mathematics of chess and the century-old theories and problems that incited legendary mathematicians,
such as Euler and Gauss, still gain interest today. This essay will take you through some of the most popular
mathematical problems that have arisen from the historic game of chess.
But there is more to chess than just the opening. Much more. The American mathematician Claude Shannon
calculated the eponymous Shannon Number: 10120. This is an estimate for the number of different possible
chess games that can be played. This figure is based on an average of about 103 possibilities for a pair of
moves, and a typical game lasting about 40 such pairs of moves. To make you understand how big 10 120
actually is, there are more possible 40 move chess games than the number of atoms in the observable
universe (1080). In fact, a lot more. Specifically, more than a billion billion billion billion times more! It
should be pretty clear that the Shannon Number is basically incomprehensible for the human brain.
It is fascinating to see how quickly the number of possible games increases after each move. You already
know that there are 400 possible positions after each player has moved one piece. Let’s see what the
numbers look like after five moves each:
Number of half-moves Number of possible games
1 20
2 400
3 8,902
4 197,281
5 4,865,609
6 119,060,324
7 3,195,901,860
8 84,998,978,956
9 2,439,530,234,167
10 69,352,859,712,417
Note: A ‘half-move’ refers to a move one player makes. In chess, a ‘move’ refers to when both sides have moved a piece.
Perhaps what I love about this most is that it can take less than five moves (ten half-moves) for the game you
are playing to reach a position that has never been reached before in the 500+ year history of chess. Isn’t that
just astonishing!
.
2
The Knight’s Tour A radially symmetric closed Knight's Tour
The first line can be read from left to right or by moving from
the first square to the second line, third syllable (2.3), replicating
the Knight’s movement, and then to 1.5 to 2.7 to 4.8 to 3.6 etc.
To understand this better, follow this half-board diagram showing the problem with colours and numbers. If
you move from each colour to the next by going left to right, you will have the same order of colours as if
you moved according to the numbers (in the movement of a Knight).
3
Going either left to right or following the
numbers (in the movement of a Knight), you
will get the same order of colours: RED,
BLUE, GREEN, GREEN, GREEN, BLUE,
BLUE, GREEN, GREEN, BLUE, BLUE,
BLUE, BLUE, GREEN, GREEN, GREEN,
BLUE, GREEN, BLUE, GREEN, GREEN,
BLUE, GREEN, BLUE, GREEN, GREEN,
GREEN, BLUE, BLUE, BLUE, BLUE,
GREEN.
Schwenk proved that for any m × n board
with m ≤ n, a closed Knight's tour is always possible unless one or more of these three conditions are met:
The table below shows the number of directed tours, both open and closed, on an n x n board, up to n = 8.
This is sequence A165134 in the OEIS.
n Number of directed tours on an n x n board
1 1
2 0
3 0
4 0
5 1,728
6 6,637,920
7 165,575,218,320
8 19,591,828,170,979,904
There are several ways to find a Knight's Tour on a given board with a computer. While you can brute force
the problem, it is not practical to do for the huge numbers involved.
Warnsdorff's rule is a heuristic for finding a single Knight's Tour, first described by H. C. von Warnsdorff in
1823. The Knight is moved so that it always proceeds to the square from which the Knight will have the
fewest onward moves. When calculating the number of onward moves for each candidate square, we do not
count moves that revisit any square already visited. There is the possibility of two or more choices for
having the same number of onward moves, but there are various methods for breaking such ties.
Warnsdorff’s rule may also more generally be applied to any graph. In graph-theoretic terms, each move is
made to the adjacent vertex with the least
degree.
4
Warnsdorff’s rule in action – Each square contains the
number of moves that the Knight could make from that
square. In this case, the rule tells us to move to the square with
the smallest number in it, namely 2.
5
This magic square has the following properties:
6
• Each half-row, each half-column, and each quadrant within the main quadrants sums to 130.
But sadly, this is only a semi-magic square as the diagonals do not add up to 260:
With a lot of computing time, we have actually proven that there does not exist a true magic square Knight’s
Tour. However, we have found 140 different semi-magic tours, including closed tours, such as the one
below:
7
Fun with Graphs
After all of these incomprehensibly huge numbers and complex mathematical chess problems, I think it is
time to end with something a little more fun (at least for most people)… Desmos!
While most people use Desmos to solve mathematical problems graphically, I find I spend most of my time
on it messing around with functions to make graph art (yes, I know that sounds weird, but trust me, it is
quite entertaining).
It was wonderful to find that someone had already made a chessboard on Desmos, but unfortunately, I could
not find the actual person who did it, so… credit to whoever spent how many hours it took to make this
amazing Desmos art! However, it was lacking the most important part, the checkerboard pattern. So, I did
my part in putting the final touches on this masterpiece.
8
From all of this chess-talk, I now really want to play. Anyone fancy a game?
Sources
Introduction
Chess Interest - Google Trends
Chess - Wikipedia
Chess.com was used to visualise some of the various problems on the board
10