Problem

Source: German TST 2022, exam 2, problem 2

Tags: combinatorics, Enumerative Combinatorics, function



Given two positive integers $n$ and $m$ and a function $f : \mathbb{Z} \times \mathbb{Z} \to \left\{0,1\right\}$ with the property that \begin{align*} f\left(i, j\right) = f\left(i+n, j\right) = f\left(i, j+m\right) \qquad \text{for all } \left(i, j\right) \in \mathbb{Z} \times \mathbb{Z} . \end{align*}Let $\left[k\right] = \left\{1,2,\ldots,k\right\}$ for each positive integer $k$. Let $a$ be the number of all $\left(i, j\right) \in \left[n\right] \times \left[m\right]$ satisfying \begin{align*} f\left(i, j\right) = f\left(i+1, j\right) = f\left(i, j+1\right) . \end{align*}Let $b$ be the number of all $\left(i, j\right) \in \left[n\right] \times \left[m\right]$ satisfying \begin{align*} f\left(i, j\right) = f\left(i-1, j\right) = f\left(i, j-1\right) . \end{align*}Prove that $a = b$.