# Finding the possible positions of chess knight mathematically relative to a given position

From this website I found the following question:

A chess board’s 8 rows are labelled 1 to 8, and its 8 columns a to h. Each square of the board is described by the ordered pair (column letter, row number).

(a) A knight is positioned at (d, 3). Write down its possible positions after a single move of the knight.

(b) If R = {1, 2, ..., 8}, C = {a, b, ..., h}, and P = {coordinates of all squares on the chess board}, use set notation to express P in terms of R and C

(c) A rook is positioned at (g, 2). If T = {2} and G = {g}, express its possible positions after one move of the rook in terms of R, C, T and G.

For (a) is there anyway mathematically to list all the possible positions of the knight? I could for example, use a chess board to determine all the possible positions of the knight.

About (C) I completely don't get it.

The answers are provided in the website, however, I'm interested in how to solve them.

• You might also be interested in this question Jun 24, 2016 at 15:25

Given an initial position for the knight, the knight can move either north-east, north-west, south-east or south-west. In each of these directions, there are usually two possible positions. For example, from $(d,3)$, the knight can move north-east to either $(e,5)$ or $(f,4)$. Thus, there are a total of 8 possible positions for the knight if the knight starts at $(d,3)$.

Since a knight move consists of jumping 3 squares in the form of an L-shape, mathematically, the 8 possible new positions for the knight can be obtained by just adding or subtracting 1 to one of the two coordinates of $(d,3)$ and 2 to the other coordinate. For instance, adding $(1,2)$ to $(d,3)$ gives $(e, 5)$. Here, I assume that 'adding' 1 to a letter gives the next letter, and so adding 1 to $d$ gives $e$. Or, we can add $(2,1)$ to $(d,3)$, and we get $(f,4)$. Or, we can add $(-1,2)$ to $(d,3)$, and we get $(c,5)$. The number of different additions we can do is the size of the set $\{ (\pm 1, \pm 2), (\pm 2, \pm 1)\}$, which is 8.

Of course, if the knight is not near the center of the board, then the knight could fall off the board if it moves in some of these 8 directions. So, if the knight is near the edge or corner of the board, only some (not all 8) of the possible 'additions' should be carried out.

For part (b), $P= C \times R$ should be clear, where $C$ is the set of columns of the board and $R$ the set of rows.

For part (c), observe that a rook on $(g,2)$ can either move horizontally to one of the 7 squares $(a,2), (b,2), \ldots, (h,2)$ or vertically to one of the 7 squares $(g,1), (g,3), \ldots, (g,8)$. Hence, there are 14 possible new positions for the rook if the rook moves. To express this set of 14 elements in set-theoretic form, observe that there are 8 positions on row 2, namely the positions $(a,2), (b,2), \ldots, (h,2)$. In other words, row 2 is the set $\{(a,2), \ldots, (h,2)\} = \{a,b,\ldots,h\} \times \{2\} = C \times T$. Similarly, column 2 is the set $\{g\} \times \{1,\ldots,8\} = G \times R$. The set of positions in row 2 or column 2 is their union $(C \times T) \cup (G \times R)$. Observe that row 2 consists of 8 positions, column 2 consists of 8 positions, and their union $(C \times T) \cup (G \times R)$ consists of 15 positions (they have a common element $(g,2)$). If a rook must move, it cannot occupy its initial position $(g,2)$. This position is the unique element in the singleton set $\{ (g,2) \} = \{g\} \times \{2 \} = G \times T$. If you remove the element $(g,2)$ from the 15-element set, you get the expression $((C \times T) \cup (G \times R)) - (G \times T)$.

a) The eight or fewer positions of a knight at $(x,y)$ after a move are $\{(x \pm 1, y \pm 2\} \cup \{x \pm 2, \pm 1\}$ or if you really want to be fancy $\{x \pm a, y \pm (3 - a)|a \in \{1,2\}$ and the terms are within 1 to 8 $\}$.

But as there are only eight positions it's easier and clearer to just list them: (d,3)=> (c,1)(c,5)(e,1)(e,5)(b,2)(b,4)(f,2)(f,4)

b) $P = R \times C = \{(a,b)|a \in R; b \in C\}$.

c) Possible positions are $\{(x,2)\}\cup \{(g,y)\}= R\times\{2\} \cup \{g\} \times C = R \times T \cup G \times C$

For (a), you would move conveniently label the board position as $(4,3)$, and the $8$ possible destination squares as $(4\pm2,3\pm1)$ and $(4\pm1,3\pm2)$

• Note, that's in answer to your question about listing the spaces mathematically. Using the original question notation, the knight's possible location after one move is $(\{c,e\},\{1,5\})\;\cup\;(\{b,f\},\{2,4\})$

Guessing at the unclear meaning of (c), I would say that the position of the rook after one move $(R,C)$ is: either $(R=G$ and $C \ne T)$ or $(R\ne G$ and $C = T)$

Edit: And looking at the website you linked, I see that $R$ and $C$ are the set of possible values of rows and columns respectively, in which case I'd phrase my answer to (c) differently: the position of the rook after one move is defined by either $(R-G,T)$ or $(G, C-T)$