1 Introduction

For notation and graph theory terminology not given here, we follow Diestel (1997) and Haynes et al. (1998). Let \(G=(V(G),E(G))\) be a finite, simple and undirected graph with vertex set \(V(G)\) and edge set \(E(G).\) The open neighborhood of a vertex \(v\) is \(N(v)=\{u\in V(G):uv\in E(G)\}\). If \(A \subset V (G)\), then \(N(A)\) denotes the union of open neighborhoods of all vertices of \(A.\) For two subsets \(A,B\) of \(V(G),\) \(E(A,B)=\{ab\in E(G):a\in A,b\in B\}.\)

The Cartesian product \(G\Box H\) of graphs \(G\) and \(H\) is the graph with vertex set \(V(G)\times V(H),\) where two vertices are adjacent if and only if they are equal in one coordinate and adjacent in the other.

We restrict our attention to the Cartesian product of \(C_{n}\) and \(C_{m},\) \(n,m\ge 3.\) Let \(V(C_{n})=\{0,1,\ldots ,n-1\}\), \(E(C_{n})=\{i(i+1), (n-1)0:i=0,1,\ldots ,n-2\}\). Hence we will denote vertices of \(V(C_m\Box C_n)\) by \((i,j)\) for \(i=0,1,\ldots ,m -\! 1\) and \(j=0,1,\ldots ,n-\! 1\). For the arbitrary integers \(i\) and \(j\) we will use the following notation

$$\begin{aligned}{}[i,j] = (i \hbox { mod } m, j \hbox { mod } n). \end{aligned}$$

A function \(f:V(G)\rightarrow {\fancyscript{P}}(\{1,\ldots ,k\})\) is called a \(k\)-rainbow dominating function of \(G\) (for short \(kRDF\) of \(G)\) if \( \bigcup \nolimits _{u\in N(v)}f(u)=\{1,\ldots ,k\},\) for each vertex \(v\in V(G)\) with \(f(v)=\varnothing .\) By \(w(f)\) we mean \(\sum _{v\in V(G)}\left| f(v)\right| \) and we call it the weight of a function \(f\) in \(G. \) The minimum weight of a \(kRDF\) of \(G\) is called the \(k\)-rainbow domination number of \(G\) and it is denoted by \(\gamma _{rk}(G).\) If \(f\) is a \(kRDF\) of \(G\) and \(w(f)=\gamma _{rk}(G),\) then \(f\) is called a \(\gamma _{rk}\)-function. For more information about rainbow domination we refer the reader to Brešar and Šumenjak (2007), Tong et al. (2009), Hartnell and Rall (1998), Wu and Rad (2013), Wu and Xing (2010), Šumenjak et al. (2013) and Xu (2009), where authors consider, in particular, connections between rainbow domination and Vizing conjecture.

Let \(f\) be any \(2RDF\) of \(C_{m}\Box C_{n}\). Define the following sets

$$\begin{aligned} V_{0}&= \{v\in V(C_{m}\Box C_{n}):f(v)=\varnothing \}, \\ V_{1}&= \{v\in V(C_{m}\Box C_{n}):f(v)=\{1\}\text { or }f(v)=\{2\}\}, \\ V_{2}&= \{v\in V(C_{m}\Box C_{n}):f(v)=\{1,2\}\}, \\ V_{i_{1}i_{2}}&= \{v\in V_{0}:\left| N(v)\cap V_{t}\right| =i_{t},t=1,2\}, \\ E_{1}&= \{uv\in E(C_{m}\Box C_{n}):u,v\in V_{1}\}, \\ E_{2}&= \{uv\in E(C_{m}\Box C_{n}):u,v\in V_{2}\}, \\ E_{12}&= \{uv\in E(C_{m}\Box C_{n}):u\in V_{1},v\in V_{2}\}. \end{aligned}$$

We need the following technical lemma.

Lemma 1

(Stȩpień and Zwierzchowski 2012) Let \(f\) be any \(2RDF\) of \(C_{m}\Box C_{n}\). Then

$$\begin{aligned} w(f)=\frac{mn}{3}+\frac{\beta }{6}, \end{aligned}$$

where

$$\begin{aligned} \beta&= 2\left| V_{2}\right| +\left| V_{11}\right| +3\left| V_{12}\right| +5\left| V_{13}\right| +2\left| V_{21}\right| +4\left| V_{22}\right| +\left| V_{30}\right| \\&+3\left| V_{31}\right| +2\left| V_{40}\right| +2\left| V_{02}\right| +4\left| V_{03}\right| +6\left| V_{04}\right| \\&+3\left| E_{12}\right| +2\left| E_{1}\right| +4\left| E_{2}\right| . \end{aligned}$$

Corollary 1

Let \(f\) be any \(2RDF\) of \(C_{m}\Box C_{n}\). Then \(w(f)\ge \frac{mn}{3}\) and equality holds if and only if \(\beta = 0.\)

In this paper we will use the following form of the Chinese Reminder Theorem.

Theorem 1

(Chinese Reminder Theorem) Two simultaneous congruences

$$\begin{aligned}&x \equiv a \pmod m, \\&x \equiv b \pmod n \end{aligned}$$

are solvable if and only if \(a\equiv b \pmod {\gcd (m,n)}\). Moreover the solution is unique modulo \(\mathrm{lcm}(m, n)\).

2 Results

For any integer \(s\), let \(L_s=\left\{ [k, k-s]\in V(C_m\Box C_n):k=0,\pm 1, \pm 2, \ldots \right\} \). The following theorem is a consequence of the Chinese Reminder Theorem.

Theorem 2

We have

$$\begin{aligned} V(C_{m}\Box C_{n})=\overset{\gcd (m,n)-1}{\underset{s=0}{\bigcup }}L_{s}. \end{aligned}$$

The sum is disjoint and \(|L_{s}|=\mathrm{lcm}(m,n).\)

Proof

By definition of \(L_s\) we have \(\bigcup _{s=0}^{\gcd (m,n)-1}\!\! L_s \subseteq V(C_m \Box C_n)\). Let \((i,j)\in V(C_m \Box C_n)\) and let \(s\in \{0,1,\ldots ,\gcd (m,n)-1\}\) be such that \(s\equiv i-j \pmod {\gcd (m,n)}\). By Theorem 1 there exists an integer \(k\) such that

$$\begin{aligned}&k\equiv i \pmod m, \\&k\equiv j+s \pmod n. \end{aligned}$$

Consequently, \((i,j) = [k, k-s] \in L_s\).

Next if the above system has any solution for a fixed \((i,j)\) and some \(s\), then again by Theorem 1 we have \(s\equiv i-j \pmod {\gcd (m,n)}.\) Hence \(L_{s_{1}}\cap L_{s_{2}}=\emptyset \) for \(s_{1}\ne s_{2}\) and \(s_{1},s_{2}\in \left\{ 0,1,\ldots ,\gcd (m,n)-1 \right\} .\) Finally, observe that cardinality of \(L_{s}\) is the same for each \(s\). Therefore \(|L_{s}|=\mathrm{lcm}(m,n).\) \(\square \)

For any integer \(s\), let us denote

$$\begin{aligned}{}[\![s ]\!]= s \hbox { mod } \gcd (m,n). \end{aligned}$$

Corollary 2

The following holds:

  1. 1.

    for any integers \(i,j\) we have \([i,j] \in L_{[\![i-j ]\!]}\),

  2. 2.

    if \(\gcd (m,n)>1\), then for any integer \(s\) we have

    $$\begin{aligned} N\left( L_{[\![s ]\!]}\right) =L_{[\![s-1 ]\!]} \cup L_{[\![s+1 ]\!]}, \end{aligned}$$
  3. 3.

    if \(\gcd (m,n)=1\), then we have

    $$\begin{aligned} V(C_m\Box C_n)=L_0. \end{aligned}$$

Now we introduce some definitions. Let \(f\) be a \(2\)-rainbow dominating function of \(C_m\Box C_n\). We say that \(f\) is positive if for any \((i,j)\in V(C_m\Box C_n)\) the following implication holds:

$$\begin{aligned} (i,j)\in V_1 \Rightarrow L_{[\![i-j ]\!]} \subset V_1. \end{aligned}$$

Let \(L_s^- =\left\{ [k, -k+s]\in V(C_m\Box C_n):k=0, \pm 1, \pm 2, \ldots \right\} \). Note that \([i,j]\in L_{[\![i+j ]\!]}^-\). We say that \(f\) is negative if for any \((i,j)\in V(C_m\Box C_n)\) the following implication holds:

$$\begin{aligned} (i,j)\in V_1 \Rightarrow L_{[\![i+j ]\!]}^- \subset V_1. \end{aligned}$$

Lemma 2

Let \(f\) be a \(2\)-rainbow dominating function of \(C_{m}\Box C_{n}\) such that \(w(f)=\frac{mn}{3}\). Then \(f\) is either positive or negative.

Proof

Let \(f\) be a \(2\)-rainbow dominating function of \(C_{m}\Box C_{n}\) such that \(w(f)=\frac{mn}{3}\). By Corollary 1, we get \(\beta =0.\) Hence \(|V_{2}|=|E_{1}|=|V_{30}|=|V_{40}|=0.\)

Take any vertex \((i,j)\in C_m\Box C_n\) such that \((i,j) \in V_1\). Assume, without loss of generality, that \(f\left( (i,j)\right) =\left\{ 1\right\} .\) Since \(|E_{1}|= 0\), we have

$$\begin{aligned} N\left( (i,j)\right) \subset V_{0}. \end{aligned}$$
(1)

We claim that also

$$\begin{aligned} \left\{ [i-2,j],\,[i+2,j],\,[i,j-2],\,[i,j+2]\right\} \subset V_{0}. \end{aligned}$$
(2)

To prove (2) suppose the contrary: assume, without loss of generality, that \([i,j+2]\in V_{1}.\) Then \([i+1,j+1],[i+1,j+2]\in V_{0}\) (otherwise \(|V_{30}\cup V_{40}\cup E_{1}|\ne 0).\) Since the vertex \([i+1,j+1]\) must be dominated in the sense of 2-rainbow domination, we get \(|V_{2}|\ne 0,\) a contradiction.

Observe that exactly one of \([i+1,j+1],\) \([i+1,j-1]\) belongs to \(V_{1}\). Indeed, on the one hand at most one of \([i+1,j+1],\) \([i+1,j-1]\) belongs to \(V_{1},\) since otherwise \(|V_{30}|\ne 0.\) On the other hand at least one of \([i+1,j+1],\) \([i+1,j-1]\) belongs to \(V_{1}\) and \(f\left( [i+1,j+1]\right) =\left\{ 2\right\} \) or \(f\left( [i+1,j-1]\right) =\left\{ 2\right\} \) (otherwise \([i+1,j]\) would not be dominated in the sense of 2-rainbow domination). Thus either \(f\left( [i+1,j+1]\right) =\left\{ 2\right\} \) or \(f\left( [i+1,j-1]\right) =\left\{ 2\right\} .\)

Assume that \(f\left( [i+1,j+1] \right) =\left\{ 2\right\} .\) This assumption combined with (1) and (2) imply that \([i+2,j+2] \in V_{1}.\) By induction we get \(L_{[[i-j]]}\subset V_{1}.\) Similarly, if \(f\left( [i+1,j-1] \right) =\left\{ 2\right\} \), then we get \(L^{-}_{[[i+j]]}\subset V_{1}.\) We have shown that if \((i,j)\in V_{1}\), then either \(L_{[[i-j]]}\subset V_{1}\) or \(L^{-}_{[[i+j]]}\subset V_{1}.\) Thus \(f\) is positive or negative.

Finally, suppose that \(f\) is positive and negative. This means that \(L_{s_{1}}\subset V_{1}\) and \(L^{-}_{s_{2}}\subset V_{1}\) for \(s_{1},s_{2}\in \left\{ 0, 1, \ldots , \gcd (m,n)-1 \right\} .\) To eliminate this possiblity, we will consider the following two cases.

  1. (a)

    There exists \(k\) such that \(s_{1}+s_{2} \equiv 2k \pmod {\gcd (m,n)}\). Consider the following system of simultaneous congruences

    $$\begin{aligned}&l\equiv k \pmod m, \\&l\equiv -k+s_{1}+s_{2} \pmod n . \end{aligned}$$

    By Theorem 1, there exists a solution \(l\). Hence \([k,k-s_{1}]=[l,-l+s_{2}]\), which means that \(L_{s_{1}}\cap L^{-}_{s_{2}}\ne \emptyset \). It is easy to see that this contradicts the fact that \(|V_{30}|= 0.\)

  2. (b)

    For all \(k\) we have \(s_{1}+s_{2} \equiv 2k+1 \pmod {\gcd (m,n)}\). Consider the following system of simultaneous congruences for some fixed \(k\)

    $$\begin{aligned}&l\equiv k \pmod m, \\&l\equiv -k+s_{1}+s_{2}-1 \pmod n . \end{aligned}$$

    By Theorem 1, there exists a solution \(l\). Hence \([l,-l+s_{2}-1]=[k,k-s_{1}]\in L_{s_1}\subset V_1\). Since vertices \([l,-l+s_{2}-1]\) and \([l,-l+s_{2}]\in L^{-}_{s_{2}}\subset V_1\) are adjacent, it contradicts the fact that \(|E_{1}| = 0.\)

Thus \(f\) is either positive or negative. \(\square \)

Lemma 3

Let \(f\) be a \(2\)-rainbow dominating function of \(C_{m}\Box C_{n}\) such that \(w(f)=\frac{mn}{3}\) then

  1. 1.

    \(\mathrm{lcm}(m,n)\equiv 0\pmod 2,\)

  2. 2.

    \(\gcd (m,n)\equiv 0\pmod 3.\)

Proof

Let \(f\) be a \(2\)-rainbow dominating function of \(C_{m}\Box C_{n}\) such that \(w(f)=\frac{mn}{3}\). By Lemma 2, \(f\) is either positive or negative. Assume, without loss of generality, that \(f\) is positive. Take any vertex \((i,j)\in C_m\Box C_n\) such that \((i,j)\in V_1.\) Hence \(L_{[\![i-j ]\!]} \subset V_1\).

The same argument as in the proof of Lemma 2 shows that

$$\begin{aligned} f((i,j))=f([i+2,j+2]) \quad \text { and } \quad f((i,j))\ne f([i+1,j+1]). \end{aligned}$$

Hence by induction we have \(|L_{[[i-j]]}|\equiv 0 \pmod 2.\) This together with Theorem 2 proves (1).

Now we will prove (2). If \(\gcd (m,n)=1\), then by Corollary 2(3) we have \(L_0 = V(C_m\Box C_n)\). Since \(f\) is positive, we have \(L_0=V_1\). Therefore, \(w(f)=mn\). This contradicts our assumption that \(w(f)=\frac{mn}{3}\). Consequently \(\gcd (m,n)>1\). Suppose that \(\gcd (m,n)= 2.\) Then \((i,j)\), \([i+1,j+1]\), \([i+2,j]\in L_{[\![i-j ]\!]} \subset V_1\). This implies that \([i+1,j]\in V_{30}\). However, this contradicts the fact that \(|V_{30}|=0.\) Hence \(\gcd (m,n) \ge 3\). Assume now that \(\gcd (m,n)>3.\)

By Corollary 2 and inclusions (1), (2) we get

$$\begin{aligned} L_{[\![i-j]\!]}\subset V_1, \quad L_{[\![i-j+1]\!]}\subset V_0, \quad L_{[\![i-j+2]\!]}\subset V_0. \end{aligned}$$

In particular \([i+1,j],\,[i+2,j+1],\,[i+2,j]\in V_{0}.\) To dominate \([i+2,j]\) we must have \([i+3,j]\in V_1\), and consequently \(L_{[\![i-j+3]\!]}\subset V_{1}\). Continuing in this way we get that for any \(l\ge 1\) we have

$$\begin{aligned} L_{[\![i-j+3l]\!]}\subset V_1, \quad L_{[\![i-j+3l+1]\!]}\subset V_0, \quad L_{[\![i-j+3l+2]\!]}\subset V_0. \end{aligned}$$
(3)

To prove (2) we must eliminate the following two possibilities.

  1. (a)

    Let \(\gcd (m,n)=3k+1\) for some \(k\ge 1\). Now \(L_{[\![i-j+3k ]\!]}\subset V_1\) and \(L_{[\![i-j+3k+1 ]\!]} = L_{[\![i-j ]\!]}\subset V_1\). This contradicts (3).

  2. (b)

    Let \(\gcd (m,n)=3k+2\) for some \(k\ge 1\). Now \( L_{[\![i-j+3k]\!]}\subset V_1,\) \(L_{[\![i-j+3k+1]\!]}\subset V_0\) and \(L_{[\![i-j+3k+2]\!]}=L_{[\![i-j ]\!]}\subset V_1. \) This contradicts (3). \(\square \)

Lemma 4

For \(k,l\ge 1\)

$$\begin{aligned} \gamma _{r2}(C_{6k}\Box C_{3l})=\gamma _{r2}(C_{3l}\Box C_{6k})=\frac{6k\cdot 3l}{3}. \end{aligned}$$

Proof

By Lemma 1, we have \(\gamma _{r2}(C_{m}\Box C_{n}) \ge \frac{mn}{3}.\) Hence for the proof it suffices to find a 2RDF of \(C_{6k}\Box C_{3l}\) of weight \(\frac{6k3l}{3}.\) First we define \(f:V\left( C_{6}\Box C_{3}\right) \rightarrow {\fancyscript{P}}\left( \left\{ 1,2\right\} \right) \) as follows

$$\begin{aligned} \begin{array}{c@{\quad }c@{\quad }c@{\quad }c@{\quad }c@{\quad }c} \varnothing &{} \varnothing &{} \{1\} &{} \varnothing &{} \varnothing &{} \{2\} \\ \varnothing &{} \{2\} &{} \varnothing &{} \varnothing &{} \{1\} &{} \varnothing \\ \{1\} &{} \varnothing &{} \varnothing &{} \{2\} &{} \varnothing &{} \varnothing \end{array}. \end{aligned}$$

It is easy to see that \(f\) is a 2RDF of \(C_{6}\Box C_{3}\) of weight \(6.\) The required function on \(C_{6k}\Box C_{3l}\) one can construct using this segment. Finally, the equality \(\gamma _{r2}(C_{6k}\Box C_{3l})=\gamma _{r2}(C_{3l}\Box C_{6k})\) follows by the symmetry. \(\square \)

We are ready to prove our main result.

Theorem 3

\(\gamma _{r2}(C_{m}\Box C_{n})=\frac{mn}{3}\) if and only if \(m=6k\) and \(n=3l\) or \(m=3k\) and \(n=6l\), \(k,l\ge 1\).

Proof

Let \(\gamma _{r2}(C_{m}\Box C_{n})=\frac{mn}{3}\) and \(f\) be a \(2RDF\) of \(C_{m}\Box C_{n}\) such that \(w(f)=\frac{mn}{3}\). By Lemma 3, we have \(\gcd (m,n)\equiv 0 \pmod 3\) and \(\mathrm{lcm}(m,n)\equiv 0 \pmod 2.\) Hence \(m\equiv 0 \pmod 3\), \(n\equiv 0 \pmod 3\) and at least one of \(m\) and \(n\) is even. This together with Lemma 4 proves our theorem. \(\square \)

The following theorem is the consequence of our considerations.

Theorem 4

Let \(m=6k\), \(n=3 l\). There are \( 6 \cdot 2^{\frac{\gcd (m,n)}{3}} \) \(\gamma _{r2}\)-functions of \(C_m\Box C_n\) and \( 2^{\frac{\gcd (m,n)}{3}} \) \(\gamma _{r2}\)-functions up to translations.