Variations on twins in permutations

Let $\pi$ be a permutation of the set $[n]=\{1,2,\dots, n\}$. Two disjoint order-isomorphic subsequences of $\pi$ are called twins. How long twins are contained in every permutation? The well known Erd\H{o}s-Szekeres theorem implies that there is always a pair of twins of length $\Omega(\sqrt{n})$. On the other hand, by a simple probabilistic argument Gawron proved that for every $n\geqslant 1$ there exist permutations with no twins of length greater than $O(n^{2/3})$. His conjecture states that the latter bound is the correct size of the longest twins guaranteed in every permutation. We prove that asymptotically almost surely a random permutation contains twins of length at least $\Omega(n^{2/3}/\log^{1/3}n)$, which supports this conjecture. We also study several variants of the problem with diverse restrictions imposed on the twins. For instance, if we restrict attention to twins avoiding a fixed permutation $\tau$, then the corresponding extremal function equals $\Theta(\sqrt{n})$, provided that $\tau$ is not monotone. In case of block twins (each twin occupies a segment) we prove that it is $(1+o(1))\frac{\log n}{\log\log n}$, while for random permutations it is twice as large. For twins that jointly occupy a segment (tight twins), we prove that for every $n$ there are permutations avoiding them on all segments of length greater than $24$.

edge-disjoint subgraphs G 1 , . . . , G k of G and H 1 , . . . , H k of H such that G i is isomorphic to H i for every i " 1, 2, . . . , k? Let U pnq denote the maximum of U pG, Hq over all pairs of graphs on n vertices with the same number of edges. It was proved by Chung, Graham, Erdős, Ulam, and Yao in [7], that U pnq " 2 3 n`opnq.
More general results and some open problems can be found in [8].
A related problem is to find two large isomorphic subgraphs in two given graphs, or in one given graph. Let f pmq denote the largest integer k such that every graph with m edges contains a pair of twins, that is, two edge-disjoint isomorphic subgraphs with k edges each.
In [1], Alon, Caro, and Krasikov proved that every tree with m edges contains a pair of twins of total size at least m´Oˆm log log m˙.

Twins in sequences.
By twins in a sequence over an alphabet we mean a pair of identical subsequences with disjoint sets of indices. Let g r pnq denote the maximum length of twins in every sequence of length n over an alphabet with r symbols. Axenovich, Person, and Puzynina proved in [5] that This result is particularly surprising for r " 2, as it says that every binary sequence consists of two identical subsequences plus an asymptotically negligible part. The proof is based on a new regularity lemma for sequences. Currently, the best lower bound for g r pnq, obtained by Bukh and Zhou [6], asserts that for some constant c ą 0. It was also proved in [6] that g 4 pnq ď 0.4932n. The case of ternary sequences remains open.
1.3. Twins in permutations. By a permutation we mean any finite sequence of distinct positive integers. We say that two permutations px 1 , . . . , x k q and py 1 , . . . , y k q are similar if their entries preserve the same relative order, that is, x i ă x j if and only if y i ă y j for all pairs ti, ju with 1 ď i ă j ď k. Note that given a permutation px 1 , . . . , x k q and a k-element set y of positive integers, there is only one permutation of y similar to px 1 , . . . , x k q.
Let rns " t1, 2, . . . , nu and π be a permutation of rns, called also an n-permutation. Two similar disjoint sub-permutations of π are called twins and the length of a pair of twins is defined as the number of elements in just one of the sub-permutations. For example, in permutation p6, 1 , 4 , 7, 3 , 9, 8 , 2 , 5 q, the red p1, 4, 2q and blue p3, 8, 5q subsequences form a pair of twins of length 3, both similar to p1, 3, 2q.
Let tpπq denote the largest integer k such that π contains a pair of twins of length k.
Let tpnq denote the minimum of tpπq over all permutations π of rns. In other words, tpnq is the largest integer k such that every n-permutation contains a pair of twins of length k. Our aim is to estimate this function, as well as some of its variants subject to various restrictions.
By the classical result of Erdős and Szekeres [11] concerning monotone subsequences of permutations, we get tpnq " Ωp ? nq. Indeed, any splitting of a monotone sequence into two subsequences of the same length gives a pair of twins. On the other hand, using a probabilistic argument, Gawron [12] proved that tpnq " Opn 2{3 q. He also made a conjecture that the later bound is the correct order of the function tpnq. Conjecture 1.1 (Gawron [12]). We have tpnq " Θpn 2{3 q.
Our main result (Theorem 2.2) supports this supposition for random permutations.
Namely, we prove that a random permutation Π n of rns, selected uniformly from all n! n-permutations, satisfies t pΠ n q " Ωˆn 2{3 log 1{3 n˙, asymptotically almost surely (a.a.s). The proof uses Talagrand's inequality [20] We also consider several variants of the function tpnq obtained by imposing various restrictions on the structure or position of twins in permutations. Let τ be a fixed permutation. We say that a permutation σ avoids τ if there is no sub-permutation of σ similar to τ . Let tpn, τ q be the largest integer k such that every n-permutation contains a pair of τ -avoiding twins of length k. Using the celebrated result of Marcus and Tardos [17], confirming the Stanley-Wilf Conjecture, we prove (Theorem 2.7) that provided τ is non-monotone.
Two further variants set restrictions on the occurrence of twins in permutations. By block twins in π we mean a pair of twins, each occupying a segment of consecutive terms of π. For instance, in permutation p6, 5 , 2 , 3 , 8, 9, 7 , 1 , 4 q, the red p5, 2, 3q and blue p7, 1, 4q subsequences form a pair of block twins similar to permutation p3, 1, 2q. Let btpnq be the largest size of block twins one can find in every n-permutation. We prove (Theorem
Interestingly, for a random permutation Π n the analogous function is twice as large (Theorem 3.5).
If a pair of twins jointly occupies a segment in π, then we call them tight twins. For example, in permutation p6, 5 , 7 , 1 , 2 , 3 , 4 , 9, 8q, the red p5, 2, 3q and blue p7, 1, 4q subsequences form a pair of tight twins similar to permutation p3, 1, 2q. Let ttpnq be the largest size of tight twins one can find in every n-permutation. By using the Lovász Local Lemma we prove (Theorem 3.6) that ttpnq ď 12 for all n ě 1 which means that there exist permutations avoiding tight twins of length at least 13. On the other hand, in Proposition 3.7 we demonstrate that every permutation of six elements contains tight twins of length at least 2.
Combining the last two variants of the problem, one may consider the most restrictive tight block twins, which are block twins jointly occupying a segment. For instance, in permutation p6, 9, 5 , 2 , 3 , 7 , 1 , 4 , 8q, the red p5, 2, 3q and blue p7, 1, 4q subsequences form a pair of tight block twins similar to permutation p3, 1, 2q. Surprisingly, as proved by Avgustinovich, Kitaev, Pyatkin, and Valyuzhenich in [3], for every n there exist npermutations containing no such twins of length more than one. This result constitutes a permutation counterpart of the famous theorem of Thue [22] on non-repetitive sequences which asserts that there exist arbitrarily long ternary sequences avoiding tight block twins of any possible length (see [15]). §2. General twins In this section we will prove our main result on twins in random permutations. Let |σ| denote the length of a permutation σ. Recall that tpπq denotes the maximum length of twins in a permutation π, that is, tpπq " maxt|σ 1 | : pσ 1 , σ 2 q is a pair of twins in πu, and tpnq is defined as tpnq " minttpπq : π is a permutation of rnsu.
For completeness, we begin with reproducing the result of Gawron.
Theorem 2.1 (Gawron [12]). We have Proof. The lower bound follows immediately from the well known theorem of Erdős and Szekeres [11] asserting that every permutation of length n contains a monotone subsequence of length Ωp ? nq.
For the upper bound we use the first moment method. Let Π :" Π n be a random permutation chosen uniformly from the set of all n! permutations of rns. Let k be a fixed positive integer and let X be a random variable counting all pairs of twins of length k in Π. Furthermore, for a pair of disjoint subsequences s, t in rns, each of length k, let X s,t be an indicator random variable such that X s,t " 1 if there is a pair of twins in Π on subsequences s and t. So, X " ř s,t X s,t and by the linearity of expectation and the number of unordered pairs ts, tu is 1 Using the inequality k! ą k k e k gives EX ă n 2k e 3k 2k 3k ăˆn It follows that for k ą en 2{3 we have EX ă 1, which means that there must be an n-permutation π with Xpπq " 0, that is, with no twins of length k. This completes the proof.
One could naturally hope to improve the upper bound for tpnq by some more refined probabilistic tools. In fact, in his master thesis [12], Gawron made such an attempt by using the Lovász Local Lemma. However, the resulting bound turned out to be the same (up to a constant).

General twins in random permutations.
In view of Theorem 2.1, to prove Conjecture 1.1 it is enough to show that tpnq " Ωpn 2{3 q. In this subsection we will prove a bound almost as good for almost all permutations. Let Π :" Π n be a random permutation of rns and let tpΠq be the corresponding random variable equal to the maximum length of twins in Π. Recall that by saying that some property of a random object holds asymptotically almost surely (a.a.s. for short) we mean that it holds with probability tending to one with the size of the object growing to infinity.
Proof. The upper bound follows immediately from the proof of Theorem 2.1. Indeed, by Now we proceed with a much more challenging proof of the lower bound. Set a " pCn log nq 1{3 , assume for convenience that a divides n, and partition rns into n{a consecutive blocks of equal size, that is, set where |A 1 | "¨¨¨" |A n{a | " a. For fixed 1 ď i, j ď n{a, let X :" X ij be the number of elements from the set A j which Π puts on the positions belonging to the set A i . We construct an auxiliary n{aˆn{a bipartite graph B with vertex classes U " t1, . . . , n{au Let M " ti 1 j 1 , . . . , i m j m u, i 1 ă¨¨¨ă i m , be a matching in B of size |M | " m. For every ij P M , let s i , t i be some two elements of A i such that Πps i q, Πpt j q P A j . Then, ts i 1 , . . . , s im u and tt i 1 , . . . , t im u form a pair of twins. Indeed, if say Πps i 1 q ă Πps i 2 q, then j 1 ă j 2 , and so Πpt i 1 q ă Πpt i 2 q.
Hence, it remains to show that a.a.s. there is a matching in B of size m " Ωpn 2{3 { log 1{3 nq.
To this end, we are going to use the obvious fact, coming from a greedy algorithm, that in every graph G there is a matching of size at least |EpGq|{p2∆pGqq, where ∆pGq is the maximum vertex degree in G.
Our plan is to first estimate the probability of an edge in B, that is, PpX ij ě 2q, and then, apply the inequality of Talagrand to show that the degrees in B are tightly concentrated around their means, that is, around pn{aqPpX ij ě 2q. Then, the ratio |EpBq|{p2∆pBqq will easily be estimated.

Fact 2.3. We have
Proof. Notice that and hence which is equivalent to the statement of Fact 2.3.
We continue with the proof of Theorem 2.2. Let Y :" Y i " ř n{a j"1 IpX ij ě 2q. We are going to apply to Y a concentration inequality which follows from some more general results in [20]. Here is a slightly simplified version from [16] (see also [18]). Moreover, it follows (see for example [20], Lemma 4.6, or [18], page 164) that |EY´m| "
Note that PpX ij ě 2q " n a¨a 4 2n 2 " a 3 2n " pC{2q log n, so, for C large enough, the union bound implies that a.a.s. for all i " 1, . . . , n{a, we have This implies that two further facts hold a.a.s.: |EpBq| " Finally, the largest matching in B has size at least This completes the proof of Theorem 2.2.
Remark 2.5. If one is aiming at a slightly weaker bound tpΠ n q " Ω´n 2{3 { log 4{3 nā .a.s., then one can avoid the Talagrand inequality altogether. Indeed, by using standard

one gets
PpY i " 0q "ˆn a a˙ˆa 1˙a a!pn´aq!¨1 n! "ˆn a a˙a a¨1 n a"`n a˘a a! expˆ´a So, the union bound implies that a.a.s. |EpBq| ě n{a. Now set k :" 3a 3 n and notice that Thus, again by the union bound we get a.a.s. ∆pBq ď k and, consequently, the size of a largest matching in B is a.a.s. at least: log 4{3 n˙.

Twins with a forbidden pattern.
In this subsection we prove tight asymptotic bounds for the maximum length of twins avoiding a fixed non-monotone permutation τ .
Recall that a permutation σ avoids τ , or is τ -free, if no subsequence of σ is similar to τ .
We will need the following result of Marcus and Tardos [17] confirming a famous conjecture stated independently by Stanley and Wilf (see [19]). Let tpπ, τ q denote the maximum length of τ -free twins in a permutation π: tpπ, τ q " maxt|σ 1 | : pσ 1 , σ 2 q is a pair of τ -free twins in πu, and let tpn, τ q be defined by tpn, τ q " minttpπ, τ q : π is a permutation of rnsu.
Proof. Owing to the non-monotonicity of τ , the lower bound follows from the Erdős-Szekeres theorem in the same way as the bound tpnq " Ωp ? nq in Theorem 2.1. For the upper bound, let Π be a random permutation of rns, and let X τ denote the random variable counting the number of τ -free twins of size k in Π. Further, let d τ be the number of τ -free permutations of rks. We have where p τ "`n k˘d τ¨`n´k k˘¨1¨p n´2kq! n! " d τ pk!q 2 .
By Theorem 2.6, p τ ď c k {pk!q 2 , which implies In this part of the paper we consider twins with some restrictions on positions they occupy in a permutation. We focus on blocks in permutations, that is, subsequences whose index sets are segments of consecutive integers. As a key technical tool we are going to use two versions of the Local Lemma which we state first.

Two versions of the Local Lemma.
In the next subsection, we will make use of the following symmetric version of the Lovász Local Lemma [9] (see [2]). For events E 1 , . . . , E n in any probability space, a dependency graph D " prns, Eq is any graph on vertex set rns such that for every vertex i the event E i is jointly independent of all events E j with ij R E.
In another proof it will be convenient to use the following version of the Lovász Local Lemma, which is equivalent to the standard asymmetric version (see [2]).   For r ě 2 let A i , B i , i " 1, . . . , r be k-elements segments of rns with A i X B i " ∅ as well as A 1 X Ť r i"2 pA i Y B i q " ∅. Further, let E i be the event that the pair pA i , B i q induces block twins in Π. Then, Proof. By (2.1), PpE 1 q " 1{k!. Let N be the number of permutations of the set rns A 1 such that all pairs A i , B i , i " 2, . . . , r span block twins. Observe that where the first equality follows from the fact that once the values of Πpiq are fixed on rns A 1 , the rest of Π is determined. Hence, The following result gives an asymptotic formula for the function btpnq.
Proof. First we show the lower bound. Let n " kpk!`1q and let π be any permutation of rns. Divide π into k!`1 blocks, each of length k. By the pigeonhole principle, there are two blocks that induce similar sub-permutations (forming thereby a pair block twins). The choice of n, together with the Stirling formula, imply that k " p1`op1qq log n log log n . For the upper bound we use Lemma 3.1 and Fact 3.3. Let n " pk´1q! 4e and let Π n be a random permutation. For a given pair of indices i and j with 1 ď i ď j´k ď n´2k, define the event E i,j that subsequences pΠpiq, Πpi`1qq, . . . , Πpi`k´1qq and pΠpjq, Πpj`1qq, . . . , Πpj`k´1qq are block twins. We have p :" PpE i,j q " 1{k!.
Also notice that by Fact 3.3, a fixed event E i,j is jointly independent of all the events Thus, there is a dependency graph D with maximum degree at most ∆ " 2p2k´1qpn´kq ď 4kn´1.
This and the choice of n gives that ep∆`1qp ď e¨4kn¨1 k! " 1.
Thus, Lemma 3.1 implies that there exists a permutation of rns with no block twins of length k. Again, the Stirling formula yields that k " p1`op1qq log n log log n .

Block twins in random permutations.
In the previous subsection we used a random permutation Π as a tool of the probabilistic method to estimate btpnq. Now we are interested in block twins in random permutations. The result below shows that the maximum length of block twins in Π is a.a.s. roughly twice as big as in the worst case. For a random n-permutation Π, a.a.s. we have btpΠq " p2`op1qq log n log log n .
Proof. For 1 ď i ď j´k ď n´2k, recall from the proof of Theorem 3.4 that E i,j denotes the event that pΠpiq, . . . , Πpi`k´1qq and pΠpjq, . . . , Πpj`k´1qq are block twins. Let X i,j be the indicator random variable of the event E i,j , that is X i,j " 1 if E ij holds and X i,j " 0 otherwise, and set X " ř X i,j .
By (2.1), we have PpX i,j " 1q " PpE i,j q " 1{k! and thus EpXq " Θpn 2 {k!q. Set ωpnq for any sequence of integers such that ωpnq Ñ 8 but ωpnq " oplog log n{ log log log nq. It is easy to check, using the Stirling formula, that Thus, in the former case EX " op1q and, by Markov's inequality, a.a.s. there are no block twins of length k in Π.
We will use the second moment method to show that in the latter case, when EX Ñ 8, a.a.s. there is a pair of block twins of length k in Π. Note that, in fact, in this case we have For 1 ď i 1 ď j 1´k ď n´2k and 1 ď i 2 ď j 2´k ď n´2k, let A " ti 1 , . . . , i 1`k´1 u, B " tj 1 , . . . , j 1`k´1 u, C " ti 2 , . . . , i 2`k´1 u and D " tj 2 , . . . , j 2`k´1 u. If either A X pC Y Dq " ∅ or B X pC Y Dq " ∅, then, by Fact 3.3, that is, X i 1 ,j 1 and X i 2 ,j 2 are independent.
The number of the remaining pairs of indicators X i 1 ,j 1 and X i 2 ,j 2 is Opn 2 k 2 q.
Hence, using the trivial bound and, by Chebyshev's inequality and (3.1),

Tight twins.
Recall that a pair of twins pσ 1 , σ 2 q in a permutation π is called tight if their union is a block in π. Note that unlike general twins and block twins, tight twins are not 'monotone', that is the absence of tight twins of length k does not exclude the presence of length bigger than k. Let ttpπq denote the maximum length of tight twins in π: ttpπq " maxt|σ 1 | : pσ 1 , σ 2 q is a pair of tight twins in πu, and let ttpnq " mintttpπq : π is a permutation of rnsu.
We will prove that ttpnq ď 12, which means that for every n there exists a permutation of rns with no tight twins of length 13 or longer.
Proof. Let Π be a random permutation of rns. We will apply Lemma 3.2 in the following setting. For a fixed segment R of length 2r, let A R denote the event that a sub-permutation of Π occupying R consists of tight twins. We consider only segments of length at least 26, so we assume that r ě 13. Let V r denote the collection of all such events A R for all possible segments of length 2r. By (2.1) and the union bound, for every A R P V r , Hence, we may take p r " 1 2`2 r r˘{ r!.
By Fact 3.3, any event A R depends only on those events A S whose segments S intersect R.
Hence, if S is any segment of length 2s, with s ě 13 and S ‰ R, then we may take ∆ rs " 2r`2s´1. Furthermore, we take x s " p2{3q s , s ě 13.
We are going to prove that for every r ě 13 hich is equivalent to proving that for r ě 13 To this end, observe that f pr`1q ě f prq for r ě 13. Indeed, Thus, checking on a calculator that f p13q ě 1 completes the proof.
Our next result provides an easy lower bound on ttpnq.
We start with the following observation.
Proof. Without loss of generality assume that πp1q ą πp2q ą πp3q. We will show that one cannot avoid tight twins of length 2 within pπp1q, . . . , πp5qq.

Proof of Proposition 3.7.
Without loss of generality we may assume that πp1q ă πp2q.

§4. Concluding Remarks
The major open problem concerning twins in permutations is to determine the asymptotic shape of the function tpnq. We made a step in this direction by getting close to the conjectured lower bound on tpnq for random permutations. It would be nice to know the whole truth in this case.
Problem 4.1. Is it true that a random n-permutation Π satisfies a.a.s.
Another challenging problem concerns the case of tight twins. In Theorem 3.6 we proved that there exist arbitrarily long permutations avoiding tight twins of length at least 13.
How far is this constant from the optimum? On the one hand, by taking x 12 " 9{500 and x s " p2{3q s for s ě 13 one can show, by a tedious adaptation of the proof that ttpnq ď 11.
On the other hand, in Proposition 3.7 we demonstrated that one cannot avoid tight twins of length 2 in any n-permutation for n ě 6. Here is an example of a permutation of length 18 avoiding tight twins of length 3 or more (but we do not know how to generalize it for larger n): p14, 15, 16, 3, 2, 1, 10, 11, 12, 5, 4, 18, 8, 9, 17, 7, 6, 13q.
Let us conclude the paper with a problem in the spirit of Ulam. Two n-permutations α and β are called k-similar if they can be split into k sub-permutations, respectively, α 1 , . . . , α k and β 1 , . . . , β k , so that α i is similar to β i for all i " 1, 2, . . . , k. Let U pα, βq be the least number k such that α and β are k-similar.

Problem 4.3.
What is the average value of U pα, βq over all pairs of n-permutations?