Vous êtes sur la page 1sur 6

Generating All Catalan Sequences By Switching

Elements From A Single Catalan Sequence


Joseph Luc-Andre Sabourin
Department of Mathematics and Computer Science
Royal Military College of Canada
Kingston, Ontario K7K 7B4 Canada
May 17, 2015
Acknowledgements: I would like to extend my most sincere gratitude to Dr. Lucien
Haddad for helping me as my advisor for this project, Xiaofeng Yang for helping me during
the editing process, and Al Moufid for helping during the idea development process. I would
also like to thank all my friends and family for providing support throughout this process.
Abstract
This paper provides and proves a method of how to generate all Catalan Sequences
from a single one of a given size by switching elements from the first Catalan sequence.
This is important as it would give us a way to map all path ways of anything traveling
in discrete space. This was done by first developing a set of axioms for switching the
elements, then analyzing the patterns from the data, and finally defining a proving the
method works by making sure it abides by the patterns observed from the data.

Introduction: Catalan numbers define the number of ways of arranging two types of
objects of equal number in a sequence such that the number of the first type (primary object)
is greater than or equal to the number of the second type. This paper provides and proves an
algorithm to generate all Catalan sequences of a given size by switching elements of a single
Catalan sequence of the same size. This would have implications where discrete pathfinding
occurs, as it can be adapted to produce all applicable paths in discrete space, such as The
Traveling Salesman problem, or navigating to avoid undesirable areas within a grid space.
At this time the algorithm is limited to square grids, however I am working to adapt it for
when the number of objects are not equal to each other allowing for navigating paths in
discrete space over any rectangular space, as well as for when there are more than 2 types
of objects allowing for higher dimension navigation of discrete spaces.

Generating All Catalan Sequences

1.1

Proposed Theorem

Theorem 1.1. All Catalan sequences can be generated by manipulating a single sequence
using the following axioms:
1. Start with the Catalan sequence ab repeated n times where a is the primary object and
b is the secondary object and represent it in matrix notation as seen below:


1 3 2n-3 2n-1
2 4 2n-2 2n
Such a matrix is referred to as a base matrix of order n.
2. Values can be switched so long as the secondary object is to the left of the primary
object in the switch.
3. When conducting multiple switches, start with the desired even value as far to the right
as possible and move left, and each of these values cannot switch with anything to the
right of a prior swap (so if 4 switched with 7, then 2 can only switch with 3 and 5).
4. After conducting the desired switches, organize each row so that it is increasing from
left to right. This will result in the columns increasing as well resulting in a Catalan
representation, where numbers in the top row represent as in that associated position
and numbers in the bottom row represent bs in that associated position.
5. The numbers in the top row represent the positions of the primary objects and the
numbers in the bottom row represent the position of the secondary objects. The rows
should increase from left to right, and the columns should increase from top to bottom.

1.2

Proof of method

Lemma 1.2 (Axioms). This will provide an explained proof of each axiom and why they will
work.
1. Axiom 1: it is in order to make manipulating the original Catalan sequence easier and
straight forward.
2. Axiom 2: by switching a secondary object with a primary object behind it, it will move
the primary object to a position earlier in the sequence resulting in a Catalan sequence
being produced.
3. Axiom 3: this is to remove repetitions as seen in Figure 1. Removing the cases in which
the switches cross was inspired by the hand shaking application of Catalan numbers.
4. Axiom 4: suppose that 2t is selected to switch, such that 1 t < n. This will result
in 2t being displaced to a position k, such that t + 1 k n, and that 2k 1 will be
placed in 2ts original place. When ordering the rows, 2t will be placed in the column
2

Figure 1: Example for Axiom 3s Proof

Figure 2: Example for Axiom 4s Proof

that is to the right of its original place, and 2k 1 will be placed in the column that is
to the left of its original place. This would result in 2t being above 2(t + 1) and 2k 1
being below 2(k 1) 1 and so the rule of the rows increasing across and the columns
increasing down is maintained. If multiple swaps occur, then this would also hold true.
5. Axiom 5: this is to ensure that the primary objects do occur prior to the secondary
objects at all possible points.
Lemma 1.3 (Uniqueness).
In order to ensure uniqueness of each matrix corresponding to a single Catalan sequence,
and that each Catalan sequence only corresponds to a single matrix, various switches will be
compared and see that when a different group of switches in conducted, a different matrix
will be made.
Suppose that when making p switches to a base order n Catalan matrix, and then p
different switches (such that at least one of the switches among the p total switches is
different) to a base order n Catalan matrix. Let t be one of the elements of the bottom row
which is switched in both cases, and let t be switched with 2x 1 for the first case and 2y 1
(WLOG let x > y)for the second case, and let the rest of the switches among the p for each
case be the same.
After applying the algorithm from T heorem2.1, the sequence from the first case would
be almost identical with the one produced from the second case, less the fact in the 2x 1

Figure 3: Example for Axiom 5s Proof

Figure 4: Example for Uniqueness Proof

position of the sequence would be a b in the first case and an a in the 2y 1 position, while
in the second case, there would be an a in the 2x 1 position and a b in the 2b 1 position,
and so the Catalan sequences are different. If we were to suppose that all p switches are
different, then each one possible combination of p switches (after applying the algorithm
from T heorem2.1) would result in a unique Catalan Sequence.
Lemma 1.4 (Producing all Catalan Sequences).
In order to determine if it is possible to produce all Catalan Sequences, then we must
show that all possible ways of making switches in accordance with the algorithm will equal
the corresponding Catalan number to those sequences (so a sequence of order n will have
Catalan number Cn ).
 A sequence
  of order 1 produces the following matrices:
1
1

2
2
This matrix can facilitate zero switches, so it would have a number of possible switches of 1
(only one way to switch no terms) and C1 = 1.
A
2 produces
the following matrices:
 sequence

of order
 

1 3
1 3
1 2

,
2 4
2 4
3 4
This matrix can facilitate zero switches and one switch (between 2 with 3), so the possible
number of switches is 2 and C2 = 2.
A
order 3 produces
the 
following
matrices:
 sequence
 of 
 

 
 

1 3 5
1 3 5
1 2 5
1 2 3
1 3 4
1 2 4

,
,
,
,
3 4 6
4 5 6
2 5 6
3 5 6
2 4 6
2 4 6
This matrix can facilitate zero switches, 3 single switches (between 2 with 3, 2 with 5,
and 4 with 5) and 1 double switch (between 2 with 3 and 4 with 5) so the possible number
of switches is 5 and C3 = 5.
The following triangle can be produced after checking matrix switched for n up to 7:
w
Pn1
0 1
2
3
4
5 6
Cn
i=0 Sn,w
1 1
1
1
2 1 1
2
2
3 1 3
1
5
5
n 4 1 6
6
1
14
14
5 1 10 20 10
1
42
42
6 1 15 50 50 15 1
132
132
7 1 21 105 175 105 21 1
429
429
The triangle is symmetric about the center line (where the total number of ways to not
switch all but 1, 2, ..., n 1 pairs of elements is the same as all the ways to switch 1, 2, ...,
4

n 1 pairs of elements) and that a new layer is formed for every odd value of n.
In order to find a way to produce each possible switch, we will need to develop a generating
function for a given n and w parameter. Let this term be called S( n, w) for the number of
Catalan sequences produced from w switches on a sequence of order n.
Based upon the triangle, the following is true about S( n, w) for all n and w:
Cn =

n1
X

Sn,w

(1)

i=0

Sn,w = Sn,n(w+1)

(2)

Testing and comparing the values in the triangle resulted in the following relationships:
Sn,0 = 1
Sn,1 =

n(n 1)
2

n(n 1)2 (n 2)
12
can be defined by the following expression:
 

1
n
n1
Sn,w =
w+1 w
w
Sn,2 =

Suppose Sn,w

(3)
(4)
(5)

(6)

In order to verify that equation 6 is in fact true, it must satisfy the two observations on
the nature of Sn,w as seen in equations 1 and 2.
n1
X
i=0

 

1
n n1
i+1 i
i

(7)

By taking the coefficient into consideration, the product of the two combinations can be
separated into a difference of products of two combinations:

  

n1 
X
n
n1
n n1

i
+
1
i
i
i+1
i=0

(8)

The sum can be broken up into two separate sums with each pair of combinations:
n1 
X
i=0


 X


n1 
n
n1
n
n1

n1i
i
ni
i+1
i=0

(9)

Using a combinatorial proof, each sum can form a single combination: suppose the first
sum is all possible ways of choosing n 1 objects from n 1 of one type and n from another
type; this is equal to choosing n 1 objects from 2n 1 objects. Similarly, the second sum
is equal to choosing n + 1 objects from 2n 1 objects:


 
 
 

2n 1
2n 1
2n 1
2n 1

n1
n+1
n
n+1

(10)

Equation 10 can be simplified to:




2
2n 1
n+1
n
By multiplying equation 11 by

(11)

n
n

we get:
 
1
2n
= Cn [1]
n+1 n

(12)

Therefore the condition in equation 1 has been satisfied. For the condition in equation
2:
Sn,w

 

1
n
n1
=
w
w+1 w

(13)

By putting the coefficient into the first combination and pulling a term out the following
is produced:



1
n
n1
Sn,w =
= Sn,n(w+1)
(14)
n w n (w + 1) n (w + 1)
Therefore both conditions observed from the table are satisfied and so we can produce
every Catalan sequence using the algorithm outlined in T heorem2.1. 
Lemma 1.5. Recursion
There are 3 recursive relations for Sn,w as there are two variables. They are as follows:
Sn,w = Sn1,w

n(n 1)
f or1 n, 0 w n 1
(n w)(n (w + 1))

(15)

(n + 1 w)(n w)
f or1 n, 1 w n 1
w(w + 1)

(16)

Sn,w = Sn,w1

Sn,w = Sn1,w1

n(n 1)
f or2 n, 1 w n 1
w(w + 1)

(17)

References
[1] Ralph P. Grimaldi, Fibonnaci and Catalan Numbers: An Introduction, John Wiley &
Sons, Inc., New Jersey, 2014.
[2] Ross G. Pinsky, Problems from Discrete to the Continuous: Probability, Number Theory,
Graph Theory, and Combinatorics, Springer International Publishing Switzerland, New
York, 2014.

Vous aimerez peut-être aussi