Why should there necessarily be a right parenthesis with equal left and right parentheses before it, in an illegal sequence of parentheses

catalan-numberscombinatorics

From this answer, proving the formula $\binom{2n}{n}-\binom{2n}{n+1}$ for the number of "legal" (ie, "balanced" or "properly matched") sequences of parentheses of length $2n$,

there is a least $k$ where there is a right parenthesis at position $k$ and equally many left and right parentheses before $k$

Why should this be necessarily true? Though I don't see any counterexamples, I can't prove it either.

Here is my digging:
Take any legal sequence and flip a correctly matched pair, then we have an illegal sequence. Note that, in any legal sequence, the ( will always be before the ) in one pair. So after the flipping, the ) will come first. As everything before the ) is correctly matched, so that proves that there is a ) before which there are equally many left and right parentheses.

But I'm not convinced. Why should this account for all illegal sequences? What if there are more than one correctly matched sequences flipped?

I want to have a rigorous proof, but I can't find it. Does anyone has an idea?

Thanks!

Best Answer

Associate to a sequence of parantheses a sequence of $1$, $-1$, by $(\mapsto 1$, $)\mapsto -1$.

Balanced sequence $a_1 a_2 \ldots a_{2n}$ means

  1. $ \sum_1^k a_i\ge 0$ for all $1\le k \le 2n$

  2. $ \sum_1^{2n} a_i = 0$

Let's show first: a sequence of $1$, $-1$, is legal if and only if it is balanced.

Now, legal sequences are sequences obtained as follows: start from the empty sequence, perform several steps of form

$$ A,B \mapsto A, 1,-1, B$$ that is, we insert into the word $A,B$ at some position the piece $1, -1$ ($A$, $B$ are words in $1$, $-1$, possibly empty).

We can see that if $AB$ is balanced, so is the new sequence. Hence, by induction, all legal sequences are balanced.

Conversely: say we have a balanced sequence of $1$, $-1$. Consider the first appearance of $-1$ from the left. Before it, there must be $1$. So our sequence is of the form $A, 1, -1, B$. It is easy to see that $A,B$ is again balanced.

Therefore: legal is equivalent to balanced.

Consider now a sequence with $\sum_1^{2n} a_i = 0$ that is not legal. Then there must exist $k$ such that $\sum_1^k a_i < 0$. Consider $k$ smallest with such property. Then $k=1$, or $\sum_1^{k-1} a_i \ge 0$. The cannot be $> 0$, since then $a_k\le -2$. Therefore we have $\sum_1^{k-1}a_i = 0$, and $a_k=-1$ $\square$

Related Question