Minimum number of moves to reach a point $(p,q)$ on a grid.

combinatorics

Question: Suppose that one moves along the points $(m,n)$ in the plane where $m$ and $n$ are integers in such a way that each move is a diagonal step, that is, consists of one unit to the right or left followed by one unit either up or down,

(a) Which points $(p,q)$ can be reached from the origin?

(b) What is the minimum number of moves needed to reach such a point $(p,q)$?

My approach: Let us color the integer points present in the grid in the following manner:

Let $(0,0)$ be colored black and taking $(0,0)$ as the reference point let the remaining integer points be colored black and white alternately. For example: $(0,1)$ is colored white, $(0,2)$ is colored black, $(0,3)$ is colored white, $(0,4)$ is colored black and so on.

My aim is to prove that none other than each and every black point can be reached from the origin $(0,0)$.

Edit: Partial proof: Let us be at a point $(m,n)$ which is colored black after any number of moves. Now from $(m,n)$ a single step can take us to the point $(m-1,n+1)$ or $(m+1,n+1)$ or $(m+1,n-1)$ or $(m-1,n-1)$. Observe that all these points are black. Therefore, from a black point we can only move to a black point.

A same reasoning helps us in proving that from a white point we can only move to a white point.

Now, since $(0,0)$ is colored black, this implies that the permissible points $(p,q)$ must be points which are colored black.

Therefore, we have shown that from the origin we can only visit points which are black in color. But, we also need to prove that we can visit all the black points from the origin. How to prove the same?

Also, after trying out some examples I can conjecture that the minimum number of steps to reach a point $(p,q)$ (note that $(p,q)$ must be black in order to reach it from the origin) is $|p|,$ if $|p|\ge |q|$ and $|q|$ otherwise.

But again this is just based on intuition and I need a concrete proof for the same.

Best Answer

You can change the reference system $(x,y) \to (u,v)$ , to a diagonal one $$ \left\{ \matrix{ u = {{y + x} \over 2} \hfill \cr v = {{y - x} \over 2} \hfill \cr} \right.\quad \Leftrightarrow \quad \left\{ \matrix{ x = u - v \hfill \cr y = u + v \hfill \cr} \right. $$

The allowed steps then are $$ \left( {\Delta x,\Delta y} \right) \in \left[ {\left( { \pm 1, \pm 1} \right)} \right]\quad \Leftrightarrow \quad \left( {\Delta u,\Delta v} \right) \in \left[ {\left( { \pm 1,0} \right),\left( {0, \pm 1} \right)} \right] $$

The origin $O=(0,0)$ is the same in both systems.

Since in the $u,v$ reference the steps are unitary in both axes, and performed separately, then clearly any point with integral coordinates $(u,v) \in {\mathbb Z}^2$ can be reached, in a minimum number of steps $N_{min}=|u|+|v|$.

Transforming back to the $x,y$ plane $$ \eqalign{ & \left\{ \matrix{ u \in Z \hfill \cr v \in Z \hfill \cr} \right.\quad \Rightarrow \quad \left\{ \matrix{ u = 2n + j\quad \left| {\;n \in Z,\;j = 0,1} \right. \hfill \cr v = 2m + k\quad \left| {\;m \in Z,\;k = 0,1} \right. \hfill \cr} \right.\quad \Rightarrow \cr & \Rightarrow \quad \left\{ \matrix{ x = u - v = 2\left( {n - m} \right) + j - k = 2p + i \hfill \cr y = u + v = 2\left( {n + m} \right) + j + k = 2q + i \hfill \cr} \right.\quad \left| {\;p,q \in Z,\;i = 0,1} \right. \cr} $$ which means that only and all the $x,y$ integral points having same parity can be reached, and that the minimum number of steps will correspond to $max(|y|,|x|)$.