Contents lists available atScienceDirect
Discrete Mathematics
www.elsevier.com/locate/disc
Pattern statistics in faro words and permutations
Jean-Luc Baril
a,∗ , Alexander Burstein
b, Sergey Kirgizov
aaLIB,UniversitédeBourgogneFranche-Comté,B.P.47870,21078DijonCedex,France bHowardUniversity,DepartmentofMathematics,Washington,DC20059,USA
a rt i c l e i nf o a b s t ra c t
Articlehistory:
Received13October2020
Receivedinrevisedform22April2021 Accepted3May2021
Availableonlinexxxx
Keywords:
Word Permutation Faroshuffle Patternstatistics Popularity Equidistribution
Westudythedistributionandthepopularityofsomepatternsink-aryfarowords,i.e.words over the alphabet {1,2,. . . ,k} obtained by interlacing the lettersoftwo nondecreasing wordsoflengthsdifferingby atmostone.We presentabijection betweenthesewords and dispersed Dyck paths(i.e. Motzkinpaths with alllevel stepsonthe x-axis) witha givennumberofpeaks.Weshowhowthebijectionmapsstatisticsofconsecutivepatterns offarowordsintolinearcombinationsofotherpatternstatisticsonpaths.Then,wededuce enumerativeresultsbyprovidingmultivariategeneratingfunctionsforthedistributionand the popularityofpatterns oflengthatmostthree.Finally,weconsider someinteresting subclassesoffarowordsthatarepermutations,involutions,derangements,orsubexcedent words.
©2021ElsevierB.V.Allrightsreserved.
1. Introductionandnotations
The faroshuffleis awell-known technique toshuffle a deckofcards.The deckissplitin twoatthe middle,andthe cardsfromthetwohalvesarecombinedbackbytakingalternativelythebottomsofstacks.Certainmathematicalquestions aboutthefaroshuffleare consideredforexampleintheworksofMorris [23],Diaconis,GrahamandKantor [15].Inspired bythesestudiesandasolidbodyofmoderncombinatorialliterature(seeforinstanceLothaire [21],Stanley [27],Bóna [13]
andKitaev [19] books)thatexploresenumerativeandbijectiveaspectsofpatternsinvariousdiscretestructures,thepresent paperconsidersanunexpectedlyoverlookedcombinatorialobjects,whichwecallfarowords.Theyarespecialkindofword shuffles,whichareimportantinseveralalgorithmicandcombinatorialsettings(seeforexampleBarneswork [7] andrefer- encestherein).Inthispaper,wepresentenumerativeresultsandshowhowfarowordsandpatternsthereinarerelatedto otherstructuressuchasDyckpaths,MotzkinpathsandDumontpermutations.
1.1. Farowordsandpermutations
Wedealwithk-arywordsu1u2
. . .
un overtheintegeralphabet[
1,
k] = {
1,
2, . . . ,
k}
endowedwiththeusualtotalorder.Ak-arywordiscallednondecreasingifuiui+1foralli
∈ [
1,
n−
1]
.Definition1.1.Fortwo k-arywords u and v such that 0
|
u| − |
v|
1,the faroshuffle ofu and v isthe k-ary wordof length|
u| + |
v|
obtainedbyinterlacingthelettersofuandv asfollows:u1v1u2v2u3v3. . .
Ak-aryfarowordisafaroshuffle oftwonondecreasingk-arywords.*
Correspondingauthor.E-mailaddresses:[email protected](J.-L. Baril),[email protected](A. Burstein),[email protected](S. Kirgizov).
https://doi.org/10.1016/j.disc.2021.112464 0012-365X/©2021ElsevierB.V.Allrightsreserved.
Let Sn,k be the set of k-ary faro words of length n. Its cardinality equals the product of two binomial coefficients n/2+k−1
k−1
n/2+k−1
k−1
,eachofthembeing,respectively,thenumberofm-multisetsof
[
1,
k]
form=
n2andm=
n2.For example,wehaveS4,2= {
1111,
1112,
1121,
1122,
1212,
1222,
2121,
2122,
2222}
and|S
4,2| =
9.Definition1.2.Afaropermutationoflengthnisan n-aryfarowordoflengthn thatcontains everyletterin
[
1,
n]
exactly once.LetPn bethesetoflengthnfaropermutations.Forinstance,wehaveP3
= {
123,
132,
213}
.Sinceafaropermutationis entirelydeterminedbythechoiceofitsvaluesontheoddindices,thecardinalityofPn is nn/2
.
A k-ary word w
=
w1w2. . .
wn avoids a classical pattern (resp. consecutive pattern) p=
p1-p2-· · ·
-pk (resp. p=
p1p2. . .
pk)iftheredoesnotexistastrictlyincreasingsequenceofindicesi1i2. . .
ik(resp.withij+1=
ij+
1 for1 jk−
1) suchthat wi1wi2. . .
wikisorder-isomorphictop(see[19] forinstance).Obviously,anyfarowordavoidstheclassicalpattern 3-2-1.LetA vn( σ )
denotethesetofpermutationsavoidingaclassicalpatternσ
,thenwehavePn⊆
A vn(
3-2-1)
forn0, andPn=
A vn(
3-2-1)
forn3 since(
n−
1)
n12. . . (
n−
2) ∈
A vn(
3-2-1)
isnotafaroword.Notethatafaropermutationcan containallclassicalpatternsoflength3 except3-2-1 (e.g.,31425).Remark1.3.Ak-arywordw
=
w1w2. . .
wnisafarowordifandonlyifwiwi+2 foranyi∈ [
1,
n−
2]
,whichmeansthat faropermutationsarepreciselythoseavoidingthethreeconsecutivepatterns231,321 and312.1.2. DyckanddispersedDyckpaths
Inordertostudythedistributionofpatternsinfarowords,wewillexhibitone-to-one correspondencesbetweenthese objectsandsome specificlatticepathsinthefirstquadrantoftheplane.Hence,weprovidebasicnecessarydefinitionson latticepaths.
Definition1.4.DispersedDyckpaths(see[17])arelattice paths starting at
(
0,
0)
,endingat(
n,
0)
, consistingoflevelsteps F= (
1,
0)
,upstepU= (
1,
1)
anddownsteps D= (
1, −
1)
,andnevergoingbelowthex-axisandwherealllevelstepsare onthex-axis.LetBn bethesetofdispersedDyckpathsoflengthn(or,equivalently,consistingofnsteps)andsetB
= ∪
n0Bn,where the empty path isdenoted by. A Dyckpath of semilengthn0 is a dispersed Dyck path of length 2n with no level steps. Let Dn be the setof Dyck paths of semilengthn and let D
=
n0Dn.Dispersed Dyck paths oflength n are in straightforwardbijectionwithprefixesofDyckpaths oflengthn,alsoknownasballotpaths [8,28].Indeed,wecanobtain a ballot path froma dispersed Dyck path by replacingall levelsteps with up steps.Dyck anddispersed Dyck paths are countedbytheCatalanandballot numbers,respectively(seeA000108andA001405intheOnlineEncyclopediaofInteger SequencesofN.J.A.Sloane [26],wherethegeneraltermsarecn
=
n+112nn
andbn
=
nn/2
,respectively).
Apath P avoids apattern X ifandonlyif P doesnotcontain X asasequenceofconsecutivesteps (see forinstance [14,22]).Notethatother patterndefinitionsexistintheliteraturewherestepsarenotnecessarilyconsecutive [3].Wealso need some notationssimilar to Kleene starand plus symbolsof formal language theory. Fora nonempty pattern X, an occurrenceofthepattern X+ ina path P isamaximalsequence ofconsecutiverepetitionsof X,i.e.amaximal subword oftheform Xkfork1.ThepatternX∗ willbeeitheranemptypatternorapatternX+.Moregenerally,fortwopossibly empty patternsY and Z suchthat Y doesnotendwithX and Z doesnot startwith X,thepatternY X+Z (resp.Y X∗Z) corresponds to an occurrence obtained by concatenation of Y, X+ and Z (resp. Y, X∗ and Z). For instance, the path F U DU D F F U D F containstwooccurrencesofthepatternF
(
U D)
+F andthreeoccurrencesofF(
U D)
∗F.1.3. Statisticsonwordsandlatticepaths
Definition1.5.Astatisticsisaninteger-valuedfunctionfromasetAofwordsorpaths.
Toagivenpattern p,we associatethepatternstatisticp
:
A→
N such thatp(
a)
isthe numberofoccurrences ofthe pattern p in theobject a∈
A (we usethe boldface todenote statistics). Forexample,the statisticgiving thenumberof occurrencesoftheconsecutivepattern123 (resp. U DU D)inaword(resp.alatticepath)isdenotedby123(resp.UDUD).Wedenoteby1ˆ (resp.2ˆ
,
n)ˆ theconstantstatisticreturningthevalue1 (resp.2,n).Definition1.6.The popularity of apattern p inA is the totalnumber ofoccurrences of p overall objects of A, that is p
(A) =
a∈Ap
(
a)
(see[5,10,18,19]).For instance, for a dispersed Dyck path P
=
F F U D F U U DU U U D D D D we have FF(
P) =
1, DDD(
P) =
2, UD(
P) =
3, UUUU(
P) =
0 and1ˆ(
P) =
1.Moreover,ifA= {
U U D D,
U DU D}
thenthepopularityofthepatternU DinAisUD(
A) =
3.LetTAbethesetofallstatisticsdefinedonasetA.Foranypairofstatisticss
,
t∈
TA,wedefine thestatistics+
tby(
s+
t)(
a) =
s(
a) +
t(
a)
foranya∈
A,whichendowsTAwithaZ-modulestructure.LetBbeasetofcombinatorialobjects, andlet TB bethecorresponding setofstatistics.We saythat twostatistics s∈
TA andt∈
TB havethesamedistribution, orareequidistributed,ifthereexistsabijection f:
A→
Bsuchthats(
a) =
t(
f(
a))
foranya∈
A.Inthiscase,withaslight abuseofthenotationalreadyusedin[4],wewriteshortly f(
s) =
tors=
twhenever f istheidentity.Asabyproduct,for anyconstantstatisticn,ˆ wehave f(ˆ
n) =
n.ˆ1.4. Outlineofthepaper
Thepaperisorganizedasfollows.InSection2,wepresentaconstructivebijection f betweenthesetSn,kofk-aryfaro words of length n andthe setof dispersed Dyck paths oflength n
+
2k−
2 with k−
1 peaks. We show where pattern statisticsaretransportedby f,whichprovidesamoresuitablegroundforstudyingthedistributionofconsecutivepatterns.Thus,wederiveenumeratingresultsonthedistributionandpopularityofpatternsinSn,k bygivingmultivariategenerating functionswhere the coefficient ofxnykzt is thenumber ofk-ary farowords oflength n having exactlyt occurrences of a givenpattern. In Section 3,we presenta similarstudy for faropermutations. Moreprecisely, we provide abijection g betweenPn andthesetofdispersedDyckpaths oflengthnandshowhow g actsonpatternstatisticsoflengthatmost three.Consequently,wededuceenumerativeresultsforthedistributionandthepopularityofthesepatternsinPn.Wealso presentabijectionbetweenPn andinvolutionsavoidingtheclassicalpattern3-2-1.Finally,inSection4,weprovethatthe set ofsubexcedent words inSn,n is relatedto ternarytrees andDumont permutationsofthe second kind [12] avoiding theclassicalpattern2-1-4-3,andweshowwhyfaroinvolutionsandfaroderangementsarerespectivelyenumeratedbythe FibonacciandCatalannumbers.
2. Patternsinfarowords
Inthissectionweconstructabijection f betweenthesetSn,kofk-aryfarowordsoflengthnandasubsetofdispersed Dyck paths,andshow how f transportspatternstatistics.Then, we deducegeneratingfunctionsforthedistribution and popularityofsomepatterns.
Apair ina faroword w isan occurrencewiwi+1 withwi
>
wi+1.Remark 1.3impliesthat alettercannot be partof two pairssincea farowordavoidsthe consecutivepattern321.Asingletonin w isaletter wi notinanypairof w.Any farowordcan be uniquely decomposedasasequence ofpairs andsingletons,whichare calledblocksof farowords.For instance,theblockdecompositionof111212131333 is13(
21)
2(
31)
33.LetLkbethesetofallpossibleblocksofadecompositionofak-aryfaroword,thatis Lk
= {
1,
2, . . . ,
k} ∪ {
ji:
1i<
jk} .
Definition2.1.Wedefineanorderrelation
onLk asfollows:forg,
h,
i,
j∈ {
1,
2, . . . ,
k}
,⎧ ⎪
⎪ ⎨
⎪ ⎪
⎩
i
j,
ifij,
ijh,
ifih<
j,
igj,
ifg<
ij,
ig
jh,
ifg<
ijandgh<
j.
Remark2.2.Theorderrelation
canbedefinedlesstechnicallyasfollows:forp,
q∈
Lk, pq⇐⇒
pqis a faro word different from a pair.ThisorderrelationendowsthesetLkwithaposetstructure,whichwecallfaroposet.SeeFig.2.1foranillustrationof theHassediagramof
(L
k, )
.Amultichaininaposetisachain,i.e.atotallyorderedsubset,withrepetitionsallowed.Duetothesimplestructureofthe faroposet,weeasilydeducethefollowingremarks.
Remark2.3.Thereisaone-to-onecorrespondencebetweenk-aryfarowordsandthemultichainsofLk.Indeed,Remark2.2 implies that the block decomposition of a k-ary faro word w into pairs and singletons w
=
b1b2. . .
b unambiguously corresponds to the multichain b1b2· · ·
b in Lk, and vice versa. For instance, the faro word 11313232343=
11(
31)(
32)(
32)
3(
43)
correspondstothemultichain11313232343 (seeFig.2.1).Remark2.4.Ifa k-aryfaroword w containsa singletonxinits decompositionintoblocks,thenitsatisfiesthefollowing property:thesetofpairsoftheformab,b
<
ax,equalsthesetofpairsoftheformcd,dx−
1.1 21 31 41 . . . k1
2 32 42 . . . k2
3 43 . . . k3
. .. . . . ...
k−1 k(k−1) k
Fig. 2.1.Thefaroposet(Lk,).Redblocksrepresentthemultichainassociatedtothek-aryfaroword11313232343=12(31)(32)23(43).(Forinterpretation ofthecolorsinthefigure(s),thereaderisreferredtothewebversionofthisarticle.)
2.1. AbijectiontothesetofdispersedDyckpaths
AsmentionedbyE.Deutschin[26] (seesequenceA124428),thenumberofdispersedpathsoflengthnwithkpeaks(a peakisanoccurrenceofthepatternU D)isgivenby
|
Bn,k| =
n2
k n 2 k.
Thus,wepresentabijection f fromthesetSn,kofk-aryfarowordsoflengthntothesetBn+2(k−1),k−1 ofdispersedDyck pathsoflengthn
+
2(
k−
1)
withexactlyk−
1 peaks.Foragivenw∈
Sn,k,wesetf
(
w) =
FT0UT1DT2FT3. . .
FT3(k−2)UT3(k−2)+1DT3(k−2)+2FT3(k−1),
whereTiisdefinedfor0i3
(
k−
1)
asfollows:– ifi
=
3(
x−
1)
then Tiisthenumberofoccurrencesofthesingletonxinw;– ifi
=
3(
x−
1) −
1 thenTi isoneplusthenumberofpairsxy, y<
x,inw;– ifi
=
3(
x−
1) +
1 thenTi isoneplusthenumberofpairs yx,y>
x,inw.It is worth noting that the image ofa faro word w
∈
Sn,k dependson the arityk that we consider. Indeed,the im- age of the empty wordis U D when k
=
2, while f( ) =
U DU D for k=
3. We refer to Fig. 2.2 for one detailed example of this bijection, while Fig. 2.3 provides more additional examples. For instance, the images by f of the 5- arywords,
12345,
3141,
111111212222 are,respectively,U DU DU DU D, F U D F U D F U D F U D F,U U U DU D DU D DU D and F F F F F F U U D D F F F F U DU DU D.Remark2.5.Clearly, thevalues Ti,0i3
(
k−
1)
,can be obtainedfrom w by reading itfromleft to rightandby de- terminingifthecurrententryxbelongstoeitherapairxy or yx,orasingletonx.Moreover,valuesofT atindicesi=
0 mod 3 correspondtothelengthsofmaximalrunsofconsecutivelevelsteps,andvaluesatindicesi=
1 mod 3 (resp.i=
2 mod 3) correspondtothe lengthsofmaximal runsofconsecutiveup(resp. down)steps, whichmeansthat thesequence T=
T0T1. . .
T3(k−1)isarun-length-like encodingofthepath f(
w)
.Thus, f(
w)
canbe constructedfromw usingalinear timealgorithm.Lemma2.6.Thepathf
(
w)
isnecessarilyadispersedDyckpathoflengthn+
2(
k−
1)
withexactlyk−
1peaks.Proof. Since for any i
=
0 mod 3, 1i3(
k−
1) −
1 wehave Ti1, the path w contains exactly k−
1 peaks U D.Interpreting Remark2.4onthe path f
(
w)
,thenumberofup steps beforeagivenlevelstep equalsthenumberofdown steps before the samelevel step, whichimpliesthat any levelstep belongs tothe x-axis. Letdx=
x+2i=2T3(i−1)−1 (resp.
ux
=
x+1i=1T3(x−1)+1) be thetotal numberofdown steps (resp.up steps) inthe first x
+
1 maximal runsofdown steps (resp.up steps).Due tothe definitionof f,dx equals thenumberofpairs i j, 1j<
ix+
2,in w,and ux equals theFig. 2.2.The image byf of the 5-ary faro wordw=11313232343 isf(w)=F F U U DU U U D D D D F U U D DU D.
numberof pairsi j, 1 jx
+
1, ij+
1,which impliesthatdxux. Alsobydefinition,the totalnumberofup steps (resp.downsteps)in f(
w)
equalsthetotalnumberofpairsinw,whichcompletestheproof.Theorem2.7.Themap f isabijectionfromSn,ktothesetBn+2(k−1),k−1ofdispersedDyckpathsoflengthn
+
2(
k−
1)
withexactly k−
1peaks.Proof. Letus prove that if w and w are two distinct k-ary faro words then we have f
(
w) =
f(
w)
. Let i1 be the smallestpositiveintegersuch that wi=
wi.Without lossofgenerality, weassume wi<
wi.Letusconsiderthepositions ofwiandwi intheblockdecompositionof w.Ifwiandwiarebothinthepairs wiwi+1andwiwi+1,thenRemark2.3impliesthatapairwix,wi
>
x,cannotappear totherightof wi inw,whichimpliesthatT3(wi−1)−1=
T3(wi−1)−1,andthus f(
w) =
f(
w)
.Thereremainthefollowingcases:
(i) wiorwiisasingletoninw,
(ii) wiandwiarebothinthepairs wi−1wi andwi−1wi
=
wi−1wi, (iii) wibelongstothepair wi−1wiandwibelongstothepair wiwi+1, (iv) wiandwiarebothinthepairs wiwi+1 andwi−1wi.Thefactthatafarowordavoids231 incase(i)andRemark2.3forcases(ii),(iii)(iv),implythat wi cannotappeartothe rightof wi in w.Then the numberof wi in w, i.e.T3(wi−1)
+
T3(wi−1)+1+
T3(wi−1)−1,is differentfromthe numberof wi inw,whichis T3(wi−1)
+
T3(wi−1)+1
+
T3(wi−1)−1.Therefore,thereis
δ ∈ {−
1,
0,
1}
suchthat T3(wi−1)+δ=
T3(wi−1)+δ, whichimpliesthat f
(
w) =
f(
w)
.Thus, f isan injectivemap,andusingacardinalityargument(seeA124428 in[26]),we concludethat f isabijection fromSn,ktoBn+2(k−1),k−1.
Althoughitisnotusedinthepaper,we couldprovethat fromagivendispersedDyckpath P
∈
Bn+2(k−1),k−1, f−1(
P)
canbeobtainedafterapplyingthefollowingprocedure.WerefertoFig.2.3forseveralexamples.Wesets
=
1 astheinitialvalue.Wemarkall D-stepsprecededbyanU-stepandalltheotherD-stepsareleftunmarked.ReadingthestepsofP fromlefttoright:
– Ifa D-stepisencountered,thenskipit.
– Ifan F-stepisencountered,thenwritethesingletons.Ifthenextstepisnotan F-step,thenupdates
=
s+
1.– Ifan U-stepisencounteredintheithrunofU-steps,thenwedistinguishtwocases:
(i) thenextstepis D;thenweskipthisU D-patternbycontinuingfromthestepafter D,ifitexists.
(ii) thenextstepisU;thenwewritethepair ji,where j istheleastintegersuchthatthe
(
j−
1)
-thrun ofD-steps hasatleastoneunmarked D-step.Markthefirstunmarked D-stepfromthe(
j−
1)
-thrunof D-steps.2.2. Distributionandpopularityofpatterns
Inthispart,wefirst showhowthe bijection f transportspatternstatistics onSn,k intothecontextofdispersed Dyck paths.After,wededucemultivariategeneratingfunctionsforthedistributionandthepopularityofpatternsoflengthtwo byexploitingtheclassicrecursivedecompositionofdispersedDyckpaths.
Fig. 2.3.Images of several 5-ary words under bijection f.
Theorem2.8.Forn0,thebijection f fromSn,ktoBn+2(k−1),k−1mapsstatisticsassociatedtopatternsoflength2asfollows:
f
(
11) =
FF,
f(
21) =
UU=
DD,
f
(
12) =
DD(
UD)
∗UU+
DD(
UD)
∗D+
DD(
UD)
∗F+
F(
UD)
+F+
F(
UD)
∗UU=
nˆ −
1ˆ −
UU−
FF.
Proof. ByRemark2.3,anyoccurrenceofthepattern11 inafarowordwisformedbytwoconsecutivesingletonsxx.From thedefinitionofthebijection f,itfollowsthatthenumberofoccurrencesof11 inw equalsthenumberofoccurrencesof F F in f
(
w)
,thatis f(
11) =
FF.Anoccurrenceofthepattern21 inwisnecessarilyapairinthedecompositionofw.Sincethelengthofamaximalrun ofconsecutiveupstepsisequaltooneplusthenumberofpairsyxinwforagivenx
∈ [
1,
n]
,thenumberofoccurrencesof 21 inwequalsthenumberofoccurrencesofU U in f(
w)
.Ontheotherhand,anynonemptydispersedDyckpathP isofthe formeitherP=
F RorP=
U Q D RwhereQ isaDyckpathandRadispersedDyckpath.Reasoningbyinduction,weobtain thatthenumberofoccurrencesof D D equalsthoseofU U inanydispersedDyckpath,whichimplies f(
21) =
UU=
DD.Now,letusprovetheequation f
(
12) =
DD(UD)∗UU+
DD(UD)∗D+
DD(UD)∗F+
F(UD)+F+
F(UD)∗UU.Anoccurrencexy ofthepattern12 occursinwasasubblockofoneofthefollowing:(i) twodistinctconsecutivepairs
(
ax)(
yb)
, (ii) twoequalconsecutivepairs(
yx)(
yx)
, (iii) apairfollowedbyasingleton(
ax)(
y)
, (iv) asingletonfollowedbyapair(
x)(
ya)
,(v) twodistinctsingletons
(
x)(
y)
. Forthecase(i),wedistinguishthreesubcases.Subcase1. Theoccurrencexy appearsina factoroftheform
(
ax)(
yb)
withba.Thisimpliesthatneithera singleton s∈ [
a,
b]
nora pairpq with p∈ (
a,
b]
orq∈ [
a,
b)
canappearin w.Therefore,T3(s−1)=
0 fors∈ [
a,
b]
,T3(p−1)−1=
1 for p∈ (
a,
b]
andT3(q−1)+1=
1 foranyq∈ [
a,
b)
.Thus,betweentherunofD-stepsassociatedtoT3(a−1)−12 andtherunof U-stepsassociatedtoT3(b−1)+12,therearenolevelsteps,andtherunsofD-stepsandU-stepsareoflengthone,which createsm=
b−
a0 peaksU D.Hence,theoccurrencexyisassociatedtoanoccurrenceofthepatternD D(
U D)
∗U U.Subcase2.The occurrencexy appears inafactorofthe form
(
ax)(
yb)
withb<
a anda<
y.Thisimpliesthatneither a singleton x∈ [
a,
y)
nor a pair pq with p∈ (
a,
y)
or q∈ [
a,
y)
can appear in the word w. Therefore, T3(x−1)=
0 forx
∈ [
a,
y[
, T3(p−1)−1=
1 for p∈ (
a,
y)
andT3(q−1)+1=
1 foranyq∈ [
a,
y)
.Thus,betweentherunof D-steps associatedto T3(a−1)−12 andthe run of D-stepsassociated to T3(y−1)+12,there are nolevel steps, andtheruns of D-steps and U-stepsareoflengthone,whichcreatesm=
y−
a>
0 peaksU D.Hence,theoccurrencexyisassociatedtoanoccurrence ofthepatternD D(
U D)
+D.Subcase3.Theoccurrencexyappearsinafactoroftheform
(
ax)(
yb)
withb<
aanday.Bydefinitionofafaroword, we necessarilyhaveay.Thus, wededucea=
y.So,we haveT3(a−1)−13,whichcountsall consecutivepairsaz,
a>
z in w.DuetoRemark2.3,allthesepairsappearconsecutivelyin w.Thus,thenumberofoccurrencesoftheform(
ax)(
ab)
, forx,
b suchthatxb<
a isequaltothenumberofD D D=
D D(
U D)
0D patternsinthe(
a−
1)
-thrunofD-stepsinthe corresponding dispersed Dyckpath.Combining tothe subcase2,the occurrencexy is associatedtoan occurrenceof the patternD D(
U D)
∗D.Inthecase(ii),wehaveafactoroftheform
(
ax)(
yb)
witha=
y andx=
b andtheargumentfromSubcase3ofcase(i) applies.Fortheremainingcases,(iii)through(v), theoccurrencexy ofthepattern12 iseithercreatedby apairfollowed byasingleton(
ax)(
y)
,orbyasingletonfollowedbyapair(
x)(
ya)
,orbytwodifferentsingletons(
x)(
y)
.Argumentssimilar totheonesgivenabove,allowustoprovethatanoccurrencexyinw correspondstoanoccurrenceof:– D D
(
U D)
y−aF forthecase(
ax)(
y)
, – F(
U D)
a−xU U forthecase(
x)(
ya)
,and – F(
U D)
y−xF forthecase(
x)(
y)
.Finally,inanyn-length wordwe haven
−
1 occurrencesof2-lengthpatterns,thusnˆ−
1ˆ=
11+
21+
12.Applying the bijection f tobothpartsoftheequation,weobtain f(
12) =
nˆ−
1ˆ−
f(
11) −
f(
21) =
nˆ−
1ˆ−
UU−
FF.Theorem2.9.Forp
∈ {
11,
12,
21}
,thetrivariategeneratingfunctionsFp(
x,
y,
z)
wherethecoefficientatxnykztisthenumberof k-aryfarowordsoflengthn containingexactlyt occurrencesofthepatternp are:F11
(
x,
y,
z) =
2y(
xz−
x−
1)
−
xyz+
xy+
x3z−
x3+
y−
x2+
xz+
x−
1+ (
xz−
x−
1)
A1,
F21(
x,
y,
z) =
2y−
y+
x2z−
2x+
1+
A2,
F12
(
x,
y,
z) =
y x3z2−
x3z+
x2z+
xyz−
xy−
3xz+
x+
y−
1+ (
xz−
x+
1)
A2x3z2
−
x3z+
x2z−
xyz+
xy−
xz−
x−
y+
1+ (
xz−
x+
1)
A2(−
1+
y)
z+
y 1−
y,
whereA1
=
x4
−
2x2y−
2x2+
y2−
2y+
1andA2=
x4z2
−
2x2yz−
2x2z+
y2−
2y+
1.Proof. Wehave f
(S
n,k) =
Bn+2(k−1),k−1.Thus,foranypattern p, thetrivariate generatingfunction Fp(
x,
y,
z)
isgivenby y·
Bp(
x,
xy2,
z)
where Bp(
x,
y,
z)
isthetrivariate generatingfunctionwhosecoefficientatxnykzt isequaltothenumberof dispersedDyckpaths P∈
Bn,ksuchthatq(
P) =
t,whereq=
f(
p)
.Forp
=
21,Theorem2.8has f(
21) =
UU.Therefore,wedecomposethesetDofDyckpathsasfollows:D
=
U DDU(
D\ )
DD.
WealsodecomposethesetBofdispersedpathsasfollows:
B
=
FBU DBU(
D\ )
DB.
IfD
(
x,
y,
z)
isthegeneratingfunctionwherexnykzt isthenumberofDyckpathsoflengthnwithkpeaksandt occurrences ofU U,thentheabove algebraicequationyields D(
x,
y,
z) =
1+
x2y D(
x,
y,
z) +
x2z(
D(
x,
y,
z) −
1)
D(
x,
y,
z)
.If B21(
x,
y,
z)
isthegeneratingfunctionwhosecoefficientatxnykzt isthenumberofdispersedDyckpathsoflengthnwithk peaksand t occurrencesofU U,thentheabovedecompositionofB yieldsthefunctionalequationB21
(
x,
y,
z) =
1+
xB21(
x,
y,
z) +
x2y B21(
x,
y,
z) +
x2z(
D(
x,
y,
z) −
1)
B21(
x,
y,
z),
which,inturn,yieldsthedesiredresult.
Forp
=
11,Theorem2.8has f(
11) =
FF.Therefore,wedecomposethesetDofDyckpathsasfollows:D
=
U DDU(
D\ )
DD.
WealsodecomposethesetBofdispersedDyckpathsasfollows:
B