Dinv and Area

We give a new combinatorial proof of the well known result that the dinv of an $(m,n)$-Dyck path is equal to the area of its sweep map image. The first proof of this remarkable identity for co-prime $(m,n)$ is due to Loehr and Warrington. There is also a second proof (in the co-prime case) due to Gorsky and Mazin and a third proof due to Mazin.


Introduction
Our main goal in this paper is to obtain a simpler proof that, under the sweep map, the dinv statistic of a rational Dyck path D becomes the area statistic of its image path D. The first proof of this remarkable identity is due to Loehr and Warrington in [4]. There is also a second proof due to Gorsky and Mazin in [3], and a third proof due to Mazin [5]. See Section 3 for further explanation.
Inspired by a recent work of [6], we have come to depict rational Dyck paths in a manner which makes the ranks of the vertices of a path consistent with its visual representation. This very simple change turns out to be conducive to considerable simplifications in proving many of the properties of rational Dyck paths. For instance, we give a geometric proof of the invertibility of the rational Sweep Map in [2].
We shall always use (m, n) for a co-prime pair of positive integers, South end (by letter S) for the starting point of a North step and West end (by letter W ) for the starting point of an East step. This is convenient and causes no confusion because we usually talk about the starting points of these steps. In Figure 1 we have depicted a path D in the 7 × 5 lattice rectangle and its sweep map image D as they are traditionally depicted. The ranks of the vertices of an (m, n)-path are constructed by assigning 0 to the origin (0, 0) and adding an m after a North step and subtracting an n after an East step.
To obtain the Sweep image D of D, we let the main diagonal (with slope n/m) sweep from right to left and successively draw the steps of D as follows: i) draw a South end (and hence a North step) when we sweep a South end of D; ii) draw a West end (hence an East step) when we sweep a West end of D. The steps of D can also be obtained by rearranging the steps of D by increasing ranks of their starting vertices.
For (dm, dn)-rational Dyck paths, we compute the ranks of the starting points in the same way, but we may have ties for the starting ranks. When this happens, we sweep the right starting point first. Geometrically, we may simply sweep the starting points of the steps of D from right to left using lines of slope n/m + for sufficiently small > 0, which will be written as 0 < 1. The area of a rational Dyck path is equal to the number of lattice cells between the path and the main diagonal. The dinv statistic we are using is the same as the h − m/n statistic in [1, Lemma 11]: A cell c above a (dm, dn)-Dyck path D contributes a unit to its dinv statistic if and only if the starting rank a of the East step of D below c and the starting rank b of the North step of D to the right of c satisfy the inequality 1 (b + m) − (a − n) m + n, which is equivalent to 0 a − b < m + n. In Figure  1, the cells contributing to dinv(D) are distinguished by a green square 1 . A quick count reveals that dinv(D) = 8 = area(D).
To proceed we need some notation. A (dm, dn) path diagram T consists of a list of dn red arrows and dm blue arrows, placed on a (dm + dn) × dmn lattice rectangle. A red arrow is the up vector (1, m) and a blue arrow is the down vector (1, −n) 2 . The rows of lattice cells will be referred to as rows and the horizontal lattice lines will be simply referred to as lines. On the left of each line we have placed its y coordinate which we will refer to as its level. The level of the starting point of an arrow is called its starting rank, and similarly its end rank is the level of its end point. It will be convenient to call row i the row of lattice cells delimited by the lines at levels i and i + 1. Let Σ be a list consisting of dn letters S and dm letters W , and let R = (r 1 , . . . , r dm+dn ) be a sequence of dn + dm non-negative ranks. The path diagram T (Σ, R) (see Figure 2) is obtained by placing the letters of Σ at the bottom of the lattice columns and if the i th letter of Σ is an S (resp., W ) then we draw a red (resp., blue) arrow with starting rank r i in the i th column. Figure 2 depicts our manner of drawing the path D. The ranks of D are now the circled levels of the starting vertices. Now the sweep order is from bottom to top and from right to left within each level. Geometrically, the Sweep lines are of slope for 0 < 1. Note that the co-prime case (i.e., when d = 1) simplifies since no two starting points have the same rank, and thus the sweep lines are just the level lines.
Notice that each lattice cell may contain a segment of a red arrow or a segment of a blue arrow or no segment at all. The red segment count of row j will be denoted c r (j) and the blue segment count is denoted c b (j). We will denote by c(j) = c r (j) − c b (j) and refer to it the j-th row count. Observe that in every row of a path diagram, the red segments and blue segments have to alternate. In particular, for Dyck paths as in Figure 2, every row must start with a red segment and end with a blue segment, and hence c(j) = 0 holds for all j. This is called the zero-row-count property. It has the following immediate consequence. Proposition 1. The starting rank of any arrow A of D may be simply obtained by drawing in green (thick) the line of slope 0 < 1 at the starting point of its preimage A, then counting the segments above the green line of any red arrow of D that starts below the green line and adding to that count the number of segments below the green line of any blue arrow of D that starts above the green line.
Proof. The desired rank is bm − an, when D has b red arrows and a blue arrows that start below the green line. We interpret this number as the segment count of these arrows the electronic journal of combinatorics 22 (2015), #P00 Figure 3: Here we see that the rank of the last red arrow of D is 18. We have altogether 4 red arrows and 2 blue arrows of D that start below the green line, giving 18 = 4 × 7 − 2 × 5. We count a total of 9 red segments above the green line and 9 blue segments below the green line. The zero-row-count property gives that these 9 blue segments are precisely the needed 4 × 7 − 2 × 5 minus 9. and apply the zero-row-count property for rows below the green line. Indeed, the count of red segments above the green line is certainly needed. All the remaining portion of bm − an are segments below the green line. On the other hand, we need to add some blue segments to have all segments below the green line to apply the zero-row-count property. These blue segments are exactly as described in the proposition. See Figure 3 for an example.
This proposition leads to the basic formula we will use to compute the area of the image D by working on the preimage D.
Theorem 2. For any (dm, dn)-Dyck path D, with (m, n) co-prime, we have where " r(S j (D))" denotes the rank of the j th South end of D.
Proof. Notice that if we define the rank of the lattice cell whose South-West coordinates are (i, j) by setting r(i, j) = mj − ni, then the least positive rank in the j th row is none other than the remainder of mj mod n. Since the residues modulo n are 0, 1, . . . , n − 1 the electronic journal of combinatorics 22 (2015), #P00 and the least positive ranks are distinct for 0 j n − 1, it follows that their sum is n(n − 1)/2. Summing over all j gives dn(n − 1)/2. Calling lpr j the least nonnegative rank in row j, it is evident that (r(S j (D)) − lpr j )/n is the contribution of row j to the area of D. This given, we see that (1) is simply obtained by summing all these contributions.
2 Proof that dinv sweeps to area Given a co-prime pair (m, n) and d, our argument is to show that as we decrease the area of the preimage D by one unit, both dinv and area satisfy the same recursion.
We have depicted in Figure 4 the cell that we have subtracted from the preimage D to obtain a preimage D with one less unit of area. This operation may be viewed as replacing a red arrow S of D by a dashed red arrow S and a blue arrow W by a dashed blue arrow W . Calling D and D the sweep map images of D and D , our task is to determine the difference area(D) − area(D ). Our tool will be formula (1) and the fact that the starting rank of any arrow A of D is bm − an where D has b red arrows and a blue arrows that start below the preimage A of A in D. This difference will be calculated in D and D by means of our tool. It should be mentioned that the following argument will be significantly simplified if we choose the starting rank of the displayed W to be the largest in the sweep order. Then some of the cases can not happen. In particular, the regions T 1 and T 2 can not have any segments.
Below we will talk about four lines of levels l + n, l, k, k − n respectively. In the d = 1 case, we actually mean the lines of slope that passing through the corresponding four vertices of middle parallelogram. This is due to the modification of the Sweep lines in the non-coprime case. Now there are 4 distinct cases. Firstly, red arrows that start above level l+n (see Figure 4) or below level k −n are not affected by the replacements. Thus their contribution to the difference is 0. Secondly in the case of any red arrow starting strictly below level l + n and strictly above level k, its contribution to the difference is n. The reason for this is that both red arrows in the display will increase the ranks of the arrows of D and D , whose starting levels are in this range by an equal amount, therefore they cancel each other. By contrast the dashed blue arrow will affect the ranks of the red arrows of D so that the contribution of each to the difference is −(−n). Thirdly, notice that each red arrow of D or D that starts strictly below rank k and strictly above rank k − n, is not affected by either of the blue arrows. But each of the red arrows of D is affected by the dashed red arrow and thus contributes a −m to the difference.
Finally we must include the contribution to the areas of D and D by the ranks of red the electronic journal of combinatorics 22 (2015), #P00 arrows in the display itself. We claim that rank(S) − rank(S ) = m × #{ red arrows that start (strictly) below level k and above level k − n } − n × #{ blue arrows that start (strictly) below level k and above level k − n }. (2) The reason is that the arrows that start below level k − n contribute equally to the areas of S and S . Thus they cancel in computing the desired difference. On the other hand all the arrows accounted for in (2) do contribute to the area of S but not to the area of S .
Notice first that the contribution to the area difference in the third case is the negative of the first part of the contribution obtained in (2). After cancellation, all the remaining contributions are multiples of n. (A convenient fact since, according to (1), n has to be divided out.) Furthermore, in the second case this multiple counts the number of red arrows that have a red segment in T 1 or T 2 . Finally, we see in (2) that the factor of n that survives the cancellation, counts exactly the arrows that have a blue segment in B 1 or B 2 .
These observations imply the following result.
Proposition 3. Let D be obtained from D by removing an area cell and let D and D be their sweep map images. Let B 1 and B 2 be the blue regions and T 1 and T 2 be the red regions 3 in Figure 4. Then where c r (T 1 ), c r (T 2 ) denote red segment counts and c b (B 1 ), c b (B 2 ) denote blue segment counts in the corresponding regions.
To obtain the recursion satisfied by dinv we will make use of the following remarkable fact. By abuse of notation, we will use W i (resp. S j ) for the i-th blue (j-th red) arrow. Proposition 4. The dinv statistic of a rational Dyck path D (given in our stretched form) may simply be obtained by counting the pairs (W i → S j ) consisting of a blue arrow to the left of a red arrow, such that W i sweeps S j , i.e., W i intersects S j when we move it along a line of slope (with 0 < 1) to the right past S j .
Proof. Suppose that W i has starting rank a and S j has starting rank b. By the quoted result of Loehr-Warrington, the pair (W i , S j ) contribute a unit to dinv(D) if and only if 0 a − b < m + n. This is equivalent to requiring that a b and a − n < b + m . But these two inequalities are precisely what is needed to guarantee that W i sweeps S j .
This given, our dinv recursion can be stated as follows.
Proposition 5. Let D be obtained from D by removing an area cell. Let B 1 and T 1 be the blue regions and B 2 and T 2 be the red regions in Figure 5. Then where c b (T 1 ), c b (B 1 ) denote blue segment counts and c r (T 2 ), c r (B 2 ) denote red segment counts in the corresponding regions.
Proof. We will use the visual fact dinv(D) = #{(W i → S j ) : W i sweeps S j }. Since D is obtained from D by replacing the solid arrows S, W by dashed arrows S , W (see Figure 5), we can divide the contribution of a pair (W i → S j ) to the difference dinv(D) − dinv(D ) into four cases.
(1) Both W i and S j are not the displayed arrows. The contribution in this case is always 0.
(2) Both W i and S j are in the displayed arrows. This can only happen in two ways: (W, S) in D (no dinv) or (W , S ) in D (1 dinv). Therefore the contribution to the difference in this case is −1. Proof that dinv sweeps to area. We first show that the recursions in (3) and (4) are identical. To do this it is sufficient to observe that c r (T 1 ) = c b (T 1 ) and c r (B 2 ) + 1 = c b (B 2 ). The reason for this is the alternating colors of segments in each row that always begin with a red segment and end with a blue segment.
Thus it is sufficient to verify the base case where area(D) = 0. The only (dm, dn)-Dyck path with area 0 is the path D that remains as close as possible to the main diagonal. Thus the ranks of the South ends of such a path are a rearrangement of 0, 1, 2, . . . , n − 1, with each appearing d times. This forces the image D of D to start with dn North steps and end with dm East steps. This is the path of maximum area. It remains to prove that D has maximum dinv, or equivalently every cell above D contributes to its dinv. By contradiction, suppose that for a pair (W i → S j ), the i-th blue arrow W i does not sweep the j-th red arrow S j . We have the following two cases. See Figure 6. (1) S j starts at a level above W i . Assume we have S j S j+1 · · · S j+r W for some r 0. Then consider the path obtained from D by changing this to S j S j+1 · · · W S j+r . This is a new Dyck path with area one less than that of D. A contradiction!
(2) S j ends below the level of W i , then assume we have SW i−r · · · W i−1 W i for some r 0. Then consider the path obtained from D by changing this to W i−r S · · · W i−1 W i . This is a new Dyck path with area one less than that of D. A contradiction! Figure 6: Two examples of our proof that the dinv of the area zero (m, n)-Dyck path is , where the blue arrow W i and red arrow S j are thickened.
This completes our proof that dinv sweeps to area.

Remarks
We terminate our presentation by a few comments. To begin we should note that our argument does not use Proposition 1. We have nevertheless included it in this writing for two reasons. Firstly because it is too surprising a result to leave out, but more importantly, because it gives a simple proof of the nontrivial result that the sweep image of a Dyck path is also a Dyck path. The reason for this is that it is implicit in the conclusion of the Proposition that the starting ranks of all the arrows of the image are non-negative. The latter is the only property needed to guarantee that the image of a (dm, dn)-Dyck path is a (dm, dn)-Dyck path.
There are three proof of the "dinv sweeps to area" result as we said in Section 1. The first two proof only deal with the co-prime case. This case simplifies a lot since all starting ranks of the steps are distinct. Gregory Warrington told us their proof in [1] can be extended for the non-coprime case. Our first draft of this paper also deal with the co-prime case, but explained how to (naturally) extend our approach to the non-coprime case. After we put this draft on the arXiv, Mazin told us immediately that the noncoprime case is [5, Corollary 1] after some translation of terminology. This write up is modified (suggested by the referee) to fit the non-coprime case.