1 Introduction

In an edge-colored graph, a copy of a graph H is called rainbow if every edge in the copy receives a unique color. If we forbid rainbow copies of some graphs in properly edge-colored graphs G, what is the maximum number of edges in G? This extremal question was first investigated by Keevash, Mubayi, Sudakov, and Verstraëte [8], where they defined the rainbow Turán number \(\textrm{ex}^*(n,{\mathcal {H}})\) for a family of graphs \({\mathcal {H}}\). Formally, \(\textrm{ex}^*(n,{\mathcal {H}})\) denotes the maximum number of edges in a properly edge-colored n-vertex graph with no rainbow copies of any \(H\in {\mathcal {H}}\). If \({\mathcal {H}}\) consists of a single graph H, then we simply write \(\textrm{ex}^*(n,H)\) instead of \(\textrm{ex}^*(n,\{H\})\).

To quote [8], there are two questions that are the most important among the several ones raised therein. The first one is to determine \(\textrm{ex}^*(n,{\mathcal {C}})\), where \({\mathcal {C}}\) is the class of all cycles. It is shown that \(\textrm{ex}^*(n,{\mathcal {C}})=\Omega (n\log n)\) in [8] and Das, Lee, and Sudakov [3] obtained an upper bound \(O(ne^{(\log n)^{\frac{1}{2}+o(1)}})\). This was improved by Janzer [5] to \(O(n\log ^4 n)\) and the current best one is \(O(n(\log n)^{2+o(1)})\) due to Tomon [9]. We improve Tomon’s bound to \(O(n\log ^2 n)\).

Theorem 1.1

A properly edge-colored n-vertex graph G with at least \(32n\log ^2 (5n)\) edges always contains a rainbow cycle.

The second question in [8] concerns \(\textrm{ex}^*(n,C_{2k})\), where \(C_{2k}\) is the even cycle of length 2k. In [8], a general lower bound \(\textrm{ex}^*(n,C_{2k})=\Omega (n^{1+1/k})\) is obtained, whereas the matching upper bounds were only verified for \(k=2,3\). This upper bound was subsequently improved by Das, Lee, and Sudakov [3] to \(O(n^{1+(1+o_k(1))\log k/k})\) and by Janzer [5] to \(O(n^{1+1/k})\). While Janzer’s bound matches the lower bound given in [8], the implicit constant is exponential in k. We improve it to a polynomial one as follows.

Theorem 1.2

A properly edge-colored n-vertex graph G with at least \(10^5 k^3 n^{1+1/k}\) edges always contains a rainbow 2k-cycle.

Whereas the recent improvement in [9] took a different approach to that of Janzer [5], our proof is in spirit closer to that of [5] using homomorphism counts and improves it in two ways. First, we use a more efficient lopsided regularization lemma than the Jiang–Seiver lemma [7] used by Janzer. Second, the main proof after regularization is conceptually simpler and more intuitive in the sense that it only relies on repeated applications of the Cauchy–Schwarz inequality.

We stress that the repeated Cauchy–Schwarz method may be of independent interest. There are various problems in extremal combinatorics, from the classical Mantel’s theorem and the Kővári–Sós–Turán theorem to the recent developments on Sidorenko’s conjecture, where the Cauchy–Schwarz inequality and its variants have been extremely useful; however, the convexity inequalities have seen less success in determining extremal numbers of bipartite graphs other than complete bipartite graphs.

To the best of our knowledge, it has been unknown whether even the Bondy–Simonovits theorem [2], a weaker statement than Theorem 1.2, has a proof that only uses the Cauchy–Schwarz inequality. Our proof method answers this natural question by giving a simple proof of the Bondy–Simonovits theorem and moreover, obtains the Erdős–Simonovits supersaturation for even cycles [4] as follows.

Corollary 1.3

Any n-vertex graph G with average degree \(d\ge 2\cdot 10^5 k^3 n^{1/k}\) contains at least \(\frac{1}{2}(2^{12}k)^{-k}d^{2k}\) copies of the 2k-cycle.

2 The Key Homomorphism Inequality

In what follows, a coloring always means an edge coloring and likewise, a colored graph is an edge-colored graph. Let \(\textrm{Hom}(H,G)\) be the set of homomorphisms from H to G. In particular, we fully label vertices of H.

Each homomorphism in \(\textrm{Hom}(C_{2k},G)\) can be seen as a closed walk \(v_0v_1\dots v_{2k}\) of length 2k (or closed 2k-walk for short) in G with \(v_0=v_{2k}\). Let \(\phi \) be a proper coloring of a graph G. A closed 2k-walk is degenerate if, for distinct i and j with \(\{i,j\}\ne \{0,2k\}\), \(v_i=v_j\) or \(\phi (v_iv_{i+1}) = \phi (v_jv_{j+1})\), where the index addition is taken modulo 2k. That is, the walk revisits a vertex in the middle or repeats a color. The former case is said to be vertex-degenerate at (i, j) and the latter is called color-degenerate at (i, j). If a 2k-walk is vertex-degenerate (resp. color-degenerate) at (ij), then it is of type \(|i-j|-1\) (resp. \(|i-j|\)).

One degenerate walk may have multiple types, so the types of degeneracy are not disjoint in general. As \(\phi \) is a proper coloring, a closed walk is vertex-degenerate of type 1 if and only if it is color-degenerate of type 1. Note that a non-degenerate 2k-walk is a rainbow cycle of length 2k. Let \({\mathcal {D}}(C_{2k},G)\) be the set of all degenerate closed walks of length 2k and let \(S_k\) be the star with k leaves. If G has no rainbow 2k-cycle, then \(\textrm{Hom}(C_{2k},G)= {\mathcal {D}}(C_{2k},G)\). Our strategy is to bound \(|{\mathcal {D}}(C_{2k},G)|\) from above to obtain an upper bound for \(|\textrm{Hom}(C_{2k},G)|\).

Lemma 2.1

Given a colored graph G, let \({\mathcal {U}}_1\) be the set of closed 2k-walks in G that are vertex-degenerate at (0, 2). Then

$$\begin{aligned} |\textrm{Hom}(C_{2k},G)| \le \left( \frac{|\textrm{Hom}(C_{2k},G)|}{|{\mathcal {U}}_1|}\right) ^k \cdot |\textrm{Hom}(S_k,G)| \quad \text {and} \quad |{\mathcal {D}}(C_{2k},G)| \le 4k^2|{\mathcal {U}}_1|. \end{aligned}$$

In particular, if G has no rainbow 2k-cycle, then \(|\textrm{Hom}(C_{2k},G)| \le (2k)^{2k} |\textrm{Hom}(S_k,G)|.\)

Proof

Let \({\mathcal {U}}_s\) and \({\mathcal {F}}_s\) be the set of closed 2k-walks that are vertex-degenerate at \((0,s+1)\) and color-degenerate at (0, s), respectively, i.e., they consist of those walks of type s. Note that \({\mathcal {U}}_1={\mathcal {F}}_1\). \(\square \)

Claim 2.2

For \(1\le s\le k-1\) and \(1\le t \le k\),

$$\begin{aligned} |{\mathcal {U}}_s|^2\le |{\mathcal {U}}_1| \cdot |{\mathcal {U}}_{2s-1}| \hspace{5.0pt}\text {and} \hspace{5.0pt}|{\mathcal {F}}_t|^2 \le |{\mathcal {F}}_1|\cdot |{\mathcal {F}}_{2t-1}|. \end{aligned}$$
(1)

In particular, \(|{\mathcal {U}}_s|\le |{\mathcal {U}}_1|\) and \(|{\mathcal {F}}_t|\le |{\mathcal {F}}_1|\) for all \(1\le s\le 2k-3\) and \(1\le t \le 2k-1\).

Proof of the claim

For \(s=1\), the inequality becomes a trivial equality, so we may assume \(s>1\). The key idea is to analyze \({\mathcal {U}}_s\) by counting the closed walks therein in the following way:

  • fix vertices \(x=v_0=v_{s+1}\), \(y=v_{s+k}\), and \(z=v_s\) with \(xz\in E(G)\);

  • choose a walk \(v_{s+1}v_{s+2}\dots v_{s+k}\) of length \(k-1\) from x to y;

  • choose a walk \(v_{s+k}v_{s+k+1}\dots v_{2k}\) of length \(k-s\) from y to x; and

  • choose a walk \(v_0v_1\dots v_{s}\) of length s from x to z.

Let \(w_{\ell }(u,v)\) be the number of walks of length \(\ell \) from u to v and let g(uv) be the edge indicator function of G, i.e., \(g(u,v)=1\) if \(uv\in E(G)\) and 0 otherwise. Then

$$\begin{aligned} |{\mathcal {U}}_s| = \sum _{x,y,z} w_{k-1}(x,y) w_{k-s}(y,x)w_{s}(x,z)g(x,z). \end{aligned}$$

The Cauchy–Schwarz inequality now gives the following bound:

$$\begin{aligned} |{\mathcal {U}}_s|^2&\le \left( \sum _{x,y,z} w_{k-1}(x,y)^2g(x,z)\right) \left( \sum _{x,y,z} w_{k-s}(y,x)^2w_{s}(x,z)^2 g(x,z)\right) \\&\le \left( \sum _{x,y,z} w_{k-1}(x,y)^2g(x,z)\right) \left( \sum _{x,y,z} w_{k-s}(y,x)^2w_{s}(x,z)^2\right) , \end{aligned}$$

where the second inequality follows from \(g(x,y)\le 1\). The sum \(\sum _{x,y,z} w_{k-1}(x,y)^2g(x,z)\) counts the number of closed \((2k-2)\)-walks plus a pendant edge that corresponds to xz, which are exactly the 2k-walks in \({\mathcal {U}}_1\). Thus, \(\sum _{x,y,z} w_{k-1}(x,y)^2\,g(x,z)=|{\mathcal {U}}_1|\). Analogously, the term \(w_{k-s}(y,x)^2\) and \(w_{s}(x,z)^2\) count the number of closed walks of length \(2(k-s)\) and 2s when summed over the choices of y and z, respectively, both starting at x. Thus, summing \(w_{k-s}(y,x)^2w_{s}(x,z)^2\) over \(x,y,z\in V(G)\) counts the number of closed 2k-walks that are vertex-degenerate at (0, 2s), which is exactly \(|{\mathcal {U}}_{2s-1}|\). Therefore, \(|{\mathcal {U}}_s|^2\le |{\mathcal {U}}_1|\cdot |{\mathcal {U}}_{2\,s-1}|\).

Let \({\mathcal {U}}_j\) be the largest set among \({\mathcal {U}}_1,\cdots ,{\mathcal {U}}_{2k-3}\). By symmetry, \(|{\mathcal {U}}_j|=|{\mathcal {U}}_{2k-2-j}|\), which allows us to assume \(j\le k-1\). Then \(|{\mathcal {U}}_j|\le |{\mathcal {U}}_1|^{1/2}|{\mathcal {U}}_{2j-1}|^{1/2}\le |{\mathcal {U}}_1|^{1/2}|{\mathcal {U}}_j|^{1/2}\), so \(|{\mathcal {U}}_j|=|{\mathcal {U}}_1|\). This proves \(|{\mathcal {U}}_s|\le |{\mathcal {U}}_1|\) for all \(s=1,2,\cdots ,2k-3\).

The second inequality for \({\mathcal {F}}_t\) can also be obtained by using essentially the same technique. As each closed 2k-walk \(v_0\dots v_{2k}\) in \({\mathcal {F}}_t\) satisfies \(\phi (v_0v_{1}) = \phi (v_{t}v_{t+1})\), we count \(|{\mathcal {F}}_t|\) as follows:

  • fix a color c that repeats at \(v_0v_1\) and \(v_{t}v_{t+1}\);

  • fix vertices \(x=v_0=v_{2k}\) and \(y=v_{k}\);

  • choose a walk \(v_{0}v_1\dots v_{k}\) of length k from x to y where \(\phi (v_0v_{1})=c\); and

  • choose a walk \(v_{k}v_{k+1}\dots v_{2k}\) of length k from y to x where \(\phi (v_{t}v_{t+1})=c\).

Let \({\tilde{w}}_{k,\ell }(u,v,c)\) be the number of k-walks from u to v such that the \(\ell \)-th edge has color c. The Cauchy–Schwarz inequality then gives

$$\begin{aligned} |{\mathcal {F}}_t|^2&= \left( \sum _{x,y,c} {\tilde{w}}_{k,1}(x,y,c) {\tilde{w}}_{k,t-k+1}(y,x,c)\right) ^2 \\&\le \left( \sum _{x,y,c} {\tilde{w}}_{k,1}(x,y,c)^2\right) \left( \sum _{x,y,c} {\tilde{w}}_{k,t-k+1}(y,x,c)^2\right) . \end{aligned}$$

The sum \(\sum _{x,y,c} {\tilde{w}}_{k,1}(x,y,c)^2\) counts the number of closed 2k-walks from x that repeat c at the first and the last edges, which is exactly \(|{\mathcal {F}}_1|\) by rotational symmetry. Similarly, the second sum corresponds to \(|{\mathcal {F}}_{2t-2k+1}|=|{\mathcal {F}}_{2t-1}|\). Therefore, we obtain the inequality \(|{\mathcal {F}}_t|^2 \le |{\mathcal {F}}_1|\cdot |{\mathcal {F}}_{2t-1}|\). Finally, \(|{\mathcal {F}}_t|\le |{\mathcal {F}}_1|\) follows from the symmetry that yields \(|{\mathcal {F}}_t|= |{\mathcal {F}}_{2k-t}|\) and verbatim the same argument used for showing \(|{\mathcal {U}}_s|\le |{\mathcal {U}}_1|\). \(\square \)

Claim 2.3

\(|{\mathcal {D}}(C_{2k},G)| \le 4k^2 |{\mathcal {U}}_1|\).

Proof of the claim

Recall that both \({\mathcal {U}}_s\) and \({\mathcal {F}}_s\) specify the labels of the vertices where degeneracy occurs. By rotational symmetry, the number of closed 2k-walks that are vertex-degenerate at \((i,i+s+1)\) is exactly \(|{\mathcal {U}}_s|\) for each \(i=0,1,\dots , 2k-1\). Likewise, the number of closed 2k-walks that are color-degenerate at \((i,i+s)\) is \(|{\mathcal {F}}_s|\) for each \(i=1,2,\dots ,2k\). Thus, the number of degenerate \(C_{2k}\)-homomorphisms of type s is at most \(2k(|{\mathcal {U}}_s|+|{\mathcal {F}}_s|)\). Taking the union bound over all possible types, we get

$$\begin{aligned} |{\mathcal {D}}(C_{2k},G)| \le 2k\left( \sum _{s=1}^{k-1}|{\mathcal {U}}_s| + \sum _{s=1}^k |{\mathcal {F}}_s|\right) . \end{aligned}$$
(2)

Together with Claim 2.2 this yields \(|{\mathcal {D}}(C_{2k},G)| \le 4k^2|{\mathcal {U}}_1|\) as desired. \(\square \)

Let \({\mathcal {O}}_s\) be the set of all closed 2k-walks \(v_0\dots v_{2k}\) with \(v_0= v_{2k}\) such that \(v_0 = v_2 = \dots = v_{2s}\). In particular, \({\mathcal {O}}_1 = {\mathcal {U}}_1 = {\mathcal {F}}_1\) and \({\mathcal {O}}_{k}={\mathcal {O}}_{k-1}\subseteq {\mathcal {O}}_{k-2}\subseteq \cdots \subseteq {\mathcal {O}}_1\). We also use \({\mathcal {O}}_0 = \textrm{Hom}(C_{2k},G)\) for consistency.

Claim 2.4

The sequence \(|{\mathcal {O}}_s|\), \(0\le s\le k\), is log-convex, i.e., for each \(s=1,\dots , k-1\),

$$\begin{aligned} |{\mathcal {O}}_{s}|^2\le |{\mathcal {O}}_{s-1}|\cdot |{\mathcal {O}}_{s+1}|. \end{aligned}$$

Proof of the claim

A star-walk of length \(\ell \) is a walk \(u_0u_1\dots u_{\ell }\) of length \(\ell \) such that every even-indexed vertex is the same one, i.e., \(u_0=u_2=\dots =u_{2t}\) where \(t=\lfloor \tfrac{\ell }{2}\rfloor \). If \(s=k-1\), then the inequality \(|{\mathcal {O}}_{k-1}|^2\le |{\mathcal {O}}_{k-2}|\cdot |{\mathcal {O}}_{k}|\) trivially follows from the fact \({\mathcal {O}}_k={\mathcal {O}}_{k-1}\) and \({\mathcal {O}}_{k-1}\subseteq {\mathcal {O}}_{k-2}\).

For \(1\le s\le k-2\), the walks in \({\mathcal {O}}_s\) can be counted as follows:

  • fix vertices \(x=v_0=v_2=\dots =v_{2s}\), \(y=v_{s+1}\), \(z=v_{k+s+1}\), where y is either x or a neighbor of x depending on the parity of s;

  • choose a walk \(v_{k+s+1}v_{k+s+2}\dots v_{2k}\) of length \(k-s-1\) from z to x;

  • choose a star-walk \(v_0v_1\dots v_{s+1}\) of length \(s+1\) from x to y;

  • choose a walk \(v_{k+s+1}v_{k+s}\dots v_{2s}\) of length \(k-s+1\) from z to x; and

  • choose a star-walk \(v_{2s}v_{2s-1}\dots v_{s+1}\) of length \(s-1\) from x to y.

As in the proof of Claim 2.2, \(w_{\ell }(u,v)\) denotes the number of \(\ell \)-walks from u to v. Let \(\sigma _{\ell }(u,v)\) be the number of star-walks of length \(\ell \) from u to v. Note that, unlike \(w_\ell (\cdot ,\cdot )\), \(\sigma _\ell (\cdot ,\cdot )\) may not be a symmetric function in general. Now we can compute \(|{\mathcal {O}}_s|\) as

$$\begin{aligned} |{\mathcal {O}}_s| = \sum _{x,y,z} w_{k-s-1}(z,x)\sigma _{s+1}(x,y)w_{k-s+1}(z,x)\sigma _{s-1}(x,y). \end{aligned}$$

The Cauchy–Schwarz inequality then yields

$$\begin{aligned} |{\mathcal {O}}_s|^2 \le \left( \sum _{x,y,z} w_{k-s-1}(z,x)^2\sigma _{s+1}(x,y)^2\right) \left( \sum _{x,y,z} w_{k-s+1}(z,x)^2\sigma _{s-1}(x,y)^2\right) . \end{aligned}$$

In the first sum, \(\sigma _{s+1}(x,y)^2\) counts either a closed star-walk of length \(2(s+1)\) (if s is odd and \(x=y\)) from x or a star-walk of length 2s together with an edge xy (if s is even and \(xy\in E(G)\)). By considering xy and yx as the \((s+1)\)-th and \((s+2)\)-th edge of the star-walk, summing the latter case over all choices of y counts the closed star-walks of length \(2(s+1)\). Hence the first sum counts the number of walks in \({\mathcal {O}}_{s+1}\) by summing the number of ways to augment each closed walk of length \(2(k-s-1)\) by a closed star-walk of length \(2(s+1)\) at x. By the same reason with replacing \(s+1\) by \(s-1\), the second sum counts the number of walks in \({\mathcal {O}}_{s-1}\), which proves the claim. \(\square \)

We are now ready to finish the proof of the lemma. By Claim 2.4,

$$\begin{aligned} \frac{|\textrm{Hom}(C_{2k},G)|}{|{\mathcal {U}}_1|} = \frac{|{\mathcal {O}}_0|}{|{\mathcal {O}}_1|} \ge \frac{|{\mathcal {O}}_1|}{|{\mathcal {O}}_2|} \ge \dots \ge \frac{|{\mathcal {O}}_{k-1}|}{|{\mathcal {O}}_k|}. \end{aligned}$$

Therefore,

$$\begin{aligned} \frac{|{\mathcal {O}}_0|}{|{\mathcal {O}}_k|} = \frac{|{\mathcal {O}}_0|}{|{\mathcal {O}}_1|} \cdot \frac{|{\mathcal {O}}_1|}{|{\mathcal {O}}_2|} \dots \frac{|{\mathcal {O}}_{k-1}|}{|{\mathcal {O}}_{k}|} \le \left( \frac{|{\mathcal {O}}_0|}{|{\mathcal {O}}_1|}\right) ^k. \end{aligned}$$

Each closed 2k-walk in \({\mathcal {O}}_k\) is of the form \(vu_1vu_2\dots vu_kv\), which naturally corresponds to a homomorphism from \(S_k\) to G that maps the central vertex to v and the i-th leaf to \(u_i\). Therefore,

$$\begin{aligned} \frac{|\textrm{Hom}(C_{2k},G)|}{|\textrm{Hom}(S_{k},G)|}=\frac{|{\mathcal {O}}_0|}{|{\mathcal {O}}_k|}\le \left( \frac{|{\mathcal {O}}_0|}{|{\mathcal {O}}_1|}\right) ^k=\left( \frac{|\textrm{Hom}(C_{2k},G)|}{|{\mathcal {U}}_1|}\right) ^k, \end{aligned}$$

which concludes the proof. \(\square \)

3 Regularization

Suppose that the n-vertex graph G is “close" to being regular, e.g., \(|\textrm{Hom}(S_k,G)|\le 10n^{k+1}p^k\), where \(p=2e(G)/n^2\) is the edge density of G. Here the constant 10 is arbitrarily chosen to illustrate. If G contains no rainbow 2k-cycles, then Lemma 2.1 gives

$$\begin{aligned} n^{2k}p^{2k}\le |\textrm{Hom}(C_{2k},G)|\le (2k)^{2k}|\textrm{Hom}(S_k,G)|\le 10\cdot (2k)^{2k} n^{k+1}p^{k}, \end{aligned}$$

where the first inequality follows from the fact that even cycles satisfy Sidorenko’s conjecture. As a corollary, \(e(G)\le 2\cdot 10^{1/k}k^2n^{1+1/k}\), which is stronger than Theorem 1.2.

However, this ideal assumption is not guaranteed in general. Instead, the following two lemmas will enable us to “regularize" the graph G.

Lemma 3.1

Let G be a properly edge-colored graph with minimum degree \(\delta (G)\ge 1\). Then there exists a properly edge-colored graph \(G'\) with the following properties:

  1. (1)

    \(G'\) satisfies \(|V(G)|\le |V(G')|\le 4e(G)/\delta (G)\) and every vertex of \(G'\) has degree between \(\delta (G)/2\) and \(\delta (G)\);

  2. (2)

    There is a color-preserving homomorphism \(\psi \) from \(G'\) to G. In particular, if \(G'\) contains a rainbow cycle, then so does G.

Proof

Let \(\delta :=\delta (G)\) for brevity. We construct \(G'\) by iterating the following process. Fix an ordering the vertices of G. At each step, take a vertex \(v\in V(G)\) according to the ordering and let \(s:=\lceil d_G(v)/\delta \rceil \). We then split v into new vertices \(v_1,\dots , v_s\) so that the neighbor sets \(N(v_1),\dots , N(v_s)\) form a partition of the neighbor set of v in G and \(\delta /2 \le |N(v_i)|\le \delta \) for every \(1\le i \le s\). This is possible since \(d_G(v)\ge \delta \) and we can make the sizes of \(N(v_1),N(v_2),\cdots , N(v_s)\) as equal as possible. We color the edges in such a way that each edge \(uv_i\) for \(u\in N_G(v)\) inherits the same color as uv.

Let \(\psi \) be a map from \(G'\) to G so that each vertex maps to the original vertex of G before splitting. Then \(\psi \) is a color-preserving homomorphism and every vertex of \(G'\) has degree between \(\delta /2\) and \(\delta \). Since the number of edges is preserved throughout the whole process,

$$\begin{aligned} |V(G')|\cdot \delta /2 \le 2e(G')=2e(G), \end{aligned}$$

which implies \(|V(G')|\le 4e(G)/\delta \). Finally, the color-preserving homomorphism \(\psi \) maps a rainbow cycle in \(G'\) to a rainbow circuit in G which contains a rainbow cycle. This proves the “in particular" part. \(\square \)

Lemma 3.2

Let \(k\ge 2\) and let G be an n-vertex bipartite graph with average degree \(d>0\). Suppose that G contains no proper subgraph with larger average degree. Then G contains a subgraph \(G'\) with bipartition (AB) satisfying the following for some \(i\in {\mathbb {N}}\):

  1. (1)

    \(|A| \ge \frac{1}{k}2^{-\frac{ki}{k-1}}n\), \(|B|\ge \frac{n}{64}\);

  2. (2)

    \(d_{G'}(a) \in [2^{i-6} d, 2^{i-5} d ]\) for all \(a\in A\);

  3. (3)

    \(d_{G'}(b) \le 4d\) for all \(b\in B\).

Proof

Denote by (XY) a bipartition of G. Let \(X_0\) and \(Y_0\) be the set of vertices in X and Y, respectively, of degree at least 4d and let \(X_1:=X\setminus X_0\) and \(Y_1:=Y\setminus Y_0\). Then \(|X_0|, |Y_0|\le e(G)/(4d)=n/8\).

Since there is no proper subgraph of G with average degree larger than d,

$$\begin{aligned} e(G[X_0,Y_0]) \le \frac{1}{2}(|X_0|+|Y_0|)d \le \frac{nd}{8}=\frac{1}{4}e(G). \end{aligned}$$

Hence, one of \(G[X_0,Y_1]\), \(G[X_1, Y_0]\) and \(G[X_1,Y_1]\) has at least e(G)/4 edges. By symmetry, we can assume that for some \(X'\in \{X_0,X_1\}\), the graph \(G[X',Y_1]\) has at least e(G)/4 edges.

As \(G[X',Y_1]\) has at least e(G)/4 edges and average degree at least d/4, we can delete some vertices of \(G[X',Y_1]\) to obtain a graph \(G_1=G[X^*,Y^*]\) with minimum degree at least d/16 and \(e(G_1)\ge e(G)/8\). Since the vertices in \(Y^*\) have degree at most 4d,

$$\begin{aligned} |Y^*|\ge \frac{e(G_1)}{4d} \ge \frac{e(G)}{32d}=\frac{n}{64}. \end{aligned}$$

We partition \(X^*\) into the following sets

$$\begin{aligned} Z_i = \left\{ v\in X^*:d_{G_1}(v) \in [2^{i-6}d, 2^{i-5}d) \right\} , \quad i\in {\mathbb {N}}. \end{aligned}$$

If there exists i such that \(|Z_i| \ge \frac{1}{k}2^{-\frac{ki}{k-1}}n\), then take A to be \(Z_i\) and \(B=Y^*\), and we are done. If not, then we have

$$\begin{aligned} \frac{e(G)}{8} \le e(G_1) \le \sum _{i=1}^{\infty } |Z_i|\cdot 2^{i-5}d< \frac{dn}{32k}\cdot \sum _{i=1}^{\infty } 2^{-\frac{i}{k-1}}< \frac{d n}{32 k} \cdot \frac{1}{1 - 2^{-\frac{1}{k-1}}} < \frac{dn }{16}. \end{aligned}$$

In the last inequality we used the facts that \(2^{-x} \le 1-x/2\) for \(0\le x \le 1\) and that \(0<\frac{1}{k-1}\le 1\) for \(k\ge 2\). This is a contradiction as \(e(G)= dn/2\). This proves the lemma. \(\square \)

The following simple lemma essentially proves Sidorenko’s conjecture for even cycles in the ‘asymmetric’ bipartite setting. We include a short proof for completeness.

Lemma 3.3

Let G be a bipartite graph with vertex partition (AB). Suppose that the average of degrees of the vertices in A is \(d_A\) and the average of degrees of the vertices in B is \(d_B\). Then for every \(k\in {\mathbb {N}}\) we have

$$\begin{aligned} |\textrm{Hom}(C_{2k},G)| \ge d_A^k \cdot d_B^k. \end{aligned}$$

Proof

Consider the bipartite adjacency matrix \(M=(m_{ij})\) of G, where the rows and columns of M are indexed by the elements of A and B, respectively, with

$$\begin{aligned} m_{ij}= {\left\{ \begin{array}{ll} 1 &{}\text {if} ij\in E(G)\\ 0 &{} \text {otherwise}. \end{array}\right. } \end{aligned}$$

Then

$$\begin{aligned} |\textrm{Hom}(C_{2k},G)| = \textrm{trace}((M^T M)^k) =\lambda _1^k +\cdots +\lambda _n^k, \end{aligned}$$

where \(n:=|B|\) and \(\lambda _1\ge \dots \ge \lambda _n\) are (nonnegative) eigenvalues of the positive semidefinite matrix \(M^TM\).

It is well-known that \(\lambda _1 = \max _{x\in {\mathbb {R}}^n}\frac{x^TM^TMx}{x^Tx}\). Taking \(x=(1,\dots ,1)^T\) and using the Cauchy–Schwarz inequality, we obtain

$$\begin{aligned} \lambda _1 \ge \frac{\sum _{a\in A} \deg ^2(a)}{|B|}\ge \frac{\left( \sum _{a\in A}\deg (a)\right) ^2}{|A||B|}=d_Ad_B. \end{aligned}$$

Hence \(|\textrm{Hom}(C_{2k},G)|\ge \lambda _1^k \ge (d_Ad_B)^k\). \(\square \)

4 Proofs of the Main Results

Now we are ready to prove our main results.

Proof of Theorem 1.2

By taking a subgraph, assume that G is a bipartite graph with at least \(50000 k^3 n^{1+1/k}\) edges and let \(d \ge 10^5 k^3 n^{1/k}\) be the average degree of G. We further assume that G has no subgraph with larger average degree, as otherwise we can just take that subgraph to be our graph. Also assume that G has no rainbow 2k-cycle. We apply Lemma 3.2 to obtain a graph \(G'\) and some \(i\in {\mathbb {N}}\) such that

  • \(|A| = \frac{1}{k}2^{-\frac{ki}{k-1}}n\);

  • \(d_{G'}(a) \in [2^{i-6} d, 2^{i-5} d ]\) for all \(a\in A\);

  • \(d_{G'}(b) \le 4 d\) for all \(b\in B\).

Indeed, we can obtain the equality in the first bullet point by deleting some vertices if necessary. Note that the first two conditions ensures that the average of degrees of vertices in B is at least

$$\begin{aligned} \frac{2^{i-6}d|A|}{n} \ge \frac{d}{64k} 2^{-\frac{i}{k-1}}. \end{aligned}$$

Apply Lemma 3.3 to obtain that

$$\begin{aligned} \textrm{Hom}(C_{2k},G') \ge 2^{k(i-6)}d^k (\frac{d}{64k})^k 2^{-\frac{ki}{k-1}}. \end{aligned}$$
(3)

As \(d_{G'}(b)\le 4d\) for all \(b\in B\) and \(\sum _{b\in B}d_{G'}(b)= e(G')\), the convexity of the function \(f(x)=x^k\) yields that

$$\begin{aligned} \sum _{b\in B} d_{G'}(b)^k \le \frac{e(G')}{4d} \cdot (4d)^k \le (4d)^{k-1}e(G'). \end{aligned}$$

Hence, Lemma 2.1 implies that

$$\begin{aligned} |\textrm{Hom}(C_{2k},G')|&\le (2k)^{2k} |\textrm{Hom}(S_k,G')| \le (2k)^{2k} \left( \sum _{a\in A} d_{G'}(a)^k+ \sum _{b\in B} d_{G'}(b)^k \right) \\ {}&\le (2k)^{2k}( |A| 2^{k(i-5)} d^k + (4d)^{k-1} e(G') )\\&\le (2k)^{2k} (2^{k(i-5)} d^{k} + (4d)^{k-1}\cdot 2^{i-5}d)|A| \\ {}&\le (2k)^{2k} d^k (2^{k(i-5)} + 4^{k-1}2^{i-5}) \cdot \frac{1}{k} 2^{-\frac{ki}{k-1}}n. \end{aligned}$$

Here, the penultimate inequality holds as \(e(G')\le 2^{i-5}d|A|\). Combining this with (3), we obtain

$$\begin{aligned} d^k < (10^5 k^3)^k n. \end{aligned}$$

However, we assume that \(d\ge 10^5 k^3 n^{1/k}\), a contradiction. This proves the theorem. \(\square \)

Proof of Corollary 1.3

The proof proceeds as in Theorem 1.2. If at least half of the \(\textrm{Hom}(C_{2k},G)\) is non-degenerate, then we can bound it from below using (3); otherwise we reach a similar contradiction as now \(|\textrm{Hom}(C_{2k},G)| \le (8k^2)^{k} |\textrm{Hom}(S_k,G)|\) by Lemma 2.1. \(\square \)

Proof of Theorem 1.1

Suppose that G does not have a rainbow cycle. By iteratively deleting low degree vertices, we may assume that the minimum degree of G is \(\delta \ge d(G)/2 \ge 32\log ^2(5n)\). Apply Lemma 3.1 to obtain a graph \(G'\) on \(n'\le 4n\) vertices such that \(G'\) doesn’t contain a rainbow cycle and every vertex of \(G'\) has degree between \(\delta /2\) and \(\delta \).

Let \(k= \log n'\). Because \(G'\) does not contain any rainbow 2k-cycle, Lemma 2.1 implies that

$$\begin{aligned} |\textrm{Hom}(C_{2k},G')|\le (2k)^{2k} |\textrm{Hom}(S_k,G')|\le (2k)^{2k} \delta ^k n'. \end{aligned}$$

On the other hand, every even cycle satisfies Sidorenko’s conjecture, so we know that

$$\begin{aligned} (2k)^{2k} \delta ^k n' \ge (\delta /2)^{2k}. \end{aligned}$$

As \(n'=2^k\), this yields that

$$\begin{aligned} (4k^2\cdot \delta \cdot 2)^k \ge (\delta ^2/4)^{k}, \end{aligned}$$

which is a contradiction as \(\delta \ge 32\log ^2(5n)>32k^2\). Hence G must contain a rainbow cycle. \(\square \)