\documentstyle{amsppt}
\magnification=\magstep1  \hsize=16.8 truecm \vsize=24truecm \nologo \NoBlackBoxes %\input jump 
%\input usefraktur  \input usescript  \input amstex  \documentstyle{amsppt} 
\def\inv{^{-1}} \def\cal{\Cal} \def\'{\prime} \def\bel{\!\in\!} \def\C{\Bbb C}\def\R{\Bbb R} \def\Z{\Bbb Z} \def\sumstar{\sideset \and^* \to\sum}
 \def\sp{|_{\lower2pt\hbox{$\scriptstyle 2k$}}} \def\sn{|_{\lower2pt\hbox{$\scriptstyle 2-2k$}}}
\def\setminus{\smallsetminus}  \def\al{\allowmathbreak}\def\bin#1#2{\bigl(#1\atop#2\bigr)} \def\M{\cal M_n} \def\J{\cal J}
\def\mg{$PSL(2,\Z)$} \def\rpf{\text{\bf RPF\rm}} \def\pp{\text{PP}_\alpha[} \def\ppi{\text{PP}_\infty[}  \def\H{\cal H}
\topmatter \title   Rational period functions for \mg\endtitle\vskip.2in
\author  YJ. Choie and D. Zagier \endauthor\endtopmatter\document
      
A \it rational period function \rm (RPF) of weight $2k$ ($k\ge0$) for \mg\  is a rational function $q(z)$ satisfying the two identities 
$$q\bigl(z\bigr)+z^{-2k}q\bigl(\frac{-1}z\bigr)=0,\qquad q\bigl(z\bigr)+z^{-2k}q\bigl(1-\frac1z\bigr)+(z-1)^{-2k}q\bigl(\frac{-1}{z-1}\bigr)=0.$$ 
The definition is motivated by the fact that the corresponding identities in negative weight $2-2k$ describe the so-called \it period
polynomials\rm, a space of polynomials closely related to the space of cusp forms on \mg\  of weight $2k$. Rational period functions
were first considered by Knopp [6], who gave non-trivial examples (e.g. $(z^2-z-1)^{-k}+(z^2+z-1)^{-k}$ if $k$ is odd)
and showed that an arbitrary RPF can have poles only at 0 or at real quadratic irrationalities. Further work 
was done by several authors (cf. references in \S2.4). Finally, Ash [1] described the set of RPF's completely, not only for the full modular
group,  but also for subgroups of finite index. In this paper we will give
 a very explicit construction of all RPF's for \mg, in particular recovering Ash's result in this case in a more concrete form
than the one he gives, and also give an explicit description of the action of Hecke operators on RPF's. The final result on the
classification of RPF's for \mg is stated in \S2.4, while the discussion of Hecke operators is in Section 3. Some numerical examples
illustrating the theory are given in \S4.

\heading 1. Review of reduction theory and of the theory of periods \endheading
In \S1.1 we review the reduction theory of indefinite binary quadratic forms and prove a lemma which will be used for the classification
of rational period functions. In \S1.2 we recall the  Eichler-Shimura theory of periods of modular forms for $\Gamma =$\mg\  
(as presented, say, in [10]) and also describe certain complements to this theory proved in [8].

{\bf 1.1.} We consider binary quadratic forms $Q(x,y)=Ax^2+Bxy+Cy^2$ with $A,\,B,\,C\in\Bbb Z$; we will denote such a form by $Q=[A,B,C]$ 
and its discriminant $B^2-4AC$ by $D=D(Q)$. We will consider only forms of positive non-square discriminant.  The group $\Gamma$ 
acts on the set of forms of discriminant $D$ by $(Q|\gamma)(x,y)=Q((x,y)\gamma^t)$ or more explicitly by
 $[A,B,C]\,|\!\bigl(\smallmatrix  a&b\\c&d\endsmallmatrix\bigr)=[Aa^2\!+\!Bac\!+\!Cc^2,2Aab\!+\!B(ad\!+\!bc)\!+\!2Ccd,Ab^2\!+\!Bbd\!+\!Cd^2]$.
The action can be extended to $PGL(2,\Bbb Z)$ by letting $(Q|\gamma)(x,y)$ denote $-Q((x,y)\gamma^t)$ if $\det(\gamma)=-1$. We will use the
letter $\cal A$ to denote a $\Gamma$-equivalence class of forms $Q$ and $\cal A\inv$, $\Theta\cal A$, and $\Theta\cal A\inv$ to denote
the classes of the quadratic forms $[A,-B,C]$, $[-A,B,-C]$ and $[-A,-B,-C]$. The notation comes from the fact that the
classes of primitive $Q$ with given discriminant $D$ form a group $\text{Cl}(D)$, the strict ideal class group of the
 order $\cal O_D=\Bbb Z+\Bbb Z\frac{D+\sqrt{D}}2$, and that $\cal A\inv$ and $\Theta\cal A$ correspond to the
 inverse of $\cal A$ and to the product of $\cal A$ with $\Theta$ in this group, $\Theta$ being 
the class of principal ideals having a generator of negative norm. The element $\Theta\bel\text{Cl}(D)$ has order 1 or 2 depending whether
 Pell's equation $t^2-Du^2=-4$ has an integral solution or not. The smallest $D$ for which there exists an $\cal A$ with $\cal A$,
 $\cal A\inv$, $\Theta\cal A$ and $\Theta\cal A\inv$ all distinct is 316.

We call the form $Q=[A,B,C]$ \it simple \rm if $A>0>C$. Clearly there are
only finitely many simple forms of a given discriminant, since the equation $D=B^2+4|AC|$ bounds $A$, $B$, and $C$. We call $Q$ \it reduced \rm
if $A>0,\,C>0,\,B>A+C$. The map $[A,B,C]\mapsto[A,B-2A,C-B+A]$ is a bijection between reduced forms and simple forms  $[A',B',C']$
with $A'+B'+C'>0$; in particular, there are exactly half as many reduced forms as simple forms of a given discriminant. To each form $Q=[A,B,C]$
we associate the real quadratic irrationality $\alpha=\alpha_Q=\frac{B+\sqrt D}{2A}$, one of the roots of $Q(x,-1)=0$.
The correspondence $Q\leftrightarrow\alpha_Q$ is bijective (of course $Q(X,-1)=0$ has a second root $\alpha^\sigma_Q=\frac{B-\sqrt D}{2A}$,
 the conjugate of $\alpha$, but this corresponds under the bijection to $-Q$, not $Q$), so that we can think of classes 
$\cal A$ as $\Gamma$-equivalence classes of quadratic irrationalities and speak of simple and reduced quadratic irrationalities
(denoted $x$ and $w$, respectively) in the obvious way. We have
$$w\text{ reduced }\Longleftrightarrow  w>1>w^\sigma>0, \qquad x\text{ simple }\Longleftrightarrow x>0>x^\sigma,$$
and the above bijection between reduced forms and half of all simple forms is given by $x=w-1$. (The condition $A+B+C>0$ for a simple
form corresponds to $x^\sigma>-1$; the involution $[A,B,C]\mapsto[-C,-B,-A]$ or $x\mapsto1/x$ interchanges this half of the set of simple forms or
simple irrationalities with the other half.) 

The reduced  forms in a given class $\cal A$ can be put into a cycle $\{Q_\nu\mid\nu\bel\Bbb Z/r\Bbb Z\}$ ($r$=number of reduced forms)
 with $Q_{\nu}=Q_{\nu+1}|\bigl(\smallmatrix  0&-1\\1&n_\nu\endsmallmatrix\bigr)$ for some integers $n_\nu\ge2$. Then $w_\nu=1/(n_\nu-w_{\nu+1})$, so that each 
of the finitely many $w_\nu$ has a pure periodic continued fraction expansion $n_\nu-1/(n_{\nu+1}-1/(n_{\nu+2}-\ldots))
=((\overline{\vphantom{t} n_\nu,n_{\nu+1},\ldots,n_{\nu+r-1}}))=$ of length $r$; conversely, any pure periodic continued fraction of this form 
except $((\overline2))=1$ is a reduced quadratic irrationality. The simple irrationalities in the class $\cal A$ are the
numbers $w_\nu-l,\,\nu\in\Bbb Z/r\Bbb Z,\,1\le l\le n_\nu-1$. They also form a cycle; more precisely, one has:
\proclaim{Lemma} Define a map $\Phi:\Bbb R_+\rightarrow\Bbb R_+$ by 
$$\Phi(x)=\cases x-1&\text{if $\;\;x\ge1$},\\ \dsize\frac x{1-x}&\text{if $\;0\le x<1$}.\endcases$$
Then the finite orbits of $\Phi$ are the set $\{0\}$ and the sets $Z_{\cal A}=\{\alpha_Q,\;Q\bel\cal A\text{ simple}\}$, where $\cal A$ runs over
all $\Gamma$-equivalence classes of primitive indefinite binary quadratic forms with integral coefficients and non-square discriminant.\endproclaim
\demo{Proof} Clearly any cycle  except $\{0\}$ has the form $\{x_1,x_1\!-\!1,\ldots,x_1\!-\!m_1,x_2,\al
x_2\!-\!1,\ldots,\al x_2\!-\!m_2,\ldots,x_r,x_r\!-\!1,
\ldots,x_r\!-\!m_r\}$ for some real numbers $x_1,\ldots,x_r>0$, where $m_\nu=[x_\nu]\ge0$ (greatest integer $\le x_\nu$) 
and $x_{\nu+1}=(x_\nu\!-\!m_\nu)/(1\!-\!x_\nu\!+\!m_\nu)$ (here $\nu$ is to be taken modulo $r$). 
 Set $w_\nu=x_\nu\!+\!1$ and $n_\nu=m_\nu\!+\!2\ge2$; then  $n_\nu=[w_\nu]\!+\!1$ and $w_{\nu}=n_\nu-\frac1{w_{\nu+1}}$, so the
 $w_\nu$ are a cycle of pure periodic continued fractions and are precisely the cycle of irreduced irrationalities in some
 \mg-equivalence class $\cal A$ as described above. $\square$ \enddemo

{\bf 1.2.} Fix an integer $k>1$ and denote by $\bold S=\bold S_{2k}$  the space of cusp forms of weight 
$2k$ on $\Gamma$ and by  $\bold V=\bold V_{2k-2}$ the space of polynomials
 of degree $\le w:=2k-2$. To each $f\bel\bold S$ is associated the {\it period polynomial } $r(f)\bel\bold V$ defined by
 $$ r(f)(X) = \int_0^\infty f(z)(z-X)^w\,dz = \sum_{n=0}^w(-1)^n\binom wnr_n(f)X^{w-n},\quad r_n(f) =\int_0^\infty f(z)z^n\,dz.$$
Denote by $\,|\,=\sn $ the action of $\Gamma$ on \bf V \rm defined by $\bigl(h|\bigl(\smallmatrix a&b\\c&d\endsmallmatrix\bigr)\bigr)(X)
=(cX+d)^wh\bigl(\tsize\frac{aX+b}{cX+d}\bigr)$.
An easy calculation shows that $(r(f)|\gamma)(X)$ for $f\bel\bold S$ and $\gamma\bel\Gamma$ is just the integral of $f(z)(z-X)^w$ from
$\gamma\inv(0)$ to $\gamma\inv(\infty)$. It follows immediately that $r(f)$ belongs to the subspace 
$\bold W=\bold W_{2k-2}=\ker(|(1+T))\cap\ker(|(1+U+U^2))$
 of \bf V\rm, where $T$ and $U$ denote the two generators $\bigl(\smallmatrix 0&-1\\1&0\endsmallmatrix\bigr)$ and $\bigl(\smallmatrix 1&-1\\1&0\endsmallmatrix\bigr)$
 of $\Gamma$ of order 2 and 3, and the definition of ``$|$" has been extended from $\Gamma$ to the group ring $\Bbb Z[\Gamma]$ by linearity.
The space \bf V \rm splits into the direct sum of the subspaces $\bold V^+$, $\bold V^-$ of even and odd polynomials, and \bf W \rm is the
direct sum of the subspaces $\bold W^\pm=\bold W\cap\bold V^\pm$, since the matrix $\epsilon=\bigl(\smallmatrix -1&0\\0&1\endsmallmatrix\bigr)\in GL(2,\Bbb Z)$
commutes with $T$ and conjugates $U$ into $TU^2T$. Write $r(f)$ for $f\bel\bold S$ as $r^+(f)+r^-(f)$ with $r^\pm\bel\bold W^\pm$.
If $f\bel\bold S$ is a normalized Hecke eigenform, then there are non-zero numbers $\omega^+(f)\in i\Bbb R$ and $\omega^-(f)\in\Bbb R$ with
product  $\,i(f,f)\,$ ( ( , ) = Petersson scalar product in \bf S\rm) such that
the polynomials $\omega^\pm(f)\inv r^\pm(f)$ both have coefficients in the algebraic number field generated by the Fourier coefficients of $f$.
The map $r^-$ is an isomorphism from $\bold S^-$ to $\bold W^-$, while $r^+$ is an isomorphism from $\bold S^-$ onto a codimension 1
 subspace of $\bold W^+$ not containing the element $p_{k,0}(X)=X^w-1$ of $\bold W^+$. In other words, there is an exact sequence 
$$0\longrightarrow\bold S_{2k}\oplus\bold S_{2k}\mathrel{\mathop{\longrightarrow}\limits^{(\!r^+\!,r^-\!)}}
\bold W_{2k-2}\mathrel{\mathop{\longrightarrow}\limits^\lambda}\C\longrightarrow0\,,$$
 where $\lambda(p_{k,0})\ne0$. The map $\lambda$ is given explicitly by the formula 
$$\lambda\biggl(\sum_{n=0}^w\binom wnr_nX^{w-n}\biggr)\,=\,\sum_{r=1}^k\beta_r\beta_{k-r}\sum_{n=0\atop n\text{ even}}^w\binom{2r-1}n r_n,$$
 where $\beta_m=\dsize\frac{B_{2m}}{(2m)!}$ ($B_{2m}=(2m)^{\text{th}}$ Bernoulli number) for $m>0$, $\beta_0=2$ 
 ([8]; the formula is both normalized and stated slightly differently there).

The space $\bold W_{2k-2}/\langle p_{k,0}\rangle$ can be identified with $H^1_{\text{par}}(\Gamma,\bold V_{2k-2})$, the subspace of the
first cohomology group of $\Gamma$ with coefficients in the representation \bf V \rm given by cocycles which vanish on the parabolic
element $S=\bigl(\smallmatrix 1&1\\0&1\endsmallmatrix\bigr)=UT$. The isomorphism is given by mapping $q\in \bold W$ to the
class of the cocycle $\phi$ with $\phi(T)=q$ and $\phi(S)=0$ (these properties determine $\phi$ because 
$\Gamma$ is generated by $S$ and $T$, and $\phi$ is a cocycle exactly for $q\in\bold W$). It follows that we can also 
canonically identify the space $\bold W^0_{2k-2}=\text{Ker}\,(\lambda)=r^+(\bold S_{2k})\oplus r^-(\bold S_{2k})\subset\bold W_{2k-2}$ 
with $H^1_{\text{par}}(\Gamma,\bold V_{2k-2})$.


The relation of the period theory with the theory of reduced quadratic forms as reviewed in \S1.1 is as follows. For each $\Gamma$-equivalence
class $\cal A$ of binary quadratic forms, define elements $P_{k,\cal A}$, $ Q_{k,\cal A}$, and $ R_{\cal A}$ of \bf V \rm by
$$ P_{k,\cal A}(X) = \sum_{Q\in\cal A\atop Q\text{ simple}} Q(X,-1)^{k-1},\qquad 
 Q_{k,\cal A}(X) = \sum_{Q\in\cal A\atop Q\text{ reduced}} Q(X,-1)^{k-1}$$ and 
$R_{k,\cal A}=P_{k,\cal A}+(-1)^kP_{k,\Theta\cal A\inv}$  (recall that $\Theta\cal A\inv$ denotes the class consisting of
all forms $-Q$ with $\quad Q\bel\cal A$). Then the relationship between simple and reduced forms as described in \S1.1 implies the equalities
$$ R_{k,\cal A}= P_{k,\cal A}|(1-T) = (Q_{k,\cal A}+(-1)^k Q_{k,\Theta\cal A\inv})|(-U+U^2).$$
From these and the equations $T^2=1$, $U^3=1$ it follows that $ R_{k,\cal A}$ belongs to the subspace \bf W \rm of \bf V\rm. Therefore
by the decomposition $\bold W_{2k-2}=\bold W^0_{2k-2}\bigoplus\C p_{k,0}$ 
 we must have $$ R_{k,\cal A} = r^+(f_{k,\cal A}^+)+r^-(f_{k,\cal A}^-)+\rho_k(\cal A)\,p_{k,0}$$ for some cusp forms
$f_{k,\cal A}^\pm\bel\bold S$ and number $\rho_k(A)$; in fact,
$$ f_{k,\cal A}^\pm(z)=\frac{D^{k-1/2}}{2\pi i\binom{2k-2}{k-1}}
\biggl(\sum_{Q\bel\cal A}\frac1{Q(z,1)^k}\pm\sum_{Q\bel\cal A}\frac1{Q(z,-1)^k}\biggr),\qquad \rho_k(A)=\frac{\zeta_{\cal A}(1-k)}{\zeta(1-2k)},$$
where $\zeta(s)$ is the Riemann zeta function and $\zeta_{\cal A}(s)$ the partial zeta function of the ideal class $\cal A$.
For all of this, see sections 2.1-2.3 of [8], esp. Theorem 5 (where, however, the normalizations are slightly different and
the factor $\,(-1)^k$ before $ Q_{\Theta\cal A\inv}$ was omitted). We denote by $R_{k,\cal A}^0=R_{k,\cal A}-\rho_k(\cal A)\,p_{k,0}$ the
component of $R_{k,\cal A}$ in $\bold W^0_{2k-2}$.

\heading 2. Classification of rational period functions for \mg\ \endheading
We now turn from negative weight $2-2k$ to positive weight $2k$, so that we consider the action 
$\bigl(h\sp\bigl(\smallmatrix a&b\\c&d\endsmallmatrix\bigr)\bigr)(X)=(cX+d)^{-2k}h\bigl(\tsize\frac{aX+b}{cX+d}\bigr)$ 
on rational functions (here we must consider rational functions rather than polynomials because the action $\sp$, unlike $\sn $, never 
maps polynomials to polynomials). We define the space of rational period polynomials of weight $2k$ in analogy to $\bold W_{2k-2}$ by
$$\rpf=\rpf_{2k}=\bigl\{\text{rational functions }q(z)\bigm| q\sp(1+T)=q\sp(1+U+U^2)=0\bigr\}.$$
(This is the same as the formula in the introduction.) Our object is to obtain a complete description of this space.

{\bf 2.1.} Suppose $q\in\rpf$, and denote by $\cal S\subset\C$ the pole set of $q$. The definition of $\rpf$ clearly implies
$$\align\alpha\in\cal S,\quad\alpha\ne0\;&\Longrightarrow\;T\alpha\;\bigl(\,=\frac{-1}\alpha\,\bigr)\;\in\cal S\,,\\
\alpha\in\cal S,\quad\alpha\ne0,\,1\;&\Longrightarrow\; 
U\alpha\;\bigl(\,=1-\frac1\alpha\,\bigr)\;\text{ or }\;U^2\alpha\;\bigl(\,=\frac1{1-\alpha}\,\bigr)\;\in\cal S\,.\endalign$$
In this subsection we will deduce from this the possible structure of the set $\cal S$.

\proclaim{Lemma 1}  $\cal S\subset\R$.\endproclaim 
\demo{Proof} Suppose $\alpha\in\cal S$, $\alpha\notin\R$.  By what we have just said, at least one of $UT\alpha=\alpha+1$
and $U^2T\alpha=\alpha/(\alpha+1)$ belongs to $\cal S$, so we get a sequence $\alpha_0=\alpha,\,\alpha_1,\,\ldots$
of elements $\alpha_n\in\cal S$ with $\alpha_{n+1}$ equal to $\alpha_n+1$ or $\alpha_n/(\alpha_n+1)$. But it is obvious
that the argument (taken in the interval $(-\pi,\pi)$) of a non-real complex number $\alpha$ decreases strictly
in absolute value when $\alpha$ is replaced by either  $\alpha+1$ or $\alpha/(\alpha+1)$.  It follows that 
$|\arg(\alpha_0)|>|\arg(\alpha_1)|>|\arg(\alpha_2)|>\ldots>0$. This is impossible since $\cal S$ is a finite set. $\square$ \enddemo

\proclaim{Lemma 2} The set $\cal S\setminus\{0\}$ is the (disjoint) union of sets $\cal Z_{\cal A}\cup T\cal Z_{\cal A}$, where
$\cal Z_{\cal A}$ is the cycle associated to a $\Gamma$-equivalence class of binary quadratic forms $\cal A$ as in \S1.1.\endproclaim
\demo{Proof} The proof is similar to that of Lemma 1. We may assume (by replacing $\alpha$ by $T\alpha$ if necessary) that
$\alpha>0$; then $T\alpha\ne0,\,1$ and therefore $\cal S$ contains either $UT\alpha=\alpha+1$ or $U^2T\alpha=\alpha/(\alpha+1)$,
which is again positive. This again gives a sequence $\alpha_0=\alpha,\,\alpha_1,\,\ldots$
of elements $\alpha_n\in\cal S$ where  for each $n$ either $\alpha_{n+1}=\alpha_n+1$ or $\alpha_{n+1}=\alpha_n/(\alpha_n+1)$.
In the first case $\alpha_{n+1}>1$ and in the second case, $0<\alpha_{n+1}<1$, so 
in both cases one finds $\Phi(\alpha_{n+1})=\alpha_n$, where $\Phi:\R\to\R$ is the map defined in \S1.1. But $\alpha_m=\alpha_n$
for some $m>n\ge0$ by the finiteness of $\cal S$, so we get a finite orbit $\{\alpha_m,\,\alpha_{m-1},\ldots,\alpha_{n+1}\}$ 
of $\Phi$. By the Lemma of \S1.1, it follows that $\alpha_n$, and hence $\alpha=\alpha_0=\Phi^n(\alpha_n)$, belongs to
a cycle $\cal Z_{\cal A}$ of simple real quadratic irrationalities, and that all of $\cal Z_{\cal A}$ is contained in $\cal S$. $\square$ \enddemo

\proclaim{Lemma 3} If $\alpha\ne0\in\cal S$, then {\rm exactly} one of $U\alpha$ and $U^2\alpha$ belongs to $\cal S$.\endproclaim
\demo{Proof} By what we have just proved, any non-zero element of $\cal S$ is a quadratic irrationality of negative norm. But
it is easily checked that if $1>\alpha>0>\alpha^\sigma$ or $1>\alpha^\sigma>0>\alpha$, then $U^2\alpha$ and $U^2\alpha^\sigma$ are both positive,
while if $\alpha>1>0>\alpha^\sigma$ or $\alpha^\sigma>1>0>\alpha$, then $U\alpha$ and $U\alpha^\sigma$ are both positive. Thus in all cases one
of $U\alpha$ and $U^2\alpha$ has positive norm and cannot belong to $\cal S$. $\square$ \enddemo

{\bf 2.2} The results of \S2.1 describe the pole set $\cal S$ of an RPF $q$. We now consider the principal part of $q$ at its pole. We use the
notation $\pp f]$ to denote the principal part of a rational function $f(z)$ near a point $z=\alpha\in\C$,  i.e., the
unique polynomial in $(z-\alpha)^{-1}$ without constant term such that $f-\pp f]$ is regular at $\alpha$. We first show: 
\proclaim{Lemma 4} Suppose that $\alpha\ne0$ is a pole of $q\in\rpf$. Then the order of the pole of $q$ at $\alpha$ is exactly $k$.\endproclaim
\demo{Proof}  The equation $q\sp(1+T)=0$ implies that $\text{PP}_{T\alpha}[q]=-\pp q]\sp T$, 
and the equation $q\sp (1+U+U^2)=0$ together with Lemma 3 implies that $\text{PP}_{V\alpha}[q]=-\pp q]\sp V\inv$,
where $V$ is that one of $U$ and $U^2$ for which $V\alpha\in\cal S$. We also know that $\alpha$ belongs to a cycle 
$\{\alpha_0=\alpha=\alpha_r,\,\alpha_1,\ldots,\alpha_{r-1}\}$ with $\alpha_{n+1}=UT\alpha_n$ or $U^2T\alpha_n$ for each $n$, i.e. 
with $\alpha_n=\gamma_n\alpha$ for some $\gamma_n\in\Gamma$, $\gamma_0=1$, $\gamma_{n+1}=U^{\pm1}T\gamma_n$ ($n\ge0$). By induction
on $n$ we obtain $\text{PP}_{\alpha_n}[q]=\pp q]\sp \gamma_n\inv$ and in particular $\pp q]=\pp q]\sp \gamma_r\inv$.  
Write $\gamma_r=\bigl(\smallmatrix  a&b\\c&d\endsmallmatrix\bigr)$ and suppose that $\pp q](z)=(z-\alpha)^{-m}+\cdots$ where ``$\cdots$"
denotes an expression with a pole of order $<m$ at $\alpha$. Then
$$\align \bigl(\pp q]\sp \gamma\inv\bigr)(z)\;&=\;(cz-a)^{-2k}\,\pp q]\bigl(\frac{\phantom{-}dz-b}{-cz+a}\bigr)\\
&=\;(cz-a)^{-2k}\,\bigl(\dsize\frac{\phantom{-}dz-b}{-cz+a}-\alpha\bigr)^{-m}\;+\;\cdots\\
&=\;\frac{(-cz+a)^{-2k+m}}{(c\alpha+d)^m}\,(z-\alpha)^{-m}\;+\;\cdots\\
&=\;(c\alpha+d)^{2k-2m}(z-\alpha)^{-m}\;+\;\cdots\endalign$$ since $c\alpha+d=(-c\alpha+a)\inv$. But
$c\alpha+d$ is clearly irrational (it is in fact a fundamental unit of the quadratic order associated to $\alpha$), so
we must have $k=m$. $\square$ \enddemo
Lemma 4 implies that for each $\alpha\ne 0$ which can occur as a pole of a rational period function $q$ of weight $2k$ there
is a (unique) function of the form $$q^{\phantom0}_{k,\alpha}(z)=\frac1{(z-\alpha)^k}+\frac{a_1(\alpha)}{(z-\alpha)^{k-1}}+\cdots+\frac{a_k}{z-\alpha}$$
such that the $\pp q]$ is a multiple of $q^{\phantom0}_{k,\alpha}$ for any $q\in\text{\bf RPF\rm}_{2k}$. 
\proclaim{Lemma 5} Let $\alpha$ be a simple quadratic irrationality, $\alpha^\sigma$ its conjugate. Then
$$q^{\phantom0}_{k,\alpha}(z)=\text{PP}_\alpha\biggl[\frac{(\alpha-\alpha^\sigma)^k}{(z-\alpha)^k(z-\alpha^\sigma)^k}\biggr]
=\text{PP}_\alpha\biggl[\frac{D^{k/2}}{Q(z,-1)^k}\biggr]\,,$$  
where $Q$ is the quadratic form associated to $\alpha$ and $D$ the discriminant of $Q$.\endproclaim
\demo{Proof} It is easily checked that $Q(z,-1)^{-k}\sp \gamma=Q(z,-1)^{-k}$ for any $\gamma\in\Gamma$ with
$\gamma\alpha=\alpha$.  But the proof of Lemma 4 shows that this property characterizes $q^{\phantom0}_{k,\alpha}(z)$ up to a constant (since any
function satisfying it has a pole of order {\it exactly} $k$ at $\alpha$). Since the leading term of $Q(z,-1)^{-k}$ is $D^{-k/2}$,
the proportionality constant is as given in the lemma. $\square$ \enddemo
It follows from Lemma 5 that any function in \bf RPF \rm has the form 
$$q(z)=\sum_{\alpha}C_{\alpha}q^{\phantom0}_{k,\alpha}(z)\;+\;q'_0(z)$$ 
for some constants $C_{\alpha}\in\C$ and some function $q^{\prime\phantom0}_0(z)\in\C[z,z\inv]$, where the sum ranges over
finitely many cycles of real quadratic irrationalities $\alpha$ with $\alpha\alpha'<0$. 
%  Moreover, it is easily seen that $q^{\phantom0}_{k,\gamma\alpha}=q^{\phantom0}_{k,\alpha}\sp \gamma\inv$ for any $\alpha$ and any $\gamma\in\Gamma$. 
The first sentence of the proof of Lemma 4 makes it clear that the coefficients $C_{\alpha}$ alternate as we go around
any cycle $\alpha$, $T\alpha$, $U^{\pm1}T\alpha$, $TU^{\pm1}T\alpha$, $\cdots\,$, i.e., that $C_{\alpha}$ equals $\;\text{sgn}(\alpha)\,C_{\cal A}$ where
$C_{\cal A}$ depends only on the class $\cal A$ corresponding to $\alpha$. Finally, we apply the operator $\sp (1-T)$ to the decomposition of $q$, observing that $q|(1-T)=2q$ and that the function $q^{\phantom0}_0=q^{\prime\phantom0}_0|(1-T)$ still belongs to $\C[z,z\inv]$. This gives a representation
$$q(z)=\sum_{\cal A}C_{\cal A}q^{\phantom0}_{k,\cal A}(z)\;+\;q^{\phantom0}_0(z),\qquad q^{\phantom0}_0(z)\in\C[z,z\inv]\sp (1-T)$$
where  $$q^{\phantom0}_{k,\cal A}(z)=\sum_{\alpha\in\cal Z_{\cal A}} \bigl(q^{\phantom0}_{k,\alpha}(z)-q^{\phantom0}_{k,T\alpha}(z)\bigr)\sp (1-T)$$
and the coefficients $C_{\cal A}$ are non-zero for only finitely many classes $\cal A$.  

{\bf 2.3.} It remains to determine which linear combinations of the functions $q^{\phantom0}_{k,\cal A}$ can be corrected by a function $q^{\phantom0}_0$ having a pole
only at $z=0$ in such a way as to become rational period functions.  Since $q^{\phantom0}_{k,\cal A}|(1+T)$ vanishes by construction, the condition
$q|(1+T)=0$ is automatic if $q^{\phantom0}_0$ is chosen to be anti-invariant under the involution $T$. We must therefore compute the image of $q^{\phantom0}_{k,\cal A}$ under $1+U+U^2$.
The poles of $q^{\phantom0}_{k,\cal A}$ at quadratic irrationalities in $\cal Z_{\cal A}\cup T\cal Z_{\cal A}$ cancel out when we slash with $1+U+U^2$ by construction,
but there are new poles at $z=0$ and $z=1$ coming from the automorphy factors $z^{-2k}$ and $(z-1)^{-2k}$ which arise from the operations $\sp U$ and
$\sp U^2$.  These poles have order at most $2k$.  By subtracting from $q$ a multiple of $1-z^{-2k}$, which can easily be checked to be an RPF, we can
assume that the pole at 0 has order $\le2k-1$.  The pole at 1 then also has order $\le2k-1$ because $q^{\phantom0}_{k,\cal A}|(1+U+U^2)$ is annihilated by $1-U$
(since $(1+U+U^2)(1-U)=1-U^3=0$ in the group ring of $\Gamma$).  Thus  $q^{\phantom0}_{k,\cal A}|(1+U+U^2)$ belongs to the space
$$\bold H=\bold H_{2k}=\bigl\{\phi\,\in\,z^{-2k+1}(z-1)^{1-2k}\,\C[z]\bigm| \phi\sp (1-U)=0\bigr\}.$$
Our first goal is to determine the structure of $\bold H$.
\proclaim{Lemma 6} There is an isomorphism $\mu:\bold H_{2k}\to\text{Ker}\,\bigl(1+U+U^2,\bold V_{2k-2}\bigr)$ given as follows: if
$$h(z)=\sum_{n=0}^w\frac{a_n}{z^{n+1}}+\sum_{n=0}^w\frac{b_n}{(z-1)^{n+1}}\qquad\qquad(w=2k-2)$$ is an element of $\bold H$, 
and $A(X)=\sum_{n=0}^w\binom wna_nX^n$, $B(X)=\sum_{n=0}^w\binom wnb_nX^n\;\in\;\bold V_{2k-2}$, 
then $\mu(h)\,=\,A\sn TU\,=\,B\sn U^2$.\endproclaim
\demo{Proof} If $h(z)\in\bold H$, the property $h(z)=z^{-2k}h(1-\frac1z)$ shows that $h$ tends to 0 as $z$ tends
 to infinity, so $h$ has the form given in the lemma. Then by partial fractions
$$\align(h|U)(z)&=\tsize\sum a_nz^{-\tilde n-1}(z-1)^{-n-1}-\tsize\sum (-1)^nb_nz^{-\tilde n-1}\\
&=\tsize\sum z^{-n-1}\biggl((-1)^{n+1}b_{\tilde n}-\tsize\sum\limits_{\tilde m\ge n}(-1)^m\binom{\tilde n}{\tilde m-n}a_m\biggr)\\
&\qquad+\tsize\sum (z-1)^{-n-1}\,\biggl(\tsize\sum\limits_{m\ge n}(-1)^{m-n}\,\binom{\tilde n}{m-n}\,a_m\biggr),\endalign$$
where $n$ in the summations goes from 0 to $w$ and $\tilde n$, $\tilde m$ denote $w-n$, $w-m$. The condition $h=h|U$ is thus equivalent to the properties
$$ a_n=(-1)^{n+1}b_{\tilde n}-\tsize\sum\limits_{\tilde m\ge n}(-1)^m\binom{\tilde n}{\tilde m-n}a_m,\qquad
b_n=\tsize\sum\limits_{m\ge n}(-1)^{m-n}\binom{\tilde n}{m-n}a_m$$ or
$$\tsize\binom wna_n=(-1)^{n+1}\binom wnb_{\tilde n}-\sum\limits_m(-1)^m\binom wma_m\binom{\tilde m}n,\qquad
\binom wnb_n=\sum\limits_m(-1)^{n-m}\binom wma_m\binom mn.$$
Multiplying by $X^n$ and summing from 0 to $w$, we find
$$h=h|U\;\;\Longleftrightarrow\;\; A(X)=-X^wB\bigl(-\frac1X\bigr)-(X+1)^wA\bigl(\frac{-1}{X+1}\bigr),\;\; B(X)=A(X-1)$$
or $A=B|UT$, $B|(1+U+U^2)=0$. Thus $\bold H$ is isomorphic to $\,\text{Ker}\,(1+U+U^2,\bold V)$ via $h\mapsto B$ or
alternatively via $h\mapsto B|U^2=\mu(h)$. $\square$ \enddemo
The following result is the key to the solution of our problem. 
\proclaim{Lemma 7} Let $\cal A$ be a $\Gamma$-equivalence class of forms as usual. Then 
$$\mu\bigl(q^{\phantom0}_{k,\cal A}\sp (1+U+U^2)\bigr)=(-1)^{k-1}\,\binom{2k-2}{k-1}\,D^{{\frac{1-k}2}\atop{\phantom{X}}}\,R_{k,\cal A},$$
where $R_{k,\cal A}$ is the element of $\bold W_{2k-2}$ defined in \S1.2.\endproclaim
\demo{Proof} Write $\psi$ for the map $\bigoplus_{0\le n\le w}\C z^{-n-1}\to\bold V$ defined by $z^{-n-1}\mapsto\binom wnX^n$, 
so that the $\mu$ of Lemma 6 is given by $\mu(h)=\psi(\text{PP}_0[h])|TU$. (We use $|$ to denote $\sp $ when applied
to rational functions of $z$ and $\sn $ when applied to polynomials in $X$.)  We begin  by calculating
 $\psi(\text{PP}_0[q^{\phantom0}_{k,\alpha}|T])$. By Lemma 5 and the binomial theorem,
$$q^{\phantom0}_{k,\alpha}(z)= \text{PP}_\alpha\bigl[\bigl(z-\alpha\bigr)^{-k}\bigl(1-\frac{z-\alpha}{\alpha'-\alpha}\bigr)^{-k}\bigr]
=\sum_{n=0}^{k-1}\bigl(\frac1{\alpha'-\alpha}\bigr)^{k-1-n}\binom{\tilde n}{k-1}(z-\alpha)^{-n-1},$$
where $\tilde n=w-n$ as before. On the other hand,
$$\text{PP}_0\bigl[\,(z-\alpha)^{-n-1}|T\,\bigr]=\text{PP}_0\bigl[\frac{(-1)^{n+1}}{z^{\tilde n+1}(1+\alpha z)^{n+1}}\bigr]
=\sum_{m=0}^{\tilde n}(-1)^{m+1}\alpha^{\tilde n-m}\binom{\tilde m}nz^{-m-1}$$
(binomial theorem again), so
$$\psi\bigl(\text{PP}_0\bigl[\,(z-\alpha)^{-n-1}|T\,\bigr]\bigr)
=\sum_{m=0}^{\tilde n}(-1)^{m+1}\alpha^{\tilde n-m}\binom{\tilde m}n\binom wmX^m=-\binom wn\bigl(\alpha-X\bigr)^{\tilde n}.$$
Therefore $$\align\psi\bigl(\text{PP}_0\bigl[\,q^{\phantom0}_{k,\alpha}\,|T\bigr]\bigr)
&=-\sum_{n=0}^{k-1}\bigl(\frac{-1}{\alpha-\alpha'}\bigr)^{k-1-n}\binom{\tilde n}{k-1}\binom wn\bigl(\alpha-X\bigr)^{\tilde n}\\
&=-\binom w{k-1}\,\frac{(\alpha-X)^{k-1}}{(\alpha-\alpha')^{k-1}}\,\sum_{n=0}^{k-1}\binom{k-1}n
(X-\alpha)^{k-1-n}(\alpha-\alpha')^n\\
&=(-1)^k\binom w{k-1}\,\biggl(\frac{(\alpha-X)(\alpha'-X)}{\alpha-\alpha'}\biggr)^{k-1}\\
&=(-1)^k\binom w{k-1}\,D^{(1-k)/2}\,Q_\alpha(X,-1)^{k-1},\endalign$$ 
where $Q_\alpha(X,-1)$ is the quadratic form associated to $\alpha$.

On the other hand, we have $$\text{PP}_0\bigl[\,q^{\phantom0}_{k,\alpha}|(1-T)(1+U+U^2)\,\bigr]
=\text{PP}_0\bigl[\,q^{\phantom0}_{k,\alpha}|(-T+U)\,\bigr]=\text{PP}_0\bigl[\,\bigl(-q^{\phantom0}_{k,\alpha}+q^{\phantom0}_{k,\alpha-1}\bigr)|T\,\bigr]$$
because the function $q^{\phantom0}_{k,\alpha}|\gamma$ has a pole at 0 only for those $\gamma$ with $\gamma(0)=\infty$ and 
$q^{\phantom0}_{k,\alpha}|S=q^{\phantom0}_{k,\alpha-1}$. Consequently
$$\text{PP}_0\bigl[\,q^{\phantom0}_{k,\cal A}|(1+U+U^2)\,\bigr]=\sum_{\alpha\in\cal Z_{\cal A}}
\text{PP}_0\bigl[\,\bigl(-q^{\phantom0}_{k,\alpha}+q^{\phantom0}_{k,\alpha-1}+q^{\phantom0}_{k,T\alpha}-q^{\phantom0}_{k,T\alpha-1}\bigr)|T\,\bigr]$$
and hence by the computation above
$$\mu\bigl(q^{\phantom0}_{k,\cal A}|(1+U+U^2)\,\bigr)=(-1)^k\binom w{k-1}\,\,D^{(1-k)/2}\,P_{k,\cal A}|(-1+S+T-TS)|TU$$
with $P_{k,\cal A}=\sum_{\alpha\in\cal Z_{\cal A}}Q_\alpha(z,-1)^{k-1}$ as in \S1.2. For the last equality we 
used the  easily checked fact that $Q_{\gamma\alpha}(X,-1)^{k-1}=Q_\alpha(X,-1)^{k-1}|\gamma\inv$ for any $\gamma\in\Gamma$.
The lemma now follows since
$$P_{k,\cal A}|(-1+S+T-TS)|TU=R_{k,\cal A}|(U^2-TU)=R_{k,\cal A}|(U^2+U)=-R_{k,\cal A}$$
because $R_{k,\cal A}\in\bold W_{2k-2}$. $\square$ \enddemo
\proclaim{Lemma 8} For $0\le n\le w$ we have $$\mu\bigl(z^{-n-1}\sp (1-T)(1+U+U^2)\bigr)=\binom wnX^n\sn (1+T)(U-U^2).$$\endproclaim
\demo{Proof}  Let $h(z)=z^{-n-1}\sp (1-T)(1+U+U^2)$. By partial fractions, we find 
$$\align h(z)&=z^{-n-1}+(-1)^nz^{-\tilde n-1}+z^{-\tilde n-1}(z-1)^{-n-1}+(-1)^nz^{-n-1}(z-1)^{-\tilde n-1}+\cdots\\ 
&=z^{-n-1}+(-1)^nz^{-\tilde n-1}-(-1)^n\tsize\sum\limits_{m=0}^{\tilde n}\binom{\tilde m}nz^{-m-1}-\tsize\sum\limits_{m=0}^n\binom{\tilde m}{\tilde n}z^{-m-1}
+\cdots,\endalign$$ where $\cdots$ denotes terms regular at $z=0$. A short calculation now shows that
 the ``$A(X)$" of Lemma 6 is $\binom wnX^n|(1+T-UT-TUT)$, so $\mu(h)=\binom wnX^n\sn (1+T)(U-U^2)$. $\square$ \enddemo
The proof of the following result, though simple, cost us a considerable effort to find.
\proclaim{Lemma 9} The intersection of $\bold V\sn (1+T)(U-U^2)$ with $\bold W$ is one-dimensional, spanned by $X^w-1$.\endproclaim
\demo{Proof}  Suppose $A\in\bold V$ with $B=A|(1+T)(U-U^2)\in\bold W$ (where $|$ denotes $\sn $). Since $B$ is automatically in $\,\text{Ker}\,(1+U+U^2)$,
this is equivalent to $B|(1+T)=0$. But $B|(1+T)=A|(1+T)(1-U+U^2)(S-1)$ since $(1+T)(U-U^2)(1+T)=(1+T)(1-U+U^2)(S-1)$ in $\Z[\Gamma]$ ($S=UT$). Since
the kernel of $S-1$ in $\bold V$ is the one-dimensional space spanned by the constant function 1 (a periodic polynomial is constant!), and since
$(1-U+U^2):\bold V\to\bold V$ is an isomorphism with inverse $\frac12(1+U)$, this says that $A|(1+T)$ belongs to the one-dimensional space spanned by
$1|(1+U)=1+X^w$, and consequently that $B$ belongs to the one-dimensional space spanned by $1|(1+U)(U-U^2)=X^w-1$. $\square$ \enddemo
{\bf 2.4.} We can now give a complete description of RPF's of arbitrary positive weight:
\proclaim{Theorem 1} For each $\Gamma$-equivalence class $\cal A$ of indefinite binary quadratic forms of non-square discriminant $D$ 
and each integer $k>0$ define
$$r_{k,\cal A}^0(z)=\frac{(-\sqrt D)^{k-1}}{\binom{2k-2}{k-1}}\,
\sum_{\alpha\in\cal Z_{\cal A}} \bigl(q^{\phantom0}_{k,\alpha}(z)-q^{\phantom0}_{k,T\alpha}(z)\bigr)\sp (1-T)\;-\;\rho_k(\cal A)\bigl(z\inv+z^{-2k+1}\bigr),$$
where the summation runs over the cycle of simple quadratic irrationalities $\alpha$ corresponding to $\cal A$,  $q^{\phantom0}_{k,\alpha}(z)$
denotes the principal part at $\alpha$ of $D^{k/2}Q_\alpha(z)^{-k}$, $Q_\alpha(z)$ being the quadratic polynomial of discriminant $D$ with root $\alpha$,
and $\rho_k(\cal A)=\zeta_{\cal A}(1-k)/\zeta(1-2k)$ as in \S1.2.  Also define $r_{k,0}^{\phantom0}(z)=1-z^{-2k}$. Then
\newline\indent i) Any rational period function of weight $2k$ has the form $$q(z)=\sum_{\cal A}\,c_{\cal A}^{\phantom0}\,r^0_{k,\cal A}(z)\;+\;c_0^{\phantom0}\;r_{k,0}^{\phantom0}(z)$$
for some complex constants $c_{\cal A}^{\phantom0}$ (almost all zero) and $c_0^{\phantom0}$.
\newline\indent ii) Conversely, a sum as in i) is an RPF if and only if $\sum c_{\cal A}^{\phantom0}\,R^0_{k,\cal A}=0$, where 
$$R_{k,\cal A}^0(X)=\sum\Sb [A,B,C]\in\cal A\\AC<0\endSb\,\text{sign}(A)\,\bigl(AX^2-BX+C)^{k-1}
-\;\rho_k(\cal A)\bigl(X^{2k-2}-1\bigr)\in\bold W^0_{2k-2}$$
\vskip-.2cm is the rational period polynomial defined at the end of \S1.\endproclaim
\demo{Proof} We already know that any RPF $q$ has the form $\sum C_{\cal A}q^{\phantom0}_{k,\cal A}+q^{\phantom0}_0$ where $q^{\phantom0}_0$ is a polynomial of
degree $\le 2k$ in $z\inv$ satisfying $q|T=-q$. Equivalently, we can write $q$ as 
$\sum c_{\cal A}^{\phantom0}r^0_{k,\cal A}+c_0^{\phantom0}r_{k,0}\,-r_0^{\phantom0}|(1-T)$
where $r_0^{\phantom0}\in\bigoplus_{0\le n\le w}\C z^{-n-1}$. This expression is automatically annihilated by $1+T$, while its image under
$1+U+U^2$ belongs to $\bold H_{2k}$, so Lemma 6 implies that $q$ is an RPF if and only if 
$\sum c_{\cal A}^{\phantom0}\mu\bigl(r^0_{k,\cal A}\sp(1+U+U^2)\bigr)$ equals $\mu\bigl(r_0^{\phantom0}\sp(1-T)(1+U+U^2)\bigr)$. But
$\mu\bigl(r^0_{k,\cal A}\sp(1+U+U^2)\bigr)$ equals $R^0_{k,\cal A}\in\bold W_{2k-2}^0$ by Lemma 7 and the special case $n=0$ of
Lemma 8, while $\mu\bigl(r_0^{\phantom0}\sp(1-T)(1+U+U^2)\bigr)\in\bold V\sn(1+T)(U-U^2)$ by Lemma 8. Lemma 9 now implies that $q$
is an RPF iff $\sum c_{\cal A}^{\phantom0}R^0_{k,\cal A}=0$ and $\mu\bigl(r_0^{\phantom0}\sp(1-T)(1+U+U^2)\bigr)=0$. 
But the latter equation implies that already $r_0^{\phantom0}\sp(1-T)=0$. 
[Proof: by Lemma 8, this statement is equivalent to the assertion that if $R\sn(1+T)(U-U^2)=0$ for some
$R\in\bold V$, then already $R\sn(1+T)=0$, and this is true because $R\sn(1+T)$ is invariant under both $T$ and
$U$ and hence under the whole group \mg.] Hence $q$ has the form given in the theorem. $\square$ \enddemo
An equivalent formulation of Theorem 1 is that there is an exact sequence 
$$0\;\longrightarrow\;\rpf_{2k}\;\longrightarrow\;\bigoplus_{\cal A}\C\,\oplus\,\C\;\longrightarrow\;\bold W^0_{2k-2}\longrightarrow0\,,$$ 
where the maps are defined by sending $\sum c_{\cal A}^{\phantom0}\,r^0_{k,\cal A}+c_0^{\phantom0}r_{k,0}^{\phantom0}$ to $\bigl(\{c_{\cal A}^{\phantom0}\}_{\cal A},\,c_0^{\phantom0}\bigr)$ and 
$\bigl(\{c_{\cal A}^{\phantom0}\}_{\cal A},\,c_0^{\phantom0}\bigr)$ to $\sum c_{\cal A}^{\phantom0}\,R_{k,\cal A}^0$, the latter map being surjective because
the functions $R_{k,\cal A}^0$ span $W^0_{2k-2}$ [9]. We also have the following
\proclaim{Corollary} For every class of forms $\cal A$ and integer $k>0$ the function $q^{\phantom0}_{k,\cal A}-(-1)^kq^{\phantom0}_{k,\Theta\cal A\inv}$ belongs to $\rpf_{2k}$.\endproclaim\demo{Proof} This follows immediately from the theorem since $R_{k,\cal A}=(-1)^kR_{k,\Theta\cal A\inv}$ and $\rho_k(\cal A)=(-1)^k\rho_k(\Theta\cal A\inv)$.
However, a direct proof is easier. The function $D^{k/2}Q_\alpha(z)^{-k}$ has poles only at $\alpha$ and $\alpha'$ and is small
at infinity, so it is the sum of its principal parts $q^{\phantom0}_{k,\alpha}(z)$ and $(-1)^kq^{\phantom0}_{k,\alpha'}(z)$. On the other hand, 
$$q^{\phantom0}_{k,\cal A}(z)=\sum\Sb \alpha\leftrightarrow Q\in\cal A\\\alpha\alpha'<0\endSb\text{sign}(\alpha)\,q^{\phantom0}_{k,\alpha}(z)\sp(1-T),$$
and under the correspondence we are using, if $\alpha\leftrightarrow Q\in\cal A$, then $\alpha'\leftrightarrow-Q\in\Theta\cal A\inv$.
Hence $$q^{\phantom0}_{k,\cal A}(z)-(-1)^kq^{\phantom0}_{k,\Theta\cal A\inv}(z)=\sum\Sb[A,B,C]\in\cal A\\ AC<0\endSb \text{sign}(A)\,(Az^2-Bz+C)^{-k},$$ 
and this is automatically a true RPF because it is a sum of terms $Q^{-k}$ and $Q^{-k}\sn\gamma=(Q\circ\gamma)^{-k}$ for 
any $\gamma\in\Gamma$: the problems of \S2.3 were caused entirely by the fact that this identity breaks down when $Q^{-k}$
is separated into its two principal parts. $\square$ \enddemo

Finally, we should comment on the overlap between the presentation given in this section and previous work.  As already mentioned in the introduction, 
the notion of rational period function was introduced by M\. Knopp in [6].
 Lemma 1 and part of Lemma 2 (namely, that any non-zero pole of an RPF is a real quadratic irrationality) were proved by him in the later paper [7].
The existence of RPF's with poles in an arbitrary real quadratic field was shown in [2]. Lemma 4 is due to J\. Hawkins [4], who also found the 
cycle structure of the poles of an RPF and observed that there is a relation between the obstructions to the RPF property for sums over cycles and the
existence of cusp forms of weight $2k$. The construction of special RPF's given in the above corollary was obtained in [3].
We have preferred to give our own proofs of these results because they are shorter and in order to keep our treatment self-contained. The general
result of Ash mentioned in the introduction is the analogue of the exact sequence given above for $\Gamma'\subset\Gamma$: the space
$\bold W^0_{2k-2}$ replaced by $H_0^1(\Gamma',\bold V_{2k-2})$, the space $\rpf_{2k}$ replaced by a similarly defined first cohomology group of $\Gamma'$
with coefficients in the $\Gamma'$-module of rational functions, and the summation ranging over $\Gamma'$-equivalence classes of indefinite quadratic
forms of non-square discriminant. However, this more general result, whose proof relies on cohomological methods,
does not give an explicit description of the generalized rational period functions.

\heading 3. Hecke operators \endheading  A definition of Hecke operators on rational period functions was given by
Knopp [6], based on the modular integrals (Eichler integrals) which he had introduced earlier [5]. In \S3.1\. we
recall the definition of modular integrals and use it to motivate a purely algebraic definition whose main properties
we then investigate.

It will be convenient to introduce the following notation. For each integer $n>0$ we set 
$\M=\{M\in M_2(\Z)/\{\pm1\}\}\mid\det(M)=n\}$, so that $\cal M_1=\Gamma$. We write $\cal M_+$ for
$\bigcup\M\al=\{M\in M_2(\Z)/\{\pm1\}\}\mid\det(M)>0\}$ and $\cal R_n=\Z[\M]$, $\,\cal R_+=\Z[\cal M_+]=\bigoplus_n\M$ 
for the sets of finite integral linear combinations of elements of $\M$ and $\cal M_+$, respectively.  Thus
$\cal R_+$ is a (non-commutative) ring with unit and is ``multiplicatively graded" in the sense that $\cal R_n\cal R_m\subseteq\cal R_{mn}$
for all $m$, $n>0$; in particular, each $\cal R_n$ is a left and right module over the group  ring $\cal R_1=\Z[\Gamma]$
of $\Gamma$.  We denote by $\J$ the right ideal $(1+T)\cal R_1+(1+U+U^2)\cal R_1$ of $\cal R_1$. Finally, the slash operator
$|$ will always mean $\sp $ unless otherwise specified, the action being extended from $\Gamma$ to $\cal M_+$ by
$(h|M)(z)=n^{2k}(cz+d)^{-2k}h\bigl(\frac{az+b}{cz+d}\bigr)$ for $M=\bigl(\smallmatrix  a&b\\c&d\endsmallmatrix\bigr)\in\M$.
Thus $\cal R_n$ and $\cal R_+$ act on the spaces of rational or meromorphic functions in the upper half plane, and $\rpf=\rpf_{2k}$ is
simply the space of rational functions annihilated by the ideal $\J$.

{\bf 3.1.} A {\it modular integral} of weight $2k$ is by definition a meromorphic function $F$ on the upper
half plane $\H$, small at infinity, satisfying $$F|S=F\qquad\text{and}\qquad F|T=F+q$$ for some rational function $q$.
In other words, $F$ is periodic of period 1 and the difference $z^{-2k}F(-1/z)-F(z)$ is a rational function of $z$; the condition
``small at infinity" means that $F(z)$ has a Fourier expansion $\sum_{n>0}a(n)\,e^{2\pi inz}$ for $\Im(z)\gg0$.
The definition implies immediately that $q$ satisfies $q|(1+T)=q|(1+U+U^2)=0$, i.e., that $q$ is an RPF. Conversely
Knopp  proved that every $q\in\rpf$ comes in this way from a modular integral $F$. This $F$ is obviously not
unique: we can add to $F$ any meromorphic cusp form of weight $2k$ without changing $q$, and even if we specify
the principal parts of $F$ at every point of $\H$, then  $F$ is still only well-defined up to the action of
a cusp form $f\in\bold S$. The terminology ``modular integral," by the way, comes from the analogous definition for the action of $\Gamma$ by $\sn $, 
where $q$ is now a polynomial; here $F$ can be obtained as an integral of a cusp form with period polynomial $q$.

On $\bold S$ we have Hecke operators defined by $f|T_n=\sum_{M\in\Gamma\backslash\M}f|M$.  This definition cannot
be applied to $F$ because $F$ is not $\Gamma$-invariant (with respect to the action $|\,$), but $F$ is invariant
under the action of the stabilizer $\Gamma_\infty=\langle S\rangle$ of infinity, so the operator
$$T_n^\infty\;\;=\sum\Sb M\in\Gamma_\infty\backslash\M\\ M(\infty)\,=\infty\endSb M=\sum\Sb ad=n,\,a,d>0\\b\pmod d\endSb\pmatrix a&b\\0&d\endpmatrix
\;\in\;\bigl((S-1)\cal R_n\bigr)\,\backslash\,\cal R_n$$
has a well-defined effect on $F$.  It is easy to see that $F|T^\infty_n$ is again periodic with period 1, and in
fact it is a new modular integral whose associated rational function depends only on $q$ (and $n$), and this
defines Knopp's Hecke operator. To phrase this more algebraically, suppose that there are elements $X_n$, $\tilde T_n$ and
$Y_n$ in $\M$ satisfying $$T_n^\infty(S-1)=(S-1)\,X_n,\qquad T_n^\infty(T-1)=(T-1)\,\tilde T_n+(S-1)\,Y_n;$$
then $$\align\bigl(F|T_n^\infty\bigr)\mid(S-1)&=\bigl(F|(S-1)\bigr)\mid X_n=0,\\
\bigl(F|T_n^\infty\bigr)\mid(T-1)&=\bigl(F|(T-1)\bigr)\mid\tilde T_n+\bigl(F|(S-1)\bigr)\mid Y_n=q\mid\tilde T_n,\endalign$$
which shows that $F|T^\infty_n$ is a modular integral with associated rational function $q|\tilde T_n$.  We now 
show that $X_n$, $\tilde T_n$ and $Y_n$ exist and that the image of $q$ under $\tilde T_n$ is independent of the
choice of these three operators and is again an RPF, and moreover that the various $\tilde T_n:\rpf\to\rpf$ commute. 
This gives a purely algebraic definition of the Hecke operators, independent of the existence of modular integrals for arbitrary RPF's, which is a non-trivial analytic fact.
\proclaim{Theorem 2} For each integer $n\ge 1$, 
$$T_n^\infty(S-1)\equiv0\,,\qquad T_n^\infty(T-1)\equiv(T-1)\tilde T_n\pmod{(S-1)\cal R_n}$$
for a certain element $\tilde T_n\in\cal R_n$. This element is unique modulo $\J\cal R_n$ and satisfies $\tilde T_n\J\subseteq\J\cal R_n$. If $m$ is a second positive integer, then the elements $\tilde T_m,\,\tilde T_n\in\cal R_+$ satisfy the product formula
$$\tilde T_m\tilde T_n=\sum_{d|(m,n)}d\inv\,\pmatrix d&0\\0&d\endpmatrix\tilde T_{mn/d^2}\pmod{\J\cal R_{mn}}.$$ \endproclaim
\proclaim{Corollary} If $q\in\rpf$, then $q|\tilde T_n$ is well-defined (independent of the choice of $\tilde T_n$) and again belongs to $\rpf$.
The operators $\tilde T_n:\rpf\to\rpf$ satisfy $\tilde T_m\tilde T_n=\tilde T_n\tilde T_m=\sum_{d|(m,n)}d^{2k-1}\tilde T_{mn/d^2}$.\endproclaim
\demo{Proof}  For the assertion $T_n^\infty(S-1)\in(S-1)\cal R_n$ we compute (for given $a,\,d>0$ with $ad=n$)
$$\align\sum_{0\le b<d}\pmatrix a&b\\0&d\endpmatrix\bigl(S-1\bigr)&=\sum_{0\le b<d}\biggl(\pmatrix a&a+b\\0&d\endpmatrix-\pmatrix a&b\\0&d\endpmatrix\biggr)\\
&=\sum_{0\le b<a+d}\pmatrix a&b\\0&d\endpmatrix-\sum_{0\le b<a}\pmatrix a&b\\0&d\endpmatrix-\sum_{0\le b<d}\pmatrix a&b\\0&d\endpmatrix\\
&=\sum_{0\le b<a}\biggl(\pmatrix a&b+d\\0&d\endpmatrix-\pmatrix a&b\\0&d\endpmatrix\biggr)=\sum_{0\le b<d}\bigl(S-1\bigr)\pmatrix a&b\\0&d\endpmatrix.\endalign$$
For the assertion $T_n^\infty(T-1)\equiv(T-1)\tilde T_n\pmod{(S-1)\cal R_n}$ we need the following lemma.
\proclaim{Lemma 1}  $\gamma-1\in(T-1)\cal R_1+(S-1)\cal R_1$ for any element $\gamma\in\Gamma$.\endproclaim
\demo{Proof} Suppose that this property holds for some $\gamma\in\Gamma$. Then the elements $T\gamma-1=(T-1)\gamma+(\gamma-1)$, $S\gamma-1=(S-1)\gamma+(\gamma-1)$
and $S\inv\gamma-1=(S-1)(-S\inv\gamma)+(\gamma-1)$ also belong to $(T-1)\cal R_1+(S-1)\cal R_1$. Since $T$ ($=T\inv$) and $S$ generate $\Gamma$, the
lemma now follows by induction on the word length.  $\square$ \enddemo
Now write $T_n^\infty$ as $\sum M_i$. For each index $i$ there is a unique index $i'$ such that $M_iT=\gamma_iM_{i'}$ with $\gamma_i\in\Gamma$. Then
$T_n^\infty(T-1)=\sum_i\bigl(\gamma_iM_{i'}-M_i\bigr)=\sum_i(\gamma_i-1)M_{i'}$, and this belongs to $(T-1)\cal R_n+(S-1)\cal R_n$ by Lemma 1.  $\square$ \enddemo
To prove the other assertions of the theorem, we need a characterization of the elements of $\J\M$. To get this, we introduce the following concept.
Suppose $V$ is an abelian group on which $\Gamma$ acts on the left. Then $V$ is a left $\cal R_1$-module. For $X\in\cal R_1$ we write $\,\text{Ker}\,(X)$
for $\{v\in V\,|\, Xv=0\}$ and $\,\text{Im}\,(X)$ for $XV=\{Xv\,|\,v\in V\}$. The intersection of $\,\text{Ker}\,(1+T)$ and $\,\text{Ker}\,(1+U+U^2)$ has
an interpretation in terms of the cohomology of $\Gamma$ with coefficients in the module $V$; we call $V$ {\it acyclic} if this intersection is zero
and if, furthermore $\,\text{Ker}\,(1-T)=\text{Im}\,(1+T)$ and $\,\text{Ker}\,(1-U)=\text{Im}\,(1+U+U^2)$. (The second hypothesis can be omitted if we work
over $\Bbb Q$, since $(1-T)v=0\Rightarrow v=(1+T)(\frac12v)$ and $(1-U)v=0\Rightarrow v=(1+U+U^2)(\frac13v)$.)
\proclaim{Lemma 2} $\cal R_n$ is an acyclic $\cal R_1$-module for all $n$.\endproclaim
\demo{Proof}  Suppose $X=\sum n_M^{\phantom0}\,M$ ($n^{\phantom0}_M\in\Z$, $M\in\M$) is an element of $\cal R_n$.  If $X\in\text{Ker}\,(1+T)\cap\text{Ker}\,(1+U+U^2)$,  then
the function $q=r|X$ is an RPF for any rational function $r(z)$. Choose $r(z)=(z-\lambda)\inv$
where $\lambda\in\C$ is not rational or quadratic; then $q(z)$ has a pole at each point $M\inv\lambda$ with $n^{\phantom0}_M\ne0$ (these cannot cancel since $M_1\inv\lambda=M_2\inv\lambda$
would lead to a quadratic equation for $\lambda$), and this contradicts the fact proved in \S2 that an RPF can have poles only at rational or quadratic
irrational points. On the other hand, if $X$ is left invariant under $T$, then $n^{\phantom0}_{TM}=n^{\phantom0}_M$ for all $M$, and since $M\ne TM$ this means that $X$ can be
written as an integral linear combination of elements $M+TM=(1+T)M\in\cal R_n$. Similarly, $X=UX$ implies $n^{\phantom0}_M=n^{\phantom0}_{UM}=n^{\phantom0}_{U^2M}$ for all 
$M$ and hence $X\in(1+U+U^2)\cal R_n$. This proves the second hypothesis in the definition of acyclicity. $\square$ \enddemo
\proclaim{Lemma 3} If $V$ is an acyclic $\Gamma$-module and $v\in V$, then
 $$(1-T)v\in(1-S)V\quad\Longleftrightarrow\quad v\in (1+T)V+(1+U+U^2)V=\J V.$$\endproclaim 
\demo{Proof} The direction ``$\Leftarrow$" is true for any $\Gamma$-module, since $v=(1+T)x+(1+U+U^2)y$ implies 
$$(1-T)v=(1-S\inv U)(1+U+U^2)y=(S-1)S\inv(1+U+U^2)y.$$
Conversely, assume that $V$ is acyclic and $(1-T)v=(1-S)w$ for some $w\in V$. Then $$(1-T)(v-w)=(T-S)w=(1-U)Tw.$$
This element must vanish since $\,\text{Im}\,(1-T)\cap\text{Im}\,(1-U)\subseteq\text{Ker}\,(1+T)\cap\text{Ker}\,(1+U+U^2)=\{0\}$. But then
$v-w\in\,\text{Im}(1+T)$ and $Tw\in\,\text{Im}(1+U+U^2)$ by the second hypothesis in the definition of acyclicity, so $v=(v-w)+(1+T)w-Tw\in(1+T)V+(1+U+U^2)V$. $\square$ \enddemo
Lemmas 2 and 3 give a characterization of $\J\cal R_n$ as $\{X\in\cal R_n\mid(1-T)X\in(1-S)\cal R_n\}$. The uniqueness of $\tilde T_n$ modulo $\J\cal R_n$
(and consequently of the image $q|\tilde T_n$ for an RPF $q$) follows immediately from this characterization and the definition of $\tilde T_n$. 
The fact that $\tilde T_n\J\subseteq\J\cal R_n$ (and consequently that $q|\tilde T_n$ is again an RPF) also follows easily, since the equations
$$T_n^\infty(S-1)\equiv0\,,\qquad T_n^\infty(T-1)\equiv(T-1)\tilde T_n\pmod{(S-1)\cal R_n}$$
imply $(1-T)\tilde T_n(1+T)\equiv0$ and $$(1-T)\tilde T_n(1+U+U^2)\equiv T_n^\infty(1-S\inv U)(1+U+U^2)\equiv T_n^\infty(S-1)S\inv(1+U+U^2)\equiv0$$ 
modulo $(S-1)\cal R_n$. Finally,
$$\align \bigl(T-1\bigr)\biggl(&\tilde T_m\tilde T_n-\sum_{d|(m,n)}d\,\inv\bigl(\smallmatrix d&0\\0&d\endsmallmatrix\bigr)\,\tilde T_{mn/d^2}\biggr)\\
&\equiv T_m^\infty(T-1)\tilde T_n-\sum\,d\inv\,\bigl(\smallmatrix d&0\\0&d\endsmallmatrix\bigr)\,(T-1)\tilde T_{mn/d^2}\\
&\equiv T_m^\infty\bigl[T_n^\infty(T-1)-(S-1)Y_n\bigr]-\sum\,d\inv\,\bigl(\smallmatrix d&0\\0&d\endsmallmatrix\bigr)\,T^\infty_{mn/d^2}(T-1)\\
&\equiv\biggl(T_m^\infty T_n^\infty-\sum d\,\inv\bigl(\smallmatrix d&0\\0&d\endsmallmatrix\bigr)\,T^\infty_{mn/d^2}\biggr)\bigl(T-1\bigr)\qquad\pmod{(S-1)\cal R_{mn}}, \endalign $$ 
and $$T_m^\infty T_n^\infty-\sum_{d|(m,n)}d\,\inv\bigl(\smallmatrix d&0\\0&d\endsmallmatrix\bigr)\,T^\infty_{mn/d^2}\equiv0\pmod{(S-1)\cal R_{mn}}$$
by the usual calculation for the commutation properties of Hecke operators. This completes the proof of Theorem 2. $\square$ \enddemo

{\bf 3.2.} In this section we give an explicit combination $\tilde T_n$ of matrices of determinant $n$ which has the property
used in \S3.1\. to define the Hecke operators on rational period functions.  This operator was given in [12], where it was shown
that it preserves the space $\bold W_{2k-2}$ of period polynomials of degree $2k-2$ and corresponds
under the isomorphism $\bold W_{2k-2}\cong\bold S_{2k}\oplus\bold S_{2k}\oplus\C$ to the usual action of Hecke operators on cusp forms,
generalizing the description given by Manin [11] of the action of Hecke operators on the constant terms of the period polynomials of
cusp forms.  However, the proof in [12] relied on an explicit knowledge of a generating function for the period polynomials of Hecke
eigenforms of weight $2k$, while the construction here is purely algebraic (and thus shows that the $\tilde T_n$ we construct
preserves the period subspace $\,\text{Ker}\,(1+T)\,\cap\,\text{Im}\,(1+U+U^2)$ of any $\Gamma$-module).
\proclaim{Theorem 3} Let $n$ be a positive integer. Then the element $\tilde T_n\in R_n$ defined by
$$\tilde T_n=\sum\Sb ad-bc=n\\a>c>0\\d>-b>0\endSb\biggl[\pmatrix a&b\\c&d\endpmatrix+\pmatrix a&-b\\-c&d\endpmatrix\biggr]
+\sum\Sb ad=n\\-\frac12d<b\le\frac12d\endSb\pmatrix a&b\\0&d\endpmatrix
+\sum\Sb ad=n\\-\frac12a<c\le\frac12a\\c\ne0\endSb\pmatrix a&0\\c&d\endpmatrix\,,$$
has the properties given in Theorem 2.\endproclaim
\demo{Proof} Define $\tilde T_n$ by the formula given. We must show that $(T-1)\tilde T_n\equiv T_n^\infty(T-1)$, where
(and throughout the proof) $\,\equiv\,$ denotes congruence modulo $(S-1)\cal R_n$.)

The maps
$$\align A=\pmatrix a&b\\c&d\endpmatrix&\mapsto TS^{-[a/c]}A=\pmatrix c&d\\-(a-c[a/c])&-b+d[a/c]\endpmatrix, \\
B=\pmatrix a&b\\c&d\endpmatrix&\mapsto\phantom-S^{[d/b]}TB=\pmatrix-c+a[d/b]&-(d-b[d/b])\\a&b\endpmatrix,\endalign$$
where $[\ ]$ denotes integral part, are easily checked to give inverse bijections between the sets 
$$\cal A_n=\left\{\pmatrix a&b\\c&d\endpmatrix\,\in\M\mid\ a>c>0,\;d>-b\ge0,\;b=0\Rightarrow a\ge2c\right\}$$ and
$$\cal B_n=\left\{\pmatrix a&b\\c&d\endpmatrix\,\in\M\mid\ a>-c\ge0,\;d>b>0,\;c=0\Rightarrow d\ge2b\right\}\,.$$ 
Since $S^rA\equiv A$ for any integer $r$, this gives $\sum_{A\in\cal A_n}A\equiv T\sum_{B\in\cal B_n}B$ or
$$\sum\Sb a>c>0\\d>-b>0\\ad-bc=n\endSb\left[\pmatrix a&b\\c&d\endpmatrix-T\,\pmatrix a&-b\\-c&d\endpmatrix\right]
\equiv\sum\Sb\frac12d\ge b>0\\ad=n\endSb\pmatrix0&-d\\a&b\endpmatrix-\!\!\sum\Sb\frac12a\ge c>0\\ad=n\endSb\pmatrix a&0\\c&d\endpmatrix.$$
Conjugating this equation by $\bigl(\smallmatrix -1&0\\0&1\endsmallmatrix\bigr)$ changes the sign of all the off-diagonal
coefficients and preserves the property ``$\equiv$". Adding the result to the original equation, we get
$$\bigl(1-T\bigr)\sum\Sb a>c>0\\d>-b>0\\ad-bc=n\endSb\left(\pmatrix a&b\\c&d\endpmatrix+\pmatrix a&-b\\-c&d\endpmatrix\right)
\equiv\sum\Sb0<|b|\le\frac12d\\ad=n\endSb\left(\pmatrix0&-d\\a&b\endpmatrix-\pmatrix d&0\\b&a\endpmatrix\right)\,.$$
(Recall that we are working with matrices modulo $\pm1$.) Hence
$$\bigl(1\,-\,T\bigr)\,\tilde T_n\equiv\sum\Sb-\frac12d<b\le\frac12d\\ad=n\endSb\pmatrix a&b\\0&d\endpmatrix\bigl(1-T\bigr)
+\sum\Sb a,d>0\\ad=n\\d\text{ even}\endSb\biggl(\pmatrix0&-d\\a&{-\frac12d}\endpmatrix-\pmatrix d&0\\{-\frac12d}&a\endpmatrix\biggr),$$
as we see after a short calculation. The first sum on the right is $\;\equiv\,T^\infty_n(1-T)$, while the second equals
$$\sum\Sb xy=n/2\\x,\,y>0\endSb\biggl(\pmatrix 0&2y\\-x&y\endpmatrix-\pmatrix 2x&0\\-x&y\endpmatrix\biggr)
=\sum\Sb xy=n/2\\x,\,y>0\endSb\bigl(S^2-1)\pmatrix 2x&0\\-x&y\endpmatrix\equiv0.\qquad\square$$ \enddemo

{\bf 3.3} Finally, we mention a problem which we have not been able to solve and which seems to be of interest, namely that of
writing down explicit modular integrals. Specifically, we would like to find functions $F_{k,\cal A}$, holomorphic in the upper half-plane
and small at infinity, such that $\sum_{\cal A}c_{\cal A}^{\phantom0}F_{k,\cal A}(z)$ is a modular integral for $q(z)=\sum_{\cal A}c_{\cal A}^{\phantom0}r^0_{k,\cal A}(z)$
whenever the latter is an RPF, i.e. (according to Theorem 1), whenever $\sum_{\cal A}c_{\cal A}^{\phantom0}R^0_{k,\cal A}(z)=0$ in $\bold W_{2k-2}^0$.
For the special case of the RPF $q^{\phantom0}_{k,\cal A}-(-1)^kq^{\phantom0}_{k,\Theta\cal A\inv}$ of the Corollary to Theorem 1, the answer was found by
A\. Parson: an explicit modular integral is given by (a multiple of) $\sum Q(z,-1)^{-k}$, where the sum ranges over quadratic forms $Q=[a,b,c]\in\cal A$ with $a>0$.
This can be checked easily: the sum is $S$-invariant and when one applies $(1-T)$ all the terms with $ac>0$ drop out, so that one is left with
a sum over simple forms. A similar calculation shows that the sum of the principal parts $q^{\phantom0}_{k,\alpha}$, where $\alpha$ ranges over the roots of
forms in $\cal A$ with $\alpha>\alpha'$ (corresponding to Parson's condition $a>0$) formally is a modular integral for $q^{\phantom0}_{k,\cal A}$. However, this
sum diverges because $q^{\phantom0}_{k,\alpha}$ grows like $a^{k-1}$ as $[a,b,c]$ runs over the class $\cal A$ (cf. the formula for $q^{\phantom0}_{k,\alpha}$ given in the proof of Lemma 7), and it is not clear how to write down an expression which makes sense.

\heading 4. Numerical examples\endheading 
For the discriminant {\bf $D=5$} there is only one class of forms $I$, represented by the simple form $[1,1,-1]$, 
with $\cal Z_I=\{\dfrac{\sqrt5+1}2,\,\dfrac{\sqrt5-1}2\}$. For $k$ odd, both $q_{k,I}^{\phantom0}(z)$ 
and $r^0_{k,I}(z)$ are multiples of
$$\sum_{\alpha\in\cal Z_I} \bigl(q^{\phantom0}_{k,\alpha}(z)-q^{\phantom0}_{k,T\alpha}(z)\bigr)
=\biggl(\frac{\sqrt5}{ z^2-z-1}\biggr)^k+ \biggl(\frac{\sqrt5}{ z^2+z-1}\biggr)^k$$ and belong to $\rpf_{2k}$.
(Note that $R_{k,I}^{\phantom0}=(1+(-1)^k)P_{k,I}^{\phantom0}=0$ in this case.) For $k=2$ we have
$$\sum_{\alpha\in\cal Z_I} \bigl(q^{\phantom0}_{2,\alpha}(z)-q^{\phantom0}_{2,T\alpha}(z)\bigr)
=-\frac1{\sqrt5}\,\biggl(\frac{4z^3-6z^2-12z+7}{(z^2-z-1)^2}+\frac{4z^3+6z^2-12z-7}{(z^2+z-1)^2}\biggr)\;.$$
Applying $|_4(1-T)$ gives
$$q_{2,I}(z)=-\frac2{\sqrt5}\,\biggl(\frac{4z^3-6z^2-12z+7}{(z^2-z-1)^2}+\frac{4z^3+6z^2-12z-7}{(z^2+z-1)^2}
  -\frac4x+\frac4{x^3}\biggr)\,;$$  and since $\rho_2(I)=4$ we find
$$r_{2,I}^0(z)=\frac{4z^3-6z^2-12z+7}{(z^2-z-1)^2}+\frac{4z^3+6z^2-12z-7}{(z^2+z-1)^2}-\frac8x\,\in\rpf_4\,,$$
 corresponding to the fact that the polynomial
$$R_{2,I}^{\phantom0}(X)=2P_{2,I}^{\phantom0}(X)-\rho_2(I)\,p_{2,0}(X)=2\bigl[(X^2-X-1)+(X^2+X-1)\bigr]-4(X^2-1)$$
vanishes (as of course it must, since $W_2^0=\{0\}$). Similarly, for $k=4$ we find that
$$r_{4,I}^0(z)=\frac{4z^7-14z^6+35z^4-42z^2-28z+\frac{45}2}{(z^2-z-1)^4}
+\frac{4z^7+14z^6-35z^4+42z^2-28z-\frac{45}2}{(z^2+z-1)^4}-\frac8x$$ is again an RPF, corresponding to the identity
$$R_{4,I}^{\phantom0}=2\bigl[(X^2-X-1)^3+(X^2+X-1)^3\bigr]-4(X^6-1)=0\;\in W_6^0=\{0\}\,.$$
For $k=6$, however, $r_{k,I}^0$ no longer has to be, and no longer is, an RPF, because of the existence
of cusp forms of weight $2k$ on \mg. Here we find 
$$r_{6,I}^0(z)=\frac{44h(z)}{(z^2-z-1)^6}-\frac{44h(-z)}{(z^2+z-1)^6}-
4\,\biggl(\frac1x+\frac1{9x^3}-\frac1{7x^5}+\frac1{7x^7}-\frac1{9x^9}-\frac1{x^{11}}\biggr)-
\rho\,\biggl(\frac1x+\frac1{x^{11}}\biggr)\,,$$
where $\rho=\rho_5(I)=\dfrac{3484}{691}$ and $h(z)$ denotes the polynomial
$$h(z)=\frac{z^{11}}{11}-\frac{z^{10}}2+\frac{5z^9}2+\frac{5z^8}4-\frac{15z^7}7-\frac{11z^6}6
+3z^5+\frac{5z^4}2-\frac{5z^3}3-\frac{5z^2}2-z+\frac{6227}{5544}\,.$$
We have $r_{6,I}^0|_{12}^{\phantom0}(1+T)=0$ but
$$ r_{6,I}^0|_{12}^{\phantom0}(1+U+U^2)=-4k\bigl(\frac1z\bigr)-4k\bigl(\frac1{1-z}\bigr)
+\rho\,\sum_{n=1}^{10}\biggl(\frac1{z^n}+\frac1{(1-z)^n}\biggr)$$ with 
$k(z)=z^{10}+z^9+\frac43\,z^8+\frac53\,z^7+\frac{221}{126}\,z^6+\frac{67}{42}\,z^5+\frac43\,z^4+\frac{10}9\,z^3+z^2+z$.  
This belongs to $\bold H_{12}$ and is mapped by the isomorphism $\mu$ of Lemma 6 to the element
$$R_{6,I}^0=2\bigl[(X^2-X-1)^5+(X^2+X-1)^5\bigr]-\rho\,\bigl(X^{10}-1\bigr)=
20\bigl(X^8-3X^6+3X^4-X^2-\frac{36}{691}\,(X^{10}-1)\bigr)$$ of the 2-dimensional space $W^0_{10}$.

Other discriminants work similarly. For $D=12$, for example, there are two classes $I$ and $\Theta$,
represented by the simple forms $[1,0,-3]$ and $[3,0,-1]$, respectively, with cycles
 $\cal Z_I=\{\sqrt3,\,\sqrt3-1,\,\sqrt3+1\}$ and 
$\cal Z_\Theta=\{\dfrac1{\sqrt3},\,\dfrac{\sqrt3+1}2,\,\dfrac{\sqrt3-1}2\}$. Here for each $k$
the rational function $r^0_{k,I}(z)-(-1)^k\,r^0_{k,\Theta}(z)$ is a multiple of
$$\align&\frac1{(z^2-3)^k}+\frac1{(z^2-2z-2)^k}+\frac1{(z^2+2z-2)^k}\\
-&\frac1{(1-3z^2)^k}-\frac1{(1-2z-2z^2)^k}-\frac1{(1+2z-2z^2)^k}\endalign$$
and is an RPF. For $k=2$, 3, 4, 5 or 7, where $S_{2k}=\{0\}$, 
the two fuctions $r^0_{k,I}$ and $r^0_{k,\Theta}$ are individually RPF's. For $k=6$ this is no
longer true, but subtracting from $r^0_{6,I}$ six times the function
$r^0_{6,I}$ for $D=5$ as given above, we do get a function belonging to $\rpf_{12}$,
corresponding to the fact that the polynomial
$$\align R_{6,I}^0=&(X^2-3)^5+(X^2+2X-2)^5+(X^2-2X-2)^5+(3X^2-1)^5\\
&+(2X^2+2X-1)^5+(2X^2-2X-1)^5-\frac{218530}{691}\,\bigl(X^{10}-1\bigr)\,.\endalign$$ 
is 6 times what it was for $D=5$. However, the coefficients of this rational function are already fairly
complicated and we do not give them or any further numerical examples.

\bigskip\bigskip\bigskip\heading References\endheading
\ref\no 1\by A\. Ash, Parabolic cohomology of  arithmetic subgroups of $SL(2,\Z)$ with coefficients
in the field of rational functions on the Riemann sphere\jour Amer\. J\. Math\.\vol 111\yr 1989\pages35--51\endref\smallskip
\ref\no 2\by YJ\. Choie, Rational period functions for the modular group and real quadratic fields
\jour Ill\. J\. Math\.\vol 33\yr1989\endref\smallskip
\ref\no 3\by YJ\. Choie and L.A\. Parson, Rational period functions and indefinite binary quadratic forms I\jour Math. Annalen 
\vol 286\yr1990\pages 697--707\endref\smallskip
\ref\no 4\by J\. Hawkins, On rational period functions for the modular group\paperinfo unpublished\endref\smallskip
\ref\no 5\by M\. Knopp, Some new results on the Eichler cohomology of automorphic forms\jour Bull\. Amer\. Math\. Soc\. \yr 1974\pages 607--632\vol 80\endref\smallskip
\ref\no 6\by M\. Knopp, Rational period functions of the modular group\jour Duke Math\. J\. \yr 1978\pages 47--62\vol 45\endref\smallskip
\ref\no 7\by M\. Knopp, Rational period functions of the modular group II\jour Glasgow Math\. J\. \yr 1981\pages 185--197\vol 22\endref\smallskip
\ref\no 8\by W\. Kohnen and D\. Zagier, Modular forms with rational periods\inbook Modular Functions\bookinfo(ed. R.A.\ Rankin)
\publ Ellis Horwood\publaddr Chichester\yr 1984\pages 197--249\endref\smallskip
\ref\no 9\by D\. Kramer, Spherical polynomials and the periods of certain modular forms\jour Trans\. Amer\. Math\. Soc\. \yr 1986\pages 595-605\vol 294\endref\smallskip
\ref\no 10\by S\. Lang \book Introduction to Modular Forms\publ Springer-Verlag\publaddr Berlin-Heidelberg-New York\yr 1976\endref\smallskip
\ref\no 11\by Yu\. Manin, Periods of parabolic forms and $p$-adic Hecke series
\jour Mat\. Sb\. \vol 21\yr 1973\pages 371--393\endref\smallskip
\ref\no 12\by D\. Zagier, Hecke operators and periods of modular forms\jour Israel Math\. Conf\. Proc\.\vol2\yr1990\pages321--336\endref\smallskip

\end

dvi2ps -f 5 -t 8 Choi3.dvi | lpr


=\sum a_n\,\bigl(1-\frac1z\bigr)^{-n-1}\,z^{-2k}\;+\;\sum b_n\,\bigl(-\frac1z\bigr)^{-n-1}\,z^{-2k}\\
&

$$\align\tilde T_n=\sum\Sb \Delta'>\delta'>0\\ \Delta>\delta>0\\ \Delta\Delta'+\delta\delta'=n\endSb
&\left[\pmatrix \Delta'&\delta\\-\delta'&\Delta\endpmatrix+\pmatrix \Delta'&\-delta\\ \delta'&\Delta\endpmatrix\right]\\
&-\sum\Sb-\frac12\Delta<\delta\le\frac12\Delta\\ \Delta\Delta'=n\endSb \pmatrix \Delta'&\delta\\0&\Delta\endpmatrix
-\sum\Sb-\frac12\Delta'<\delta'\le\frac12\Delta'\\ \Delta\Delta'=n\\ \delta'\ne0\endSb \pmatrix \Delta'&0\\-delta'&\Delta\endpmatrix
\endalign$$

(z-1)^{-\tilde n-1}+(-1)^n(z-1)^{-n-1}


&=(-1)^k\binom w{k-1}\,D^{-(k-1)/2}\,\sum_{\alpha\in\cal Z_{\cal A}}
\bigl(\,-Q_\alpha(X,-1)^{k-1}+Q_{\alpha-1}(X,-1)^{k-1}+Q_{T\alpha}(X,-1)^{k-1}-Q_{T\alpha-1}(X,-1)^{k-1}\,\bigr)\bigm|TU\\
fm



$$T_n^\infty(S-1)=(S-1)\,X_n,\qquad T_n^\infty(T-1)=(T-1)\,\tilde T_n+(S-1)\,Y_n$$ 

\proclaim{Theorem 3} Let $n$ be a positive integer. Then the element
 $$\align\tilde T_n=\sum\Sb \Delta'>\delta'>0\\ \Delta>\delta>0\\ \Delta\Delta'+\delta\delta'=n\endSb
&\left[\pmatrix \Delta'&\delta\\-\delta'&\Delta\endpmatrix+\pmatrix \Delta'&-\delta\\ \delta'&\Delta\endpmatrix\right]\\
&+\sum\Sb-\frac12\Delta<\delta\le\frac12\Delta\\ \Delta\Delta'=n\endSb \pmatrix \Delta'&\delta\\0&\Delta\endpmatrix
+\sum\Sb-\frac12\Delta'<\delta'\le\frac12\Delta'\\ \Delta\Delta'=n\\ \delta'\ne0\endSb \pmatrix \Delta'&0\\-\delta'&\Delta\endpmatrix\endalign$$ of $\cal R_n$ has the properties given in Theorem 2.\endproclaim
\demo{Proof} Define $\tilde T_n$ by the expression in the theorem. We must show that $(T-1)\tilde T_n\equiv T_n^\infty(T-1)$ (here
and throughout the proof, $\,\equiv\,$ denotes congruence modulo $(S-1)\cal R_n$).

The maps
$$\align A=\pmatrix \Delta'&-\delta\\ \delta'&\Delta\endpmatrix&\mapsto TS^{-[\Delta'/\delta']}A=
\pmatrix\delta'&\Delta\\-(\Delta'-\delta'[\Delta'/\delta'])&\delta+\Delta[\Delta'/\delta']\endpmatrix, \\
B=\pmatrix \Delta'&\delta\\-\delta'&\Delta\endpmatrix&\mapsto\;\;\; S^{[\Delta/\delta]}TB\;\;=\;\;
\pmatrix\delta'+\Delta'[\Delta/\delta]&-(\Delta-\delta[\Delta/\delta])\\\Delta'&\delta\endpmatrix,\endalign$$
where $[\ ]$ denotes integral part, are easily checked to give inverse bijections between the sets 
$$\cal A_n=\left\{\pmatrix \Delta'&-\delta\\ \delta'&\Delta\endpmatrix\,\in\M\mid\
\Delta'>\delta'>0,\;\Delta>\delta\ge0,\;\delta=0\Rightarrow\Delta'\ge2\delta'\right\}$$ and
$$\cal B_n=\left\{\pmatrix \Delta'&\delta\\-\delta'&\Delta\endpmatrix\,\in\M\mid\
\Delta'>\delta'\ge0,\;\Delta>\delta>0,\;\delta'=0\Rightarrow\Delta\ge2\delta\right\}\,.$$ 
Since $S^rA\equiv A$ for any integer $r$, this gives $\sum_{A\in\cal A_n}A\equiv T\sum_{B\in\cal B_n}B$ or
$$\sum\Sb \Delta'>\delta'>0\\ \Delta>\delta>0\\ \Delta\Delta'+\delta\delta'=n\endSb
\left[\pmatrix \Delta'&-\delta\\ \delta'&\Delta\endpmatrix-T\,\pmatrix \Delta'&\delta\\-\delta'&\Delta\endpmatrix\right]
\equiv\sum\Sb\frac12\Delta\ge\delta>0\\ \Delta\Delta'=n\endSb\pmatrix0&-\Delta\\ \Delta'&\delta\endpmatrix
-\!\!\sum\Sb\frac12\Delta'\ge\delta'>0\\ \Delta\Delta'=n\endSb\pmatrix\Delta'&0\\ \delta'&\Delta\endpmatrix.$$
Conjugating this equation by $\bigl(\smallmatrix -1&0\\0&1\endsmallmatrix\bigr)$ changes the sign of all the off-diagonal
coefficients and preserves the property ``$\equiv$". Adding the resulting equation to the original one we get
$$\bigl(1-T\bigr)\sum\Sb \Delta'>\delta'>0\\ \Delta>\delta>0\\ \Delta\Delta'+\delta\delta'=n\endSb
\left(\pmatrix \Delta'&-\delta\\ \delta'&\Delta\endpmatrix+\pmatrix \Delta'&\delta\\-\delta'&\Delta\endpmatrix\right)
\equiv\sum\Sb0<|b|\le\frac12d\\ad=n\endSb\left(\pmatrix0&-d\\a&b\endpmatrix-\pmatrix d&0\\b&a\endpmatrix\right)$$
(recall that we are working with matrices modulo $\pm1$). Hence
$$\bigl(1\,-\,T\bigr)\,\tilde T_n\equiv\sumstar\Sb |b|\le\frac12d\\ad=n\endSb\pmatrix a&b\\0&d\endpmatrix\bigl(1-T\bigr)
+\frac12\sum\Sb a,d>0\\ad=n\\d\,\text{even}\endSb\biggl(\pmatrix0&-d\\a&-\frac12d\endpmatrix-\pmatrix d&0\\-\frac12d&a\endpmatrix\biggr),$$
as we see after a short calculation. The first sum on the right is $\;\equiv\,T^\infty_n(1-T)$, while the second equals
$$\sum\Sb xy=n/2\\x,\,y>0\endSb\biggl(\pmatrix 0&2y\\-x&y\endpmatrix-\pmatrix 2x&0\\-x&y\endpmatrix\biggr)
=\sum\Sb xy=n/2\\ x,\,y>0\endSb\bigl(S^2-1)\pmatrix 2x&0\\-x&y\endpmatrix\equiv0.\qquad\square$$ \enddemo


where $R_d=\bigl(\smallmatrix d&0\\0&d\endsmallmatrix\bigr)\in\cal R_{d^2}$
