TITLE: Show that a generalized knight can return to its original position only after an even number of moves
QUESTION [41 upvotes]: Source: German Mathematical Olympiad
Problem:

On an arbitrarily large chessboard, a generalized knight moves by jumping p squares in one direction and q squares in a perpendicular direction, p, q > 0. Show that such a knight can return to its original position only after an even number of moves.

Attempt:
Assume, wlog, the knight moves $q$ steps to the right after its $p$ steps. Let the valid moves for the knight be "LU", "UR", "DL", "RD" i.e. when it moves Left, it has to go Up("LU"), or when it goes Up , it has to go Right("UR") and so on.
Let the knight be stationed at $(0,0)$. We note that after any move its coordinates will be integer multiples of $p,q$. Let its final position be $(pk, qr)$ for $ k,r\in\mathbb{Z}$. We follow sign conventions of coordinate system.
Let knight move by $-pk$ horizontally and $-qk$ vertically by repeated application of one step. So, its new position is $(0,q(r-k))$ I am thinking that somehow I need to cancel that $q(r-k)$ to achieve $(0,0)$, but don't be able to do the same.
Any hints please?

REPLY [24 votes]: This uses complex numbers.
Define $z=p+qi$. Say that the knight starts at $0$ on the complex plane. Note that, in one move, the knight may add or subtract $z$, $iz$, $\bar z$, $i\bar z$ to his position.
Thus, at any point, the knight is at a point of the form:
$$(a+bi)z+(c+di)\bar z$$
where $a$ and $b$ are integers.
Note that the parity (evenness/oddness) of the quantity $a+b+c+d$ changes after every move. This means it's even after an even number of moves and odd after an odd number of moves. Also note that:
$$a+b+c+d\equiv a^2+b^2-c^2-d^2\pmod2$$
(This is because $x\equiv x^2\pmod2$ and $x\equiv-x\pmod2$ for all $x$.)
Now, let's say that the knight has reached its original position. Then:
\begin{align}
(a+bi)z+(c+di)\bar z&=0\\
(a+bi)z&=-(c+di)\bar z\\
|a+bi||z|&=|c+di||z|\\
|a+bi|&=|c+di|\\
\sqrt{a^2+b^2}&=\sqrt{c^2+d^2}\\
a^2+b^2&=c^2+d^2\\
a^2+b^2-c^2-d^2&=0\\
a^2+b^2-c^2-d^2&\equiv0\pmod2\\
a+b+c+d&\equiv0\pmod2
\end{align}
Thus, the number of moves is even.

Interestingly, this implies that $p$ and $q$ do not need to be integers. They can each be any real number. The only constraint is that we can't have $p=q=0$.