Using singularity analysis, we show that the probability that two independently and uniformly selected generalized derangements of size n have the same number of cycles is asymptotically the same as the corresponding probability for unrestricted permutations, namely, ∼2πlogn1.
Introduction
When studying large combinatorial objects, a natural question arises: if we select two random objects of size n from a given class, what is the probability that they share a specified shape, profile or parameter? For example, the authors of [2] study the probability that two random compositions have the same number of parts, while Wilf [5] studies the corresponding question for the number of cycles in random permutations.
Recall that the Stirling numbers of the first kind [kn] count permutations of size n that have exactly k cycles. In [5] Wilf showed that for two independently and randomly selected permutations the probability that they have the same number of cycles is asymptotically
(n!)21k=1∑n[kn]2∼2πlogn1.
Wilf’s elegant argument relies on the polynomial structure of the generating function for the Stirling numbers and on specific properties of the Gamma function. This approach does not extend directly to permutations with restrictions on cycle lengths.
Definition 1.Let S be a (possibly empty) finite set of positive integers. An S-derangement is a permutation whose cycle lengths do not belong to S.
We denote the collection of all S-derangements of length n by DnS.
Using this notation, Dn∅ is the set of all permutations of size n, and Dn{1} is the set of ordinary derangements, that is, permutations without fixed points. To simplify the notation, we fix S throughout the remainder of this paper and omit the superscript.
In this paper, we prove the perhaps surprising fact that the probability that two randomly selected generalized S-derangements of size n have the same number of cycles is asymptotically the same as the corresponding probability for unrestricted permutations. This is interesting, because the possible numbers of cycles are much less numerous. For instance, an ordinary derangement of length n can have at most ⌊n/2⌋ cycles, whereas for S={1,2,⋯,k}, the highest possible number of cycles is ⌊n/(k+1)⌋.
In order to keep the paper self-contained while not slowing down the flow of the proof too much, out of the three theorems we use, we include two in the main part of the article, and we present the third in the Appendix.
The proof of our main result
Definition 2.We refine Dn according to the number of cycles by setting
Dn,k={p∈Dn∣#cycles(p)=k}.
Write Dn=∣Dn∣ and Dn,k=∣Dn,k∣ for the corresponding cardinalities.
Our goal is to show that
(Dn)21k=1∑n(Dn,k)2∼2πlogn1.
for any finite S. We use the methods of [3] to establish a Gaussian local limit law for the appropriately normalized cycle counts as n tends to infinity.
Definition 3. Let F(z,u) be the bivariate generating function given by
F(z,u)=n=0∑∞k=0∑nDn,kukn!zn
with the convention that D0,0=1 and Dn,0=0 for all positive integers n. We denote the horizontal layers of F(z,u) by
fn(u)=[zn]F(z,u)=n!1k=0∑nDn,kuk.
Definition 4. For n such that Dn>0, let Xn be the number of cycles in a random S-derangement of size n. Its probability generating function is
pn(u)=EuXn=k=0∑nDnDn,kuk=fn(1)fn(u).
Using the symbolic properties of generating functions from [1] we derive the explicit formula for F(z,u) as a collection of cycles marked by parameter u. Thus,
The series ∑j∈/Szj/j defines a holomorphic function g(z) on the open unit disk. Consequently, F(z,u)=exp(ug(z)) is holomorphic on the set {z∈C∣∣z∣<1}×C.
Following the proof of the singularity analysis theorem for variable-exponent perturbations [3 Theorem IX.11] (see our Appendix for a detailed discussion of the theorem and how we apply it here), we obtain
Theorem 1 (Quasi-powers theorem). Let Xn be a sequence of non-negative discrete random variables with probability generating functions Pn(u). Suppose that, uniformly in a fixed complex neighborhood of u=1,
Pn(u)=A(u)⋅B(u)βn(1+O(κn1)),
where βn,κn→+∞, the functions A(u) and B(u) are analytic at u=1, and A(1)=B(1)=1. Suppose also that the variability condition
v(B)=B′′(1)+B′(1)−(B′(1))2=0
holds. Then the mean and variance of Xn satisfy
μn=EXn=βnm(B)+m(A)+O(κn−1),
σn2=VarXn=βnv(B)+v(A)+O(κn−1).
Moreover, the distribution of Xn, after standardization, is asymptotically Gaussian:
P{σnXn−μn≤x}=Φ(x)+O(κn−1+βn−1/2),
uniformly for x∈R, where Φ is the distribution function of the standard normal distribution.
We now apply this theorem to the number Xn of cycles in a random S-derangement of size n. Writing nu−1=(eu−1)logn, the uniform estimate for pn(u) obtained above has the required quasi-power form, with
βn=logn,
κn=n,
A(u)=Γ(u)exp((1−u)∑j∈Sj1),
B(u)=exp(u−1).
Both sequences βn and κn tend to infinity, and both functions A(u) and B(u) are analytic in a neighborhood of u=1, with A(1)=B(1)=1. Furthermore,
B′′(1)+B′(1)−(B′(1))2=1=0,
so the variability condition is satisfied. Thus, all the hypotheses of the theorem hold.
Using the properties of derivatives of the Gamma function and substituting these functions and sequences into the theorem’s mean and variance formulas gives
μn=EXn=logn+γ−j∈S∑j1+O(κn−1),
σn2=VXn=logn+γ−6π2−j∈S∑j1+O(κn−1).
Consequently,
σnXn−μndn→∞N(0,1),
with an error term
O(κn−1+βn−1/2)=O((logn)−1/2).
This Gaussian limit is not new: V. Goncharov [4] established it for unrestricted permutations in the 1940s by analyzing characteristic functions. The convergence to a Gaussian distribution for generalized derangements is stated in [3]. We nevertheless verify the hypotheses of the Quasi-powers theorem because they are also required by the local limit theorem [3], Theorem IX.14. We include this theorem below for easy reference.
Theorem 2 (Local Limit Law). Let Xn be a sequence of non-negative discrete random variables with probability generating functions pn(u). Suppose that pn(u) satisfies the hypotheses of the Quasi-powers Theorem. In particular, the approximation
pn(u)=A(u)⋅B(u)βn(1+O(κn1))
holds uniformly in a sufficiently small fixed complex neighborhood Ω of 1. Suppose, in addition, that there exists K>1 such that
∣pn(u)∣≤K−βn
uniformly for all u in the intersection of the unit circle and the complement C∖Ω. Then the distribution of Xn satisfies a local limit law of the Gaussian type, with a rate of convergence O(βn−1/2+κn−1). More precisely, writing μn=EXn, σn2=VXn, and φ(x)=(2π)−1/2e−x2/2, we have
To apply this theorem, we must also estimate pn(u) on the unit circle, rather than only in a small neighborhood of 1.
Lemma.For n sufficiently large, for each 0<δ<π, there exist C>0 and K>1 such that
∣pn(u)∣<CK−logn
for all u satisfying ∣u∣=1 and ∣argu∣>δ.
Proof. Recall that pn(u)=fn(u)/fn(1), where fn(u)=[zn]F(z,u). As F(z,u) is the product of two factors, we will estimate those two factors individually. We write F(z,u)=G(z,u)H(z,u) where
G(z,u)=(1−z)−u=n=0∑∞gn(u)zn
H(z,u)=exp−uj∈S∑jzj=n=0∑∞hn(u)zn
gn(u)=n!u(u+1)⋯(u+n−1)
hn(u)=n!1∂zn∂nH(z,u)z=0
Setting u=eit with −π<t≤π, we obtain the following expression for the squared magnitude of gn(u):
Put α=1−cost∈[0,2]. Since 0≤2kα/(k+1)2≤1 for every k≥1, we may apply 1−x≤e−x for 0≤x≤1 directly to the factors. This gives
∣gn(eit)∣2≤exp(−2αk=1∑n−1(k+1)2k).
Moreover,
k=1∑n−1(k+1)2k=j=1∑n(j1−j21)≥logn−6π2,
since ∑j=1n1/j≥logn and ∑j=1n1/j2≤π2/6. Taking square roots, we obtain
∣gn(eit)∣≤eαπ2/6n−α≤C2ncost−1,
where C2=eπ2/3. This bound holds uniformly for −π<t≤π, including t=π.
To bound hn(u), note that H(z,u) is an entire mapping C2→C and for each fixed u the function z↦H(z,u) is entire. Fix R>1. Setting MR=max∣z∣≤R,∣u∣=1∣H(z,u)∣, we obtain the following bound from Cauchy’s integral formula:
∣hn(u)∣=2πi1∫∣z∣=Rzn+1H(z,u)dz≤MRR−n.
This bound holds for all u with ∣u∣=1.
Finally, we show that convolving a polynomially decaying sequence with an exponentially decaying sequence preserves polynomial decay. Indeed,
The second term asymptotically dominates the first.
Since 1−cost>1−cosδ>0 and fn(1)→exp(−∑j∈S1/j)>0 as n→∞ by setting u=1 in (1), we may take K=e1−cosδ and choose C>0 such that
∣pn(eit)∣=fn(1)∣fn(eit)∣<CK−logn.
We have already verified the hypotheses of the Quasi-powers theorem for the number Xn of cycles in a random S-derangement, with βn=logn and κn=n. In order to apply the Local Limit Law, it remains to verify the additional bound on the unit circle.
Choose 0<δ<π sufficiently small that
{eit∣∣t∣≤δ}⊆Ω.
The preceding lemma gives constants C>0 and K>1 such that
∣pn(u)∣<CK−logn
for all u on the unit circle with ∣argu∣>δ. In particular, this bound holds on the part of the unit circle outside Ω. Choosing any K with 1<K<K, we have, for all sufficiently large n,
CK−logn≤K−logn=K−βn.
Thus, the additional hypothesis of the Local Limit Law is satisfied.
Applying the Local Limit Law yields the following estimate, which is the key ingredient in determining the probability that two random S-derangements have the same number of cycles.
Proposition. Let pn,k=P{Xn=k}=DnDn,k and let ϕ(x) denote the standard Gaussian density function, that is, ϕ(x)=(2π)−1/2e−x2/2. Then
x∈Rsup∣σnP{Xn=⌊μn+xσn⌋}−ϕ(x)∣=O(logn1).
In particular,
pn,k=σn1(ϕ(σnk−μn)+ϵn,k)
where ϵn=maxk∈[n]∣ϵn,k∣=O(logn1).
We now prove the main result of this paper.
Theorem 3.The equality
n→∞limσnk=1∑npn,k2=∫−∞∞ϕ2(x)dx=2π1(2)
holds.
Proof. The crucial idea is to view the expression on the left-hand side as a sequence of Riemann sums converging to the integral. To make this argument rigorous, we first truncate the tails of the distribution of Xn and establish convergence to the integral over the interval [−A,A] for fixed A. We then let A tend to infinity.
Fix A>0. Define the set of indices
InA={k∈[n]∣σn∣k−μn∣≤A}.
Note that 2σnA−1<∣InA∣≤2σnA+1 if n is large enough. Writing ϕnk=ϕ(σnk−μn), we obtain
For the main result we utilized the fact that σnpnk is approximated by ϕnk with the uniformly controlled error and that ϕ2(x)∈L1(R). But higher powers of ϕ(x) are also integrable. Thus, the proof can be naturally extended for the scenario of multiple permutations. Fix an integer d≥2. Given a tuple of d generalized S-derangements (p1,p2,…,pd) selected uniformly at random with replacement1 from Dn we show that the probability that they all have the same number of cycles satisfies the following asymptotics:
k=1∑npnkd∼d(2πlogn)d−11.
To show this we prove the following theorem.
Theorem 4. Let d≥2 be a fixed integer. The equality
Proof. The argument is analogous to that of the proof for d=2. Using the same notation, we highlight the inequalities that are different. First, note that
Hence we obtain identical bounds for liminf and limsup yielding the limit result that was to be proved. □
As an application of the generalized result we can consider S=∅. Then having pnk=n!1[nk], we immediately obtain the following asymptotics for the sum of d-th powers of Stirling numbers.
Corollary. As n→∞, the asymptotic equivalence
k=1∑n[nk]d∼d(2πlogn)d−1(n!)d
holds.
Appendix
We present the variable-exponent theorem of Flajolet and Sedgewick [3 Theorem IX.11, pp. 669–670] and explain how its proof gives the coefficient estimate used in § 1.1. We write A(z,u) and B(z,u) for the analytic functions in that theorem, to distinguish them from the functions A(u) and B(u) in the Quasi-powers theorem.
The theorem
Theorem IX.11 (Variable exponent perturbation). Let F(z,u) be analytic at (0,0), with nonnegative Taylor coefficients. Suppose that it admits a representation
F(z,u)=A(z,u)+B(z,u)C(z)−α(u)
with the following properties, for some r>ρ>0 and ε>0:
The functions A and B are analytic on a neighborhood of {(z,u):∣z∣≤r,∣u−1∣≤ε}.
The function α is analytic for ∣u−1∣≤ε, and α(1)∈R∖{0,−1,−2,…}.
The function C is analytic for ∣z∣≤r. Its only zero in this disk is the simple zero ρ, and B(ρ,1)=0.
The variability condition α′(1)+α′′(1)=0 holds.
The representation is understood by analytic continuation, with a consistent choice of the power of C(z). If Xn has probability generating function
pn(u)=[zn]F(z,1)[zn]F(z,u),
then, writing μn=EXn and σn2=Var(Xn), we have
μn=α′(1)logn+O(1),
σn2=(α′(1)+α′′(1))logn+O(1),
and
P{σnXn−μn≤x}=Φ(x)+O((logn)−1/2)
uniformly for x∈R, where Φ is the standard normal distribution function.
The coefficient estimate in the proof
Put d=−ρC′(ρ). Since ρ is a simple zero, the local expansions at z=ρ are
C(z)=d(1−z/ρ)(1+O(1−z/ρ)),B(z,u)=B(ρ,u)+O(1−z/ρ),
uniformly for u near 1. Thus the leading singular term of F is
The contribution of A is exponentially smaller, while the remaining singular terms contain an additional factor 1−z/ρ. Uniform singularity analysis, after restricting the neighborhood of u=1 if necessary, therefore gives the estimate established in the proof of Theorem IX.11:
Here c is analytic and nonzero on a sufficiently small neighborhood of 1, and the error is uniform there. Dividing (2) by its value at u=1 yields
pn(u)=c(1)c(u)exp((α(u)−α(1))logn)(1+O(n−1/2)).
This is the quasi-powers approximation from which the Gaussian conclusion follows. The analytic mean and variance of its factor exp(α(u)−α(1)) are α′(1) and α′(1)+α′′(1), respectively, which explains the leading terms in the theorem’s mean and variance formulas. In our paper, it is the intermediate coefficient estimate (2) that is used first.
Application to generalized derangements
Set
P(z)=j∈S∑jzj,s=P(1)=j∈S∑j1,H(z,u)=e−uP(z).
Our generating function is F(z,u)=H(z,u)(1−z)−u, so the theorem applies with
A(z,u)=0,B(z,u)=H(z,u),C(z)=1−z,α(u)=u,ρ=1.
Indeed, P is a polynomial because S is finite, so H is entire. The function C has the unique simple zero 1, while H(1,1)=e−s>0, and α(1)=1 and α′(1)+α′′(1)=1. The nonnegativity of the coefficients of F follows from its counting interpretation, or directly from
F(z,u)=expuj≥1j∈/S∑jzj.
Also d=−ρC′(ρ)=1, so c(u)=e−us/Γ(u). Consequently, (2) becomes
fn(u)=[zn]F(z,u)=Γ(u)e−usnu−1(1+O(n−1/2)).(4)
This is precisely the coefficient estimate used in (1).
For completeness, the uniformity on the particular disk Ω={u:∣u−1∣≤1/3} used there can be seen directly from the same argument. Since H is entire, write
H(z,u)=H(1,u)+(1−z)J(z,u),
where the apparent singularity of J at z=1 is removable. Thus J is entire, and
F(z,u)=e−us(1−z)−u+(1−z)1−uJ(z,u).
Choose the branch of log(1−z) on C∖[1,∞). The terms are analytic in a common Δ-domain at 1. The uniform transfer argument used in the proof of Theorem IX.11 gives
[zn]((1−z)1−uJ(z,u))=O(nu−2),u∈Ω.
The constants can be chosen uniformly because J is bounded on the relevant compact sets and both the real and imaginary parts of u range over bounded intervals. For the leading term, uniformly on Ω,
Since e−us/Γ(u) is bounded away from zero on Ω, these estimates give a uniform relative error O(n−1), which in particular implies the O(n−1/2) error retained in (3).
Finally, setting u=1 in (3) gives
fn(1)=e−s(1+O(n−1/2))⟶e−s>0,
because Γ(1)=1 and n1−1=1. Dividing by this normalizing factor, uniformly for u∈Ω, we obtain
Writing nu−1=(eu−1)logn gives exactly the quasi-powers parameters used in the paper:
A(u)=Γ(u)e(1−u)s,B(u)=eu−1,βn=logn,κn=n.
In particular, A(1)=B(1)=1 and B′′(1)+B′(1)−(B′(1))2=1=0, as required.
Sampling without replacement
The same asymptotic result holds when (p1,p2,…,pd) is sampled without replacement. Indeed, sampling without replacement is equivalent to sampling with replacement conditioned on the event that the pi are all distinct. Define the events Qij={pi=pj} for 1≤i<j≤d and let Q=⋂i<jQij. Let C={#cycles(p1)=#cycles(p2)=⋯=#cycles(pd)}. By the law of total probability,
We now show that P(Qc) is asymptotically negligible relative to P(C). By the union bound,
P(Qc)=P(i<j⋃Qijc)≤1≤i<j≤d∑P(Qijc)=(2d)Dn1.
Recall that Dn/n!=[zn]F(z,1)=[zn](1−zexp(−P(z))) and that F(z,1) has a unique singularity, a simple pole at z=1. Applying singularity analysis, we conclude that Dn/n!→exp(−P(1))=e−s as n→∞. Dividing both sides of (5) by P(C), we obtain
1−P(C)P(C∣Q)≤P(C)P(Qc)=O(n!(logn)(d−1)/2)→0
as n→∞. Thus, P(C∣Q)∼P(C).
References
[1]M. Bóna. A Walk Through Combinatorics: An Introduction to Enumeration and Graph Theory. Fifth edition. World Scientific Publishing Company, 2023. ISBN: 9789811277856.
[2]Miklós Bóna and Arnold Knopfmacher. “On the probability that certain compositions have the same number of parts”. In: Ann. Comb. 14.3 (2010), pp. 291–306. ISSN: 0218-0006,0219-3094. DOI: 10.1007/s00026-010-0060-7. URL: https://doi.org/10.1007/s00026-010-0060-7.
[3]Philippe Flajolet and Robert Sedgewick. Analytic Combinatorics. Cambridge University Press, 2009.
[4]V. Goncharoff. “Du domaine de l’analyse combinatoire”. In: Bull. Acad. Sci. URSS. Sér. Math. [Izvestia Akad. Nauk SSSR] 8 (1944), pp. 3–48.
[5]Herbert S. Wilf. The variance of the Stirling cycle numbers. 2005. arXiv: math/0511428 [math.CO]. URL: https://arxiv.org/abs/math/0511428.