
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Latex-file of "Euler-Mahonian statistics..."
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentstyle[12pt]{article}

\newcommand\mb{\boldmath}

\newcommand\mn{\rm}
\newcommand\mc{\cal}

\def\disp{\displaystyle}

\def\+{\; + \;}
\def\-{\; - \;}

\def\ra{\rightarrow}

\def\vecn#1{(#1_1,\ldots,#1_n)}
\def\permn#1{#1_1\cdots #1_n}

\def\cl#1{{\mc #1}}

\newcommand\ch{\choose} %Binomial coefficients
\newcommand\st{\; | \;} %Bar in a set with extra space around
\newcommand\clS{{\mc S}}        %Symmetric group

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Eulerian stats %%%%%%%%%%%%%%%%%%%%%%
\newcommand\des{\mathop{\mn des}}
\newcommand\exc{\mathop{\mn exc}}
\newcommand\eul{\mathop{\mn eul}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Mahonian stats %%%%%%%%%%%%%%%%%%%%%%
\newcommand\inv{\mathop{\mbox{\sc inv}}\nolimits}

\newcommand\invmv{\mathop{\mbox{\sc
      inv}}_{\mbox{$\mn\scriptscriptstyle MV$}}\nolimits}
%EINAR  I changed to make the subscript smaller
%
\newcommand\expinv{\mathop{\mbox{$\mn\scriptscriptstyle INV$}}}
\newcommand\env{\mathop{\mbox{\sc env}}\nolimits}
\newcommand\maj{\mathop{\mbox{\sc maj}}\nolimits}
\newcommand\expmaj{\mathop{\mbox{$\mn\scriptscriptstyle MAJ$}}}
%\newcommand\imaj{\mathop{{\mn\scriptstyle i}\kern .15ex\mbox{\sc maj}}}
\newcommand\imaj{\mathop{\mbox{\sc imaj}}\nolimits}
\newcommand\mad{\mathop{\mbox{\sc mad}}\nolimits}
\newcommand\expmad{\mathop{\mbox{$\mn\scriptscriptstyle MAD$}}}
\newcommand\mak{\mathop{\mbox{\sc mak}}\nolimits}
\newcommand\madl{\mathop{\mbox{\sc madl}}\nolimits}
\newcommand\makl{\mathop{\mbox{\sc makl}}\nolimits}
\newcommand\den{\mathop{\mbox{\sc den}}\nolimits}
\newcommand\mah{\mathop{\mbox{\sc mah}}\nolimits}
\newcommand\sist{\mathop{\mbox{\sc sist}}\nolimits}
\newcommand\lag{\mathop{\mbox{\sc lag}}\nolimits}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Partial stats %%%%%%%%%%%%%%%%%%%%%%
\def\emb#1{e_#1}
\newcommand\rsg{\mathop{\mn Res}}
\newcommand\res{\mathop{\mn Res}}
\newcommand\les{\mathop{\mn Les}}
\newcommand\dtop{\mathop{\mn Dtop}}
\newcommand\etop{\mathop{\mn Etop}}
\newcommand\dbot{\mathop{\mn Dbot}\nolimits}
\newcommand\ebot{\mathop{\mn Ebot}}
\newcommand\ddiff{\mathop{\mn Ddif}\nolimits}
\newcommand\ddif{\mathop{\mn Ddif}}
\newcommand\ediff{\mathop{\mn Edif}}
\newcommand\edif{\mathop{\mn Edif}}
\newcommand\imv{\mathop{\mn Imv}}
\newcommand\ine{\mathop{\mn Ine}}
\newcommand\run{\mathop{\mn Run}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Miscellaneous %%%%%%%%%%%%%%%%%%%%%%
\def\EXC#1{#1_{\mbox{\sc e}}}
\def\NEX#1{#1_{\mbox{\sc n}}}
\def\inve#1{\inv #1_{\mbox{\sc e}}}
\def\imve#1{\imv #1_{\mbox{\sc e}}}
\def\invn#1{\inv #1_{\mbox{\sc n}}}
%\def\phiw{\mbox{$\Phi_{\mbox{\sc w}}$}}
%EINAR's suggestion
\def\phiw{\mbox{$\Phi_{\mbox{$\mn\scriptscriptstyle W$}}$}}
\newcommand\op{\mbox{\sc o}}
\newcommand\clo{\mbox{\sc c}}
%\newcommand\ins{\mbox{\sc ins}}
%\newcommand\out{\mbox{\sc outs}}

\newcommand\imversion{\mbox{i\kern -.15mm{\em m}\kern .15mm version}}
\newcommand\imversions{\mbox{i\kern -.15mm{\em m}\kern .15mm versions}}

\newcommand\iimversion{\mbox{i\kern .23mm{\em m}\kern -.23mm version}}
\newcommand\iimversions{\mbox{i\kern .23mm{\em m}\kern -.23mm versions}}
\def\NE{{\mn N}}
\def\SE{{\mn S}}
\def\sE{{\mn E}}
\def\dE{{\mn dE}}


\newcommand{\mpg}{\marginpar}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\lbiw#1#2#3{\pmatrix{
#1_1\; #1_2\;\cdots #1_#3\; \cr
#2_1\; #2_2\;\cdots #2_#3\; \cr
}}

\def\biw#1#2{\pmatrix{
#1\cr
#2\cr
}}

\def\bbiw#1#2{\pmatrix{
\mb #1\cr
\mb #2\cr
}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\w{\mbox{$w$}}
\newcommand\p{\mbox{$\pi$}}
\newcommand\pp{\mbox{$\pi'$}}
\newcommand\ta{\mbox{$\tau$}}
\newcommand\wb{\mbox{$\overline{w}$}}
\newcommand\wt{\mbox{$\widetilde{w}$}}
\newcommand\ol{\overline}
\newcommand\e{\mbox{$\epsilon$}}
\newcommand\ep{\mbox{$\epsilon(\pi)$}}
\newcommand\eep{\mbox{$\epsilon^2(\pi)$}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Structure of Thms. etc.  %%%%%%%%%%%%%%
\newtheorem{thm}{Theorem}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{defn}{Definition}
\newtheorem{defns}[defn]{Definitions}
\newtheorem{eg}{Example}
\newtheorem{egs}[eg]{Examples}
\newtheorem{remark}{Remark}
\newtheorem{fact}[remark]{Fact}
\newtheorem{blank}[remark]{$\!\!$}
\newtheorem{porism}[thm]{Porism}
\newtheorem{conj}{Conjecture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\pf}{{\bf Proof: \/}}


%%% \qed produces a square at the end of the line.

%\newcommand{\qed}[1]{{\unskip\nobreak\hfil\penalty50
%                   \hskip2em\vadjust{}\nobreak$\Box$#1
%                   \parfillskip=0pt\finalhyphendemerits=0\par\vspace{3ex}}}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
%\renewcommand{\thefootnote}{\arabic{footnote}}
%
%EINAR Take away the \hfil in definition of \qed?
%BOB This seems to have bad effects.  The following definition works (but
%you then
%don't put "{}" after the \qed.
\def\qed{\nobreak\quad\raise -2pt\hbox{\vrule\vbox to 10pt{\hrule width 4pt
\vfill\hrule}\vrule}\par\vspace{2ex}}
%The following variation is useful if you don't want a \par or \vspace after.
\def\qel{\nobreak\quad\raise -2pt\hbox{\vrule\vbox to 10pt{\hrule width 4pt
\vfill\hrule}\vrule}}

\hyphenation{mac-mahon}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

%\pagestyle{empty}

\title{New Euler--Mahonian statistics on permutations and words}
\author{Robert J. Clarke
\thanks{This work was carried out while the author was Visiting
Professor at the Universit\'e Louis-Pasteur in Strasbourg during summer and
autumn of 1995.}
\\Pure Mathematics Department
\\University of Adelaide
\\Adelaide, South Australia 5005
\and
Einar Steingr{\'\i}msson
    \thanks{Partially supported by a grant from
      The Icelandic Council of Science and partially supported by the EU
      Network in Algebraic Combinatorics while visiting Universit\'e
      Louis-Pasteur in Strasbourg.}\\
Matematiska institutionen \\
University of G\" {o}teborg\\
412 96 G\"oteborg, Sweden
\and
Jiang Zeng\thanks{Partially supported by the EU
Network in Algebraic Combinatorics.}
\\ D\'epartement de math\'ematique
 \\Universit\'e Louis-Pasteur
\\ 67084 Strasbourg Cedex, France}
\maketitle
\newpage
\begin{abstract}

We define new Mahonian statistics, called $\mad$, $\mak$ and $\env$,
on words.  Of these, $\env$ is shown to equal the classical $\inv$,
that is the number of inversions, while for permutations $\mak$ has
been already defined by Foata and Zeilberger \cite{FZ}.  It is shown
that the triple statistics $(\des,\mak,\mad)$ and $(\exc,\den,\env)$
are equidistributed over the rearrangement class of an arbitrary word.
Here, $\exc$ is the number of excedances, and $\den$ is Denert's
statistic \cite{FZ,han}.  In particular, this implies the
equidistribution of $(\exc,\inv)$ and $(\des,\mad)$.  These
bistatistics are not equidistributed with the classical Euler-Mahonian
statistic ($\des$,$\maj$).  The proof of the main result is by means
of a bijection which, in the case of permutations,
is essentially equivalent to several bijections
in the literature (or inverses of these).  These include bijections
defined by Foata and Zeilberger, by Fran\c con and
Viennot and by Biane, between the symmetric group and sets of weighted
Motzkin paths.  These bijections are used to give a continued fraction
expression for the generating function of $(\exc,\inv)$ or
$(\des,\mad)$ on the symmetric group.
\end{abstract}


\section{Introduction}
The subject of permutation statistics, it is frequently claimed, dates back at
least to Euler \cite{euler}.  However, it was not until MacMahon's
extensive study
\cite{macmahon} at the turn of the century that this became an established
discipline of mathematics, and it was to take a long time before it developed
into the vast field that it is today.

In the last three decades or so much progress has been made, both in discovering
and analyzing new statistics, and in extending these, together with the
classical
permutation statistics, to arbitrary words with repeated letters.  See for
example \cite{foa1,foa2,FS1,FS2,FZ,han,ra,simstan1,stanley}.  
Inroads have also been made in connecting permutation statistics to
various geometric structures and to the classical theory of hypergeometric
functions, as in \cite{fla, fravie, garges, medvie}.
%which some see as the natural environment of the subject.

MacMahon considered four different statistics for a permutation \p: The
number of
descents ($\des \p$), the number of excedances ($\exc \p$), the number of
inversions ($\inv \p$), and the major index ($\maj \p$).  These are defined as
follows:  A descent in a permutation $\pi = a_1 a_2\cdots a_n$ is an $i$ such
that $a_i>a_{i+1}$, an excedance is an $i$ such that $a_i>i$, an inversion is a
pair $(i,j)$ such that $i<j$ and $a_i>a_j$, and the major index of \p\ is
the sum
of the descents in \p.

In fact, MacMahon studied these statistics in greater generality, namely
over the
rearrangement class of an arbitrary word \w.  The rearrangement class
$R(w)$ of a
word $w = a_1 a_2\cdots a_n$ is the set of all words obtained by permuting the
letters of \w.  All of the above mentioned statistics generalize to words,
and in
each case, except for that of $\exc$, the generalization is trivial.

MacMahon showed, algebraically, that $\exc$ is {\em equidistributed}\/ with
$\des$,
and that $\inv$ is equidistributed with $\maj$, over $R(w)$ for any word \w.
That is to say,

$$\sum_{z\in R(w)}{t^{\exc z}} = \sum_{z\in R(w)}{t^{\des z}}
\mbox{\hskip 5mm and \hskip 5mm}
\sum_{z\in R(w)}{q^{\expinv z}} = \sum_{z\in R(w)}{q^{\expmaj z}}.$$
Foata gave a combinatorial proof of these equidistribution results. (See
\cite{foa2}.)

Any statistic that is equidistributed with $\des$ is said to be
{\em Eulerian}, the reason being that Euler was apparently the first to discover
the recurrence relation for the {\em Eulerian numbers} $A(n,k)$. These numbers
count permutations in the symmetric group $\cl S_n$ with $k$ descents and they
are the coefficients of the {\em Eulerian polynomials} $A_n(t)$ defined by
$A_n(t) =\sum_{\pi\in\cl S_n}{t^{1+\des\pi}}$.  The Eulerian polynomials satisfy
the identity
$$ \sum_{k\ge 0}{k^n t^k} = \frac{A_n(t)}{(1-t)^{n+1}}.$$
Whether Euler was aware of that is less clear, but the polynomials $A_n(t)$
appear in his work \cite[p. 373]{euler}.

On the other hand, a statistic that is equidistributed with $\inv$ is said to be
{\em Mahonian}. It was shown more than a hundred and fifty years ago, by
Rodriguez \cite{rodrig}, that, for permutations,
$$\sum_{\pi\in\cl S_n}{q^{\inv \p}} =
(1+q)(1+q+q^2)\cdots(1+q+\cdots+q^{n-1}).$$
This is easy to see.  Namely, given a permutation $\pi= a_1 a_2\cdots a_{n-1}$,
if we insert $n$ between $a_{k-1}$ and $a_k$, then $\inv$ increases by $(n-k)$,
whence the recurrence which yields the above identity.

All of the above statistics, and, in fact, most of the permutation statistics
found in the literature, fall into one of these two categories; they are either
Eulerian or Mahonian.  Moreover, most of them can be generalized to the
rearrangement class of an arbitrary word. As a rule, equidistribution results
extend to these generalizations.

\pagestyle{plain}

\hyphenation{mac-mahon}

Curiously, new Eulerian statistics have not become prominent since Mac-Mahon's
definition of $\des$ and $\exc$, whereas new Mahonian statistics are constantly
entering the scene.  Proving directly that a statistic is Mahonian is by no
means
always trivial, and there are still many such statistics for which no direct
proof exists.  What is more interesting, however, is the study of {\em pairs} of
statistics, usually an Eulerian one and a Mahonian one, and equidistribution of
such {\em bistatistics}, first developed in \cite{foa1}.

The first pair of equidistributed Euler-Mahonian bistatistics to be discovered
was that of $(\des,\inv)$ and $(\des,\imaj)$, where $\imaj \p$ is the major
index
of the {\em inverse} of the permutation \p\ (see \cite{FS2}).  Although
instrumental in some of the analytic developments of the subject, this discovery
cannot be extended to words with repetition of letters.  In addition, the
purists
among us are reluctant to admit to the Euler-Mahonian club a pair of pairs that
really is only a triple.  Thus, they would recommend that $(\des,\inv)$ be
accompanied by $\exc$ and a suitable Mahonian partner.

The first discovery of a {\em proper} pair of equidistributed Euler-Mahonian
bistatistics is only a few years old, and it came from a rather unexpected
direction.  Denert \cite{denert}, in 1990, conjectured that the pair
$(\des,\maj)$ was equidistributed with the pair $(\exc,\den)$, where $\den$ is a
Mahonian statistic somewhat related to, but crucially different from, $\inv$.
Shortly afterwards, her conjecture was proved by Foata and Zeilberger \cite{FZ},
who named the new statistic ``Denert's statistic''.  In the process, Foata and
Zeilberger defined yet another Mahonian statistic on permutations, which they
called $\mak$, and which, when taken together with $\des$, they showed to be
equidistributed with $(\exc,\den)$.

It is fair to say that the discovery of Denert's statistic paved the way to the
more esoteric reaches of Mahonian statistics, because it was the first such
statistic to be composed of ``smaller'' partial statistics.  Since then, many
such composite Mahonian statistics have been discovered, and most of these
are treated here.

The pairs of bistatistics $(\exc,\den)$, $(\des,\maj)$ vs.
$(\exc,\den)$, $(\des,\mak)$ were the first proper pairs of
Euler-Mahonian statistics to be shown equidistributed over the
symmetric group, and they are, to the best of our knowledge, the only
ones preceding the present paper. It is possible to vary the
definition of $\mak$ slightly, as will be made clear later, to obtain
a new statistic for permutations, and four new statistics in the case
of words. However, the bistatistics obtained are all equidistributed
with each other, and this is easy to show.

\vskip 6pt
\centerline{---------------}
\vskip 6pt

In the present paper, we define some new Mahonian statistics and redefine
many of
the existing ones, with an eye to illuminating their common properties and thus
also their differences.  Doing this allows us to recover some of the known
instances of equidistribution among Euler-Mahonian pairs, and to prove the
equidistribution of two new pairs introduced, as well as that of some similiar,
but not equal, pairs of bistatistics.  Moreover, we extend all these
equidistribution results to arbitrary words, and we do this simultaneously for
all the statistics involved, by means of a single, simply described bijection.

All of our constructions, and some of our statistics, have appeared previously,
in the work of several authors and in many different guises.  They have involved
Motzkin paths, binary trees, and even more exotic structures, but have so far
been limited to permutations. As we will show, the bijections in the literature
pertaining to these statistics, those of Foata--Zeilberger, Fran\c con--Viennot
\cite{fravie}, de M\'edicis--Viennot \cite{medvie}, Simion--Stanton
\cite{simstan1} and Biane \cite{biane}, defined in different ways and for
different purposes, are all essentially the same, or inverses of each other. In
the case of permutations these bijections are equivalent to the bijection
of this
paper, but their relationships with each other have not before been elucidated.

Perhaps the most interesting fact to emerge is the equidistribution of
the two bistatistics $(\des,\mad)$ and $(\exc,\inv)$, where $\mad$ is
one of our new statistics. The latter bistatistic, whose components
are classical, is {\em not} equidistributed with $(\des,\maj)$ and
might therefore, together with its equidistributed mates, be
classified as an ``Euler-Mahonian pair of the second kind.'' In fact
there exist at least three different {\em families} of Euler-Mahonian
statistics.  The first one, containing $(\des,\maj)$, $(\des,\mak)$,
and $(\exc,\den)$, has been extensively studied, both analytically and
bijectively.  For the family containing $(\des,\inv)$ and
$(\des,\imaj)$, only the analytic branch has seen substantial
development (see \cite{fohan}).  The bijective theory of the family
with $(\des,\mad)$ and $(\exc,\inv)$ is thoroughly analyzed in the
present paper, but its analytic properties remain to be further
elicited.

It is, of course, possible to define scores of different families of
Euler-Mahonian statistics by arbitrarily combining an Eulerian statistic and a
Mahonian one.  Although some needles are sure to be found in that haystack, most
of the possible such statistics seem rather unattractive, and unlikely to
possess
particularly interesting properties.

An essential feature of our bijection is that it simultaneously preserves
each of
several building blocks of the statistics involved. This allows us to derive the
equidistribution of the triples of statistics $(\des,\mak,\mad)$ and
$(\exc,\den,\inv)$, involving Mahonian statistics of both the first and second
kind.

In contrast to the bijections mentioned above, the bijection by Han,
in \cite{han}, seems to be singular.
Han proved the equidistribution of $(\exc,\den)$ and $(\des,\maj)$ for
words.  Han's bijection employs a very interesting technique, called
``contextual transposition'', which will no doubt resurface many times
in the literature on words. However, it does not preserve all the
partial statistics vital to our present construction and thus does not
extend to other pairs than $(\exc,\den)$ and $(\des,\maj)$. In fact,
Han's bijection is the only one we are aware of which proves the
equidistribution of a proper pair of Euler-Mahonian statistics and
which can not be suitably modified to encompass the results presented
here on the statistics $(\exc,\inv)$, $(\des,\mad)$ and $(\exc,\den)$,
$(\des,\mak)$.

\vskip 6pt
\centerline{---------------}
\vskip 6pt

We prove our main results first for permutations and then extend them to
arbitrary words by {\em coding} a word into a permutation in a way which lends
insight into how the statistics on the word are affected. It is possible to
prove
all our results directly for words, but this involves intricate labeling schemes
for the letters, and we feel that it simply obscures the presentation.

In the next section we will present the formal definitions of our statistics and
state the main results.  These results will be proved in sections \ref{bijperm},
\ref{bijword} and \ref{motzkin}. In section \ref{variations} we present some
variations on our statistics and in section \ref{concl} we indicate
precisely the
relationship between our statistics and those previously defined, and indicate
extensions of our results to the case of words with large and small letters.

%\newpage


\section{Definitions and main results}\label{defns}

We consider words $w = a_1 a_2\cdots a_n$ on a totally ordered alphabet
$\cl A$.
Although it is not necessary, we always take $\cl A$ to be the interval $[m] =
\{1,2,\ldots,m\}$.  For any word \w, we will study statistics on its {\em
rearrangement class} $R(w)$, that is, the set of all words that can be obtained
by permuting the letters of \w.  If the letters of \w\ are distinct, then \w\ is
a permutation and $R(w)$ is the set of elements of the symmetric group $\cl
S_n$.

Let $w = a_1 a_2\cdots a_n$ be a word. The {\em non-decreasing rearrangement}\/
of \w\ is the word $\wb = b_1 b_2\cdots b_n $, with $b_i \le b_{i+1}$ and
$\wb\in
R(w)$.  The {\em biword associated to} \w\ is $\wt = \biw \wb w$.
For example, if $w=1\ 2\ 1\ 4\ 4\ 2\ 3\ 1\ 4$ then
$\wt = \pmatrix{1&1&1&2&2&3&4&4&4\cr1&2&1&4&4&2&3&1&4}.$
This notation will be adhered to throughout, that is, if $w = a_1 a_2\cdots a_n$
is a word, then \wb\ and \wt\ have the above meaning.

\begin{defn}
%BOB changed "and" to ", with" on next line.
 Let $w= a_1 a_2\cdots a_n$ be a word, with $\wb = b_1 b_2\cdots b_n$.
  A {\em descent} in \w\ is a
  triple ($i$, $a_i$, $a_{i+1}$) such that $i\in [n-1]$ and
  $a_i>a_{i+1}$.  Here $i$ is called the {\em descent place\/}, $a_i$
  is called the {\em descent top\/} and $a_{i+1}$ is called the {\em
    descent bottom\/}.  An {\em excedance} in \w\ is a triple ($i$,
  $a_i$, $b_i$) such that $i\in [n]$ and $a_i>b_i$.  Here $i$ is
  called the {\em excedance place\/}, $a_i$ is called the {\em
    excedance top\/} and $b_i$ is called the {\em excedance bottom\/}.
  The {\em number of descents in} \w\ is denoted by $\des w$, and the
  {\em number of excedances} is denoted by $\exc w$.

The {\em descent set of $w$\/}, $D(w)$, is the set of descent places.  The {\em
excedance set of $w$\/}, $E(w)$, is the set of excedance places.
\end{defn}
Traditionally, the {\em descent\/} has been identified with the {\em
descent place\/},
and the {\em excedance\/} has been identified with the {\em excedance place}.

As an example, if $w = 3\ 2\ 2\ 1\ 3\ 2\ 1$ then the descent places of \w\
are 1,
3, 5, 6, and, since $\wt = \pmatrix{1&1&2&2&2&3&3 \cr 3&2&2&1&3&2&1 \cr}$, the
excedance places are 1, 2, 5, so $\des w= 4$ and $\exc w = 3$.

If \w\ is a permutation, an excedance place is simply an $i$ such that $a_i>i$.

Given a word $w = a_1a_2\cdots a_n$, we separate \w\ into its {\em descent
blocks} by putting in dashes between $a_i$ and $a_{i+1}$ whenever $a_i\le
a_{i+1}$.  A maximal contiguous subword of \w\ which lies between two
dashes is a
descent block.  A descent block is an {\em outsider}\/ if it has only one
letter,
otherwise it is a {\em proper} descent block. The leftmost letter of a proper
descent block is its {\em closer} and the rightmost letter is its {\em
opener}. A
letter which lies strictly inside a descent block is an {\em insider}. For
example, the word $1\ 3\ 3\ 2\ 1\ 2\ 5\ 3\ 2\ 4\ 1\ 1$ has descent block
decomposition $1-3-3\ 2\ 1-2-5\ 3\ 2-4\ 1-1$, with closers $3, 5, 4$,
corresponding openers $1, 2, 1,$ outsiders $1, 3, 2, 1$ and insiders $2, 3$.  We
will frequently write a word \w\ with its separating dashes to emphasize this
structure.

Let $B$ be a proper descent block of the word \w\ and let $\clo(B)$ and $\op(B)$
be the closer and opener, respectively, of $B$.  If $a$ is a letter of \w,
we say
that $a$ {\em is embraced by} $B$ if $\clo(B) \ge a > \op(B)$.

\begin{defn}\label{e numbers}
The {\em (right) embracing numbers of a word} $w = a_1 a_2\cdots a_n$ are the
numbers $e_1,e_2, \ldots, e_n$ where $e_i$ is the number of
descent blocks in \w\ that are strictly to the right of $a_i$ and that embrace
$a_i$.  The {\em right embracing sum} of \w, denoted by $\res w$, is defined by
$$\disp\res w = e_1+e_2+\cdots+e_n.$$
\end{defn}

For instance, the embracing numbers of $w=2\ 1-3-4\ 1-2-2\ 1$ are
$2\ 0-1-0\ 0-1-0\ 0$, so $\res w = 4$.

One can obviously define $\les w$ in an analogous way, by simply replacing
``right'' by ``left'' in the above definition.  (See section \ref{variations}.)
\medskip

Let $w = a_1 a_2\cdots a_n$.  The {\em height}\/ of a letter $a$
in \w, $h_w(a)$ is one more than the number of letters in \w\
that are strictly smaller than $a$. The (left) {\em value} of the $i$-th letter
in \p, denoted by $v_w(i)$, is defined by
$$ v_w(i)= h_w(a_i)+\ell_w(i), $$
where $\ell_w(i)$ is the number of letters in \w\ that are to the left of $a_i$
and equal to $a_i$. Thus, the height of two identical letters in a word \w\ is
always the same, whereas the value of a letter depends on the letter's position
in \w, relative to other equal letters. For example, given $w =
1\ 2\ 1\ 4\ 4\ 2\ 3\ 1\ 4,$ we have $\wb = 1\ 1\ 1\ 2\ 2\ 3\ 4\ 4\ 4$, so the
heights of $1,2,3,4$ are, respectively, $1,4,6,7$. The values of the letters of
\w\ are given by $1,4,2,7,8,5,6,3,9,$ in the order in which they appear in \w.
Thus, replacing each letter of a word \w\ by its value yields a permutation
$v_w$
which has the same number of inversions and descents as \w\ does. If \w\ is a
permutation, then $v_w(i) = h_w(a_i) = a_i$.

\begin{defn}%
The {\em descent bottoms sum} of a word $w = a_1a_2\cdots a_n$, denoted by
$\dbot
w$, is the sum of the values of the descent bottoms of \w. The {\em descent tops
sum} of \w, denoted by $\dtop w$, is the sum of the heights of the descent tops
of \w. The {\em descent difference} of \w\ is
$$ \ddiff w=\dtop w-\dbot w. $$
\end{defn}
As an example, $w = 2\ 1-1-3\ 2\ 1-3$ has $\wt = \biw {1\ 1\ 1\ 2\ 2\ 3\ 3}
{2\ 1\ 1\ 3\ 2\ 1\ 3}$, so the heights of 1, 2 and 3 are 1, 4 and 6,
respectively, and the values of the letters of \w\ are given by
$4\ 1-2-6\ 5\ 3-7$. Consequently, $\dbot w= v_w(2)+v_w(5)+v_w(6)=1+5+3=9$,
$\dtop
w= h_w(2)+h_w(3)+h_w(2) = 4+6+4=14$ and $\ddiff w = 14-9=5$.

It is easy to see that $i$ is a descent place if and only if
$h_w(a_i)>v_w(i+1)$.  It follows that $\dtop w\ge \dbot w$, with equality
only if
there are no descents in \w. If \w\ is a permutation, then $\dtop$ and $\dbot$
are simply the sums of the descent tops and the descent bottoms, respectively.
Thus, for a permutation $\pi$, $\ddiff \pi$ is the sum of closers minus the sum
of openers of descent blocks.

\begin{defn}%
The {\em excedance bottoms sum} of a word $w = a_1a_2\cdots a_n$, denoted by
$\ebot w$, is the sum of the values, in the word $\bar{w}$, of the excedance
bottoms of \w. The {\em excedance tops sum} of \w, denoted by $\etop w$, is the
sum of the heights of the excedance tops of \w. The {\em excedance
difference} of
\w\ is
$$ \ediff w= \etop w-\ebot w. $$
The {\em excedance subword of \w}, denoted by $\EXC w$, is the word
consisting of
all the excedance tops of \w, in the order induced by \w. The {\em non-excedance
subword of \w} is denoted by $\NEX w$, and consists of those letters of \w\
that are
not excedance tops.
\end{defn}%

Notice that $v_{\bar{w}}(i)=i$ for all $i$.  Thus the value of an excedance
bottom
equals the corresponding excedance place, and we could equally well define
$\ebot w$
to be the sum of the excedance places of \w.

For example, if $w = 3\ 2\ 2\ 1\ 3\ 2\ 1$, so $\wt =\pmatrix{1&1&2&2&2&3&3 \cr
3&2&2&1&3&2&1 \cr }$, then $\EXC w = 3\ 2\ 3$ and $\NEX w = 2\ 1\ 2\ 1$.

The following lemma is straightforward to prove.
\begin{lem}
The integer $i$ is an excedance place in $w=a_1 a_2\cdots a_n$ if and only if
$h_w(a_i) > i$.  \qed
\end{lem}
\begin{defn}%
An {\em inversion} in a word $w = a_1 a_2\cdots a_n$ is a pair $(i,j)$ such that
$i<j$ and $a_i>a_j$. An {\em \imversion}\ is a weak inversion, that is, a pair
$(i,j)$ such that $i<j$ and $a_i\ge a_j$. The {\em number of \imversions\
in} \w\
is denoted by $\imv w$. The {\em number of inversions in} \w\ is denoted by
$\inv
w$.
\end{defn}
Note that we spell \imversion\ with an italicized {\em m} to avoid
confusion with
the word ``inversion''.  The reason we spell $\inv$, but not
$\imv$, with all capital letters is that $\inv$ is a Mahonian statistic, whereas
$\imv$ is not. We do this consistently throughout the paper, that is, all
Mahonian statistics are spelled with uppercase letters. The two Eulerian
statistics, $\exc$ and $\des$, are spelled with lowercase letters, while
``partial statistics'' (such as $\imv$ and $\res$), used in the definitions of
Mahonian statistics, are merely capitalized.

\begin{defn}\label{invno}
Let $w = a_1 a_2\cdots a_n$ be a word and $i$ an excedance place in \w. We say
that {\em $a_i$ is the bottom of $d$ \imversions}\ if there are exactly $d$
letters in \w\ to the left of $a_i$ that are greater than or equal to $a_i$, and
we call $d$ the {\em \imversion\ bottom number of $i$}. Similarly, if $i$ is a
non-excedance place in \w\ and there are exactly $d$ letters smaller than $a_i$
and to the right of $a_i$ in \ta, then we say that $d$ is the {\em inversion top
number of $i$.} The {\em side number of $a_i$ in \w} is the \imversion\ bottom
number or the inversion top number of $a_i$ in \w, according as $i$ is an
excedance place or not in \w. The {\em sequence of side numbers of} \w\ is the
sequence $s_1,s_2,\ldots, s_n$ where $s_i$ is the side number of $i$.
%EINAR Shouldn't it be the side number of $a_i$ on previous line?
%BOB No.  We think it should be above "The {\em side number of $i$ in \w}
%is the
%\imversion\ bottom number or the inversion top number of $i$ in \w,
%according as
%$i$ is an excedance place or not in \w."  As \w\ is a word, we
%cannot explicitly refer to $a_i$.  It is difficult to see how we can get aroun%d
%this without be very wordy and pedantic.  Saying that "$a_i$ is the bottom of
%$d$ inversions" is also strictly wrong, but we think it is right to leave it s%o
%as it is much more descriptive than saying "$i$ is the bottom of $d$
%inversions".
\end{defn}
For example, let
$$w=1\ 3\ 2\ 3\ 2\ 3\ 2\ 1\ 1.$$
Then $\EXC{w}=3\ 2\ 3\ 3$, so the \imversion\ bottom numbers of the
excedances in
\w\ are 0, 1, 1, 2.  Also, $\NEX{w}=1\ 2\ 2\ 1\ 1$, so the inversion top numbers
of the non-excedances in \w\ are 0, 2, 2, 0, 0.  Hence the sequence of side
numbers of \w\ is 0, 0, 1, 1, 2, 2, 2, 0, 0.

Note that if $i$ is an excedance place of the word \w, then any letter in
\w\ that
is to the left of $a_i$ and greater than or equal to $a_i$ must also
represent an
excedance.  Hence, the sum of the \imversion\ bottom numbers of the
letters
%EINAR Should be \imversions instead of inversions on next line?
%BOB yes.
in $\EXC{w}$ equals the total number of imversions in $\EXC{w}$, that is,
$\imv\EXC{w}$.  Similarly,  the sum of the inversion top numbers of the letters
in $\NEX{w}$ equals $\inv\NEX{w}$.

\begin{defn}\label{ine}
Let $w$ be a word. Then
$$\ine w=\imv\EXC{w}+\inv\NEX{w}.$$
\end{defn}
Hence, from the remark preceding definition \ref{ine}, we have
\begin{equation}
\ine w=s_1+\cdots+s_n.
\end{equation}

We now define the four Mahonian statistics central to this paper.

\begin{defn}%
\begin{eqnarray*}
\mak w&=&\dbot w \+ \res w.\\
\mad w&=&\ddiff w \+ \res w.\\
\den w&=&\ebot w \+ \ine w.\\
\env w&=&\ediff w \+ \ine w.
\end{eqnarray*}
\end{defn}

As it turns out, our statistic $\env$ equals the classical $\inv$. It may seem
superfluous to redefine $\inv$ in this way, but it turns out that $\env$'s
similarity in definition to $\mad$ is crucial in proving our main results.

Let $w=a_1\cdots a_n$. Since $\edif w = \sum_{i\in E(w)}(h(a_i)-i)$, we have
$$\env w=\imv\EXC w+\inv\NEX w+\sum_{i\in E(w)}(h(a_i)-i), $$
which clearly leads to
\begin{equation}\label{envdef}
\env w=\inv\EXC w+\inv\NEX w+\sum_{i\in E(w)}(v(i)-i).
\end{equation}

\begin{thm}\label{envinv}
For any word $w= a_1a_2\cdots a_n$, we have $\env w=\inv w$.
\end{thm}
\pf  By equation (\ref{envdef}) and the
definition of $\inv$, it suffices to show that
$$\sum_{i\in E(w)}(v(i)-i)=\#\{\,(i,j)\mid i<j, a_i>a_j, i\in E(w), j\notin
E(w)\,\}. $$
The right hand side equals
$$\sum_{i\in E(w)}\#\{\,j\mid i<j, a_i>a_j, j\notin E(w)\,\}, $$
which, in turn, is equal to
\begin{equation}\label{invbit}
\sum_{i\in E(w)}\left(\#\{\,j\mid i<j, a_i>a_j\,\} -\#\{\,j\mid i<j, a_i>a_j,
j\in E(w)\,\}\right).
\end{equation}
Now,
\begin{eqnarray}
v(i)-i &=&v(i)-\#\{\,j\mid j\le i\,\}\nonumber\\
&=&\#\{\,j\mid a_j<a_i\,\}-\#\{\,j\mid j<i,a_j\ne a_i\,\}\nonumber\\
&=&\#\{\,j\mid j>i,a_j<a_i\,\}-\#\{\,j\mid j<i,a_j>a_i\,\}.\label{envbit}
\end{eqnarray}
Hence, comparing (\ref{invbit}) and (\ref{envbit}), we must show that
\begin{equation}\label{bits}
\sum_{i\in E(w)}\#\{\,j\mid i<j, a_i>a_j, j\in E(w)\,\} =\sum_{i\in
E(w)}\#\{\,j\mid
j<i,a_j>a_i\,\}.
\end{equation}
Clearly, each of the sums in equation (\ref{bits}) is $\inv\EXC w$. \qed

We now describe the main results of this paper.

In section \ref{bijperm} we will define a mapping $\Phi$ on ${\clS}_n$ and
prove the following result.
\begin{prop}\label{phistat}
For any permutation \p, we have
\begin{eqnarray*}
(\des,\dbot,\ddiff,\res)\ \pi&=&(\exc,\ebot,\ediff,\ine)\ \Phi(\pi),\\
(\des,\mad,\mak)\ \pi&=&(\exc,\inv,\den)\ \Phi(\pi).
\end{eqnarray*}
\end{prop}
By showing that $\Phi$ is a bijection, we deduce the following theorem.
\begin{thm}\label{masterperm}
  The quadristatistics
$$(\des, \dbot, \ddiff, \res)\quad\mbox{and}\quad
(\exc, \ebot,\ediff, \ine)$$
are equidistributed over the symmetric group $\cl S_n$. That is,
$$\sum_{\pi\in\cl S_n}{t^{\des\p}x^{\dbot\p}y^{\ddiff\p}q^{\res\p}}
=\sum_{\pi\in\cl S_n}{t^{\exc\p}x^{\ebot\p}y^{\ediff\p}q^{\ine\p}}.$$
Hence the triple $(\des, \mak, \mad)$ is equidistributed with $(\exc, \den,
\inv)$ over $\cl S_n$.
\end{thm}

In section \ref{bijword}, we will extend these results to words.  In fact
we will
prove the following result.
\begin{thm}\label{wordbij}
For any word $v$ there is a bijection \phiw\ on the rearrangement class
$R(v)$ of $v$
such that, for any word $w = a_1a_2\cdots a_n\in R(v)$, we have
$$(\des,\mad,\mak)\ w=(\exc,\inv,\den)\ \phiw(w).$$
\end{thm}

In section \ref{motzkin}, we shall make evident the relation between
our bijection $\Phi$ and some well-known bijections between the
symmetric group $\cl S_n$ and weighted Motzkin paths.  As a
by-product, we will obtain a continued fraction expansion
%EINAR I would remove commas around the parentheses on next line.
%BOB yes
(equation \ref{dfrac}) for the ordinary generating function of
$$D_n(x,q)=\sum_{\pi\in{\clS}_n}x^{\des\p}q^{\mad\p}.$$

%\newpage


\section{The bijection $\Phi$ for permutations}\label{bijperm}

Before proving Proposition \ref{phistat} and Theorem \ref{masterperm}, we
describe the construction of a bijection $\Phi: \cl S_n \ra \cl S_n$ which
takes a
permutation \p\ to a permutation \ta\ such that the set of descent tops in \p\
equals the set of excedance tops in \ta\ and the set of descent bottoms in \p\
equals the set of excedance bottoms in \ta. Moreover, the embracing numbers of
\p\ are preserved in a way that we now describe.

Observe that, since the letters of a permutation are distinct, we can refer
to the $i$-th embracing number $e_i$ of the permutation \p\ as the embracing
number of the {\em letter} $a_i$ in \p, and we will then denote $e_i$ by
$e(a_i)$.
Similarly, we may if we wish denote the $i$-th side number of \p\ by $d(a_i)$.

We will construct $\ta = \Phi(\pi)$ in such a way that the embracing number of a
letter $a_i$ in \p\ is the side number of $a_i$ in \ta.

Given a permutation \p, we first construct two biwords, $\biw f {f'}$ and
$\biw g
{g'}$, and then form the biword $\tau'=\biw {f\; g} {f'\; g'}$ by concatenating
$f$ and $g$, and $f'$ and $g'$, respectively. The word $f$ is defined as the
subword of descent bottoms in \p, ordered increasingly, and $g$ is defined
as the
subword of non-descent bottoms in \p, also ordered increasingly. The word
$f'$ is
the subword of descent tops in \p, ordered so that the \imversion\ bottom
number of
a letter $a$ in $f'$ is the embracing number of $a$ in \p, and $g'$ is the
subword of non-descent tops in \p, ordered so that the inversion top number of a
letter $b$ in $g'$ is the embracing number of $b$ in \p. Rearranging the columns
of $\tau'$, so that the top row is in increasing order, we obtain the
permutation
$\ta=\Phi(\pi)$ as the bottom row of the rearranged biword.

\begin{eg}{\rm Let $\pi = 4\ 1-2-7-9\ 6\ 5-8\ 3$, with embracing numbers 1,
0, 0, 2,
0, 1, 1, 0, 0.  Then
$$ \biw f {f'} = \biw {1\ 3\ 5\ 6}{8\ 4\ 6\ 9},\,\,\,\, \biw g {g'} = \biw
{2\ 4\ 7\ 8\ 9}{1\ 2\ 7\ 5\ 3},\,\,\,\, \tau'= \biw {1\ 3\ 5\ 6\ 2\ 4\ 7\ 8\ 9}
{8\ 4\ 6\ 9\ 1\ 2\ 7\ 5\ 3} $$
and thus $\Phi(\p)=\tau=8\ 1\ 4\ 2\ 6\ 9\ 7\ 5\ 3$.}
\end{eg}
%
It is easily checked that the descent tops and descent bottoms in \p\ are the
excedance tops and excedance bottoms in \ta, respectively, and that the
embracing
number of each letter in \p\ is the side number of the same letter in \ta.

\bigskip
\noindent{\bf Proof of Proposition \ref{phistat}:\/}
Assuming that the construction of $f'$ and $g'$ can be carried out
in the way described, and such that $f'=\EXC{\tau}$ and $g'=\NEX{\tau}$, it
is clear that the excedance tops and excedance bottoms in \ta\ are the descent
tops and descent bottoms, respectively, in \p, and that
$$\res \pi= \imv \EXC{\tau} +\inv \NEX{\tau} = \ine \tau.$$
As a consequence, we have
$$(\des,\dbot,\ddiff,\res)\ \pi= (\exc,\ebot,\ediff,\ine)\ \Phi(\pi).$$

%EINAR side numbers instead of inversino numbers on next line?
%BOB no, these are the inversion numbers of $f'$ and of $g'$, i.e., the side
%numbers of \ta.  Use "bottom or top inversion numbers"?
To complete the proof, we need to show two things. Firstly, that $f'$
and $g'$ can be constructed so that the \imversion\ bottom numbers and
the inversion top numbers of $f'$ and $g'$ respectively are those
claimed, and, secondly, that $f'=\EXC{\tau}$ (and thus
$g'=\NEX{\tau}$).




Let $a$ be the least descent top in \p. Then, if the embracing number of $a$ in
\p\ is $k$, there are $k$ descent blocks in \p\ to the right of $a$ that embrace
$a$. Thus, there are at least $k$ descent tops in \p\ that are larger than $a$,
namely the closers of the descent blocks embracing $a$. Also, there are at least
$k+1$ descent bottoms in \p\ that are smaller than $a$, namely the openers
of the
descent blocks embracing $a$, together with the opener of the descent block
containing $a$. If we put $a$ in the $(k+1)$--st place in $f'$ from the left,
then the \imversion\ bottom number of $a$ in $f'$ is $k$ as desired, and the
$(k+1)$--st place {\em does exist} in $f'$, because, as pointed out, there
are at
least $(k+1)$ descent bottoms, and thus at least $(k+1)$ descent tops, in \p\ if
$a$ has embracing number $k$.

Moreover, the same argument shows that $a$ is larger than the $(k+1)$--st letter
in $f$, because the first $(k+1)$ letters in $f$ are descent bottoms in \p\ that
are smaller than $a$. Hence, $a$ is an excedance in \ta. If we now remove the
letter $a$ from $f'$ and its corresponding descent bottom, the $(k+1)$--st
letter
of $f$, from $f$, then we can repeat the argument, appealing to induction, to
show that $f'$ can be constructed in the way described. That is, so that each
letter $x$ in $f'$ is an excedance top in \ta\ whose \imversion\ bottom number
equals the embracing number of $x$ in \p. An analogous argument shows that $g'$
can be constructed as claimed, and so that each letter in $g'$ is not an
excedance top in \ta.  \qed

In order to prove Theorem \ref{masterperm}, we must show that $\Phi$ is a
bijection.
Since $\Phi$ is a map from a finite set to itself, it suffices to show
$\Phi$ injective, but in the process we will, in fact, construct an inverse to
$\Phi$.

We introduce the idea of the {\em skeleton\/} of a permutation.  This is closely
related to the idea of ``gravid permutation'' introduced by Foata and Zeilberger
[7].  We first adjoin to the positive integers a symbol $\infty$ such that
$a<\infty$ for any positive integer $a$.

\begin{defn}
Let $n$ be a positive integer.  A {\em block\/} is a subset $B$ of
$[n]\cup\infty$ such that $B\cap[n]\ne\emptyset$.  The block $B$ is called {\em
open\/} if $\infty\in B$, {\em closed\/} if $\infty\notin B$ and {\em
improper\/}
if $|B|=1$. The {\em opener\/}, $\op(B)$, of $B$ is the smallest element of $B$,
the {\em closer\/}, \clo$(B)$, of $B$ is the largest element of $B$.

A {\em skeleton\/} is a sequence $S=B_1-B_2-\ldots-B_r$ of blocks such that any
pair of blocks intersect in at most $\{\infty\}$.  The skeleton $S$ is {\em
valid\/} if for each $i$ with $1\le i<n$ we have
$\op(B_i)<\clo(B_{i+1})$.\label{skeleton}
\end{defn}

\begin{defn}
Let $\pi\in{\cal S}_n$ be a permutation with descent block decomposition
$B_1-B_2-\cdots-B_r$.  Let $1\le a\le n$.  The {\em $a$-skeleton\/} of $\pi$
is the sequence of blocks obtained by
\begin{itemize}
\item deleting any descent block $B$ of $\pi$ for which $\op(B)>a$;
\item replacing any remaining letter of $\pi$ that is greater than $a$ by
$\infty$;
\item replacing each remaining descent block (which is a {\em sequence\/} of
elements) by its underlying set.
\end{itemize}
\end{defn}

For example, if $\pi=3\ 1-6-7\ 5-9\ 8\ 4\ 2$, the 4-skeleton of $\pi$ is
the sequence
$\{1,3\}-\{2,4,\infty\}$, which we will write as $3\ 1-\infty\ 4\ 2$.

It is clear that one can recover $\pi$ from its $n$-skeleton.

\begin{lem}\label{validity}
Let $\pi\in{\cal S}_n$.  For any $a$ with $1\le a\le n$, the $a$-skeleton of
$\pi$ is valid.
\end{lem}
\pf
We use downwards induction on $a$, knowing that the result is true
for the $n$-skeleton.  Suppose it is true for $a$.  To obtain the
$(a-1)$-skeleton from the $a$-skeleton, we merely replace $a$ by
$\infty$ in the block $B$ in which it occurs and delete that block if
it now contains only $\infty$.  But as the $a$-skeleton is valid and
$a$ is the largest finite element occuring in it, a block
$\{a,\infty\}$ or $\{a\}$ can only occur as the last block in the
$a$-skeleton, in which case its deletion will not cause
invalidity.\qed

The following result is easy to see.

\begin{lem}\label{embracing}
The embracing number of the letter $a$ in $\pi$ equals the number of open
blocks to the
right of the block containing $a$ in the $a$-skeleton of $\pi$.\qel
\end{lem}

\noindent{\bf Proof of Theorem \ref{masterperm}:\/}  We show that $\Phi$ is an
injection by showing that, given a permutation \ta\ in the image of $\Phi$,
there
is at most one permutation $\pi$ such that $\Phi(\pi)=\tau$. Given such a
\ta, it
is clear what the associated biword $\biw {f\;  g} {f'\; g'}$ must be. Namely,
$\biw f {f'}$ consists of those columns of $\widetilde{\tau}$ that represent
excedances in \ta, and $\biw g {g'}$ consists of the remaining columns of
$\widetilde{\tau}$. Now denote by $F$, $F'$, $G$ and $G'$ the sets whose
elements
are the letters of $f$, $f'$, $g$ and $g'$ respectively.  Then we can identify
the openers of $\pi$ as the letters in $F\cap G'$, the closers as the letters in
$F'\cap G$, the insiders as those in $F\cap F'$ and the outsiders as those in
$G\cap G'$.  As we can calculate the side numbers of \ta, we know the embracing
numbers of $\pi$.  We will show how to construct successively the
1-, 2-, \dots, $n$-skeletons of $\pi$.

\smallskip
The 1-skeleton of $\pi$ is either $\{1\}$ or $\{1,\infty\}$, according
as 1 is an outsider or an opener.  Suppose that the $(a-1)$-skeleton
$S=B_1-B_2-\ldots-B_r$ of $\pi$ has been constructed.  To construct
the $a$-skeleton of $\pi$ we must insert $a$ in the correct place in
$S$.  Let the embracing number of $a$ in $\pi$ be $e$.  Let $B_i$ be
the $(e+1)$-st open block from the right in $S$. If $a$ is an insider or
a closer in $\pi$ then, by Lemma \ref{embracing}, $a$ must be inserted
into $B_i$, and if $a$ is a closer then $B_i$ must be closed by the
removal of its $\infty$.  Suppose that $a$ is an outsider.  Then the
improper block $B=\{a\}$ must be inserted immediately to the left of
$B_i$.  For if $B$ is inserted to the left of $B_{i-1}$ then either
the resulting skeleton will be invalid or Lemma \ref{embracing} will
be violated.  Similarly, if $a$ is an opener, the open block
$\{a,\infty\}$ must be inserted immediately before $B_i$.

After the $n$-skeleton of $\pi$ has been constructed, we can immediately
construct
$\pi$.  Hence there is at most one permutation $\pi$  such that
$\Phi(\pi)=\tau$.
Hence, $\Phi$ is injective, and so a bijection, and its inverse is
defined by the construction just described.

The equidistribution of ($\des$, $\dbot$, $\ddiff$, $\res$) and ($\exc$,
$\ebot$,
$\ediff$, $\ine$) now follows from Proposition \ref{phistat} and the fact that
$\Phi$ is a bijection. As $\inv = \env$, the equidistribution of ($\des$,
$\mak$,
$\mad$) with ($\exc$, $\den$, $\inv$) follows from the definitions of the
Mahonian statistics involved, since each is the sum of two of the partial
statistics $\dbot$, $\ddiff$, $\res$ and $\ebot$, $\ediff$, $\ine$,
respectively.  \qed

\begin{eg} {\rm Let $\tau= 8\ 1\ 4\ 2\ 6\ 9\ 7\ 5\ 3$, so
    $$
    \biw f {f'} = \biw {1\ 3\ 5\ 6}{8\ 4\ 6\ 9},\,\,\,\, \biw g
    {g'} = \biw {2\ 4\ 7\ 8\ 9}{1\ 2\ 7\ 5\ 3},\,\,\,\, \tau'= \biw
    {1\ 3\ 5\ 6\ 2\ 4\ 7\ 8\ 9} {8\ 4\ 6\ 9\ 1\ 2\ 7\ 5\ 3}. $$
    For
    clarity, we now rewrite $\tau'$ with a bar separating $f$ from $g$
%EINAR side numbers instead of inversion numbers on next line?
%BOB no, see previous note.  More precisely "top and bottom"?
    and $f'$ from $g'$, and we write the imversion bottom and
    inversion top numbers in $f'$ and $g'$ respectively as subscripts
    of their corresponding letters, omitting those that are zero.
%
$$ 
\tau'= \biw {f&|&g} {f'&|&g'} = \left( \begin{array}{cccccccccc} 1 & 3 &
5 & 6
& | & 2 & 4 & 7 & 8 & 9 \\ 8 & 4_1 & 6_1 & 9 & | & 1 & 2 & 7_2 & 5_1 & 3
\end{array}     \right). $$
\vspace{6pt}
%EINAR How about replacing next line by
%The $k$-skeletons, for $k= 1,2,\cdots,9$, of our ...
%BOB Suggest the following.
The sequence of $k$-skeletons, for $k=1,2,\ldots,9$, of our required
permutation $\pi$ is:
\begin{eqnarray*}
&&\infty\ 1;\\
&&\infty\ 1-2;\\
&&\infty\ 1-2-\infty\ 3;\\
&&4\ 1-2-\infty\ 3;\\
&&4\ 1-2-\infty\ 5-\infty\ 3;\\
&&4\ 1-2-\infty\ 6\ 5-\infty\ 3;\\
&&4\ 1-2-7-\infty\ 6\ 5-\infty\ 3;\\
&&4\ 1-2-7-\infty\ 6\ 5-8\ 3;\\
&&4\ 1-2-7-9\ 6\ 5-8\ 3.
\end{eqnarray*}

Hence
$$\pi=4\ 1-2-7-9\ 6\ 5-8\ 3.$$}
\end{eg}

%\newpage
\section{\bf The extension to words of the bijection $\Phi$}\label{bijword}

To extend the bijection $\Phi$ of the previous section to the
rearrangement class of an arbitrary {\em word}, we {\em code} each
word $w = a_1 a_2\cdots a_n$ by the permutation $\p=v_w=x_1x_2\cdots
x_n$, where $x_i= v_w(i)$.  For example, the word 2 1 3 3 2 1 2 is
coded by 3 1 6 7 4 2 5. We then apply $\Phi$ to the permutation \p\ to
get a permutation $\p'$ such that $(\des,\dbot,\ddif,\res)\p =
(\exc,\ebot,\edif,\ine)\p'$. Finally, we {\em decode} $\pi'$ by
replacing each letter $x$ of $\p'$ by a letter $a_i$ of \w\ such that
$v_w(i)= x$.  (We point out that in general this ``decoding'' map is
{\em not\/} the inverse of the coding map that replaces $a_i$ by
$v_w(i)$.)

\medskip
Let $w=a_1a_2\cdots a_n$ be a word with descent set
$D(w)=\{i_1,\ldots,i_s\}$ and embracing numbers $e_1,\ldots,e_n$. Let
$\pi=x_1\cdots x_n$ be the coding of $w$ described above. Thus $x_i<x_j$ if and
only if either $a_i<a_j$ or $a_i=a_j$ with $i<j$. Let $\pi'=\Phi(\pi)=x'_1\cdots
x'_n$. Finally, let $w'=a'_1\cdots a'_n$ be the decoding of $\pi'$, where
$\theta$ is the decoding map, so $a'_i=\theta(x'_i)$. We define \phiw\ on
$R(\overline{w})$ by setting $\phiw(w)=w'$.

\bigskip
\noindent{\bf Proof of Theorem \ref{wordbij}:\/}  It is clear that
$D(\pi)=D(w)$, so that the set of descent bottoms of $\pi$ is
$\{x_{i_1+1},\ldots,x_{i_s+1}\}$, and the set of descent tops of $\pi$ is
$\{x_{i_1},\ldots,x_{i_s}\}$. Furthermore, the sequence of embracing numbers of
$\pi$ equals the sequence of embracing numbers of $w$.

Now, if the letters $a_i$ and $a_j$ are equal for distinct $i$ and $j$, then the
following claims are easily checked:
\begin{itemize}
\item[ i)] If $e_i>e_j$ then $i<j$.
\item[ ii)] If $e_i=e_j$ and $i\in D(w)$, $j\not\in D(w)$ then $i<j$.
\item[iii)] If $i,j\in D(w)$ then $e_i\ne e_j$.  In fact, if $i<j$ then
$e_i>e_j$.
\end{itemize}
In the first two cases, for the corresponding letters of $\pi$ we have
$x_i<x_j$.

As in the previous section, we refer to the embracing numbers $e_i$ of \p\ as
$e(x_i)$.

Let the biwords $\beta=\pmatrix{f\cr f'\cr}$ and $\gamma=\pmatrix{g\cr
  g'\cr}$ be as in the definition of $\Phi$ for permutations. Then,
from the previous section, the set $F'$ of letters of $f'$, which is
the set of excedance bottoms of $\pi'$, equals the set of descent
bottoms of $\pi$, and the set $G'$ of letters of $g'$, which is the
set of excedance tops of $\pi'$, equals the set of descent tops of
$\pi$. Moreover, the side number of a letter $x$ in $\p'$ equals the
embracing number of $x$ in \p. Suppose now that the same letter $a$
occurs in postions $i$ and $j$ of $w'$, that is, that
$\theta(x'_i)=\theta(x'_j)=a$. The following are immediate
consequences of i-iii) above.

\begin{itemize}
\item[ iv)] If $e(x'_i)>e(x'_j)$ then $x'_i<x'_j$.
\item[ v)] If $e(x'_i)=e(x'_j)$ and $x'_i\in F'$, $x_j'\in G'$ then
$x'_i<x'_j$.
\item[vi)] If $e(x'_i)=e(x'_j)$ and $x'_i, x_j'\in G'$ with $i<j$ then also
$x'_i<x'_j$ (for otherwise $(i,j)$ would be an inversion in \p, so that
$e(x'_i)>e(x'_j)$.)
\item[vii)] If $x'_i, x_j'\in F'$ then $e(x'_i)\ne e(x'_j)$. In fact, if
$x'_i<x'_j$ then $e(x'_i)>e(x'_j)$.
\end{itemize}

We claim that the sets of excedance places of $w'$ and $\pi'$ are equal. It is
easy to check that a non-excedance place in $\p'$ is a non-excedance place in
$w'$. Thus we need only show that no excedances ``disappear'' when
going from
$\pi'$ to $w'$, that is, that every column of the biword
$\theta(\beta)=\pmatrix{\theta(f)\cr\theta(f')\cr}$ represents an excedance,
where $\theta(f)$ is the word obtained by applying $\theta$ to each letter of
$f$. Let the $p$-th entry of $f'$ be the descent top $x_j$ of $\pi$. Then
$$p\le 1+e_j+\#\{\,i\in D(w)\mid a_i<a_j\,\},$$
by vii) above. But the number $q$ of letters in $\theta(f)$ strictly less than
$a_j$ satisfies
\begin{equation}\label{qinequality}
q\ge 1+e_j+\#\{\,i\in D(w)\mid a_i<a_j\,\}.
\end{equation}
For let $B$ be one of the $e_j$ descent blocks to the right of $a_j$
in $w$ that embrace $a_j$.  Let $a_k$ be the largest letter in $B$
that is less than $a_j$.  Then $a_k$ is a descent bottom in $w$ that
is less than $a_j$.  In addition, for each descent top $a_i$ of \w\
which is less than $a_j$, there is a descent bottom in \w\ which is
less than $a_j$.  But as $a_j$ itself is a descent top, its
corresponding descent bottom $a_{j+1}$ is less than $a_j$.  Hence
inequality (\ref{qinequality}) follows, so the $p$-th column of
$\theta(\beta)$ represents an excedance, as claimed.

\medskip Now we show that the side number of a letter $x'_i$ in $\pi'$
equals the side number of the corresponding letter $a=\theta(x'_i)$ in
$w'$.  For let $x'_i$ and $x'_j$ be letters of $f'$ such that
$\theta(x'_i)=\theta(x'_j)=a$.  We may assume that $i<j$ and that
there is no letter $x'_k$ in $f$, with $i<k<j$, such that
$\theta(x'_k)=a$.  Then by vii) above, $e(x'_i)\ne e(x'_j)$ and, since
$e(x'_i)$ is the \imversion\ bottom number of $x'_i$ in $f'$ and
$x'_i$ occurs to the left of $x'_j$ in $f'$, we must have $x'_i>x'_j$.
Hence, for every pair of equal letters in $\theta(f')$, there is an
inversion between the corresponding letters of $f'$.  Therefore the
\imversion\ bottom number of $a$ in $w'$ equals the \imversion\ bottom
number of $x'_i$ in $\pi'$.  Similarly, from vi) above it follows that
if $x'_i$ is a letter of $g'$ then the inversion top number of
$\theta(x'_i)$ in $w'$ equals the inversion top number of $x'_i$ in
$\pi'$.

Thus
$$\ine w'=\ine\pi'=\res\pi=\res w.$$

Since the set of excedance tops and the set of excedance bottoms of $\w'$ equal,
respectively, the set of descent tops and the set of descent bottoms of
$w$, we have
$$(\des,\mad,\mak)\ w=(\exc,\env,\den)\ \phiw(w).$$

To complete the proof of theorem \ref{wordbij}, we need only show that
\phiw\ is an injection.  Suppose that for words $w_1$ and $w_2$ we
have $w_k\mapsto\pi_k\mapsto\pi'_k\mapsto w'$ for $k=1, 2$.  Let us
refer to the sets and words involved in the construction of
$\phiw(w_k)$ by $F_k$, $f_k$, $G_k$, etc., for $k=1,2$.  Suppose that
$E(w')=E(\pi'_k)=\{i_1,\ldots,i_r\}$.  Then $F_k=\{i_1,\ldots,i_r\}$
and $G_k$ is the complementary set.  Hence the words $f_k$ and $g_k$
can be determined.  Further, $f'_k$ is an inverse image under $\theta$
of the word $a'_{i_1}\cdots a'_{i_r}$, and we have a similar result
for $g'_k$.  We can compute the side numbers of $\pi'_k$, as these
equal the side numbers of $w'$.  Now we can recover $f'_k$ and $g'_k$.
For, suppose that the letter $a$ occurs only in positions
$j_1,\ldots,j_s$ of $w'$.  Then from $e(x'_{j_1}),\ldots,e(x'_{j_s})$
and iv-vii) above, we can find $x'_{j_1},\ldots,x'_{j_s}$.  Hence
$\pi'_1=\pi'_2$.  As \phiw\ is injective on permutations, we have
$\pi_1=\pi_2$, so that $w_1=w_2$.  \qed

Note that we can explictly describe an inverse to \phiw\  with the aid of
the inverse to $\Phi$ for the case of permutations and the proof of the
preceding
theorem.

\begin{eg}{\rm Consider the word
$$w=1\ 3\ 2\ 2\ 3\ 2\ 1\ 3\ 1.$$
The coding of \w\ gives
$$\pi=1\ 7\ 4\ 5\ 8\ 6\ 2\ 9\ 3.$$
Now,
$$\pi'=\Phi(\pi)=1\ 9\ 6\ 8\ 4\ 7\ 5\ 2\ 3.$$
Thus
$$w'=\phiw(w)=1\ 3\ 2\ 3\ 2\ 3\ 2\ 1\ 1.$$

Conversely, given the word
$$w'=\phiw(w)=1\ 3\ 2\ 3\ 2\ 3\ 2\ 1\ 1,$$
consider the biword
$$\pmatrix{\overline{w'}\cr w'   \cr}
=\pmatrix{1&1&1&2&2&2&3&3&3\cr1&3&2&3&2&3&2&1&1\cr}.$$
The excedance places of $w'$ are 2, 3, 4 and 6. Hence
$$\pmatrix{f\cr f'\cr}=\pmatrix{2&3&4&6\cr3'&2'&3''&3'''\cr}$$
and
$$\pmatrix{g\cr g'\cr}=\pmatrix{1&5&7&8&9\cr1'&2''&2'''&1''&1'''\cr},$$
where $1'$, $1''$, $1'''$ are inverse images of 1, etc. Now
$$1'=1,\ 1''=2,\ 1'''=3,$$
since the corresponding side numbers satisfy $s(1')=s(1'')=s(1''')=0$.
Also,
$$ 2''=4,\ 2'''=5,\ 2'=6,$$
since $s(2'')=s(2''')=2,\ s(2')=1$,
and
$$3'''=7,\ 3''=8,\ 3'=9,$$
since $s(3''')=2,\ s(3'')=1,\ s(3')=0$.
Hence we have
$$\pi'=\Phi(\pi)=1\ 9\ 6\ 8\ 4\ 7\ 5\ 2\ 3$$
and we can recover $\pi$, and thus $w$, as before. }\end{eg}

%\newpage


\newcommand\colored{}

\section{Motzkin paths and a continued fraction expansion} \label{motzkin}


In this section we shall make evident the relation between our
bijection $\Phi$ and some well-known bijections between the symmetric
group $\cl S_n$ and weighted Motzkin paths. As a by-product we get the
continued fraction expansion for the generating function of $\cl S_n$
with respect to some of our statistics.

A {\em Motzkin path}, informally, is a connected sequence of $n$ line
segments, or ``steps,'' in the first quadrant of ${\mb R}^2$, starting
out from the origin in ${\mb R}^2$ and ending at $(0,n)$.
%EINAR Check that R^2 looks as intended (doesn't in Goteborg)
%BOB It just looks like $R^2$ here.
%XXX Just a note to myself (Einar) to fix R^2
The steps are of four different types,
northeast steps (N) going from $(a,b)$ to $(a+1,b+1)$, southeast (S)
going from $(a,b)$ to $(a+1,b-1)$ and solid/dotted east steps (E,dE),
from $(a,b)$ to $(a+1,b)$ (see Figure 1). Formally, a Motzkin path is
defined as follows.

\begin{defn}%
  A {\em \colored Motzkin path} is a word $w=c_1c_2\cdots c_n$ on the
  alphabet $\{\NE, \SE, \sE, \dE \}$ such that for each $i$ the {\em
    level $h_i$ of the $i$-th step}, defined by
$$h_i=\#\{j|j<i, c_j=\NE\}-\#\{j|j<i, c_j=\SE\}, $$
is non-negative, and equal to zero if $i=n$.
\end{defn}

\begin{defn}%
A {\em weighted Motzkin path of length $n$} is a pair $(c,d)$, where
$c=c_1\cdots
c_n$ is a \colored Motzkin path of length $n$, and $d=(d_1,\ldots, d_n)$ is a
sequence of integers such that
$$ 0\leq d_i\leq \cases{h_i& if
$c_i\in\{\NE,\sE\}$,\cr h_i-1& if $ c_i\in\{\SE,\dE\}$.\cr }$$
The set of weighted Motzkin paths of length $n$ is denoted by $\Gamma_n$.
\end{defn}

Fran\c con and Viennot \cite{fravie} gave the first bijection $\Psi_{\mn FV}$
between $\cl S_n$ and $\Gamma_n$. Here we describe one {\sl variant} of this
bijection.

\begin{defn}%
Let $\p =a_1\cdots a_n\in \cl S_n$ and set $a_0=0$ and $a_{n+1}=n+1$. For $1\leq
i\leq n$ we say that $a_i$ is a
\begin{itemize}
\item {\em linear double ascent} (outsider) if $a_{i-1}<a_i<a_{i+1}$;
\item {\em linear double descent} (insider) if $a_{i-1}> a_i> a_{i+1}$;
\item {\em linear peak} (closer) if $a_{i-1}<a_i>a_{i+1}$;
\item {\em linear valley} (opener) if $a_{i-1}>a_i<a_{i+1}$.
\end{itemize}
\end{defn}

\bigskip
\centerline {\sc The bijection $\Psi_{\mn FV}$ of Fran\c con and Viennot}
\bigskip

\noindent
Given a permutation $\p \in \cl S_n$, determine the right embracing
number $e_i$ for each $i\in [n]$. Form the weighted Motzkin path
$(c,d)=\Psi_{\mn FV}(\p )$ by setting $d_i=e_i$ and by defining $c_i$
as follows:
\begin{itemize}
\item if $i$ is a linear double descent, then $c_i=\dE$;
\item if $i$ is a linear double ascent then $c_i=\sE$; \item
if $i$ is a linear peak then $c_i=\SE$;
\item if $i$ is a linear valley then $c_i=\NE$.
\end{itemize}
For example, if $\p =6\  1-8\  7\  4\  2-5-9\  3$, then the corresponding
weighted Motzkin path $\Psi_{\mn FV}(\p )=(c,d)$ is shown in Figure 1.

\begin{figure}
{ \setlength{\unitlength}{0.6pt}
\begin{picture}(420,202)
\put(150,5)
{\begin{picture}(400,197)
\thicklines
\put(241,106){\dashbox{5}(35,0){}}
\put(134,135){\dashbox{5}(35,0){}}
\put(29,58){\line(4,3){105}}
\thinlines
\put(346,55){\circle*{7}}
\put(312,81){\circle*{7}}
\put(276,106){\circle*{7}}
\put(240,106){\circle*{7}}
\put(133,136){\circle*{7}}
\put(168,136){\circle*{7}}
\put(203,136){\circle*{7}}
\put(98,109){\circle*{7}}
\put(63,82){\circle*{7}}
\put(27,55){\circle*{7}}
\thicklines
\put(27,4){\vector(0,1){188}}
\put(98,107){\line(0,-1){103}}
\put(133,136){\line(0,-1){132}}
\put(168,135){\line(0,-1){132}}
\put(204,136){\line(0,-1){133}}
\put(240,107){\line(0,-1){103}}
\put(276,107){\line(0,-1){103}}
\put(205,136){\line(6,-5){36}}
\put(276,107){\line(4,-3){71}}
\put(346,52){\line(0,-1){50}}
\put(311,82){\line(0,-1){78}}
\put(63,82){\line(0,-1){78}}
\put(1,2){\line(1,0){345}}
\put(0,25){\line(1,0){345}}
\put(1,54){\vector(1,0){399}}
\put(10,33){$i$}
\put(45,33){\scriptsize 1}
\put(78,33){\scriptsize 2}
\put(113,33){\scriptsize 3}
\put(149,33){\scriptsize 4}
\put(183,33){\scriptsize 5}
\put(219,33){\scriptsize 6}
\put(255,33){\scriptsize 7}
\put(290,33){\scriptsize 8}
\put(327,33){\scriptsize 9}
\put(45,8){\scriptsize 0}
\put(78,8){\scriptsize 0}
\put(112,8){\scriptsize 0}
\put(150,8){\scriptsize 1}
\put(183,8){\scriptsize 1}
\put(218,8){\scriptsize 2}
\put(255,8){\scriptsize 1}
\put(291,8){\scriptsize 1}
\put(328,8){\scriptsize 0}
\put(3,8){$d_i$}
\put(168,136){\line(1,0){35}}
\end{picture}}
\end{picture}}

\medskip
\centerline {Figure 1}
\end{figure}

\bigskip
\centerline {\sc The bijection $\Psi_{\mn FZ}$ of Foata and Zeilberger}
\bigskip

\noindent In \cite{FZ} Foata and Zeilberger gave another bijection from
$\cl S_n$ to
$\Gamma_n$, which can be described by the following example.

Start with a permutation $\p$, say, $\pi= 9\ 4\ 7\ 6\ 1\ 2\ 8\ 5\ 3$, so
%
$$
\widetilde{\pi}=\biw {1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9} {9\ 4\ 7\ 6\ 1\ 2\ 8\ 5\ 3}.
$$
%
As in section \ref{bijperm}, separate
$\widetilde{\pi}$ into two biwords corresponding to $\p_E$ and $\p_N$ to get
$$
\biw f {f'}=\left(\matrix{1&2&3&4&7\cr9&4&7&6&8\cr}\right),\quad \biw g {g'}
=\left(\matrix{5&6&8&9\cr 1&2&5&3\cr}\right).$$
Form the weighted Motzkin path $(c,d)=\Psi_{\mn FZ}(\pi)$ as follows: Let
$s_1,s_2,\ldots,s_n$ be the sequence of side numbers of \p\ (see Definition
\ref{invno}) and put
\begin{equation}\label{pnumbers}
d_{\pi(i)}=s_i \mbox{ for } i=1,2,\ldots,n.
\end{equation}
 Let %
$$
c_i=\cases{\dE, & if $i\in F\cap F'$,\cr
\sE, & if $i\in G\cap G'$,\cr
\SE, & if $i \in F'\cap G$, \cr
\NE, & if $i\in F\cap G'$.\cr
}$$
%
Here we have $d=(0,\,0,\,0,\,1,\,1,\,2,\,1,\,1,\,0)$ and
$$F\cap F'=\{4,\, 7\},\quad G\cap G'=\{5\}, \quad F'\cap G=\{6,\, 8,\,9\},
\quad F\cap G'=\{1,\, 2,\, 3\}. $$
\begin{defn}%
For $\p \in \cl S_n$ and $i\in [n]$, we say that $i$ is a
\begin{itemize}
\item {\em cyclic double ascent} if $\p ^{-1}(i)<i<\p(i)$;
\item {\em cyclic double descent} if $\p ^{-1}(i)\geq i\geq \p(i)$;
\item {\em cyclic peak} if $\p ^{-1}(i)<i>\p(i)$;
\item {\em cyclic valley} if $\p ^{-1}(i)>i<\p(i)$.
\end{itemize}
\end{defn}

Note that the four sets $F\cap F'$, $G\cap G'$, $F'\cap G$ and $F\cap G'$
correspond respectively to cyclic double ascents, cyclic double descents, cyclic
peaks and cyclic valleys of $\p $. The corresponding weighted Motzkin path
is the
same as in Figure 1. We note that $\Psi_{\mn FV}=\Psi_{\mn FZ}\circ \Phi$. In
other words, we have the commutative diagram in Figure 2.

\bigskip
\centerline {\sc Biane's bijection}
\bigskip

\noindent In \cite{biane}, Biane gave a bijection similar to $\Psi_{\mn
FZ}$ which we
now describe.

\begin{defn}%
A {\em labeled path of length $n$} is a pair $(c, \xi)$, where $c=c_1\cdots c_n$
is a \colored Motzkin path of length $n$, and $\xi=(\xi_1, \ldots,\xi_n)$ is a
sequence such that
%
$$ 
\xi_i\in \cases{\{\Delta\},& if $c_i = \NE$,\cr 
\{0, \ldots,h_i\},& if $c_i = \dE$ or $\sE$,\cr 
\{0, \ldots, h_i-1\}^2,& if $c_i = \SE$.\cr }
$$
%
\end{defn}

\begin{figure}
  { \setlength{\unitlength}{0.62pt}
\begin{picture}(420,110)
\put(185,5)
{\begin{picture}(420,110)
\thinlines
\put(26,50){$\Psi_{\mn FV}$}
\put(172,50){$\Psi_{\mn FZ}$}
\put(114,7){$\Gamma_n$}
\put(199,98){$\clS_n$}
\put(8,98){$\clS_n$}
\put(114,113){$\Phi$}
\thicklines
\put(195,96){\vector(-1,-1){68}}
\put(40,95){\vector(1,-1){68}}
\put(41,105){\vector(1,0){150}}
\end{picture}}
\end{picture}}

\medskip
\centerline {Figure 2}
\end{figure}

\bigskip Biane's bijection is from the labeled paths of length $n$ to
$\cl S_n$.  Using the same notation as in the description of
$\Psi_{\mn FZ}$, the inverse of Biane's bijection can be summarized as
follows. Let $d_1,d_2,\ldots,d_n$ be the sequence of numbers
calculated using equation (\ref{pnumbers}) from the side numbers of
\p.  Note that Biane gave a recursive algorithm to compute these
numbers but did not point out that they are actually the side numbers
of $\pi$,
%EINAR I would rewrite the next two lines as follows
% that is the \imversion\ bottom and inversion top numbers in  $f'$
% and $g'$
%BOB Yes.
that is the \imversion\ bottom and inversion top numbers in $f'$ and $g'$
respectively.  Form the labeled path $(c, \xi)$ thus:
\begin{itemize}
\item if $i\in F\cap G'$ (valley), let $c_i=\NE$ and $\xi_i=\Delta$;
\item if $i\in F\cap F'$ (double ascent), let $c_i=\dE$ and $\xi_i=d_{i}$;
\item if $i\in G\cap G'$ (double descent), let $c_i=\sE$ and $\xi_i=d_{\p(i)}$;
\item if $i\in F'\cap G$ (peak), let $c_i=\SE$ and $\xi_i=(d_{\p(i)}, d_i)$.
\end{itemize}
The path is the same as for $\Psi_{\mn FZ}$, the only difference being
the distribution of the side numbers associated to each step of
the path. If we apply Biane's bijection to the permutation $\p$ above,
we get the labeled path in Figure 3.

\begin{figure}
{ \setlength{\unitlength}{0.6pt}
\begin{picture}(410,202)
\put(150,5)
{\begin{picture}(400,192)
\thicklines
\put(241,106){\dashbox{5}(35,0){}}
\put(134,135){\dashbox{5}(35,0){}}
\put(29,58){\line(4,3){105}}
\thinlines
\put(346,55){\circle*{7}}
\put(312,80){\circle*{7}}
\put(276,106){\circle*{7}}
\put(240,106){\circle*{7}}
\put(133,136){\circle*{7}}
\put(168,135){\circle*{7}}
\put(203,136){\circle*{7}}
\put(97,108){\circle*{7}}
\put(63,83){\circle*{7}}
\put(27,55){\circle*{7}}
\thicklines
\put(27,4){\vector(0,1){188}}
\put(98,107){\line(0,-1){103}}
\put(133,136){\line(0,-1){132}}
\put(168,135){\line(0,-1){133}}
\put(204,136){\line(0,-1){133}}
\put(240,107){\line(0,-1){103}}
\put(276,107){\line(0,-1){103}}
\put(205,136){\line(6,-5){36}}
\put(276,107){\line(4,-3){71}}
\put(347,52){\line(0,-1){50}}
\put(311,82){\line(0,-1){78}}
\put(63,82){\line(0,-1){78}}
\put(1,2){\line(1,0){345}}
\put(0,25){\line(1,0){345}}
\put(1,54){\vector(1,0){399}}
\put(10,33){$i$}
\put(45,33){\scriptsize 1}
\put(78,33){\scriptsize 2}
\put(112,33){\scriptsize 3}
\put(149,33){\scriptsize 4}
\put(183,33){\scriptsize 5}
\put(218,33){\scriptsize 6}
\put(255,33){\scriptsize 7}
\put(290,33){\scriptsize 8}
\put(327,33){\scriptsize 9}
\put(42,7){$\tiny \Delta$}
\put(76,7){$\tiny \Delta$}
\put(111,7){$\tiny \Delta$}
\put(150,8){\scriptsize 1}
\put(183,8){\scriptsize 0}
\put(207,8){\scriptsize (0,2)}
\put(255,8){\scriptsize 1}
\put(278,8){\scriptsize (1,1)}
\put(315,8){\scriptsize (0,0)}
\put(3,8){$\xi_i$}
\put(168,136){\line(1,0){35}}
\end{picture}}
\end{picture}}

\medskip
\centerline {Figure 3}
\end{figure}

In \cite{FZ}, Foata and Zeilberger's purpose with the bijection $\Psi_{\mn FZ}$
was to code the $\den$ statistic by weighted Motzkin paths, in order to
show that
$(\exc,\den)$ was equidistributed with $(\des,\maj)$. That $\Psi_{\mn FZ}$ also
keeps track of the $\inv$ statistic was first remarked by de M\'edicis and
Viennot \cite[Proposition 5.2]{medvie}. They proved that
\begin{eqnarray}
\inv\pi=\sum_{i=1}^nh_i+\sum_{i=1}^nd_i. \label{inveq}
\end{eqnarray}
In Biane's bijection, on the other hand, the $\inv$ statistic is seen
to equal
$$\inv\p=\sum_{i=1}^n(h_i+|\xi_i|), $$
where $|\xi|=x+y$ if
$\xi=(x,y)$. This is obviously equivalent to (\ref{inveq}).
%EINAR Shouldn't it be \xi_i (in two cases) above?
%BOB No, we are defining $|\xi|$ for a general vector $\xi=(x,y)$.

The proof of (\ref{inveq}) given in \cite{medvie} was based on a new definition
of $\inv$, similar to that of $\env$. This statistic of de M\'edicis and
Viennot's, which we denote $\invmv$ can be defined in our notation by
\begin{eqnarray}
\invmv \p =\inv \p_E&+&\inv \p_N +\#\{(i,j)|i\leq j<\p(i),\,
\p(j)> j\}\label{invbis}\cr &+&\#\{(i,j)|\p(i)<\p(j)\leq i, \, \p(j)\leq j\}.
\end{eqnarray}
However, their proof that $\inv$ equals $\invmv$ is fairly complicated, and can
be compared to that of the equivalence of the two definitions of $\den$ given in
\cite{FZ}. In \cite{clarke}, Clarke gave a short proof of the equivalence of the
two definitions of $\den$. Actually, the identity proved in \cite{clarke} can
also be used to prove the equivalence of the three definitions of $\inv$
mentioned above.  Of course, we have already furnished in Theorem \ref{envinv} a
proof that $\env\pi=\inv\pi$.

\begin{lem}
For any permutation $\p \in \cl S_n$, we have
\begin{eqnarray}%
\#\{(i,j)|i\leq j<a_i, \, a_j > j\}
=\#\{(i,j)|a_i<a_j\leq i, \, a_j >j\},&&\label{first}\\
\#\{(i,j)|i\leq j<a_i, \, a_j\le j\}
=\#\{(i,j)|a_i<a_j\leq i, \, a_j\le j\}.&&\label{second}
\end{eqnarray}
\end{lem}
\pf The equality (\ref{first}) was proved by Clarke \cite{clarke}. Since
\begin{eqnarray*}
\#\{(i,j)|i\leq j<a_i\} =\#\{(i,j)|a_i<j\leq i\}=\#\{(i,j)|a_i<a_j\leq i\},
\end{eqnarray*}
the identity (\ref{second}) follows from (\ref{first}).  \qed

\begin{prop}
For $\p \in \cl S_n$, we have $\invmv \p =\env \p =\inv \p $.
\end{prop}
\pf  Notice that
\begin{eqnarray}
\sum_{i\in E(\pi)}(a_i-i)&=&\#\{(i,j)|i\leq j<a_i\}\\
&=&\#\{(i,j)|i<j<a_i,\, a_j\leq j\}\\
&&+\;\#\{(i,j)|i\leq j<a_i, \, a_j> j\}.\nonumber
\end{eqnarray}
Comparing with (\ref{invbis}), the first equality follows from
(\ref{second}). On
the other hand, since
\begin{eqnarray*}
\inv \p &=&\inv \p _E+\inv \p _N
+\#\{(i,j)|i<j,\, a_i>a_j,\, i\in \p_E , \, j \in \p_N \}\\
 &=&\inv \p _E+\inv\p_N+\#\{(i,j)|i<j<a_i,\, a_j\leq j\}\\
&&\hskip 3.5cm +\;\#\{(i,j)|i<a_i,\,a_j<a_i\leq j\},
\end{eqnarray*}
it follows from (\ref{first}) that $\env \p=\inv \p $.  \qed

Using the connections between Motzkin paths and permutations we have described,
we now give a continued fraction expansion for the generating function
$D_n(x, q)=\sum_{\p \in \cl S_n}{x^{\des\p}q^{\expmad\p}}$.

For $n\geq 0$ let $[n]_q=1+q+\cdots +q^{n-1}$ and let
$$ f_n(x, p, q)=\sum_{\p\in \cl S_n}x^{\exc \p }q^{\edif \p }p^{\ine \p }. $$
Then, by Theorem \ref{masterperm}, we also have
$$ f_n(x, p, q)=\sum_{\p \in \cl S_n}x^{\des \p}q^{\ddif \p }p^{\res \p }. $$

\begin{thm}
The ordinary generating function of $f_n(x, p, q)$ has the following Jacobi
continued fraction expansion:
$$ \sum_{n\geq 0}f_n(x,p, q)t^n={1\over\displaystyle 1-b_0t- {\strut
\lambda_1t^2\over\displaystyle 1-b_1t- {\strut \lambda_2t^2\over\displaystyle {}
{\strut \ddots\over\displaystyle 1-b_nt- {\strut
\lambda_{n+1}t^2\over\displaystyle \ddots }}}}}, $$
where $b_n=q^n(x[n]_p+[n+1]_p)$ and $\lambda_{n+1}=xq^{2n+1}([n+1]_p)^2$
for $n\geq 0$.
\end{thm}
\pf  For $\p \in \cl S_n$, if $\Psi_{\mn FZ}(\p )=(c,d)$, then it is easy
to see that
\begin{eqnarray*}
\exc \p &=&\sum_{{c_i=\NE}}1+\sum_{{c_i=\dE}}1,\\
\edif \p &=&\sum_{c_i=\SE}i- \sum_{c_i=\NE}i=\sum_{i=1}^n h_i,\\
\ine \p &=&\sum_{i=1}^n d_i.
\end{eqnarray*}
It follows that
%EINAR I wonder if one could separate the following two lines a
%little.  They look a little messy.  I suppose we could each fix this
%and similar things separately before we print out the paper.
%BOB Done.
\begin{eqnarray*}
f_n(x,p,q)&=&\sum_{(c,d)\in \Gamma_n}\prod_{c_i=\NE}xq^{h_i}p^{d_i}
\prod_{c_i=\SE}q^{h_i}p^{d_i} \prod_{c_i=\dE}xq^{h_i}p^{d_i}
\prod_{c_i=\sE}q^{h_i}p^{d_i}\cr
\noalign{\vskip 10pt}
&=&\sum_{c\in M_n}\prod_{c_i=\NE} xq^{h_i}[h_i+1]_p
\prod_{c_i=\SE}q^{h_i}[h_i]_p
\prod_{c_i=\dE}xq^{h_i}[h_i]_p \prod_{c_i=\sE}q^{h_i}[h_i+1]_p ,
\end{eqnarray*}
where $M_n$ is the set of all Motzkin paths of length $n$. The theorem then
follows by applying a
result of Flajolet \cite[Theorem 1]{fla}.  \qed
%EINAR spelled out Theorem in reference above.

Using the {\em contraction} formula
\begin{eqnarray}
{c_0\over\displaystyle 1- {\strut c_1t\over\displaystyle 1- {\strut
c_2t\over\displaystyle \ddots }}} =c_0+{c_0c_1t\over\displaystyle 1-(c_1+c_2)t-
{\strut c_2c_3t^2\over\displaystyle 1-(c_3+c_4)t- {\strut
c_4c_5t^2\over\displaystyle \ddots }}},\label{contraction}
\end{eqnarray}
we immediately get the following Stieltjes continued fraction expansion for the
same generating function.
\begin{cor}\label{Stieltjes}  We have
\begin{eqnarray}
\sum_{n\geq 0}f_n(x,p,q)t^n={1\over\displaystyle 1- {\strut t\over\displaystyle
1- {\strut xqt\over\displaystyle {} {\strut \ddots\over\displaystyle 1- {\strut
q^{n-1}[n]_pt\over\displaystyle 1- {\strut xq^n[n]_pt\over\displaystyle \ddots
}}}}}}.
\end{eqnarray}

In particular, if $\disp D_n(x, q)= \sum_{\p \in \cl S_n}
{x^{\des\p}q^{\expmad\p}}$, if follows from Corollary \ref{Stieltjes}, by
putting $p=q$ in the above equation, that
\begin{eqnarray}
\sum_{n\geq 0}D_n(x,q)t^n= {1\over\displaystyle 1- {\strut
t\over\displaystyle 1-
{\strut xqt\over\displaystyle {} {\strut \ddots\over\displaystyle 1- {\strut
q^{n-1}[n]_qt\over\displaystyle 1- {\strut xq^n[n]_qt\over\displaystyle \ddots
}}}}}}.\qel\label{dfrac}
\end{eqnarray}
\end{cor}

\begin{table}
{\scriptsize
\begin{tabular}{c|c c c c c c c c c c c c c c c c } $k\backslash m$& 0& 1& 2&
3&4& 5& 6& 7&8 &9&10&11&12&13&14&15\\
\hline
0& \phantom{0}1& & & & & & & & & & & & & & & \\
1& &5 &4 &7 &8 &10 &10 &8 &4 &1 & & & & & & \\
2& & & 10 &12 &24 &32 &41 &44 &43 &36 &27 &18 &10 &4 &1 &\\
 3& & & & 10& 12& 24& 32& 41& 44& 43& 36& 27&18 & 10& 4& 1\\
 4& & & & & 5& 4& 7& 8& 10& 10& 8& 4& 1& & & \\
 5&\phantom{00}&\phantom{00} & \phantom{00} &\phantom{00}& \phantom{00}
  &1 & & & & & & & & & &{} \\
  \end{tabular}
\caption{$[x^kq^m]D_n(x,q)$ for $n=6$.}}
\end{table}

Note that the continued fraction expansion of the generating function
of $\sum_{\p \in \cl S_n}x^{\des \p}q^{\inv \p}$ can also be derived
from \cite[Theorem 6.5]{medvie}.

\begin{cor} For $0\leq k\leq n-1$ and $0\leq m\leq {n(n-1)\over 2}$ we have
\begin{eqnarray}
[x^kq^{k+m}]D_n(x,q)=[x^{n-1-k}q^{n-1-k+m}]D_n(x,q),\label{dualitycor}
\end{eqnarray}
where $[x^kq^m]D_n(x,q)$ is the coefficient of $x^kq^m$ in the polynomial
$D_n(x,q)$.
\end{cor}
\pf  Let $B_n(x,q)=D_n(xq^{-1},q)$. Then (\ref{dualitycor}) is equivalent to
\begin{eqnarray}
[x^kq^m]B_n(x,q)=[x^{n-1-k}q^m]B_n(x,q).\label{duality}
\end{eqnarray}

From (\ref{dfrac}) and (\ref{contraction}) we derive
\begin{eqnarray}\label{bequation}
\sum_{n\geq 1}B_n(x,q)t^n= {t\over\displaystyle 1-(c_1+c_2)t- {\strut
c_2c_3t^2\over\displaystyle 1-(c_3+c_4)t- {\strut c_4c_5t^2\over\displaystyle
\ddots }}},
\end{eqnarray}
where $c_{2n-1}=q^{n-1}[n]_q$ and $c_{2n}=xq^{n-1}[n]_q$ for $n\geq 0$.
Replacing
$x$ by $1/x$ and $t$ by $xt$ in (\ref{bequation}) we get
\begin{eqnarray}\label{beqinverse}
\sum_{n\geq 1}x^{n-1}B_n(x^{-1},q)t^n= {t\over\displaystyle 1-(c_1+c_2)t-
{\strut
c_2c_3t^2\over\displaystyle 1-(c_3+c_4)t- {\strut
c_4c_5t^2\over\displaystyle \ddots }}}.
\end{eqnarray}
Comparing
(\ref{bequation}) and (\ref{beqinverse}) then yields
$B_n(x,q)=x^{n-1}B_n(x^{-1},q)$, which is clearly
equivalent to (\ref{duality}). \qed

To illustrate the above corollary, we give in Table 1 the number of
permutations corresponding to the values of $(\des,\mad)$ when $n=6$
and for clarity we omit writing zeros.
%\newpage


\section{Variations on our statistics}\label{variations}
There are several variants on our statistics.  First of all, two new
statistics $\madl$ and $\makl$ are defined for a word $w$ as follows.
\begin{defn}
\begin{eqnarray*}
\madl w&=&\ddiff w+\les w.\\
\makl w&=&\dbot w+\les w.
\end{eqnarray*}
\end{defn}
Recall that $\les w$ is the sum of the left embracing numbers of $w$,
defined by replacing ``right'' by ``left'' in the definition of $\res w$.
(See Definition \ref{e numbers}.)

The relationship between these statistics and $\mad$ and $\mak$ for permutations
is based on the following result, the proof of which will occupy the major
part of
this section.

\begin{prop}\label{epsilon}
There is an involution \e\ on $\cl S_n$ such that, for each $\pi\in \cl S_n$,
$$(\des, \dbot, \dtop, \res, \les)\ \pi=
(\des, \dbot, \dtop, \les, \res)\ \ep. $$
In particular,
\begin{eqnarray*}
\mad \pi&=&\madl\ep,\\
\mak \pi&=&\makl\ep.
\end{eqnarray*}
\end{prop}

The involution \e\ can be informally described as follows.  Let \p\ be a
permutation with descent block decompostion $B_1-B_2-\cdots-B_k$.  Write the
descent blocks of \p\ down in reverse order to give a permutation
$\pp=B_k-B_{k-1}-\cdots-B_1$.  Now this may not be the descent block
decomposition of \pp, as new descents may have been introduced between adjacent
descent blocks.  If $\op(B_2)>\clo(B_1)$, that is, if a new descent has been
introduced between $B_2$ and $B_1$, then move block $B_2$ to the right of $B_1$
to get $B_k-B_{k-1}-\cdots-B_1-B_2$, otherwise leave block $B_2$ where it is.
Now consider block $B_3$.  If there is a descent between $B_3$ and the block to
its right, move $B_3$ past that block. Continue moving $B_3$ to the right until
there is no descent between it and the block to its right.  Continuing in this
way we arrive at the permutation \ep.
\begin{eg}
  {\rm If $\pi=3\ 1-5\ 4\ 2-7\ 6$ with descent blocks $B_1-B_2-B_3$
    then $\pp=B_3-B_2-B_1=7\ 6-5\ 4\ 2-3\ 1$ and, as there is a
    descent between $B_3$ and $B_2$, we get successively $5\ 4\ 2-7\
    6-3\ 1$ and $\ep=5\ 4\ 2-3\ 1-7\ 6$.}
\end{eg}

To show that \e\ is an involution, we must proceed more formally.
For the remainder of this section, \p\ will be a permutation with descent
block decomposition $B_1-B_2-\cdots-B_k$.  We will write \p\ either in this
way or as the juxtaposition product $B_1B_2\cdots B_k$.

%EINAR Do we need double subscripts in the next definition and the
%paragraph following it?
%BOB I don't see how to avoid them.

\begin{defn}
Let $(i_1, i_2, \ldots, i_r)$ be a sequence of distinct integers in
$[k]$. Then $(B_{i_1}, B_{i_2}, \ldots, B_{i_r})$ is a {\em valid\/}
sequence of descent blocks if $\op(B_{i_j})\le\clo(B_{i_{j+1}})$ for $1\le j<r$.
\end{defn}
Note that if $(B_{i_1}, B_{i_2}, \ldots, B_{i_r})$ is a valid
sequence of descent blocks, then $B_{i_1}-B_{i_2}-\cdots-B_{i_r}$ is the descent
block decomposition of the permutation $B_{i_1}B_{i_2}\ldots B_{i_r}$.

\begin{defn}
For any two descent blocks $B_i$ and $B_j$ of $\pi$, write $B_i<B_j$ if
$\op(B_j)>\clo(B_i)$, that is, if $(B_j, B_i)$ is not a valid sequence of
descent
blocks.
\end{defn}
Thus $B_i\not<B_j$ if and only if $(B_j, B_i)$ {\em is\/} a valid sequence
of descent
blocks. It is easy to see that $<$ is a partial ordering on the descent
blocks of
$\pi$.
\begin{eg}
{\rm If $\pi=3\ 1-5\ 4\ 2-7\ 6$ with descent blocks $B_1-B_2-B_3$ then
$B_1<B_3$ and $B_2<B_3$.}
\end{eg}
Note that, as $(B_1, B_2, \dots, B_k)$ is a valid sequence of descent
blocks, we have
$B_{i+1}\not<B_i$ for $1\le i<k$.

\medskip
We now describe more formally the involution \e.  Given the permutation $\pi$,
define the sequence of permutations $\pi_1$, $\pi_2$, \dots, $\pi_k=\pi$ by
$$\pi_r=B_1-B_2-\cdots-B_r,\qquad 1\le r\le k.$$
We shall construct a sequence of permutations $S_1$, $S_2$, \dots, $S_k$, with
$$S_r=B_{r_1}-B_{r_2}-\cdots-B_{r_r},\qquad 1\le r\le k,$$
such that, for each $r$,
\begin{itemize}
\item the sequence $(B_{r_1}, B_{r_2}, \ldots, B_{r_r})$ is a valid sequence of
descent blocks, and is a rearrangement of the sequence $(B_1, B_2, \ldots,
B_r)$;
\item $(\des,\dbot,\dtop,\res,\les)\ \pi_r=(\des,\dbot,\dtop,\les,\res)\
S_r$.\hfill$(*)$
\end{itemize}
Having done so we define
$$\ep=S_k.$$

The algorithm for constructing the sequence $S_1$, \dots, $S_k$ is as follows.
\begin{enumerate}
\item Put $S_1=B_1$.
\item If $B_1<B_2$ then put $S_2=B_1-B_2$, otherwise put $S_2=B_2-B_1$.
\item Suppose that $S_r$ has been constructed as required for some $r<k$.  Let
$j$ be the smallest integer such that $B_{r_j}\not<B_{r+1}$, if such an integer
exists.  Then form $S_{r+1}$ from $S_r$ by inserting block $B_{r+1}$ immediately
to the left of block $B_{r_j}$.  If no such integer $j$ exists, then form
$S_{r+1}$ by appending $B_{r+1}$ to the right of $S_r$.
\end{enumerate}
It is easy to verify that equation $(*)$ above holds.  We need merely note that
if $B$ and $B'$ are descent blocks of $\pi$ with $\op(B)>\clo(B')$ then no
element of $B$ is embraced by $B'$ and no element of $B'$ is embraced by $B$.

\begin{eg}
{\rm If $\pi=3\ 1-5\ 4\ 2-7\ 6$ then $S_1=3\ 1$, $S_2=5\ 4\ 2-3\ 1$ and
$\ep=S_3=5\ 4\ 2-3\ 1-7\ 6$.}
\end{eg}

The following lemma is easy to prove.
\begin{lem}\label{rightof}
Let $1\le i<j\le k$.  Then the block $B_i$ occurs to the right of $B_j$ in \ep\
if and only if there is a sequence $i=i_0<i_1<\cdots<i_\ell=j$ such that
$(B_j,B_{i_{\ell-1}},\ldots,B_i)$ is a valid sequence of descent blocks.  \qed
\end{lem}

As a special case of the above lemma, if $1\le i<j\le k$ and the block $B_i$
occurs to the left of $B_j$ in \ep\ then $B_i<B_j$.

\begin{lem}
The mapping \e\ is an involution.
\end{lem}
\pf Let $1\le i<j\le k$, so that $B_i$ occurs to the left of $B_j$ in $\pi$.
Suppose first that $B_i$ occurs to the right of $B_j$ in \ep.  We show that
$B_i$
occurs to the left of $B_j$ in \eep.  Without loss of generality, we may assume
that $j$ is the smallest integer greater than $i$ such that $B_i$ occurs to the
right of $B_j$ in \ep.  Suppose that $B_i$ occurs to the right of $B_j$ in
\eep.
Then, by the remark after Lemma \ref{rightof}, we have $B_j<B_i$.  We show by
induction that for every $t$ with $i\le t<j$ we have $B_j<B_t$.  This is
true for
$t=i$.  Suppose it is true for $t-1$, where $i<t<j$. Then, from the
definition of
$j$, the block $B_t$ does not occur between $B_j$ and $B_i$ in \ep.  If $B_t$
occurs to the left of $B_j$ then $B_t<B_j<B_{t-1}$, a contradiction.  Hence
$B_t$
occurs to the right of $B_i$ and we have $B_j<B_i<B_t$.  But now
$B_j<B_{j-1}$, a contradiction.

%EINAR I would write ``Suppose now'' on the next line, because the
%next paragraph also begins with a Now.
%BOB yes.
Suppose now that $1\le i<j\le k$ and that $B_i$ occurs to the left of $B_j$ in
\ep.  We show that $B_i$ occurs to the left of $B_j$ in \eep.  If not, by Lemma
\ref{rightof} applied to \ep\ there must be a sequence
$i=i_0,i_1,\ldots,i_\ell=j$
such that
\begin{itemize}
\item for $1\le r<\ell$, $B_{i_r}$ occurs to the left of $B_{i_{r+1}}$ in \ep.
\item the sequence $(B_j,B_{i_{\ell-1}},\ldots,B_i)$ is a valid sequence of
descent
blocks.
\end{itemize}
Now, as $i<j$, for some $r$ we must have $i_r<i_{r+1}$.  But, as $B_{i_r}$
occurs
to the left of $B_{i_{r+1}}$ in \ep, $B_{i_r}<B_{i_{r+1}}$, a contradiction
as the
above sequence will not be valid.

Thus we have shown that any two descent blocks of $\pi$ occur in the same
order in
\eep\ as they do in $\pi$.
Therefore $\eep=\pi$.  \qed

\noindent{\bf Proof of Proposition \ref{epsilon}:}  The equation
$$(\des, \dbot, \dtop, \res, \les)\ \pi=
(\des, \dbot, \dtop, \les, \res)\ \ep$$
follows from equation $(*)$ above and the fact that $\pi=\pi_k$ and $\ep=S_k$.
The equations involving $\mad$ and $\mak$ follow from the definitions of those
statistics.  \qed

It follows from Proposition \ref{epsilon} that the triple ($\des$, $\madl$,
$\makl$) is equidistributed with the triple ($\des$, $\mad$, $\mak$) on
$\clS_n$.

\bigskip
The above involution $\epsilon$ is defined in precisely the same way for words
as for permutations, but Proposition \ref{epsilon} is replaced by a result
(Proposition \ref{epsilonword} below) that is both more
complicated and more interesting. Let $w=a_1a_2\cdots a_n$ be a word. If $1\le
i\le n$, define the {\em right value\/} of the $i$-th letter in $w$,
$v'_w(i)$, by
$$v'_w(i)=h(a_i)+r_w(i),$$
where $r_w(i)$ is the number of letters in $w$ that
are to the {\em right\/} of $a_i$ and equal to $a_i$. For example, if
$w=1\ 2\ 1\ 4\ 4\ 2\ 3\ 1\ 4$, the right values of the letters of $w$ are given
by 3, 5, 2, 9, 8, 4, 6, 1, 7, in the order in which they appear in $w$. Then we
can define the {\em right\/} descent bottoms sum of $w$, denoted by $\dbot'
w$, as
the sum of the right values of the descent bottoms of $w$ and the {\em right\/}
descent difference of $w$, denoted by $\ddiff' w$, by
$$\ddiff' w=\dtop w-\dbot' w.$$
Now we can define two new statistics corresponding to each of $\mad$ and $\mak$:
\begin{defn}
\begin{eqnarray*}
\mak' w&=&\dbot' w \+ \res w.\\
\mad' w&=&\ddiff' w \+ \res w.\\
\makl' w&=&\dbot' w \+ \les w.\\
\madl' w&=&\ddiff' w \+ \les w.
\end{eqnarray*}
\end{defn}

%EINAR I would remove the Now on next line and write ``It is not...''
%because the previous paragraph also starts with Now.
%BOB Yes.
It is not hard to see that the effect of the involution $\epsilon$ above is
to interchange $\res$ and $\les$ {\em and\/} to interchange value and right
value. Thus we have the following result.
\begin{prop}\label{epsilonword}
Let $v$ be a word. Then there is an involution $\epsilon$ on the rearrangement
class $R(v)$ such that for all $w\in R(v)$,
$$(\des, \dbot, \dtop, \res, \les)\ w=(\des, {\dbot}', \dtop, \les, \res)\
\epsilon(w).$$
In particular,
\begin{eqnarray*}
\mad w&=&\madl'\epsilon(w),\\
\madl w&=&\mad'\epsilon(w),\\
\mak w&=&\makl'\epsilon(w),\\
\makl w&=&\mak'\epsilon(w).\qel
\end{eqnarray*}
\end{prop}
It now immediately follows that the triple ($\des$, $\madl'$, $\makl'$) is
equidistributed with the triple ($\des$, $\mad$, $\mak$).

%BOB Also changed Now below to Consequently
Consequently, it is easy to modify the bijection $\phiw$ of section
\ref{bijword} to show that the triple ($\des$, $\madl$, $\makl$) is
%EINAR on the next line we have ($\exc$, $\inv$, $\den$) whereas in
%section \ref{bijword} we say ($\exc$, $\env$, $\den$).  I'm not sure,
%though, that we need to make this uniform.
%BOB I suspect that we should use $\inv$ as soon as we have proved or
stated that
%$\env=\den$.  Should we change Theorem 5 to "inv"?
equidistributed with ($\exc$, $\inv$, $\den$), and hence with ($\des$,
$\mad$, $\mak$). Hence the triple ($\des$, $\mad'$, $\mak'$) is also
equidistributed with ($\des$, $\mad$, $\mak$).


\section{Concluding remarks}\label{concl}
\subsection{Links to the past}
Some Mahonian statistics on $\cl S_n$ equivalent to $\mad$ have been
given by Simion and Stanton \cite{simstan1} and by de M\'edicis and
Viennot \cite{medvie}.  More precisely, de M\'edecis and Viennot
%EINAR Change Prop. to Proposition, next line?
%BOB Yes.
\cite[Proposition 6.2]{medvie} gave a Mahonian statistic they called ``lag''
(but which we call $\lag$, for the sake of consistency). It can be
defined as follows: Given a permutation $\pi=a_1 a_2\cdots a_n$, let
$$\pi'=(n+1)a_1 a_2\cdots a_n0\in \cl S_{n+2}$$
and let $\run\pi$ be the
number of descent blocks in \p. Then
$$\lag \pi = \ddif \pi' +\les \pi' - \run \pi-n.$$
It is not hard to
see that $\lag \p =\mad\pi^r$, where $\p ^r=a_na_{n-1}\cdots a_1$.

We define the {\em dual} of a permutation $\p=a_1 a_2\cdots a_n \in \cl S_n$ as
the permutation $\pi^{\ast}= b_1 b_2\cdots b_n$, where $b_i= n+1-a_i$ for $1\leq
i\leq n$.  Simion and Stanton \cite{simstan1} use notions dual to ours, with
ascents instead of descents, and embracing by ascent blocks, which they call
``runs''.  They also use the notion of left embracing. Their statistic,
translated into our dual setting, is
$$\sist\; \pi = n-\run \pi +2\les\pi+\res\pi$$
(see Theorem 2 in \cite{simstan1}), so, since $n-\run \pi = \des \pi$, we have
$$\sist\; \pi = \des \pi +2\les \pi +\res \pi.$$
A counterpart of this statistic, namely
$$\sist'\; \pi = \des \pi +2\res\pi +\les\pi,$$
whose dual was also defined by Simion and Stanton, is readily seen to equal
$\mad$ for permutations, because of the identity:
$$ \ddiff\p = \des\p+\res\p+\les\p. \eqno(*)$$
However, $\sist'$ is not Mahonian for words --- because the identity $(*)$ does
not hold for words --- and neither are the other statistics defined by
Simion and Stanton. Some of their other statistics are equivalent to the
variations on  $\mad$ given in the last section.
\subsection{Large and small letters}

Various authors, for example \cite{clfo, han2, stein}, have considered
statistics on words and permutations in the context of an alphabet
$\cl A=[m]$ in which the letters are divided into two classes, {\em
  large\/} and {\em small\/}. Namely, for some $k$ with $0\le k\le m$
%EINAR should we change ``l'' to ``\ell'' in what follows (5 places)?
%BOB Done.
and for $\ell=m-k$, the letters $1,2,\ldots,\ell$ are designated small and
the letters $\ell+1,\ldots,m$ are designated large. Then, for a word
$w=a_1a_2\cdots a_m$, a \mbox{$k$-{\em descent\/}} is an integer $i$ such
that one of the following conditions holds:
\begin{itemize}
\item $1\le i<m$ and $a_i>a_{i+1}$;
\item $1\le i<m$ and $a_i=a_{i+1}>\ell$;
\item $i=m$ and $a_i>\ell$.
\end{itemize}
Then $\des_k w$ equals the number of $k$-descents of $w$. One can similarly
define $k$-extensions of the other Eulerian and Mahonian statistics. The results
of the present paper can all be $k$-extended, as will be presented by the
present
authors in a subsequent note.

\begin{thebibliography}{99}
\bibitem{biane}P. Biane: Permutations suivant le type d'exc\'edance et le nombre
d'inversions et interpr\'etation combinatoire d'une fraction continue de Heine,
Europ. J. Combinatorics {\bf 14} (1993), 277--284.

\bibitem{clarke} R. J. Clarke: A short proof of a result of Foata and
Zeilberger,
Adv. Appl. Math. {\bf 16} (1995), 129--131.

\bibitem{clfo} R. J. Clarke and D. Foata: Eulerian Calculus I: Univariate
statistics,
 Europ. J. Combinatorics {\bf 15} (1994), 345--362.

\bibitem{denert} M. Denert: The genus zeta function of hereditary orders in
central simple algebras over global fields, Math. Comp. {\bf 54} (1990),
449--465.

\bibitem{euler} L. Euler: Institutiones calculi differentialis, in {\em Opera
Omnia, Series Prima}, vol. X, Verlag von B.G. Teubner, Leipzig, 1913.

\bibitem{fla} P. Flajolet: Combinatorial aspects of continued fractions, Disc.
Math. {\bf 41} (1982), 145--153.

\bibitem{foa1} D. Foata: Distribution Eul\'eriennes et Mahoniennes sur
  le groupe des permutations, in M. Aigner (ed.), {\em Higher
  Combinatorics}, 27--49, D. Reidel, Boston, Berlin Combinatorics
  Symposium, 1976.
%EINAR Italicized Higher Combinatorics above

\bibitem{foa2} D. Foata: Rearrangements of words, in M. Lothaire, {\em
    Combinatorics on Words}, (ed.) G.-C. Rota, Vol. 17, Encyclopedia
  of Math.  and its Appl., Addison-Wesley Publishing Company, 1983.
%EINAR Changed Words to lower case above

\bibitem{fohan} D. Foata and G.-N. Han: Calcul basique des distributions
statistiques sur les permutations sign\'ees, Preprint, 1995.

\bibitem{FS1} D. Foata and M.-P. Sch\"utzenberger: {\em Th\'eorie
g\'eom\'etriques des polyn\^omes eul\'eriens}, Lecture Notes in Math., vol. 138,
Springer-Verlag, Berlin, 1970.

\bibitem{FS2} D. Foata and M.-P. Sch\"utzenberger: Major index and inversion
number of permutations, Math. Nachr. {\bf 83} (1978), 143--159.

\bibitem{FZ} D. Foata and D. Zeilberger: Denert's permutation statistic is
indeed
Euler-Mahonian, Studies in Appl. Math. {\bf 83} (1990), 31--59.

\bibitem{fravie} J. Fran\c con and X. G. Viennot: { Permutations selon les pics,
creux, doubles mont\'ees, doubles descentes, nombres d'Euler, nombres de
Genocchi}, Disc. Math. {\bf 28} (1979), 21--35.

\bibitem{garges} A. M. Garsia and I. M. Gessel: Permutations statistics and
partitions, Adv. in Math. {\bf 31} (1979), 288--305.

\bibitem{han} G.-N. Han: Une transformation fondamentale sur les
r\'earrangements de mots,
 Adv. in Math., {\bf 105} (1994), 26--41.

\bibitem{han2} G.-N. Han: The $k$-extension of a Mahonian statistic,
  Adv. Appl. Math., {\bf 16} (1995),297--305.

\bibitem{macmahon} P.A. MacMahon: {\em Combinatory Analysis}, vols. 1 and 2.
Cambridge Univ. Press, Cambridge, 1915 (reprinted by Chelsea, New York, 1955).

\bibitem{medvie} A. de M\'edicis and X. G. Viennot: Moments des $q$-Polyn\^omes
de Laguerre et la bijection de Foata-Zeilberger, Adv. Appl. Math. {\bf 15}
(1994), 262--304.

\bibitem{ra} D. Rawlings: Permutation and multipermutation statistics, Europ.
J. Comb., {\bf 2} (1981), 67-78.

\bibitem{rodrig} O. Rodriguez: Note sur les inversions, ou d\'erangements
produits dans les permutations, J. de Math. {\bf 4} (1839), 236--240.

\bibitem{simstan1} S. Simion and D. Stanton: Specializations of generalized
Laguerre polynomials, SIAM J. Math. Anal. {\bf 25} (1994), 712--719.

\bibitem{simstan2} S. Simion and D. Stanton: Octabasic Laguerre polynomials and
permutation statistics, J. Comp. Appl. Math., to appear.

\bibitem{stanley} R. Stanley: Binomial posets, M\" {o}bius inversion and
permutation
enumeration, J. Comb. Theory, {\bf A, 20} (1976),  712--719.

\bibitem{stein} E. Steingr\'{\i}msson: Permutation statistics of
  indexed permutations, Europ. J. Combinatorics, {\bf 15} (1994),
  187--205.
\end{thebibliography}






\end{document}

