Balanced parentheses 2026-10-14
A string of opening and closing parentheses is balanced when its total numbers of openings and closings agree and every prefix has at least as many openings as closings. Thus
(()()) is balanced, while ())(() has equal totals but an invalid prefix. Reading ( as an up step and ) as a down step gives a bijection with Dyck paths: height is the number of openings awaiting a closing parenthesis. There are balanced strings with pairs, including one empty string. This models nested syntax and the stack discipline that remembers the most recently opened unfinished part. Catalan number Created 2026-09-24 Updated 2026-10-14
The Catalan number counts Dyck paths with semilength of a Dyck path . For a nonnegative integer ,The count includes the empty path. Of the paths with three up steps and three down steps, exactly five stay at nonnegative height. Their shapes and balanced parentheses encodings appear below.[ref]
Bijective Proof Problems by Richard P. Stanley. §5, printed pp. 38–39, formula (7) and Problems 154–159: Catalan counts, binary parenthesizations, binary trees and Dyck paths
All five Dyck paths of semilength three and their balanced parentheses encodings
. Original enumeration of six-step up/down paths with nonnegative prefix heights. An up step encodes an opening parenthesis and a down step a closing one. Each panel shows one distinct string; no path shape or illustration is copied from a source. Details.The useful connection is a shared decomposition. A Dyck path splits uniquely at its first-return decomposition of a Dyck path; a binary tree splits at its root into left and right subtrees; a binary parenthesization splits at its last operation. Each removes one outer unit and leaves an ordered pair of smaller objects. The resulting Catalan recurrence lets one count several different structures with the same calculation. A count of five does not mean the structures are physically identical: a bijection supplies the precise translation between them.
Dyck path Created 2026-09-24 Updated 2026-10-14
A Dyck path starts at , ends at , uses steps and , and never passes below the horizontal axis. Its semilength of a Dyck path is : there are up steps and down steps. The nonnegative height records a constraint throughout the journey, not just the endpoint. The Catalan number counts the Dyck paths of this size.
First-return decomposition of a Dyck path 2026-10-14
A nonempty Dyck path starts with . At its first later return to height zero, cut after the matching . The segment between these two steps stays at height at least one; translating it down one level gives a Dyck path . The remaining suffix is another Dyck path . This gives the unique form .
If the original semilength of a Dyck path is and that of is , then has semilength of a Dyck path . The first return occurs after steps. For the illustrated path
UUUDDDUD, , is UUDD, is UD, and the first return occurs after six steps.Draw balls sequentially without replacement from green and red balls. Let be the first positive draw count at which the numbers of drawn green and red balls agree. For ,where denotes the falling factorial and is a Catalan number. Odd first return times are impossible because equality requires an even total number of draws.
To count the successful colour orders, encode green by a step and red by a step . If the first step is positive, a first return time means that the partial sums remain strictly positive until the last step. Delete the first positive step and the last negative step, and shift the remaining heights down by one. The result is a Dyck path of length , of which there are . Interchanging the colours doubles this count. Every such colour order has the same probability under sampling without replacement, namely , proving the formula. In particular, the numbers of successful colour orders at lengths two, four and six are two, two and four; balanced orders with an earlier return must not be counted.
Narayana number 2026-10-20
The number counts Dyck paths of semilength with exactly peaks, for . Summing over gives the th Catalan number.
Past exam of the mathematics course of the University of Cambridge 2026 iii Paper 145 3 a Solution Created 2026-09-24 Updated 2026-10-03
Suppose the first draw is green. The excess of green over red must remain positive after draws one through five and return to zero at draw six. After deleting the first green and final red, the remaining four steps must form a Dyck path: they have equal colour counts and never go below zero relative to the new starting level. There are such orders, and , giving and in the original game.
Interchanging green and red gives and . Thus there areorders. More generally, the Catalan number counts each sign of excursion with first return time .
Semilength of a Dyck path 2026-10-14

