The tangent counts zigzags
Worth reading first: The sine, rebuilt from its zeros · One point's worth of information.
The Taylor series of the sine and cosine have coefficients anyone can remember: with a sign pattern. The tangent’s do not:
and the secant’s are over the even factorials. Rebuilding the sine from its zeros found where the tangent’s partner, the cotangent, gets its coefficients — from the sums of reciprocal even powers — and that is one explanation of the numbers. This essay is about a second, which has nothing to do with analysis at all. The numbers count arrangements.
Arrangements that zigzag
Write the numbers 1 to in some order. Call the arrangement a zigzag — up-down, or alternating — if the first number is smaller than the second, the second larger than the third, the third smaller than the fourth, and so on, alternately rising and falling.
For one number there is one arrangement, trivially a zigzag. For two there is one, 12. For three, 132 and 231: two. For four, five: 1324, 1423, 2314, 2413, 3412. For five, the sixteen drawn. The counts go 1, 1, 2, 5, 16, and continue 61, 272, 1385, 7936. The odd-length counts are the tangent’s numerators, ; the even-length ones are the secant’s, . Désiré André proved in 1879 that this continues for ever: the number of zigzag arrangements of numbers is times the coefficient of in .
It is a statement that should not be true. The tangent is a ratio of two waves — the sine and the cosine, a circle seen from the side — and its Taylor coefficients come out of dividing one power series by another, a computation with alternating signs and cancellation. The zigzags are a property of orderings, with no signs anywhere. The bridge between them is short, and it is worth seeing before believing.
Splitting at the largest number
Take any zigzag of numbers, up-down or down-up, and find its largest entry. The largest entry is a peak — it is bigger than both neighbours, being bigger than everything — and it cuts the arrangement in two.
The left part is a zigzag of whatever length it has, ending as the arrangement approached the peak; the right part, read from the far end inwards, is a zigzag too. Conversely, choose which of the other numbers go on the left, put any zigzag of them there, put any zigzag of the remaining on the right reversed, and place the maximum between: the result alternates, and it is up-down or down-up according to the parity of . Counting both kinds, every alternating arrangement of numbers arises exactly once, so
For seven numbers that is , and the figure’s arrangement is one of those 544.
Now the bridge. Put the counts into a series with factorials, . The left side of the recurrence is twice the coefficient of the derivative . The right side is the coefficient of , because multiplying two such series multiplies their coefficients with exactly those binomial weights. The equation holds for every , and the constant terms fix the rest: the counts are the coefficients of the solution of
And that equation has a solution anyone can check: . Its derivative is , and simplifies to the same thing using . A recurrence about splitting arrangements at their maximum is the derivative of the tangent, read coefficient by coefficient.
A triangle that only adds
The recurrence computes the counts but needs multiplication. There is a faster way that needs nothing but addition, found by Ludwig Seidel in 1877 and rediscovered several times since, most memorably by Vladimir Arnold.
Each row is built from the one above by running sums taken in the opposite direction — the zigzag of the ploughing that gives the triangle its name — and the last entry of row is the number of zigzags of length . The entries in between count something too: the number in row , position , counts the zigzags of numbers that start with the number (in the appropriate direction), a refinement due to Robert Entringer. Row four shows it concretely. Row three, read in its own direction, is ; row four starts at nought and adds those numbers taken from the other end — , then , then , then — giving the running totals . The last entry, five, is the number of zigzags of four numbers, and the entries before it, , split those five according to how the arrangement begins. Two arithmetic operations per entry, and no multiplication anywhere, produce numbers that the tangent’s series produces by long division.
That is why the triangle works. A zigzag starting at and going down continues with a zigzag of the remaining numbers going up from something smaller than , and summing over the possible second entries is exactly the running sum along the row.
Three counts, one table
Since the claim is that three unrelated computations give the same numbers, the honest check is to do all three.
The first column is brute force: 362,880 arrangements of nine numbers, filtered. The second is the triangle. The third is pure series arithmetic: the coefficients of satisfy , which, multiplied by factorials, is a triangular system of whole numbers solved one coefficient at a time; the secant’s satisfy in the same way. No step of the third computation mentions an arrangement, and no step of the first mentions a cosine. They agree: 1, 1, 1, 2, 5, 16, 61, 272, 1,385, 7,936, 50,521, 353,792, 2,702,765, 22,368,256, 199,360,981.
The division is short enough to do by hand for the first terms, and doing it shows where the cancellation lives. Write and multiply by ; the product must be . Matching the coefficient of gives . Matching gives , so . Matching gives , so . Every step is a subtraction of binomially weighted earlier terms, with signs alternating — the opposite of the zigzag count, which never subtracts anything. That the two produce the same positive integers is the content of the theorem, and no single step of the division hints at it.
The secant’s numbers, , are older than André’s interpretation: Euler computed them in the 1750s, and they are still called the Euler numbers. They count the zigzags of even length, which begin by rising and end by rising. A zigzag of odd length ends on a fall from a peak, and that asymmetry — even lengths end where they started going, odd lengths end where they turned — is why the counts split between two functions, one even and one odd, rather than coming from a single one.
The tangent numbers have a further life. Each is a multiple of a Bernoulli number, the numbers that sums of powers are built from: . So the zigzags of odd length are counted by the same numbers that give and the even values of the zeta function, and the reason, ultimately, is that all of them are coefficients of one family of functions — the tangent, the cotangent and their relatives — computed in different ways.
Zigzags as a volume
There is a third reading of the share , and it makes the π less mysterious. Choose numbers independently and uniformly between nought and one. With probability one they are distinct, and their relative order is a uniformly random arrangement, so the chance that they zigzag — — is exactly . That chance is a volume: the volume of the region of the -dimensional unit cube where the coordinates alternate.
The cube splits into congruent slices, one for each ordering of the coordinates, each a simplex of volume — the slicing that counting the orderings consistent with a partial order turns into a volume computation. A zigzag is a partial order on the coordinates, a fence of alternating comparisons, and the region it carves out is the union of of the slices. So the coefficients of the tangent and secant are the volumes of these “zigzag polytopes”: for three coordinates, for four, for five.
Seen this way, the recurrence is a statement about integrals. The volume for coordinates can be computed by integrating over the position of the largest coordinate and multiplying the volumes of the two smaller zigzag regions on either side, with the right scaling — and that is the convolution that the binomial coefficients express. The differential equation is the same convolution, made continuous.
A zigzag is not a mountain range
Alternating patterns appear elsewhere too, and the comparison is instructive. A path of up-steps and down-steps that never dips below its start is counted by the Catalan numbers, and the reflection trick counts them in a closed form; their generating function satisfies an equation with a square in it, an algebraic equation, and the counts grow like . The zigzag arrangements are a different object — they record the relative order of all the values, not just the sequence of directions — and their generating function satisfies a differential equation, not an algebraic one. Its solution is transcendental, and the counts grow like times .
The difference is the general rule. Sequences counted by an algebraic equation have growth rates that are algebraic numbers and generating functions with branch points; sequences whose exponential generating function solves a non-linear differential equation can have π, and the trigonometric functions, in their growth. The derangements — arrangements in which no number keeps its place — are the gentlest case of the second kind: their exponential generating function is , with a single pole at one, so a random arrangement is a derangement with probability tending to . The zigzags’ function has its first pole at instead, and so the share falls geometrically rather than settling.
How rare a zigzag is
There are arrangements of numbers, and of them zigzag. The share is exactly the Taylor coefficient of , and so the question “how rare are zigzags?” is a question about how fast a Taylor series’ coefficients shrink. That has a sharp answer, and it comes from places the series never visits on the real line between nought and its first blow-up.
The function blows up at — a simple pole — and its radius of convergence is therefore : the coefficients must shrink, eventually, by a factor of per term. More than that, near the pole the function behaves like , and the coefficients of that simple fraction are exactly . Subtracting it leaves a function whose nearest singularity is at — where happens to be finite, the two blow-ups cancelling — and then at , three times further away. So the next correction to the coefficients is smaller by a factor of three per term, and
The figure measures it: the relative error tracks down to about at twenty-four numbers. A random arrangement of twenty numbers zigzags with chance about , roughly one in 6,569 — and the formula gets that chance right to ten digits.
There is a surprise in it. A count of arrangements — a purely combinatorial question about finite orderings — has π in its answer, and to eleven significant figures. The π is the location of the tangent’s pole, which is where the cosine has its first zero. The zigzags know where the cosine crosses the axis.
What the figures leave to the theorem
The counts agree in three columns for every length drawn, and the boustrophedon and the series agree to twenty-four terms; André’s theorem says they agree for every , and the proof is the splitting argument, not the table. The splitting argument itself is drawn for one arrangement; its correctness rests on the claim that every alternating arrangement arises exactly once from a choice of left set and two smaller zigzags, which is a bijection that has to be checked in general, as above, rather than observed.
The asymptotic formula’s error term is a statement about every , derived from the location of the poles; the figure shows the error following to twenty-four terms, where floating-point arithmetic is still comfortably adequate, and says nothing beyond. The identification of the poles is exact: the tangent and secant are meromorphic, with poles only at odd multiples of , which is what makes the error decrease by exactly a factor of three rather than some other ratio.
Still open: which alternations have such formulas
André’s theorem is the first of a family. Count arrangements by more refined patterns — the positions of their peaks, the lengths of their runs, the arrangements avoiding a given smaller pattern — and some of the counts have generating functions as clean as , while others do not. Arrangements whose runs all have length at most two or three, or that alternate with a fixed period, have exponential generating functions that are ratios of sums of exponentials; their growth rates are set by the zeros of those denominators, as here. But for arrangements avoiding a pattern of length four, such as 1324, no formula is known, and even the growth rate of the count is known only to lie between about 10.27 and 13.5.
A second question is the one the boustrophedon raises. Seidel’s triangle, Arnold’s “snakes” and the Entringer numbers all describe the same refinement of the zigzags; a similar addition-only triangle exists for many sequences defined by a differential equation of this kind, and which differential equations admit one — which coefficient sequences can be produced by alternating running sums — has no general answer, though Arnold found the phenomenon in the geometry of singularities, where the snakes count the ways a polynomial’s critical values can be arranged.
Arnold’s own generalisation shows how far the pattern reaches. Allow the numbers in an arrangement to carry signs, as the symmetries of a cube or a hypercube do, and count the signed zigzags he called snakes: their counts are the Springer numbers, , and their exponential generating function is . The same reasoning applies to it. Its first pole is where , at , so the snakes outnumber the zigzags by a factor approaching two per added number; and the next pole, at , is three times as far away, so the same factor-of-three accuracy holds. Every family of reflection groups has its own version, and in each the growth is read off the first zero of a trigonometric denominator.
Where the cosine crosses the axis
The tangent’s Taylor coefficients count the arrangements of numbers that alternately rise and fall. Splitting such an arrangement at its maximum gives a recurrence, and the recurrence is the differential equation that satisfies. A triangle of additions computes the same numbers, and series division computes them again; all three agree.
And because the counts are Taylor coefficients, their size is set by the nearest singularity. The cosine vanishes at , the tangent blows up there, and the share of arrangements that zigzag falls by a factor of with every number added — a fact about orderings of finite sets, controlled by where a wave first crosses the axis.
Reads more easily once this is understood
Essays that name this one as worth reading first.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- The centre is a choice — both name radius of convergence, singularity, taylor series
- A series that converges nowhere — both name radius of convergence, taylor series
- An ellipse, not a disc — both name radius of convergence, singularity
- The points that ruin the fit — both name radius of convergence, taylor series
Named objects
A dashed tag is an object no other essay names yet.
Differential equationPermutationRadius of convergenceRecurrence relationSingularityTangentTaylor series