S-duality, triangle groups and modular anomalies in N=2 SQCD

We study N = 2 superconformal theories with gauge group SU(N) and 2N fundamental flavours in a locus of the Coulomb branch with a Z_N symmetry. In this special vacuum, we calculate the prepotential, the dual periods and the period matrix using equivariant localization. When the flavours are massless, we find that the period matrix is completely specified by [N/2] effective couplings. On each of these, we show that the S-duality group acts as a generalized triangle group and that its hauptmodul can be used to write a non-perturbatively exact relation between each effective coupling and the bare one. For N = 2, 3, 4 and 6, the generalized triangle group is an arithmetic Hecke group which contains a subgroup that is also a congruence subgroup of the modular group PSL(2,Z). For these cases, we introduce mass deformations that respect the symmetries of the special vacuum and show that the constraints arising from S-duality make it possible to resum the instanton contributions to the period matrix in terms of meromorphic modular forms which solve modular anomaly equations.

1 Introduction One of the most interesting properties of supersymmetric gauge theories is the existence of non-perturbative S-dualities that relate their weak-and strong-coupling behaviour. 1 Recently, there has been much progress in understanding these dualities in conformally invariant N = 2 supersymmetric gauge theories in four dimensions, especially following the seminal work of Gaiotto [2]. In that work, the four-dimensional N = 2 theories were realized as compactifications of the six-dimensional (2, 0) theory on a punctured Riemann surface Σ. One of the important results of this approach was to identify the complex structure moduli space of Σ with the space of gauge couplings modulo the action of the S-duality group. For linear quiver gauge theories in the weak coupling limit, the Riemann surface degenerates into a collection of three-punctured spheres connected by long thin tubes, and the sewing parameters are identified with the bare coupling constants of the superconformal gauge theory. This approach is fruitfully contrasted with the original solution of N = 2 gauge theories due to Seiberg and Witten [3,4], where the quantum effective action on the Coulomb branch is obtained from an algebraic curve describing a Riemann surface, and an associated holomorphic differential. For generic vacuum expectation values of the scalar fields in the adjoint gauge multiplet, the quantum effective action describes a N = 2 supersymmetric theory with gauge group U(1) r , where r is the rank of the original non-abelian gauge group. The matrix of effective couplings τ ij between the various U(1)'s is identified with the period matrix of the Seiberg-Witten curve. For gauge groups with large r, it becomes difficult to use the Seiberg-Witten curve and the corresponding differential to do explicit calculations. In such cases, however, it is possible to make progress using equivariant localization methods [5][6][7][8] which allow one to compute the prepotential, the dual periods and the period matrix of the effective action order by order in an instanton expansion. Interestingly, the instanton counting parameters in this expansion have a natural interpretation as the bare coupling constants of the superconformal gauge theory [2,9].
Whichever approach one uses to study the low-energy theory, a natural question to ask is whether the non-perturbative S-duality group can be used to solve for the effective action. For N = 2 theories (i.e. mass deformed N = 4 theories) with unitary gauge groups it has been shown [10][11][12][13] that the constraints coming from S-duality take the form of a modular anomaly equation whose solution allows one to reconstruct the prepotential on the Coulomb branch order by order in the mass of the adjoint hypermultiplet to all orders in the gauge coupling. To achieve this result one has to organize the low-energy effective prepotential as a semi-classical expansion in inverse powers of the vacuum expectation values of the scalar fields in the gauge vector multiplet and realize that the coefficients of this expansion satisfy a recursion relation whose solution can be written in terms of quasi-modular forms of PSL(2,Z) acting on the bare gauge coupling. These modular forms resum the instanton series and therefore provide an exact result. It is of particular importance that N = 2 theories are characterized by the absence of any renormalization of the coupling constant, even non-perturbatively; thus, the bare coupling is the only coupling that is present in the effective theory. This procedure has been applied also to N = 2 theories with arbitrary gauge groups in [14][15][16], where it has been observed that for non-simply laced algebras the effective prepotential is expressed in terms of quasi-modular forms of congruence subgroups of PSL (2,Z).
In this work we study N = 2 gauge theories with gauge group SU(N ) and 2N fundamental flavours, generalizing the analysis of the SU(3) gauge theory with six flavours recently presented in [17]. When all flavours are massless, these SQCD theories are superconformal. However, unlike the case of N = 2 theories, the bare gauge coupling in N = 2 SQCD is renormalized by quantum corrections which arise from a finite 1-loop contribution as well as from an infinite series of non-perturbative contributions due to instantons. In general these corrections are different for the various U(1) factors and thus one expects to find several effective couplings in the low-energy theory. This paper is divided into two parts. In the first part, we work in the limit where all flavours are massless, and calculate various observables of the effective theory such as the prepotential, the period integrals and the period matrix, using equivariant localization. In particular, we work in a special locus of the Coulomb branch which possesses a Z N symmetry and which we call "special vacuum" [18]. In this special vacuum, the period matrix has fewer independent components than it does at a generic point of the moduli space. More precisely, when all quantum corrections are taken into account there are N 2 distinct matrix structures which correspond to N 2 renormalized coupling constants in the effective theory. 2 Of course, at leading order such renormalized couplings are all equal to the bare coupling, but when 1-loop and instanton corrections are taken into account, they begin to differ from one another. Given that the S-duality group naturally acts on the bare coupling, an obvious question to ask is how S-duality is realized on the various parameters of the quantum theory. The answer we provide in this paper is that on each individual effective coupling S-duality acts as a generalized triangle group (see for example [19]). Moreover, using this insight, we propose a non-perturbatively exact relation between the bare coupling and the renormalized ones that takes a universal form in terms of the j-invariants of the triangle groups. We perform several successful checks of this proposal by comparing the instanton contributions predicted by the exact relation with the explicit results obtained from multi-instanton localization. As a further evidence in favour of our proposal, we show that the action of S-duality on the renormalized couplings is fully consistent with the action on the bare coupling as obtained from Gaiotto's analysis [2].
We believe that our results, and in particular the exact relation we propose, can play an important role in the study of these SQCD theories at strong coupling [20]. This is because the j-invariants have a well-understood behaviour near those cusp points where the coupling constants become large and the usual weak-coupling expansion cannot be used.
In the second part of the paper we consider the case where the fundamental flavour hypermultiplets are massive. For generic masses the Z N symmetry of the special vacuum is broken; to avoid this, we restrict our analysis to Z N -symmetric mass configurations so that the modular structure uncovered in the massless limit gets deformed in a natural and smooth manner. In particular, with these Z N -symmetric mass configurations we find that the N 2 matrix structures of the massless theories are preserved, while the N 2 effective couplings simply receive further contributions proportional to the hypermultiplet masses. Building on earlier literature [21,22], this analysis was already carried out for the SU(2) theory in [11,12], where it was shown that the prepotential can be written in terms of quasi-modular forms of the modular group PSL(2, Z). Moreover, after expanding the prepotential in powers of the flavour masses, it was realized that the coefficients of this expansion satisfy a modular anomaly equation that takes the form of a recursion relation, similar to that of the N = 2 case. These results have been recently extended to the SU(3) theory with six massive flavours in [17], where it has been shown that the prepotential, the dual periods and the period matrix are constrained by S-duality to obey again a recursion relation that can be written as a modular anomaly equation. In this case, the solutions of this equation are quasi-modular forms of Γ 1 (3), which is a subgroup of the S-duality group that is also a congruence subgroup of PSL(2, Z). 3 Here we further extend these results to the general SU(N ) theory with 2N massive flavours and show that the constraints arising from S-duality can always be written as a recursion relation for any N . However, beyond this step, the analysis crucially depends on the arithmetic properties of the Sduality group. It turns out that for N = 2, 3, 4 and 6, the S-duality group acting on each quantum coupling always has a subgroup which is a congruence subgroup of PSL(2, Z). For these theories, which we call arithmetic, the discussion proceeds along the same lines described in [17] for the SU(3) theory, with one important modification: in the higher rank cases, the S-duality constraints are written as coupled modular anomaly equations. These coupled equations are nevertheless integrable and their solutions turn out to be polynomials in meromorphic quasi-modular forms of congruence subgroups of PSL(2, Z). For all nonarithmetic theories, instead, S-duality acts as generalized triangle groups and one would need to use their automorphic forms to solve for various observables. Here, we restrict our analysis only to the massive arithmetic cases, leaving the study of the non-arithmetic cases for the future.
The paper ends with a discussion of the results and some future directions for work, and with two technical appendices.

Massless N = 2 SQCD and duality groups
In this part, we discuss N = 2 SQCD theories with massless fundamental hypermultiplets.

Massless superconformal QCD theories and special vacuum
We begin by reviewing the main features of N = 2 SQCD theories with unitary gauge groups U(N ). These theories are superconformal invariant if the number of flavours is 2N .
As usual, we can combine the bare Yang-Mills coupling g and the θ-angle into the complex variable so that the instanton counting parameter q 0 is defined as The low-energy effective dynamics of these N = 2 theories is completely determined by the prepotential, which we now describe.

Classical contribution
For the U(N ) gauge theory the classical prepotential is given by where the vacuum expectation value of the adjoint scalar A is For unitary gauge groups the A u 's are unrestricted, while for special unitary groups we have to impose the tracelessness condition Throughout this paper we satisfy this constraint by taking (2.7) When referring to the SU(N ) theory we will use the indices i, j, · · · ∈ {1, · · · , N − 1} to label the Cartan directions.

Perturbative contribution
The perturbative (1-loop) contribution to the prepotential is independent of the bare coupling τ 0 and is given by where (see for example [26]) Here Λ is an arbitrary mass scale, which actually drops out from F 1-loop due to conformal invariance.

Instanton contribution
The non-perturbative contributions to the prepotential can be explicitly calculated using the methods of equivariant localization [5][6][7][8] (see also [27] for technical details) and are of the form for r = 1, · · · , N are the Casimir invariants of the gauge group. The function F k represents the k-instanton contribution to the prepotential and, on dimensional grounds, must have mass dimension 2.

The special vacuum
In the following we will study the massless SQCD theories in the so-called special vacuum [18] which is defined as the locus of points on the moduli space where u r = 0 for r = 1, · · · , N − 1 . (2.12) For SU(N ) theories the condition u 1 = 0 is nothing but (2.7), while the other conditions select vacuum configurations with special properties. 4 The special vacuum restriction (2.12) can be implemented by choosing the vacuum expectation values of the adjoint SU(N ) scalar as (2.14) We thus see that the special vacuum can be parametrized by a single scale a and that it possesses a Z N symmetry.

Observables in the special vacuum
We now discuss the properties of some observables in the special vacuum, starting with the prepotential.

The prepotential
In the special vacuum several simplifications occur when one evaluates the prepotential. For instance, the classical prepotential (2.4) vanishes and the Z N -invariance of the special vacuum implies that for large a the prepotential has a semi-classical expansion of the form The coefficients f n 's must have mass dimension equal to (nN + 2); however, since the flavours are massless, the only available scale is a and it is not possible to give f n the required mass dimensions. Thus the prepotential identically vanishes in the special vacuum. 5

Dual periods
In the SU(N ) theory the dual periods a D i are defined by As in the special vacuum all a i 's are proportional to each other, this is also true of the dual periods. For example one can verify that for any i = 1, · · · , N − 1. Therefore, in the special vacuum without any loss of generality we can choose the following conjugate pair of variables: (a D N −1 , a 1 ). To simplify notation, we will omit the subscripts and denote these just by (a D , a).
The classical contribution to a D is given by where the second line follows upon using the special vacuum values (2.13) which lead to The classical dual period receives both 1-loop and instanton corrections, even in the massless theory. Physically, this corresponds to a non-perturbative redefinition of the bare coupling constant τ 0 into a new renormalized coupling constant that we denote τ . This renormalized coupling constant is defined in such a way that the quantum corrected dual period takes the simple form a D = c N τ a , (2.20) namely the same classical expression (2.18) with τ 0 replaced by τ . The latter admits the following non-perturbative expansion In this expression, the logarithmic term represents a finite contribution at 1-loop, while the term proportional to q k 0 is the k-instanton contribution.

The period matrix
In the SU(N ) theory the period matrix Ω is the (N − 1) × (N − 1) matrix defined as The classical part of the period matrix is simply given by is the Cartan matrix corresponding to our parametrization of SU(N ). For N > 3 this simple structure is lost [24,28] when perturbative and instanton contributions are taken into account, even in the special vacuum. For example, at 1-loop from (2.8) one finds where the matrix elements of G are given by [24] G ii = 2 log sin iπ N , (2.26) For N = 3 it is easy to see that G is proportional to the Cartan matrix C, but this relation does not hold for N > 3. Indeed, a closer inspection of (2.26) reveals that it is possible to identify N 2 different matrix structures. A similar result is found even after the instanton contributions are taken into account. Thus, in general the complete period matrix Ω can be written as where the M k 's are independent matrix structures and the τ k are distinct complex couplings that characterize the effective theory. Of course, one could in principle use any basis of matrices M k to write Ω, but a particularly insightful choice is the one that "diagonalizes" the action of the S-duality group. In such a basis, under S-duality each M k stays invariant and each τ k transforms individually as for some positive λ k . We will explicitly show in a series of examples that the spectrum of λ k is given by (2.29) Note that for N ∈ {2, 3, 4, 6} all the λ k 's take integer values. We call these cases arithmetic.
If instead N ∈ {2, 3, 4, 6}, then the λ k 's are not necessarily integer. We refer to the latter as the non-arithmetic cases. Moreover, we will find that for any N the coupling τ 1 in (2.27) coincides with the coupling τ that appears in the expression (2.20) for the dual period a D .
In order to show these facts, we now turn to a detailed discussion of the S-duality group.

The S-duality group
The S-duality group of N = 2 SQCD has been derived in [29]. Here, we focus on the massless case in the special vacuum, for which the Seiberg-Witten curve takes the following hyperelliptic form Here u N is the only non-zero Coulomb modulus labeling the special vacuum and h is a function of the gauge coupling given by (see for example [17,27]) (3. 2) The Seiberg-Witten curve degenerates when its discriminant vanishes and from (3.1) it is easy to see that this happens at h = 0, 1, ∞. The monodromies around these points generate the S-duality group [29]. We will take this to be our working definition of the S-duality group in what follows. In Section 5 we will rederive this result by a completely different method. We begin by choosing a canonical homology basis of cycles for the U(N ) theory described by (3.1), which we denote by hatted variables. Specifically, we introduceα andβ cycles with the following intersectionŝ for u, v = 1, · · · , N . These cycles are not linearly independent since N u=1α u = 0 and In the special vacuum there is a natural Z N symmetry that rotates this basis clockwise and is generated by (3.5) Physical observables are insensitive to this Z N rotation. The action of S-and T -transformations on this basis of cycles has been determined in [29] from the monodromy around the points h = ∞ and h = 0, respectively, and is given by In the SU(N ) theory we can choose the independent cycles as follows: for i, j = 1, · · · , N − 1. Using (3.3) one can easily check that this basis is symplectic, in the sense that α i ∩ α j = β i ∩ β j = 0 and α i ∩ β j = δ ij . The restriction of the S and T transformations to the SU(N ) basis (3.7) follows directly from (3.6). If we represent them as (2N − 2) × (2N − 2) matrices acting on the (2N − 2) vector β α , we find and C is the Cartan matrix (2.24). It is interesting to observe that where V is an Sp(2N − 2, Z) matrix that implements the Z N transformation (3.5) on the SU(N ) basis of cycles (α i , β j ), given by Notice that V N = 1. Such a transformation leaves the period matrix invariant and is a symmetry of the theory. This means that S effectively squares to the identity.

S-action on period integrals and gauge coupling
From the transformations (3.8) on the homology cycles we can straightforwardly deduce how S and T act on the periods a i and their duals a D j , which are the integrals of the Seiberg-Witten differential associated to the curve (3.1) over the cycles α i and β j respectively. Focusing in particular on the S-transformation, we find where B is the matrix in (3.9). Thus, for our conjugate pair of variables (a D where in each line the second equality follows upon using the special vacuum relations (2.13) and (2.17). As expected, the period and dual period integrals are exchanged under S-duality. This result is quite useful since it allows us to deduce how S-duality acts on the gauge coupling τ . Indeed, if we take into account the link (2.20) between a D and a, and apply to it the S-duality transformations, we find Consistency with (3.14) implies that (3.17) Here we have used (2.19) and (2.14). This is precisely the case k = 1 of the general formula (2.29), and thus we conclude that the coupling τ that appears in the relation between a and a D is actually τ 1 , according to our definition in (2.28). As we have already noticed, in the arithmetic cases N ∈ {2, 3, 4, 6}, the constant λ in (3.17) takes integer values.

The arithmetic theories
In this section, we collect the results obtained from localization calculations for the lower rank SQCD models and accumulate evidence for our conjecture regarding the form of the period matrix and the S-duality transformations of the quantum couplings that we anticipated at the end of Section 2.3. While the SU(2) and SU(3) theories have already been studied in the literature, for completeness we start by briefly recalling the main results for these cases.

N = 2
In this case, the period matrix is just a complex constant given by where τ 1 is the only effective coupling of this theory. Using multi-instanton calculations (see for example [9,27]), one can show that which can be inverted order by order to give where q 1 = e 2πiτ 1 and η is the Dedekind η-function. The non-trivial relation between q 0 and the effective coupling for the SU(2) theory was first noticed in [30,31]. The analysis of the previous section shows that under the S-transformation, the period matrix transforms under a symplectic Sp(2, Z) transformation 6 : From this it follows that the effective coupling τ 1 transforms as in agreement with (2.28) since λ 1 = 4 for N = 2. Using this in (4.3), we get Furthermore, by computing the dual period we find in agreement with the general formula (2.20) for ω = −1.

N = 3
In this case the period matrix turns out to be proportional to the SU(3) Cartan matrix where τ 1 has the following instanton expansion (see for example [17,27]) As for the SU(2) case, the SU(3) theory in the special vacuum has a single τ 1 -parameter even after the quantum corrections are taken into account. On inverting the above expansion, we get where, as before, q 1 = e 2πiτ 1 . Again, we have provided a non-perturbatively exact expression in terms of η-quotients. Using the Sp(4, Z) matrices derived in Section 3, one can check that S-duality leaves the SU (3) Cartan matrix invariant and acts on τ 1 as [17]: in agreement with (2.29) since λ 1 = 3 for N = 3; using this in (4.10), we easily see again that Finally, on computing the dual period in this case we find which confirms the general formula (2.20) since for SU(3) ω = e 2πi 3 .

N = 4
We now turn to the SU(4) theory. As always, the classical period matrix is proportional to the Cartan matrix of the gauge Lie algebra but this time another independent matrix structure appears when one takes into account the 1-loop and the instanton corrections.
We have explicitly checked up to three instantons that it is possible to write the quantum period matrix as where M 1 and M 2 are two 3 × 3 matrices given by 15) and the two couplings τ 1 and τ 2 have the following instanton expansions On inverting these expansions we find where we have introduced the notation for k = 1, 2. Once again, as for N = 2 and 3, the bare coupling can be expressed as a quotient of η-functions of the renormalized couplings. Notice that the q 0 -expansion of τ 2 is the same as that of the effective coupling of the SU(2) theory (see (4.2)). Although this coincidence may appear surprising at first glance, it is actually a consequence of the fact that this pair of couplings transform in the same way under S-duality. We will explicitly show this below, but this result can be anticipated by noticing that the general formula (2.29) implies that λ 2 for N = 4 and λ 1 for N = 2 are both equal to 4. 7 Let us now consider the action of S-duality on the period matrix (4.14). Using the Sp(6, Z) transformations (3.8), we find that M 1 and M 2 are left invariant while with λ 1 = 2 and λ 2 = 4, exactly as predicted by (2.28) and (2.29). Using these transformations in (4.17), we can check also in this case that By computing the dual period a D ≡ a D 3 in terms of a ≡ a 1 , we find in agreement with (2.20) for ω = i.

N = 6
We now turn to the last arithmetic case, namely the SU(6) theory. We have verified using localization techniques up to two instantons that in the special vacuum the period matrix can be written as a sum of three independent structures as follows where We easily recognize that the q 0 -expansion of τ 2 is the same as that of the effective coupling of the SU(3) theory (see (4.9)), and that the q 0 -expansion of τ 3 is the same as that of the coupling τ 2 appearing in the SU(4) theory which, as we already remarked, is also the same as the coupling τ 1 of the SU(2) theory. Again these facts are a consequence of the symmetries of the formula (2.29) which imply that these pairs of couplings have the same transformations under S-duality. Inverting the expansions (4.24), we obtain where we have used the notation (4.18). We observe that there appears to be no simple way to express q 0 in terms of η-quotients of τ 1 . However, we will revisit this issue in Section 5 where we will provide for all SU(N ) models a universal formula for q 0 in terms of modular functions of any renormalized couplings τ k , thus including also the τ 1 of the SU(6) theory.
Let us now consider the S-duality action on the period matrix (4.22). Under the Sp(10,Z) transformation given in (3.8), we find that the three matrices (4.23) remain invariant while the couplings transform as with λ 1 = 1, λ 2 = 3 and λ 3 = 4 in full agreement with (2.29). Exploiting the η-quotient expressions in (4.25), one can easily prove that the S-transformations of τ 2 and τ 3 lead again to Finally, by computing the dual period a D ≡ a D 5 in terms of a ≡ a 1 in the special vacuum, we obtain a D = −aτ 1 (4.28) which confirms once more (2.20), since for SU (6) we have ω = e πi/3 .
Besides the S-duality action we should also consider the T-duality transformation of the effective couplings which is simply 8 Thus the previous results can be summarized by saying that in the arithmetic cases the duality transformations act as fractional linear transformations on each of the τ k and form a subgroup of PSL(2,R) generated by with λ k ∈ {1, 2, 3, 4} as given by (2.29). We call this subgroup Γ * (λ k ). For λ k = 1 this is the usual modular group PSL(2,Z).

S-duality and j-invariants for the arithmetic theories
In this section we collect the results obtained so far and explain how our definition of Sduality fits in the general discussion presented in [2]. If we describe the SU(N ) theory in the special vacuum by the Seiberg-Witten curve in the Gaiotto form then S-duality can be described as an action on the (x, t) variables given by [2] S : ( which effectively amounts to an inversion of the bare coupling 9 : We have already seen in various explicit examples that the rule (5.3) is implied by the Sduality transformations of the renormalized couplings τ k of the arithmetic theories, namely 8 See Section 5.1 for the SU(2) case, which has a distinct T -transformation. 9 The curve (5.1) retains its form if (5.3) is accompanied by uN → (−1) N uN /q0. with λ k ∈ {2, 3, 4}. Actually, all these cases can be combined together by observing that the η-quotients in (4.3), (4.10), (4.17), (4.25) can be written as from which the inversion rule (5.3) immediately follows upon using the transformation properties of the Dedekind η-function under (5.4). The only case that is not covered by this formula is the relation between q 0 and τ 1 in the SU(6) theory, given by the first line of (4.25), for which there seems to be no simple expression in terms of η-quotients. 10 However, the argument based on the transformation properties of the curve (5.1) is completely general; thus, also in this case the S-duality transformation τ 1 → −1/τ 1 should imply, for consistency, an inversion of q 0 . We will solve this problem in the following subsections, and in doing so we will actually find a new way of writing a non-perturbatively exact relation between the bare coupling and the effective ones. This will turn out to be valid not only in all arithmetic cases, including the SU(6) theory mentioned above, but also in the non-arithmetic theories, thus opening the way to make further progress. Before doing this, however, we briefly revisit the SU(2) theory in order to clarify some issues that are specific to the N = 2 case.

The S-duality group of the SU(2) gauge theory
In the SU(2) gauge theory with four fundamental flavours there is only one renormalized coupling constant τ 1 , which is related to the bare coupling constant by the non-perturbative relation (5.5) with λ 1 = 4. This might seem unfamiliar, given that it was already proven in [4] that the S-duality group for this theory is the full modular group PSL(2, Z). We now explain how this enhancement takes place within the formalism of our paper. Let us rewrite the non-perturbative relation between the bare coupling and the renormalized coupling using the standard Jacobi θ-functions as follows: One can check that this coincides with the η-quotient expression in (4.3). We have already seen that the S-transformation acts as follows on the renormalized coupling τ 1 : The key point is that only for the SU(2) theory, there is a shift symmetry of the form This is because, in the presence of massless hypermultiplets in the doublet pseudoreal representation, the SU(2) theory enjoys a shift symmetry of the effective θ-angle: θ → θ + π , (5.9) 10 Note that in this case we have λ1 = 1 which cannot be used in (5.5).
Using the non-perturbative relation (5.6), the T -transformation (5.8) leads to the following action on the bare coupling constant: Note that this symmetry transformation exists only for the SU(2) gauge theory because in all other cases the T -action leaves the bare coupling invariant, since it shifts τ by an integer. Combined with the S-transformation, which inverts q 0 , one can check that We now show that this is completely consistent with the Gaiotto formulation of the S-duality group on the bare coupling constant. The Gaiotto curve for the SU(2) case is [2]: In this expression there is a symmetry between the poles at t = 0 and t = 1. 11 Thus, besides (5.2), there is another transformation which leaves the curve invariant, namely [2] T : It is easy to check that T precisely generates the transformation (5.11). Therefore, in the SU(2) theory the S-duality group is enhanced to the full modular group PSL(2,Z), on account of the half-integer shift of the τ -parameter.

Renormalized couplings and j-invariants
Let us now return to the issue of finding a non-perturbative relation between the renormalized coupling τ 1 of the SU(6) theory and the bare coupling constant. The new and key ingredient is the Klein j-invariant function j(τ 1 ) for the modular group PSL(2,Z) which is the S-duality group for the τ 1 coupling of the SU(6) theory. The j-invariant has the following weak-coupling expansion with q 1 = e 2πiτ 1 , and is such that The j-invariant is also called hauptmodul (see for example [33]), and is such that all rational functions of j are modular. 11 For generic N , there is a higher order pole at t = 0.
Using (5.14), it is possible to verify that which is precisely the same expansion appearing in the first line of (4.25) that was obtained by inverting the instanton series. Based on this evidence, we propose that the exact relation between the bare coupling q 0 and the renormalized coupling τ 1 is Further evidence in support of this proposal is its behaviour under τ 1 → −1/τ 1 . This is derived from the monodromy of j around the fixed point of this action, i.e. τ 1 = i, namely which implies the inversion of q 0 as it should be. This approach is easily generalized, since hauptmoduln have been studied for the duality groups Γ * (λ k ) of the arithmetic theories. 12 Indeed, following [34] for λ k ∈ {1, 2, 3, 4} we introduce the functions j λ k given by where in the first line E 4 is the Eisenstein series of weight 4. It is possible to check that j 1 coincides with the j-invariant introduced above, while j 2 , j 3 and j 4 are generalizations thereof. 13 Notice that in (5.19b)-(5.19d) we find precisely the η-quotients appearing in the relations between the bare coupling q 0 and the renormalized couplings τ k . Solving for these quotients in terms of the j λ k 's and inserting the result in (5.5), we obtain Recall that the duality group is generated by S and T as defined in (4.30). 13 Our definition of the j-invariants differ from those in [34] by a constant term, which does not affect its invariance under the duality group.
Eq. (5.20) has the same structure as (5.17); however, this is more than a formal analogy. On consulting Fig. 1, one sees that the location of the corners of the fundamental domain -which are the fixed points of the S, ST −1 , and T transformations -are given by respectively. Furthermore, one can show that [34] which is a direct generalization of (5.15), while from the monodromy of j λ k around the fixed points of S, namely one easily deduces from (5.20) that q 0 gets inverted under S-duality, as expected.
In Tab. 1 we collect the relevant properties of these j-invariants together with their expansions around the cusp point at infinity. In particular we observe in the last column that the weak-coupling expansions of the bare coupling q 0 are in perfect agreement with the results presented in Section 4.
{1, 2, 3, 4} -the S-duality groups Γ * (λ k ) are particular instances of Hecke groups. A Hecke group H(p) is a discrete subgroup of PSL(2,R) whose generators T and S satisfy where p is an integer ≥ 3. 14 When p = 3 the Hecke group is the modular group PSL(2,Z).
Using the results of Section 4, it is not difficult to realize that Γ * (λ k ) = H(p k ) where For the four arithmetic cases the correspondence between λ k and p k is summarized in Tab. 2.
λ k 1 2 3 4 p k 3 4 6 ∞ Table 2. The correspondence between λ k and p k according to (6.2) in the arithmetic cases.
Notice that these are the only cases in which both λ k and p k are integers. By combining (2.29) and (6.2), we find 1 for k = 1, . . . , N 2 . This formula can be formally extended beyond the arithmetic cases where, in general, p k becomes a rational number.
The Hecke groups H(p) also exist when p ∈ {3, 4, 6, ∞}; moreover they admit a generalization into the so-called triangle groups [19] which we conjecture can be further extended for rational p. In the following we show that the action of the S-duality group on the 14 The constraints (6.1) are usually implemented by S : τ → − 1 τ and T : τ → τ + 2 cos π p .
By setting τ = 2 cos π p τ , we see that on τ the group H(p) coincides with Γ * (λ) with λ = 4 cos 2 ( π p ). renormalized couplings of the SU(N ) SQCD theories for arbitrary N is precisely that of a generalized triangle group. Furthermore, we show that the j-invariant or hauptmodul associated to these triangle groups appears in the non-perturbative relation between the bare coupling and the renormalized ones, exactly as in the arithmetic cases.

A short digression on triangle groups
We follow closely the presentation of [19], often considering special cases of their formulas for our purposes. Triangle groups are defined by a triple of integer numbers m i that form the so-called type t = (m 1 , m 2 , m 3 ) and correspond to the orders of the stabilizers. These groups are Fuchsian, i.e. they are discrete subgroups of PSL(2, R). The type t defines a set of angular parameters v i = 1/m i , which are related to deficit angles πv i at the cusps of the corresponding fundamental domain. In what follows, we will analyze in particular types of the form t = (2, p, ∞) corresponding to the Hecke groups H(p) if p is an integer, and to their generalizations if p is a rational number. In the latter case the associated triangle groups are not discrete.
Let us first consider a type t = (m 1 , m 2 , ∞). Using Theorem 1 of [19], we define the parameter d t according to where the primed variables are given by with v i = 1/m i . Introducing the rescaled variable q = q d t (6.6) with q = e 2πiτ , the hauptmodul J t for this triangle group has a weak-coupling expansion in q of the form The coefficients c k are uniquely determined by the following Schwarzian equation .
Here the dots denote the logarithmic τ -derivatives. The hauptmodul that will be relevant for us is the one whose weak-coupling expansion begins with q −1 . This is simply obtained by rescaling J t according to Let us check these formulas for t = (2, 3, ∞) which corresponds to H(3) = PSL(2, Z). When p = 3 the corresponding λ is 1 as we see from Tab. 2, and thus instead of the subscript t we can use the subscript 1 in all relevant quantities. In this case we have Substituting this into (6.4), we find while the Schwarzian equation (6.8) becomes .
In a similar way one can check that for t = (2, p, ∞) with p ∈ {4, 6, ∞}, the above formulas correctly lead to the expressions of the j-invariants and the d parameters of the other arithmetic cases that are summarized in Tab. 1. However, as we have already mentioned, these same formulas can be used also for other integer values of p and formally extended to the case in which p is a rational number. As a first example of this extension we consider the SU(5) SQCD theory.

N = 5
Using localization techniques we have computed the prepotential and the period matrix of the SU(5) theory with 10 massless flavours up to 2 instantons. In the special vacuum we find that the period matrix Ω can be conveniently written as a sum of two independent structures, in agreement with the general formula (2.27). Defining the quantum corrected period matrix can be written as This structure is less cumbersome than it appears at first sight. Indeed, one can check that the parameters λ 1 and λ 2 in (6.15) are another instance of the general formula (2.29) and that where C is the Cartan matrix of SU (5). Moreover, the classical and the logarithmic terms of τ 1 and τ 2 exactly coincide with the results already reported in [24]. But, most importantly, using the S-duality transformations described in Section 3, one finds that the matrices M 1 and M 2 remain invariant while the effective couplings transform simply as These observations show that the SU(5) theory has the same general features we encountered in the arithmetic cases. Therefore it is natural to expect that also this theory can be understood along the same lines, and in particular that it is possible to write nonperturbatively exact expressions for the relations between the bare coupling and the renormalized ones in terms of hauptmoduln. We now confirm that these expectations are correct. Let us first put k = 2. The form of λ 2 in (6.15) indicates to us that the relevant Hecke group is H(10). Indeed, for k = 2 and N = 5, equation (6.3) yields p 2 = 10 so that the type of the triangle group is t 2 = (2, 10, ∞). Using this in (6.4), with a little bit of algebra we obtain while from (6.8) we get the following rescaled hauptmodul This function is such that where τ A,B,C 2 are the cusp locations in the τ 2 -plane given by (5.22) with the current value of λ 2 . Notice also that the quantity in square brackets in (6.22) also appears in the 1-loop logarithmic term of (6.19).
These facts and our experience with the arithmetic theories indicate that it is in fact not too bold to propose that the relation between the bare coupling q 0 and the renormalized coupling τ 2 be of the general form (5.20), namely Inverting this series and taking the logarithm, we obtain 2πi τ 2 = log q 0 + iπ + log 4d λ 2 + 12 25 q 0 + 25 125 q 2 0 + · · · (6.26) which precisely matches the instanton expansion for τ 2 in (6.19) obtained using equivariant localization! Furthermore, from the monodromy around τ A 2 which is the fixed point under we see that q 0 gets inverted, in agreement with the general expectations. This analysis shows that the action of the S-duality group on the effective coupling τ 2 of the SU(5) theory is that of the Hecke group H(10). We now turn to k = 1 and the quantum coupling τ 1 . The form of λ 1 in (6.15) indicates that we are dealing with a non-Hecke group. Indeed, setting k = 1 and N = 5 in (6.3), we get p 1 = 10 3 which leads to the type t 1 = (2, 10 3 , ∞). Despite the non-integer entry of t 1 , we still proceed and apply the formulas we have described in the previous subsection to obtain d λ 1 and the hauptmodul j λ 1 (τ 1 ). Specifically, from (6.4) after some algebraic manipulations we get while from the Schwarzian equation (6.8) we find the following rescaled hauptmodul with q 1 = e 2πiτ 1 . This function is such that where τ A,B,C 1 are the three cusps in the τ 1 -plane (see (5.22)). Plugging these results into our universal formula (5.20), we get (6.31) Inverting this and taking the logarithm of q 1 , we obtain 2πi τ 1 = log q 0 + iπ + log 4d λ 1 + 8 25 q 0 + 14 125 q 2 0 + · · · (6.32) which is in perfect agreement with the explicit result (6.18) derived from localization! Again, from the monodromy around τ A 1 , which is the fixed point of S, we easily see that under S-duality q 0 is correctly mapped into its inverse.
In conclusion, the SU(5) theory has two non-arithmetic couplings which are related to the bare coupling by the same universal formula that holds in the arithmetic theories.

Generalization to higher N
The analysis of the previous subsection can be extended to arbitrary values of N . Even if the algebraic manipulations become more and more involved as N increases, it is possible to prove that the quantum period matrix can always be written as where each individual coefficient τ k transforms under the duality group according to for some positive λ k . To show this, let us first consider N to be an odd number. In this case a careful analysis [25] of the duality transformations on the homology cycles of the Seiberg-Witten curve shows that S and T have to satisfy the constraint S T S −1 T N = 1 . The latter solution, however, leads to an additional constraint of the form (S T ) N = −1, which is not found in the explicit realization of the S and T transformations as Sp(2N −2, Z) matrices [25]. This leaves us with the solution (6.37) which is precisely the spectrum we conjectured and found to be true in all cases we have considered so far.
The matrices M k can be given an explicit expression too. The key ingredient for this is the matrix G appearing at 1-loop (see (2.26)). Decomposing it into its N 2 independent components according to it turns out that the matrices satisfy the required properties. Notice also that these matrices add up to the Cartan matrix: We have explicitly checked and verified these statements up to N = 15.
Having the spectrum of the allowed λ k 's, from the cosine expression in (6.37) we see that the type of the generalized triangle group that we should consider is , ∞ (6.42) whose second entry is in general a rational number. As we have seen in the SU(5) theory, there are no obstructions in extending the formulas (6.4), (6.7) and (6.9) to types with a rational entry. Thus, proceeding as we described in the previous subsections, we can determine d t k and the hauptmoduln j t k corresponding to (6.42) and use the resulting expressions into the universal formula (5.20) to find the exact relation between the bare coupling q 0 and the renormalized one τ k . If this procedure is correct, inverting this map order by order in q 0 we should retrieve the multi-instanton expansion produced by the localization method, exactly as we showed for N = 5. In Appendix B we give some details for the case N = 7, where again we finding perfect agreement. At this point, it should be clear that our procedure works for arbitrary values of N . We regard the complete agreement between these two approaches as a highly non-trivial and quite remarkable check on the consistency of the procedure. The above results are valid also when N is even. In this case, the spectrum of λ k is still given by (6.37) while the matrices G k and M k are defined by (6.39) and (6.40) with the caveat that for k = N 2 one should use We have checked this is indeed the case up to N = 14.

Relation to earlier work
We now show that our analysis is consistent with earlier discussions of S-duality in conformal SQCD theories and that it extends them in several aspects. Consider the Seiberg-Witten curve (3.1) for the massless case and in the special vacuum: Using our results, we can write the function h in terms of the renormalized couplings as follows: . (6.45) This shows that for any N the Seiberg-Witten curve can be expressed in terms of jinvariants. Of course, any of the renormalized couplings can be chosen as long as the appropriate j-invariant is used. Let us now consider the behaviour of h near the cusp points (5.22). Using (5.23), it is easy to find that Given the meaning of the fixed points, we conclude that the monodromy of h around ∞, 1 and 0 yields, respectively, the behaviour under S, ST −1 and T . This is precisely what we began with in Section 3. There, we obtained the T and S matrices by associating them with monodromies around the points h = 0 and h = ∞, respectively, and by following their effects on theα-andβ-cycles of the Seiberg-Witten curve. It is reassuring to rederive this very same result by studying the action of the duality group on the quantum couplings τ k . This provides additional confirmation for our proposal (5.20).
There are a number of novel elements in our discussion compared with earlier works [24,25,29]. To begin with, we note that (5.20) represents a non-perturbatively exact relation between the bare and renormalized coupling constants. As we have shown in a case-by-case study, this completely specifies the manner in which all N 2 coupling constants are renormalized for all SU(N ) theories in the special vacuum.
Furthermore, we observe that previous investigations have focused on a specific renormalized coupling, which in our notation, is τ [ N 2 ] . For odd N , the type (6.42) corresponding to k = N 2 is (2, 2N, ∞), which identifies the Hecke group H(2N ), while for even N , the type becomes (2, ∞, ∞) corresponding to the Hecke group H(∞) which is isomorphic to Γ 0 (2). Thus, we have successfully reproduced the observations of [25,35,36] that these Hecke groups are relevant when considering the duality properties of SU(N ) theories. However, as we have tried to emphasize, one does not need to single out any specific quantum coupling τ k in order to understand the S-duality group. Indeed, one could choose to express q 0 in terms of any of the τ k 's since the behaviour of the curve near the cusps is universal and independent of this choice.
While this remains true away from the massless limit (provided the mass deformations are turned on in a controlled manner), we find that expressing the observables in terms of specific effective coupling constants τ k instead of the bare coupling q 0 expedites the identification of modular structures. In particular, the choice of which effective couplings to consider follows solely from S-duality constraints. This, in turn, makes it possible to resum the non-perturbative data of the gauge theory into modular forms associated to congruence subgroups of the full modular group. This analysis is the subject of Part II.

Part II
Massive N = 2 SQCD and modular anomaly equations In this part, we discuss N = 2 SQCD theories with 2N massive fundamental hypermultiplets in the special vacuum. In order to retain the Z N symmetry of the special vacuum, we will consider only mass configurations that preserve this symmetry. Furthermore, we will restrict our attention to the arithmetic theories. The reason for this is just a matter of simplicity. Indeed, as we will see, in the arithmetic theories the S-duality groups Γ * (λ k ) contain subgroups that are also congruence subgroups of the modular group PSL(2,Z), so that the analysis of the modular properties of the various observables can be done using standard modular forms, without the need of introducing the more involved theory of automorphic forms. Since the SU(2) and SU(3) SQCD theories have already been considered from this point of view in [11,12] and in [17] respectively, we will discuss in detail the other two arithmetic cases, namely N = 4 and N = 6, even if many of the subsequent formulas are valid for arbitrary N .

Mass deformations and observables
While the classical prepotential (2.4) is unaffected by mass deformations, the 1-loop prepotential (2.8) becomes Expanding for small masses, one obtains an expression in which the 2N fundamental masses appear through the Casimir invariants of the flavour group, namely for = 1, . . . , 2N . As we mentioned above, in order not to spoil the Z N symmetry of the special vacuum, we turn on only those flavour Casimirs that are Z N -symmetric. This can be done by choosing the following mass configuration where ω = e 2πi N , which in turn implies with all other T vanishing. In what follows, by special vacuum we will mean both the restriction (2.12) on the scalar vacuum expectation values and the above choice of masses. As discussed in Section 2.3, the Z N -invariance of the special vacuum implies that the prepotential has a semi-classical expansion of the form (2.15), but now the coefficients f n depend also on the mass invariants (7.4), namely The f n 's must have mass-dimension equal to (nN + 2), but since q 0 is dimensionless and T N and T 2N have dimensions N and 2N respectively, it is not possible to satisfy this requirement. As a result, in the massive case as well, the special vacuum prepotential vanishes identically.
Let us now turn to the dual period a D . When the 1-loop and instanton corrections are taken into account, we find where c N is defined in (2.19). This form, which will be confirmed by the explicit examples worked out in the later sections, can be argued simply using dimensional analysis because g (1) n has mass dimension (N n+N ) and can be constructed out of the Z N -invariant Casimirs T N and T 2N . Finally, we consider the period matrix Ω. Its decomposition in terms of the matrices M k that diagonalize the S-action remains valid Ω = τ 1 M 1 + τ 2 M 2 + · · · , (7.7) but now the coefficients acquire terms proportional to the flavour Casimirs. In particular one finds Detailed examples will be given in the following sections.

S-duality in massive SQCD
To see the implications of S-duality in massive SQCD theories, we use the same approach described in [17] for the SU(3) theory and introduce the following combination where g n ≡ g (1) n (τ 1 ; T N , T 2N ). We now perform an S-duality transformation on the first line of (8.1) and use (3.14), (3.16) and (3.17); after some simple algebra we get On the other hand, applying S-duality to the second line of (8.1) we get If we now substitute the expression (7.6) for a D and equate the two different expressions for S(X) order by order in the large-a expansion, we can deduce how the coefficients g n transform under S. From the leading term, we simply find where λ 1 is as in (3.17). For the higher order terms, however, we find non-linear contributions that lead to a recursion relation (8.5) The summand on the right hand side is symmetric under m → (n − m − 1), and thus S(g n ) can be more conveniently written as The presence of the (−1) n factor suggest to us that the notion of S-parity or charge under S-duality will be a useful one. We define it to be (+1) when n is even and (−1) when n is odd. So far N has been generic, but to make further progress from now on we will restrict our attention to the arithmetic cases for which λ 1 is an integer. In fact, in these cases the S-duality group Γ * (λ 1 ) contains a subgroup, denoted as Γ 1 (λ 1 ), which is also a congruence subgroup of PSL(2,Z). The modular forms of such a subgroup, which are well-known and classified (see for instance [37,38]), will play a crucial role in our analysis and will appear in the exact expressions of the coefficients g n . To see this, let us first recall that Γ 1 (λ 1 ) is generated by T and S = ST S −1 , the latter acting on the effective coupling as When λ 1 is an integer, this is indeed an element of PSL(2,Z). Combining the actions of S and T , we can easily deduce how the conjugate periods a and a D transform under S . The result is S (a D ) = a D and S (a) = a + ω(1 − ω)a D . (8.8) Using these rules on X, from the first line of (8.1) we get while from the second line of (8.1) we find (8.10) Equating these two expressions, to leading order we obtain while at higher orders we get a recursion relation very similar to the one obtained before for S, namely Eq. (8.11) shows that g 0 is a modular form of Γ 1 (λ 1 ) with weight (N − 2). As we will see in the specific examples in the next section, such a modular form behaves under S exactly as required by (8.4), thus proving the consistency of our analysis. On the other hand, the presence of non-linear terms in the right hand side of (8.12) implies that the coefficients g n for n > 0 are quasi -modular forms of Γ 1 (λ 1 ) with weight (N n + N − 2) that satisfy a modular anomaly equation to which we now turn.

The modular anomaly equation
In [11,12,17] it has been shown that in the massive SU(2) and SU(3) theories the quasimodularity is due to the presence of the anomalous Eisenstein series E 2 . The same conclusion has been reached for the N = 2 theories with arbitrary gauge groups in [13][14][15]. Therefore it is very natural to expect that for the massive higher rank SQCD theories too, the Eisenstein series E 2 plays a fundamental role. Let us recall that E 2 is a quasi-modular form of weight 2 such that In the arithmetic cases under consideration, it is always possible to form a linear combination of E 2 and a modular form of Γ 1 (λ 1 ), which under the S transformation τ 1 → − 1 transforms in a way similar to (8.13). More precisely, if we denote such a combination by E (λ 1 ) 2 , we will have Notice that the existence of such a combination is a priori not obvious since the Stransformation lies outside both the modular group and its congruence subgroup Γ 1 (λ 1 ).

Nevertheless this combination exists and the explicit examples for the relevant cases are given in Appendix A (see in particular (A.15), (A.24) and (A.30)).
Following [11,12,17] we propose that the coefficients g n depend on τ 1 only through E (λ 1 ) 2 and the modular forms of Γ 1 (λ 1 ), in such a way that they are globally quasi-modular forms of Γ 1 (λ 1 ) with total weight (N n + N − 2). For simplicity, in the following we will only exhibit the dependence on E (λ 1 ) 2 and just write g n E (λ 1 ) 2 . Then, applying S-duality, we have where the second line follows upon expanding for large τ 1 . Comparing with (8.6) we obtain the modular anomaly equation which has the form of a recursion relation. Indeed, given the initial condition that specifies g 0 as a modular form, the E 2 -dependent part of g 1 can be unambiguously obtained by integrating the modular anomaly equation. This leaves room for a truly modular piece, which can be fixed by comparing with the explicit instanton expansion obtained using localization. Once g 1 is fully fixed, we can use it in (8.16) to find g 2 , and recursively proceed in this way for the higher g n 's. This approach has been successfully applied to the SU(3) theory in [17]. In the next sections we complete the analysis for the SU(4) and SU(6) theories.

Coupled modular anomaly equations
We now consider the period matrix Ω. As we mentioned in Section 7, after including the quantum corrections it can be decomposed as in (7.7) where, under S-duality, the flavour deformed couplings τ k transform as The fact that τ k behave like τ k is a simple consequence of the algebraic properties of the matrices M k . Applying S-duality to both sides of (7.8), we get n−1 (8.18) which, after inserting the semi-classical expansion (7.6) for the dual period, yields the Sduality transformation rules for the coefficients g n . In particular, at leading order we find while at higher orders we get (8.20) When k = 1, both (8.19) and (8.20) reduce to (8.4) and (8.6), respectively. This is a simple but important consistency check of our analysis. We now perform a similar analysis for the S transformation under which each effective coupling τ k changes as Since in the arithmetic theories the λ k 's are integers, this is a PSL(2,Z) transformation.
Using the general technique of comparing coefficients in the semi-classical expansions, we obtain the following constraint for g while for the higher coefficients g (k) n we get Again it is not difficult to check that for k = 1 these two equations reduce respectively to (8.11) and (8.12), as it should be. From (8.22) combined with (8.19), we can infer that g is a ratio of a modular form of Γ 1 (λ 1 ) with weight N and a modular form of Γ 1 (λ k ) with weight 2. Likewise, by combining (8.23) with (8.20) we deduce that for n > 0 the coefficients g (k) n are quasimodular meromorphic forms of Γ 1 (λ 1 ) and Γ 1 (λ k ) which receive contributions from both E . Taking into account the factors multiplying the square brackets in (8.20) and (8.23), we are led to the following ansatz: where the coefficients G r 1 ;r k n (τ 1 , τ k ) are made of modular forms of Γ 1 (λ 1 ) and Γ 1 (λ k ) with weights r 1 and r k respectively. Using the anomalous transformation properties of the second Eisenstein series, from (8.24) we get and, after comparison with (8.20), we arrive at the following coupled equations In order for these equations to be consistent and integrable, it is necessary that the mixed second derivatives computed from either line of (8.26) match. We find that this is indeed the case, since we have Given the structure of the modular anomaly equations (8.26), this is a non-trivial check which makes it possible to "integrate-in" the quasi-modular terms in a consistent manner.
9 Resummation: the cases N = 4 and N = 6 In this section we study in detail the SU(4) and SU(6) gauge theories along the lines discussed before. Throughout this section, we use special cases of the formulas derived in the previous section, i.e. setting N = 4 or N = 6 as the case may be.

N = 4
For the SU(4) theory the relevant parameters are:

The dual period
We have computed the SU(4) prepotential, the dual periods, and the period matrix up to three instantons using localization methods. From these results, after using the relation (4.17a) to rewrite the instanton counting parameter q 0 in terms of the renormalized coupling q 1 , we find that the dual period can be written as in agreement with the general form (7.6). The first coefficients g n are g 0 = T 4 12 1 + 24 q 1 + 24 q 2 1 + 96 q 3 1 + · · · , (9.3a) where, as usual, we have set q 1 = e 2πiτ 1 .
Our goal is to show that these expressions arise from a weak-coupling expansion of quasi-modular forms of Γ 1 (2). Indeed, according to the discussion of the previous section, we should have S(g n ) = (−1) n i √ 2τ 1 4n+2 g n + · · · , S (g n ) = (1 − 2τ 1 ) 4n+2 g n + · · · . (9.4) In particular for n = 0 when there are no extra terms beyond leading order, these equations tell us that g 0 should be a modular form of Γ 1 (2) with weight 2 and S-parity (+1). As shown in Appendix A there is only one such form, namely f 2,+ whose weak-coupling expansion is f 2,+ = 1 + 24q 1 + 24q 2 1 + 96q 3 1 + 24q 4 1 + 144q 5 1 · · · . (9.5) Comparing with (9.3a), we are led to conclude 2,+ , (9.6) which, to be consistent with (9.4), implies also that T 4 is invariant under both S and S transformations, namely S(T 4 ) = S (T 4 ) = T 4 . We would like to stress that once we assume that g 0 is a modular form Γ 1 (2) of weight 2, the only freedom we have is the overall coefficient which is fixed by matching with the perturbative contribution. After this is done, all non-perturbative terms are fixed by the Fourier expansion of the modular form. The fact that these terms perfectly match the explicit multi-instanton results coming from localization up to three instantons is a very strong and highly non-trivial test of our general strategy.
To obtain the coefficients g n for n > 0 we can use the recursion relation (8.16), which in the present case is where E 2 is the quasi-modular form introduced in Appendix A (see in particular (A.15)). Let us now determine g 1 which according to our general analysis should be a quasi-modular form of of Γ 1 (2) with weight 6 and with S-parity (−1) that solves the above modular anomaly equation for n = 1, namely Integrating with respect to E (2) 2 and using the exact expression for g 0 obtained above, we find 2 + modular piece , (9.9) where by 'modular piece' we mean a modular form of Γ 1 (2) with weight 6 and with S-parity (−1). As shown in Appendix A there is only one such form, namely f 2,+ f Comparing with the localization result (9.3b), obtain the following exact expression 2,+ f 2,+ f 4,− . (9.11) As before, all coefficients are fixed by matching with the perturbative terms and following that, all non-perturbative contributions follow from the Fourier expansions of the modular forms. The agreement with the explicit multi-instanton results in (9.3b) is rather remarkable.
The above procedure can be iteratively used to determine the higher coefficients g n . In this way we have determined up to g 3 , always finding perfect agreement with the localization results.

The period matrix
In the special vacuum the period matrix Ω of the massive SU(4) theory can be compactly written as Ω = τ 1 M 1 + τ 2 M 2 (9.12) where the two matrices M k are given in (4.15) and This has the same form as (7.8), except that the coefficients are expressed in terms of the bare coupling q 0 instead of the renormalized ones; this is the meaning of the g (n) k notation. From our explicit calculations, using the non-perturbative relation (4.17a) we find g (1) n (q 0 ; T 4 , T 8 ) = g n (q 1 ; T 4 , T 8 ) (9.14) where the g n 's are the same coefficients appearing in the dual period, for which we have already given exact expressions. On the other hand, we find that the first g (2) n coefficients are The challenge is now to show that, once the bare coupling is mapped into the renormalized ones, the resulting expressions g (2) n have good modular properties. In particular for g (2) 0 , according to the general analysis of the previous section (see (8.19) and (8.22) for N = 4 and k = 2), we should have S g 0 . (9.16) These equations tell us that g (2) 0 is the ratio of a modular form of Γ 1 (2) in τ 1 with weight 4 and a modular form of Γ 1 (4) in τ 2 with weight 2, with total S-parity (+1). From the list of the modular forms presented in Appendices A for Γ 1 (2) and Γ 1 (4), we see that the most general ansatz which satisfies these properties is where the overall coefficient has been fixed to match with the perturbative result in (9.15a) and x is a free parameter. By Fourier expanding the modular forms and expressing the result in terms of the bare coupling q 0 , one sees that both meromorphic forms within square brackets are identical and both match the q 0 expansion in (9.15a). In the following we choose for simplicity x = 1, so that 15 0 g 0 , (9.19) where E 2 and E 2 are the quasi-modular forms of Γ 1 (2) and Γ 1 (4) defined in (A.15) and (A.30) respectively. Integrating (9.19) we find 2 + modular piece . (9.20) Once again, the perturbative terms are enough to fix all coefficients that are not determined by the modular anomaly equations; then, the instanton contributions follow by Fourier expanding the modular forms. The perfect agreement with the explicit result (9.15b) obtained from localization confirms in a very non-trivial way the validity of our procedure. Using this approach iteratively, we have computed higher g (2) k coefficients, finding complete agreement with the multi-instanton results.

N = 6
We now repeat the above analysis for the massive SU(6) theory. In this case the relevant parameters are:

The dual period
The large-a expansion of dual period of the massive SU(6) theory takes the form Using localization methods we have computed the coefficients g n up to two instantons and rewritten them in terms of the effective parameter q 1 by means the relation (5.17). The explicit expressions of the first coefficients are g 0 = T 6 5 1 + 240q 1 + 2160q 2 1 + · · · , (9.24a) g 1 = 12 T 2 6 q 1 + 258q 2 1 + · · · + T 12 22 1 − 264q 1 − 135432q 2 1 + · · · . (9.24b) Since λ 1 = 1 we expect to resum these expansions into standard modular forms of PSL(2, Z). In particular, from (8.4) and (8.11) we have S(g 0 ) = i τ 1 4 g 0 and S (g 0 ) = 1 − τ 1 4 g 0 , (9.25) which tell us that g 0 is a modular form of weight 4 with positive S-parity. The unique form of this kind is the Eisenstein series E 4 ; thus, matching the perturbative contribution we find Again, all instanton terms are dictated by the Fourier expansion of E 4 and are in perfect agreement with the localization result (9.24a). We also verify that g 0 satisfies (9.25) provided that T 6 is invariant under S-duality, namely S(T 6 ) = S (T 6 ) = T 6 . To obtain the coefficients g n with n > 0, we use the modular anomaly equation ( For example, integrating this equation for n = 1 and fixing the E 2 -independent part by comparing with the perturbative contributions, we get Using the Fourier expansion of the Eisenstein series it is easy to check that the instanton terms precisely match those in (9.24b). Proceeding iteratively in this manner one can derive the exact expressions of the higher coefficients g n . In particular we have explicitly computed a few higher g n , always finding perfect agreement with the localization results.

The period matrix
In the special vacuum the period matrix Ω of the massive SU(6) theory can be written compactly as where the three matrices M k are given in (4.23) while, using a notation similar to that of the SU(4) theory, the three effective couplings turn out to have the following semi-classical expansion The coefficients g (1) n coincide with the g n 's already discussed, while the first coefficients for k = 2 are We now show that these are the first few terms in the semi-classical expansion of rational functions of quasi-modular forms. Since the procedure is similar to that of the SU(4) theory, we will be brief in our discussion. Let us first consider g (2) 0 and g 0 , whose S and S transformations are S g 0 . (9.33) These formulas suggest that g (2) 0 should be expressed as a ratio of a modular form in τ 1 with weight 6 and a modular form of Γ 1 (3) in τ 2 with weight 2, with an overall S-parity equal to (+1). Likewise, g (3) 0 should be expressed as a ratio of a modular form in τ 1 with weight 6 and a modular form of Γ 1 (4) in τ 3 with weight 2, with an overall S-parity equal to (+1). Using the results collected in Appendix A, matching the weights and S-parities and fixing the overall normalization in agreement with the perturbative contributions, we find that a solution is By Fourier expanding the modular forms and expressing the result with bare coupling q 0 , we do not only recover the multi-instanton terms in (9.31a) and (9.32a) but also predict all other higher instanton contributions. As before, the coefficients g (k) n with n > 0 are obtained from the coupled modular anomaly equations (8.26), which in this case become where the quasi-modular forms E 2 for k = 2 and E 2 for k = 3 are given in (A.24) and (A.30), respectively. These equations can be solved in a straightforward manner and the undetermined modular terms can be fixed by comparing with the perturbative contributions in (9.31b) and (9.32b). In this way one obtains Again, by Fourier expanding the right hand sides and expressing everything in terms of the bare coupling q 0 , we retrieve the first instanton corrections in perfect agreement with the localization results (9.31) and (9.32), and predict all successive non-perturbative contributions. A similar analysis can be performed at the next orders; indeed we have checked that the higher coefficients g (k) n are successfully determined by these methods.

Discussion and outlook
In this paper we have obtained two sets of largely independent, but complementary results.
In the first part, we calculated the period matrix for massless N = 2 SQCD theories with gauge group SU(N ) in the massless limit in a locus of vacua possessing a Z N symmetry. We uncovered an interesting modular structure that becomes manifest only when the observables are written in terms of the N 2 renormalized couplings τ k . In particular, we have shown that on each of these couplings, the S-duality group acts as a (generalized) triangle group. We also proposed a non-perturbatively exact relation between the bare coupling and the renormalized ones in terms of the hauptmodul of the corresponding triangle group, namely .
This relation correctly reproduces the instanton expansion and we showed that it is consistent with expectations from S-duality. While previous investigations [25,29] concentrated essentially on only one of these effective couplings, which in our notation is τ N

2
, our analysis shows that S-duality is more transparent if we consider all individual couplings τ k . Of course, we could select one of them and express all the others in terms of it using the exact relation (10.1) via the bare coupling q 0 , but then the modular structure we have described is hidden.
There are many questions that remain to be explored. For example, it would be interesting to understand from "first principles" the spectrum of λ k , for which our caseby-case analysis provides the simple answer Using the universal formula (10.1), questions about the strong coupling properties of the gauge theory could be addressed in an explicit way because the behaviour of the hauptmodul j λ k around the strong coupling cusps in the τ k plane is well understood [19].
As an interesting curiosity, we observe that if we define then, in the arithmetic cases (see Tab. 1) the pairs (j λ k , j * λ k ) satisfy remarkable identities, called the Ramanujan-Sato identities, that take the form [39]: where the s A,B λ k (k) are integers. It would be interesting to understand if these mathematical identities hold also in the non-arithmetic cases and if they have any interpretation within the gauge theory.
In the second part, we considered massive SQCD theories with SU(N ) gauge groups, and restricted our analysis to mass configurations that respect the Z N symmetry of the special vacuum. We then showed that in this case the modular structure of the massless theory is deformed in an interesting manner. In particular we have proved that the period matrix maintains the same structure as in the massless case, while the renormalized couplings have a semiclassical expansion with mass dependent coefficients. In the arithmetic theories, these coefficients are constrained by S-duality to satisfy coupled modular anomaly equations whose solutions are meromorphic functions of quasi-modular forms of the congruence subgroups of the modular group.
A natural question to pose is whether these results can be extended to all SU(N ) theories. Since in the non-arithmetic cases the S-duality group has no subset in common with the modular group, we expect that the automorphic forms and Eisenstein series of the (generalized) triangle groups should play an important role. This subject seems to be of recent interest in the mathematical literature [19] and it might be worthwhile to explore this possibility.
Another extension of our work would be to study the modular structure in the special vacuum with generic masses or in the Ω-deformed theory [5,6]. An incentive to study this problem comes from the AGT correspondence [32,40]. Indeed, in the SU(2) theory with four flavours the non-perturbative relation between the bare and renormalized coupling plays an important role in writing the prepotential as quasi-modular functions. The quantum-corrected coupling constant is used to rewrite the null-vector decoupling equation as an elliptic equation [41][42][43]. This in turn can be used to obtain the Ω-dependent corrections to the prepotential in terms of modular functions in the Nekrasov-Shatashvili limit [44]. It would be nice to extend this approach to higher rank gauge theories using the non-perturbative relation (10.1). In [45,46] it was observed that for the SU(2) theory the relation between the bare and the effective coupling is encoded in the Zamolodchikov asymptotic recursion relation satisfied by the 4-point conformal blocks of the associated two-dimensional Liouville theory. It would be interesting to extend this analysis to higher rank theories in order to provide further checks on our formulas.
A more difficult but very interesting problem is to release the special vacuum constraints and analyse the theory at a generic point on the Coulomb moduli space, to see how the modular structures we have obtained are generalized. We hope to return to some of these issues in the near future.

The modular group PSL(2,Z) and Eisenstein series
The Eisenstein series E 2n are holomorphic functions of τ (with Im(τ ) ≥ 0), defined as where ζ denotes the Riemann ζ-function. For n > 1, the E 2n 's are modular forms of degree 2n. In particular, under τ → −1/τ they transform as This shows that the S-parity of E 2n is (−1) n . The E 2 series is instead quasi-modular: and has odd S-parity. All modular forms of degree 2n > 6 can be expressed in terms of E 4 and E 6 ; the quasimodular forms instead can be expressed as polynomials in E 2 , E 4 and E 6 . The Fourier expansions of the first Eisenstein series are E 2 = 1 − 24q − 72q 2 − 96q 3 + · · · , E 4 = 1 + 240q + 2160q 2 + 6720q 3 + · · · , where q = e 2πiτ .
Let us now consider the subgroup Γ generated by T and S = ST S −1 . As the results on the SU(6) theory reported in Section 9 explicitly indicate, the following expression f (1) 2,+ = 1 + 120q − 6120q 2 + 737760q 3 + · · · (A.5) plays a crucial role in matching the modular structure of the period matrix with the multiinstanton calculations. We notice that this expansion is accounted for if we write The presence of the square root seems to suggest that the modular group can be viewed as a two-sheeted cover of Γ . Moreover we observe that everything is consistent by requiring that f 2,+ be a modular form of weight 2 under Γ and with positive S-parity. This also explains the notation we have used.
Now consider the cube-root of f The modular forms of Γ 1 (3) form a ring generated by f 1,− and f 3,+ . In order to study quasi-modular forms of Γ 1 (3) we have to consider the second Eisenstein series E 2 which satisfies Finally, up to two instantons we find that the three renormalized couplings are given by 2πi τ 1 = log q 0 + iπ + log 4d λ 1 + 12 49 q 0 + 192 2401 q 2 0 + · · · , 2πi τ 2 = log q 0 + iπ + log 4d λ 2 + 20 49 q 0 + 370 2401 q 2 0 + · · · , 2πi τ 3 = log q 0 + iπ + log 4d λ 3 + 24 49 q 0 + 474 2401 q 2 0 + · · · , (B.5) with d λ 1 = 4611.1803 · · · , d λ 2 = 163.6225 · · · , d λ 3 = 69.8572 · · · . (B.6) It is worth noticing that all coefficients in the instanton expansion of the renormalized couplings are rational. According to the general discussion of Section 6, these formulas should follow upon using the hauptmoduln of certain (generalized) triangle groups in the universal formula (5.20). We now show that this is indeed the case for the SU(7) theory. Let us start from k = 3. Here we have λ 3 = 4 cos 2 π 14 and thus the S-duality group is simply the Hecke group H(14) whose type is t = (2, 14, ∞). Applying the formulas of Section 6.1, it is not difficult to find that the corresponding hauptmodul is where d λ 3 is precisely the same number given in (B.6). Now let us put k = 2. In this case we have λ 2 = 4 cos 2 3π 14 which implies that the S-duality group is a generalized triangle group with type t = 2, 14 3 , ∞ . As we observed in the main text, the formulas for the hauptmoduln can be formally extended also when the type has a rational entry. In this case we find with d λ 1 given in (B.6).
If we now plug these expansions in the universal formula (5.20) and invert the resulting series, we perfectly match the instanton results (B.5) obtained from localization, thus confirming also in this case the consistency of our proposal.