1 Introduction

Throughout this paper, all rings are associative with identity. Let R be a ring, we use N(R) and Z(R) to denote the set of all nilpotent elements and the center, respectively.

In 1977, Ligh and Richou proved that if R is a ring with 1 which satisfies the identities: \((xy)^{k}=x^{k}y^{k}, k=n, n+1, n+2\), where n is a positive integer, then R is commutative (see [1]). In 2015, Wei and Fan proved that if R is a ring with 1, \(n\ge 1\) and for any \(x\in R\backslash N(R)\) and any \(y\in R\), \((xy)^{k}=x^{k}y^{k}, k=n, n+1, n+2\), then R is commutative (see Theorem 2.7 of [2] and Theorem 1.1 of [3]).

In this note, we generalize the above results as follows.

Theorem 1.1

Let R be a ring with 1. Suppose that for any \(x, y\in R\backslash N(R)\), there exists a nonnegative integer \(n=n(x, y)\) which relies on x and y such that \((xy)^{k}=x^{k}y^{k}, k=n, n+1, n+2\). Then R is commutative.

2 Preliminaries

Lemma 2.1

Let R be a ring with 1. Suppose that for any \(x, y\in R\), there exists a nonnegative integer \(n=n(x, y)\) which relies on x and y such that \((xy)^{k}=x^{k}y^{k}, k=n, n+1, n+2\). Then for any \(x, y\in R\), we have \(x^{n}[x, y^{n}]y=0\) and \(x^{n+1}[x, y^{n+1}]y=0\).

Proof

For any \(x, y\in R\), by the hypotheses, there exists a nonnegative integer \(n=n(x, y)\) which relies on x and y such that \((xy)^{k}=x^{k}y^{k}, k=n, n+1, n+2\). Then \(x^{n+1}y^{n+1}=(xy)^{n+1}=(xy)^{n}xy=x^{n}y^{n}xy\). Hence \(x^{n}(xy^{n}-y^{n}x)y=0\), i.e., \(x^{n}[x, y^{n}]y=0\). Similarly, we have \(x^{n+2}y^{n+2}=(xy)^{n+2}=(xy)^{n+1}xy=x^{n+1}y^{n+1}xy\). Hence \(x^{n+1}(xy^{n+1}-y^{n+1}x)y=0\), i.e., \(x^{n+1}[x, y^{n+1}]y=0\). \(\square \)

Lemma 2.2

Let R be a ring with 1 and \(a, x\in R\). Suppose that there exist nonnegative integers mn such that \([a, x]x^{m}=0\) and \([a, x](1+x)^{n}=0\). Then \([a, x]=0\).

Proof

There is no loss of generality to assume that \(m\ge 1\) and \(n\ge 1\). Let \(M=\{f\) is a nonnegative integer\(\mid [a, x]x^{f}=0\}\). Since \([a, x]x^{m}=0\), we see that M is nonempty. Then there exists \(m_{0}\in M\) such that \(m_{0}\) is the smallest number of M. Assume that \(m_{0}\ge 1\) and we work to obtain a contradiction. Since \(m_{0}\ge 1\) and \([a, x]x^{m_{0}}=0\), it is not very difficult to see that \([a, x]\{(1+x)^{n}x^{m_{0}-1}-x^{m_{0}-1}\}=0\), i.e., \([a, x](1+x)^{n}x^{m_{0}-1}-[a, x]x^{m_{0}-1}=0\). Recall that \([a, x](1+x)^{n}=0\). Hence \([a, x]x^{m_{0}-1}=0\), and thus \(m_{0}-1\in M\). This is a contradiction since \(m_{0}\) is the smallest number of M. Hence \(m_{0}=0\), and thus \([a, x]=0\). \(\square \)

Lemma 2.3

Let R be a ring with 1. Suppose that for any \(x, y\in R\), there exists a nonnegative integer \(n=n(x, y)\) which relies on x and y such that \((xy)^{k}=x^{k}y^{k}, k=n, n+1, n+2\). Then \(N(R)\subseteq Z(R)\).

Proof

It suffices to prove that for any \(a\in N(R)\) and any \(y\in R\), \([a, y]=0\). For any \(a\in N(R)\) and any \(y\in R\), by the the hypotheses, we have

$$\begin{aligned} \{(1+a)y\}^{k}= & {} (1+a)^{k}y^{k}, k=n, n+1, n+2, n=n(1+a, y); \end{aligned}$$
(2.1)
$$\begin{aligned} \{(1+a)(1+y)\}^{k}= & {} (1+a)^{k}(1+y)^{k}, k=n_{1}, n_{1}+1, n_{1}+2, n_{1}=n_{1}(1+a, 1+y). \end{aligned}$$
(2.2)

By (2.1) and Lemma 2.1, it follows that

$$\begin{aligned} (1+a)^{n}[1+a, y^{n}]y=0, (1+a)^{n+1}[1+a, y^{n+1}]y=0. \end{aligned}$$
(2.3)

Since \(a\in N(R)\), we see that \(1+a\) is invertible. Hence

$$\begin{aligned}&[a, y^{n}]y=[1+a, y^{n}]y=0, \end{aligned}$$
(2.4)
$$\begin{aligned}&[a, y^{n+1}]y=[1+a, y^{n+1}]y=0. \end{aligned}$$
(2.5)

By (2.4) and (2.5), it follows that

$$\begin{aligned}{}[a, y]y^{n+1}=[a, y^{n+1}]y-y[a, y^{n}]y=0. \end{aligned}$$
(2.6)

Similarly, by (2.2), we have

$$\begin{aligned}{}[a, (1+y)^{n_{1}}](1+y)=0, [a, (1+y)^{n_{1}+1}](1+y)=0. \end{aligned}$$
(2.7)

Similarly, by (2.7), we have

$$\begin{aligned}{}[a, y](1+y)^{n_{1}+1}=[a, 1+y](1+y)^{n_{1}+1}=0. \end{aligned}$$
(2.8)

By (2.6), (2.8) and Lemma 2.2, we see that \([a, y]=0\). This completes the proof. \(\square \)

By Lemma 2.3, it is not very difficult to prove the following lemma.

Lemma 2.4

Let R be a ring with 1. Suppose that for any \(x, y\in R\), there exists a nonnegative integer \(n=n(x, y)\) which relies on x and y such that \((xy)^{k}=x^{k}y^{k}, k=n, n+1, n+2\). Then N(R) is an ideal of R.

Lemma 2.5

Let R be a ring with 1. Suppose that for any \(x, y\in R\), there exist nonnegative integers \(m=m(x, y), n=n(x, y)\) which rely on x and y such that \(x^{m}[x, y]y^{n}=0\). Then R is commutative.

Proof

It suffices to prove that for any \(x, y\in R\), \([x, y]=0\). For any \(x, y\in R\), by the hypotheses, we have

$$\begin{aligned}&x^{m}[x, y]y^{n}=0, m=m(x, y), n=n(x, y); \end{aligned}$$
(2.9)
$$\begin{aligned}&(1+x)^{m_{1}}[x, y]y^{n_{1}}=(1+x)^{m_{1}}[1+x, y]y^{n_{1}}=0, m_{1}=m_{1}(1+x, y), n_{1}=n_{1}(1+x, y). \end{aligned}$$
(2.10)

Let \(M=\{f\) is a nonnegative integer\(\mid ~\)there exists a nonnegative integer h such that \(x^{f}[x, y]y^{h}=0\}\). By (2.9), we see that M is nonempty. Then there exists \(m_{0}\in M\) such that \(m_{0}\) is the smallest number of M. Since \(m_{0}\in M\), there exists a nonnegative integer \(n_{0}\) such that \(x^{m_{0}}[x, y]y^{n_{0}}=0\). Assume that \(m_{0}\ge 1\) and we work to obtain a contradiction. Since \(m_{0}\ge 1\) and \(x^{m_{0}}[x, y]y^{n_{0}}=0\), it is not very difficult to see that

$$\begin{aligned} \{x^{m_{0}-1}(1+x)^{m_{1}}-x^{m_{0}-1}\}[x, y]y^{n_{0}+n_{1}}=0. \end{aligned}$$
(2.11)

Combine (2.10) with (2.11), we see that

$$\begin{aligned} x^{m_{0}-1}[x, y]y^{n_{0}+n_{1}}=0. \end{aligned}$$
(2.12)

Hence \(m_{0}-1\in M\). This is a contradiction since \(m_{0}\) is the smallest number of M. Hence \(m_{0}=0\), and thus \([x, y]y^{n_{0}}=0\). Since y is an arbitrary element of R, we see that there exists a nonnegative integer \(n_{2}\) such that \([x, y](1+y)^{n_{2}}=0\). By Lemma 2.2, it follows that \([x, y]=0\). This completes the proof. \(\square \)

Lemma 2.6

Let R be a ring with 1. Suppose that for any \(x, y\in R\), there exists a nonnegative integer \(n=n(x, y)\) which relies on x and y such that \((xy)^{k}=x^{k}y^{k}, k=n, n+1, n+2\). Then R is commutative.

Proof

It suffices to prove that for any \(x, y\in R\), \([x, y]=0\). By Lemmas 2.3 and 2.4, it follows that \(N(R)\subseteq Z(R)\) and N(R) is an ideal of R. For any \(x, y\in R\), by the hypotheses, we have

$$\begin{aligned} (xy)^{k}= & {} x^{k}y^{k}, k=n, n+1, n+2, n=n(x, y); \end{aligned}$$
(2.13)
$$\begin{aligned} \{(1+x)y\}^{k}= & {} (1+x)^{k}y^{k}, k=n_{1}, n_{1}+1, n_{1}+2, n_{1}=n_{1}(1+x, y). \end{aligned}$$
(2.14)

By Lemma 2.1, it follows that

$$\begin{aligned}&x^{n}[x, y^{n}]y=0, x^{n+1}[x, y^{n+1}]y=0, \end{aligned}$$
(2.15)
$$\begin{aligned}&(1+x)^{n_{1}}[x, y^{n_{1}}]y=(1+x)^{n_{1}}[1+x, y^{n_{1}}]y=0, \end{aligned}$$
(2.16)
$$\begin{aligned}&(1+x)^{n_{1}+1}[x, y^{n_{1}+1}]y=(1+x)^{n_{1}+1}[1+x, y^{n_{1}+1}]y=0. \end{aligned}$$
(2.17)

Since \(x^{n+1}\{[x, y^{n}]y+y^{n}[x, y]\}y=x^{n+1}[x, y^{n+1}]y=0\), we see that

$$\begin{aligned} x^{n+1}y^{n}[x, y]y=0. \end{aligned}$$
(2.18)

Similarly, since \((1+x)^{n_{1}+1}\{[x, y^{n_{1}}]y+y^{n_{1}}[x, y]\}y=(1+x)^{n_{1}+1}[x, y^{n_{1}+1}]y=0\), we see that

$$\begin{aligned} (1+x)^{n_{1}+1}y^{n_{1}}[x, y]y=0. \end{aligned}$$
(2.19)

By (2.18), we see that

$$\begin{aligned} y^{n}[x, y]yx^{n+1}\in N(R). \end{aligned}$$
(2.20)

By (2.19), we see that

$$\begin{aligned} y^{n_{1}}[x, y]y(1+x)^{n_{1}+1}\in N(R). \end{aligned}$$
(2.21)

Let \(M=\{t\) is a nonnegative integer\(\mid ~\)there exists a nonnegative integer s such that \(y^{s}[x, y]yx^{t}\in N(R)\}\). By (2.20), we see that M is nonempty. Then there exists \(t_{0}\in M\) such that \(t_{0}\) is the smallest number of M. Since \(t_{0}\in M\), there exists a nonnegative integer \(s_{0}\) such that

$$\begin{aligned} y^{s_{0}}[x, y]yx^{t_{0}}\in N(R). \end{aligned}$$
(2.22)

Assume that \(t_{0}\ge 1\) and we work to obtain a contradiction. Since N(R) is an ideal of R, by (2.21) and (2.22), we have

$$\begin{aligned}&y^{n_{1}+s_{0}}[x, y]y\{x^{t_{0}-1}(1+x)^{n_{1}+1}-x^{t_{0}-1}\}\in N(R), \end{aligned}$$
(2.23)
$$\begin{aligned}&y^{n_{1}+s_{0}}[x, y]yx^{t_{0}-1}(1+x)^{n_{1}+1}=y^{n_{1}+s_{0}}[x, y]y(1+x)^{n_{1}+1}x^{t_{0}-1}\in N(R). \end{aligned}$$
(2.24)

Combine (2.23) with (2.24), we see that

$$\begin{aligned} y^{n_{1}+s_{0}}[x, y]yx^{t_{0}-1}\in N(R). \end{aligned}$$
(2.25)

Hence \(t_{0}-1\in M\). This is a contradiction since \(t_{0}\) is the smallest number of M. Hence \(t_{0}=0\). By (2.22), it follows that \(y^{s_{0}}[x, y]y\in N(R)\), and thus \([x, y]y^{s_{0}+1}\in N(R)\). Since \(N(R)\subseteq Z(R)\), we see that

$$\begin{aligned}{}[x, y]y^{s_{0}+1}\in Z(R). \end{aligned}$$
(2.26)

By (2.18), it follows that \(x^{n+1}y^{n}[x, y]y^{s_{0}+1}=0\). By (2.26), it follows that \(x^{n+1}[x, y]y^{n+s_{0}+1}=0\). By Lemma 2.5, we see that R is commutative. \(\square \)

3 Proof of Theorem 1.1

Proof of Theorem 1.1

At first, we work to prove that \([x, y]=0\) for any \(x\in N(R)\) and any \(y\in R\).

Assume that \(y\in N(R)\). Since \(x\in N(R)\), we see that \(1+x\) is invertible, in particular, \(1+x\in R\backslash N(R)\). Similarly, \(1+y\) is invertible, in particular, \(1+y\in R\backslash N(R)\). Let \(a=1+x\) and \(b=1+y\). By the the hypotheses, we have

$$\begin{aligned} (ab)^{k}=a^{k}b^{k}, k=n, n+1, n+2, n=n(a, b). \end{aligned}$$
(3.27)

By Lemma 2.1, it follows that \(a^{n}[a, b^{n}]b=0, a^{n+1}[a, b^{n+1}]b=0\). Since ab are invertible, we see that \([a, b^{n}]=0, [a, b^{n+1}]=0\). Hence \([a, b]b^{n}=[a, b^{n+1}]-b[a, b^{n}]=0\). Since b is invertible, we see that \([a, b]=0\), i.e., \([1+x, 1+y]=0\). Hence \([x, y]=0\).

Assume that \(y\in R\backslash N(R)\) and \(1+y\in N(R)\). Since \(1+y\in N(R)\), by the above proof, we see that \([x, 1+y]=0\), i.e., \([x, y]=0\).

Assume that neither y nor \(1+y\) is a nilpotent element of R. Since \(x\in N(R)\), we see that \(1+x\) is invertible, in particular, \(1+x\in R\backslash N(R)\). By the the hypotheses, we have

$$\begin{aligned} \{(1+x)y\}^{k}= & {} (1+x)^{k}y^{k}, k=n, n+1, n+2, n=n(1+x, y); \end{aligned}$$
(3.28)
$$\begin{aligned} \{(1+x)(1+y)\}^{k}= & {} (1+x)^{k}(1+y)^{k}, k=n_{1}, n_{1}+1, n_{1}+2, n_{1}=n_{1}(1+x, 1+y). \end{aligned}$$
(3.29)

By (3.28) and Lemma 2.1, it follows that \((1+x)^{n}[1+x, y^{n}]y=0, (1+x)^{n+1}[1+x, y^{n+1}]y=0\). Since \(1+x\) is invertible, we see that \([1+x, y^{n}]y=0, [1+x, y^{n+1}]y=0\), i.e., \([x, y^{n}]y=0, [x, y^{n+1}]y=0\). Hence

$$\begin{aligned}{}[x, y]y^{n+1}=[x, y^{n+1}]y-y[x, y^{n}]y=0. \end{aligned}$$
(3.30)

By (3.29) and Lemma 2.1, it follows that

$$\begin{aligned} (1+x)^{n_{1}}[1+x, (1+y)^{n_{1}}](1+y)=0, (1+x)^{n_{1}+1}[1+x, (1+y)^{n_{1}+1}](1+y)=0. \end{aligned}$$
(3.31)

Since \(1+x\) is invertible, we see that \([1+x, (1+y)^{n_{1}}](1+y)=0, [1+x, (1+y)^{n_{1}+1}](1+y)=0\). Hence

$$\begin{aligned}{}[1+x, 1+y](1+y)^{n_{1}+1}=[1+x, (1+y)^{n_{1}+1}](1+y)-(1+y)[1+x, (1+y)^{n_{1}}](1+y)=0. \end{aligned}$$
(3.32)

Hence

$$\begin{aligned}{}[x, y](1+y)^{n_{1}+1}=0. \end{aligned}$$
(3.33)

By (3.30), (3.33) and Lemma 2.2, it follows that \([x, y]=0\).

Now we have proved that for any \(x\in N(R)\) and any \(y\in R\), \([x, y]=0\).

For \(x, y\in R\), if either x or y is a nilpotent element of R, by the above proof, it follows that \([x, y]=0\), in particular, \((xy)^{k}=x^{k}y^{k}, k=n, n+1, n+2, n=1\). If neither x nor y is a nilpotent element of R, by the the hypotheses, there exists a nonnegative integer \(n=n(x, y)\) which relies on x and y such that \((xy)^{k}=x^{k}y^{k}, k=n, n+1, n+2\). By Lemma 2.6, it follows that R is commutative. This completes that proof. \(\square \)