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. 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
Semilength of a Dyck path 2026-10-14

