Counting Well-Formed Parenthesizations Easily

Similar documents
A symmetrical Eulerian identity

The Random Walk For Dummies

Math 155 (Lecture 3)

Lecture Overview. 2 Permutations and Combinations. n(n 1) (n (k 1)) = n(n 1) (n k + 1) =

Books Recommended for Further Reading

Math 172 Spring 2010 Haiman Notes on ordinary generating functions

The Rand and block distances of pairs of set partitions

Recursive Algorithm for Generating Partitions of an Integer. 1 Preliminary

arxiv: v1 [math.co] 23 Mar 2016

CIS Spring 2018 (instructor Val Tannen)

Square-Congruence Modulo n

SOME TRIBONACCI IDENTITIES

2 A bijective proof of Theorem 1 I order to give a bijective proof of Theorem 1, we eed to itroduce the local biary search (LBS) trees, used by Postio

Section 5.1 The Basics of Counting

A GENERALIZATION OF THE SYMMETRY BETWEEN COMPLETE AND ELEMENTARY SYMMETRIC FUNCTIONS. Mircea Merca

Fortgeschrittene Datenstrukturen Vorlesung 11

Basic Counting. Periklis A. Papakonstantinou. York University

NICK DUFRESNE. 1 1 p(x). To determine some formulas for the generating function of the Schröder numbers, r(x) = a(x) =

~W I F

De Bruijn Sequences for the Binary Strings with Maximum Density

Harmonic Number Identities Via Euler s Transform

Sequences A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

Injections, Surjections, and the Pigeonhole Principle

FLOOR AND ROOF FUNCTION ANALOGS OF THE BELL NUMBERS. H. W. Gould Department of Mathematics, West Virginia University, Morgantown, WV 26506, USA

A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

6 Integers Modulo n. integer k can be written as k = qn + r, with q,r, 0 r b. So any integer.

On Divisibility concerning Binomial Coefficients

DIVISIBILITY PROPERTIES OF GENERALIZED FIBONACCI POLYNOMIALS

Math 2784 (or 2794W) University of Connecticut

Bijective Proofs of Gould s and Rothe s Identities

De Bruijn Sequences for the Binary Strings with Maximum Specified Density

CLOSED FORM FORMULA FOR THE NUMBER OF RESTRICTED COMPOSITIONS

A Note on the Symmetric Powers of the Standard Representation of S n

Discrete Mathematics Recurrences

An enumeration of flags in finite vector spaces

5. Recurrences. The recursive denition of the Fibonacci numbers is well-known: if F n is the n th Fibonacci number, then

4 The Sperner property.

Analysis of Algorithms. Introduction. Contents

Commutativity in Permutation Groups

1 Generating functions for balls in boxes

Combinatorics and Random Generation. Dominique Gouyou-Beauchamps

V. Adamchik 1. Recursions. Victor Adamchik Fall of x n1. x n 2. Here are a few first values of the above sequence (coded in Mathematica)

1 What is combinatorics?

Chapter IV Integration Theory

Generating Functions

Some Explicit Formulae of NAF and its Left-to-Right. Analogue Based on Booth Encoding

Math 475, Problem Set #12: Answers

REVIEW FOR CHAPTER 1

Weakly Connected Closed Geodetic Numbers of Graphs

MT5821 Advanced Combinatorics

Let us consider the following problem to warm up towards a more general statement.

subcaptionfont+=small,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0 subcaption ALGEBRAIC COMBINATORICS LECTURE 8 TUESDAY, 2/16/2016

Interesting Series Associated with Central Binomial Coefficients, Catalan Numbers and Harmonic Numbers

1 Counting and Stirling Numbers

Large holes in quasi-random graphs

Course : Algebraic Combinatorics

The Local Harmonious Chromatic Problem

THIS paper analyzes the behavior of those complex

Langford s Problem. Moti Ben-Ari. Department of Science Teaching. Weizmann Institute of Science.

Some p-adic congruences for p q -Catalan numbers

ANTI-LECTURE HALL COMPOSITIONS AND ANDREWS GENERALIZATION OF THE WATSON-WHIPPLE TRANSFORMATION

Product measures, Tonelli s and Fubini s theorems For use in MAT3400/4400, autumn 2014 Nadia S. Larsen. Version of 13 October 2014.

Proof of Fermat s Last Theorem by Algebra Identities and Linear Algebra

Randomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)

Mathematical Induction

Pairs of disjoint q-element subsets far from each other

MAXIMALLY FLAT FIR FILTERS

Induction: Solutions

Infinite Sequences and Series

A Combinatorial Proof of a Theorem of Katsuura

Linear chord diagrams with long chords

A NOTE ON PASCAL S MATRIX. Gi-Sang Cheon, Jin-Soo Kim and Haeng-Won Yoon

MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.436J/15.085J Fall 2008 Lecture 19 11/17/2008 LAWS OF LARGE NUMBERS II THE STRONG LAW OF LARGE NUMBERS

CSE 191, Class Note 05: Counting Methods Computer Sci & Eng Dept SUNY Buffalo

Enumerative & Asymptotic Combinatorics

Problem Set 2 Solutions

Week 5-6: The Binomial Coefficients

Factors of sums and alternating sums involving binomial coefficients and powers of integers

TEACHER CERTIFICATION STUDY GUIDE

Solutions to Final Exam

2.4 - Sequences and Series

The Borel hierarchy classifies subsets of the reals by their topological complexity. Another approach is to classify them by size.

Discrete Mathematics

6.895 Essential Coding Theory October 20, Lecture 11. This lecture is focused in comparisons of the following properties/parameters of a code:

Series with Central Binomial Coefficients, Catalan Numbers, and Harmonic Numbers

The Growth of Functions. Theoretical Supplement

Sequences of Definite Integrals, Factorials and Double Factorials

Disjoint Systems. Abstract

CSE 1400 Applied Discrete Mathematics Number Theory and Proofs

The multiplicative structure of finite field and a construction of LRC

Complex Numbers Solutions

Homework 9. (n + 1)! = 1 1

Some remarks for codes and lattices over imaginary quadratic

4.3 Growth Rates of Solutions to Recurrences

Applicable Analysis and Discrete Mathematics available online at ON JENSEN S AND RELATED COMBINATORIAL IDENTITIES

A Combinatoric Proof and Generalization of Ferguson s Formula for k-generalized Fibonacci Numbers

62. Power series Definition 16. (Power series) Given a sequence {c n }, the series. c n x n = c 0 + c 1 x + c 2 x 2 + c 3 x 3 +

Fermat s Little Theorem. mod 13 = 0, = }{{} mod 13 = 0. = a a a }{{} mod 13 = a 12 mod 13 = 1, mod 13 = a 13 mod 13 = a.

On a Smarandache problem concerning the prime gaps

Complex Stochastic Boolean Systems: Generating and Counting the Binary n-tuples Intrinsically Less or Greater than u

Transcription:

Coutig Well-Formed Parethesizatios Easily Pekka Kilpeläie Uiversity of Easter Filad School of Computig, Kuopio August 20, 2014 Abstract It is well kow that there is a oe-to-oe correspodece betwee ordered trees of + 1 odes, forests of odes, biary trees of odes, ad well-formed parethesizatios with opeig ad closig paretheses, which leads to the classic result that the umber of objects i each of these collectios is give by the th Catala umber C. The closed form of C is typically derived as a applicatio of geeratig fuctios. This ote presets a simple combiatorial argumet for the fact that the umber of well-formed parethesizatios of opeig ad 1 closig paretheses is 2 +1(. 1 Key words: Well-formed parethesizatio, Dyck word, Catala umber, coutig, Raey s lemma 1 Itroductio It is well kow that the th Catala umber C gives the umber of differet ordered trees of + 1 odes, forests of odes, biary trees of odes, ad well-formed parethesizatios with opeig ad closig paretheses. Catala umbers have surprisigly may additioal combiatorial iterpretatios. Staley metios about 70 of them i his book (1999. Together with a addedum published o his web site 2 the umber of combiatorial iterpretatios of C is 207. Koshy (2009, Chap. 5 provides a historical itroductio to Catala umbers. The closed form +1( 1 2 of the th Catala umber C is typically derived as follows (See, e.g., (Kuth, 1973, pp. 388-389 or (Graham et al., 1 The overall idea of this proof was give by late Derick Wood i persoal commuicatio at the Uiversity of Waterloo, Otario, i 1994. 2 www-math.mit.edu/ rsta/ec/ 1

1990, pp. 343-344: First a recurrece is derived for C, with C 0 = 1 1 C = C i C 1 i for 1. i=0 The a quadratic equatio is derived for a geeratig fuctio C(z whose coefficiets are C, ad solved as C(z = 1 1 4z 2z Usig the biomial theorem ad properties of biomial coefficiets the closed form of C(z ca be trasformed back to a power series, whose coefficiets fially give the result C = +1( 1 2. Geeratig fuctios are a powerful tool to solve combiatorial eumeratio problems; see (Graham et al., 1990, Chap. 7. Their drawback is that by maipulatig formal power series oe easily looses combiatorial ituitio of the objects that are beig studied. For this reaso we preset a simple combiatorial proof for the value of C. The argumet is based o placig well-formed parethesizatios i correspodece with strigs of paretheses which are straight-forward to cout. A strig of opeig paretheses ( ad closig paretheses is a well-formed parethesizatio (wfp if each of its opeig paretheses is matched by a uique closig parethesis that follows it, ad vice versa. The followig are the five well-formed parethesizatios with three opeig ad three closig paretheses: (((, (((, (((, (((, ad ((( Well-formed parethesizatios cosist of equally may opeig ad closig paretheses, but ot all such strigs are well-formed. I geeral, a strig of opeig ad closig paretheses ca be formed by choosig which out of the 2 available positios are occupied by a opeig parethesis, ad placig a closig parethesis at each of the remaiig positios (or vice versa. Thus the total umber of such strigs is ( 2. For example, there are ( 6 3 = 20 differet strigs that cosist of three opeig ad three closig paretheses. I additio to the above five of them which are well-formed parethesizatios, below are the remaiig 15 which are ot well-formed: (((, (((, (((, (((, (((, (((, (((, (((, (((, (((, (((, (((, (((, (((, (((. 2

Table 1: Correspodece btw Dyck-1 words of legth 7 ad strigs of 4 opeig ad 3 closig paretheses Dyck-1 Rotatios, or strigs with four ( ad three (((( ((((, ((((, ((((, ((((, ((((, ((((, (((( (((( ((((, ((((, ((((, ((((, ((((, ((((, (((( (((( ((((, ((((, ((((, ((((, ((((, ((((, (((( (((( ((((, ((((, ((((, ((((, ((((, ((((, (((( (((( ((((, ((((, ((((, ((((, ((((, ((((, (((( Our proof for the umber of well-formed parethesizatios is based o a correspodece betwee wfp s ad their rotatios. For a strig w which starts by a prefix α that is followed by the suffix β, the strigs w = αβ ad βα are rotatios (aka cyclic shifts of each other. Whe both α ad β are o-empty strigs, the strigs αβ ad βα are proper rotatios of each other. Oe complicatio for coutig wfp s i terms of their rotatios is that some wfp s have rotatios which are idetical. For example, ((( has oly two differet rotatios, which are ((( ad (((. Aother complicatio is that the rotatios of some wfp s coicide. For example, the wfp s ((( ad ((( have the followig commo set of rotatios: {(((, (((, (((, (((, (((, (((} Surprisigly these complicatios disappear whe we prefix the wfp s by a extra opeig parethesis. We call the resultig strigs Dyck-1 words. Let C be the umber of well-formed parethesizatios of legth 2. Clearly the umber of Dyck-1 words of legth 2+1 is also C. Let A be the set of strigs of + 1 opeig ad closig paretheses. The size of A is easily see to be ( 2+1. As we ll prove formally, the rotatios of Dyck-1 words partitio the set A i C equivalece classes each with 2 + 1 members. This yields for the th Catala umber its closed form ( 2 ( 2+1 C = 2 + 1 = + 1. For example, Table 1 gives the correspodece betwee the five Dyck-1 words of legth 7 ad the ( 7 3 = 35 strigs with four opeig ad three closig paretheses, which yields the umber 35/7 = 5 of wfp s of legth 6. 2 Proof Next we justify the details of the above claim. 3

All strigs that we cosider i this ote are over the alphabet {(, }. For a strig w we use d(w to deote the depth of strig w, which we defie as the differece betwee the umber of opeig paretheses ad the umber of closig paretheses that occur i w. For example, d(ε = d( ( = d( (( = 0, d( ( = 2, ad d( (( = 1. Notice that the depth of a strig is the sum of the depths of its subwords, that is, if w = uv the d(w = d(u + d(v. Well-formed parethesizatios ca be characterized as those strigs w which satisfy the coditios that d(w = 0 ad d(α 0 for each prefix α of w. They are also kow as Dyck words. Let us call well-formed parethesizatios which are prefixed by a extra opeig parethesis Dyck-1 words (or Dyck words of depth 1. That is, a strig w is a Dyck-1 word, or simply Dyck-1, iff d(w = 1 ad d(α 1 for every o-empty prefix α of w. We first prove two remarkable properties of rotatios of Dyck-1 words: Lemma 2.1 There are o Dyck-1 words amog the proper rotatios of a Dyck-1 word. Proof. Let w = αβ be a Dyck-1 word ad u = βα its proper rotatio. Sice w is Dyck-1, we have d(w = 1 ad d(α 1. Sice d(u = d(β + d(α = d(w, we have that d(β 0. This meas that u caot be Dyck-1. A cosequece of Lemma 2.1 is that a Dyck-1 word of legth 2 + 1 has 2 + 1 differet rotatios: Lemma 2.2 All rotatios of a Dyck-1 word are differet. Proof. Let w = a 1 a 2 a m be a Dyck-1 word of symbols a 1, a 2,..., a m {(, }. Let r i deote its ith rotatio a i a i+1 a m a 1 a 2 a i 1, where 1 i m. Assume for the cotrary that w has two rotatios r i ad r j with 1 i < j m which are idetical. The also a 1 a i 1 = a j i+1 a j 1. This meas that w equals its proper rotatio r j i+1, which is accordig to Lemma 2.1 ot possible. The two lemmas above imply the ext result, which says that rotatios partitio the set A i C equivalece classes of equal cardiality: Lemma 2.3 Every strig of A has 2 + 1 differet rotatios, out of which exactly oe is a Dyck-1 word. Proof. Let w A. It suffices to show that w has a rotatio w which is a Dyck-1 word. Because rotatios of this w are also rotatios of w, Lemma 2.1 gives that o other of them is Dyck-1, ad Lemma 2.2 gives that all 2 + 1 of them are differet. If w is a Dyck-1 word, there is othig further to prove. Otherwise let u be a o-empty prefix of w such that d(u is miimal; if there are 4

several such prefixes, we take u to be the logest of them. Let v be the correspodig suffix of w, that is, w = uv. Sice d(w = 1, strig w must fail the Dyck-1 coditio by d(u < 1. Now w = vu is a rotatio of w with d(w = 1, which satisfies also the other Dyck-1 coditio that each of its o-empty prefixes has a positive depth: First, let α be a o-empty prefix of w which is also a prefix of v. Sice u was chose to be the logest of the miimal-depth prefixes of w ad uα is a loger prefix of w, we have that d(uα = d(u + d(α d(u + 1, which gives that d(α 1. Secod, let α be a prefix of w which cotais also some characters of u, that is, α = vu for some o-empty prefix u of u. Sice u is a miimal-depth prefix of w, we have d(u d(u ad thus d(α = d(vu = d(v + d(u d(v + d(u = 1. Sice there are C differet Dyck-1 words of legth 2 + 1, we have the followig corollary: Corollary 2.4 The set A cosists of C equivalece classes uder rotatio, ad each of them has 2 + 1 members. Accordig to the Corollary A = (2 + 1C, ad thus C = A 2 + 1 ( 2+1 3 Cocludig remarks = 2 + 1 (2 + 12 ( + 2 = (2 + 1! 2(2 1 ( + 1 =!( + 1 = 1 ( 2 + 1 Our argumet is closely related to a lemma which states that a sequece of itegers which add up to +1 has exactly oe rotatio such that all of its partial sums of are positive. Graham, Kuth ad Patashik (1990, p. 345 attribute this result to Raey (1960. Ideed, this Raey s Lemma ca be proved by the same argumet as Lemmas 2.3 ad 2.1, simply by iterpretig d(w as sum of a subsequece istead of depth of a sub-word. Graham, Kuth ad Patashik (1990, p. 346 give for Raey s Lemma a geometric proof, which is debatably more ivolved tha our simple combiatorial argumet. 5

Refereces Graham, R. L., Kuth, D. E., ad Patashik, O. (1990. Cocrete Mathematics. Addiso-Wesley. Kuth, D. E. (1973. The Art of Computer Programmig, Volume 1: Fudametal Algorithms. Addiso-Wesley, 2d editio. Koshy, T. (2009. Catala Numbers with Applicatios. Oxford Uiversity Press. Raey, G. N. (1960. Fuctioal compositio patters ad power series reversio. Trasactios of the AMS, 94:441 451. Staley, R. P. (1999. Eumerative Combiatorics, Volume 2. Cambridge Uiversity Press. 6