Zigzag Permutation — Definition, Formula & Example
A zigzag permutation is an ordering of the numbers 1 through n that goes up, then down, then up, and so on, so that every entry is either a local peak or a local valley. Up-down examples are 1 3 2 4 and 2 4 1 3.
A permutation of is an up-down (alternating) permutation if . Equivalently, for odd and for even . The number of such permutations is the Euler zigzag number , with . The first values are for . The complement map is a bijection onto the down-up permutations, so the two counts are equal. Some authors start with a descent instead of an ascent, and the count is unchanged.
Key Formula
Where:
- = Number of up-down permutations of (Euler zigzag number)
- = Formal variable of the exponential generating function
- = Binomial coefficient: the number of ways to choose of the smaller entries to sit left of the largest entry
Worked Example
Problem: How many up-down permutations of are there? List them.
Step 1: The largest entry, 4, can never be smaller than a neighbor, so it must sit at a peak. In the pattern , the peaks are positions 2 and 4. Split the count into these two cases.
Step 2: Case : the first three entries must satisfy , so . The values 1 and 2 fill positions 1 and 3 in either order, which gives 1 3 2 4 and 2 3 1 4. Case : pick any of the 3 remaining values for . The other two must satisfy , so their order is forced. This gives 1 4 2 3, 2 4 1 3 and 3 4 1 2.
Step 3: Add the two cases. As a check, the recurrence with gives the same value.
Answer: There are up-down permutations: 1 3 2 4, 2 3 1 4, 1 4 2 3, 2 4 1 3 and 3 4 1 2.
Why It Matters
Zigzag permutations are a standard example in enumerative combinatorics courses of a counting problem solved by an exponential generating function. The count equals times the coefficient of in . For example, the coefficient of is , and . The odd-index values are the tangent numbers, and the even-index values are the secant numbers. This links a pure counting problem to calculus.
Common Mistakes
Mistake: Counting every permutation that alternates in either direction and calling the total .
Correction: counts only one direction, usually up-down. For , no permutation is both up-down and down-up, so the number alternating in either direction is . For that is , not .
