# Question on asymptotic behavior of exponential sum

Consider the following function, where below $$r$$ is a fixed real number, and $$q$$ is a positive integer

$$f(q) = \sum_{\substack{k = 1 \\ (k, q) = 1}}^{q} e^{\frac{2 \pi i k r}{q}}$$ I wished to determine the asymptotic behavior of this function as $$q \rightarrow \infty$$, for fixed $$r$$. When $$r$$ is an integer, I note that the above sum becomes the Ramanujan sum $$c_q(r)$$ which is $$O(1)$$ (since $$|c_q(r)| \leq \sigma(r)$$)

However for general $$r$$, it's not at all clear to me how to concretely bound this function, beyond the naive bound that $$f(q) \leq \phi(q)$$ I have a heuristic to think that $$f(q) = O(\sqrt{\phi(q)})$$ since we can think of $$f(q)$$ as a sum of $$\phi(q)$$ "random" exponential terms, which would have an expectation value of $$O(\sqrt{\phi(q)})$$. However, I am not sure how to make this argument rigorous.

• When $r=q$ the sum equals the trivial bound $\phi(q)$, and when $r$ is a real number very close to $q$ then the sum will still be very close to $\phi(q)$. Also, $|c_q(r)| \le \sigma(r)$ doesn't imply $c_q(r) = O(1)$ (or, perhaps, it needs to be made clearer which parameter(s) the $O$-constant may depend on). – Greg Martin Jul 31 '20 at 17:00
• Sorry, in the question above I was thinking of $r$ to be a fixed real number, and the asymptotic behavior as $q \rightarrow \infty$. In this context, if $r$ is an integer, then $|c_q(r)| \leq \sigma(r)$ does imply $c_q(r) = O(1)$ since then $\sigma(r)$ is a constant. I have updated the question to try to clarify this, if it helps. – chaiKaram Jul 31 '20 at 17:15

If $$r$$ is not an integer, we can rewrite the sum using geometric series: \begin{align*} \sum_{\substack{0\le k When $$d\ge r$$, say, we have $$e^{2 \pi i r/d}-1 = 2 \pi i \frac rd + O_r(\frac1{d^2}) = 2 \pi i \frac rd (1+O_r(\frac1d))$$. Therefore* \begin{align*} \sum_{\substack{0\le k where $$\tau(q)$$ is the number of divisors of $$q$$. So, surprisingly, the asymptotic behavior really is like $$\phi(q)$$. (Numerical experiments confirm this asymptotic formula.)

*I cheated with the terms $$d, but I think that this just gives a $$O_r(1)$$ error.

• As far as I can tell, the argument up to the third line ($= \sum_{d | q} \mu(d) \sum \ldots$ should hold regardless of whether or not $r$ is an integer. But this leads to concerning conclusions. As a concrete example, let $q$ be prime, and let $r$ be a multiple of $q$. Then we would expect that the sum should evaluate to $\phi(q)$, but the third line from your argument reduces to $\frac{e^{2\pi i r} - 1}{e^{2 \pi i r / q} - 1} - 1$ which reduces to 0/0 - 1. Also could you please explain how to go from line 1-2 of your argument (changing order of summation)? – chaiKaram Jul 31 '20 at 20:17
• Agreed, it is very surprising from the $\sum_{(k,q)=1}$ formula, but obvious once put in the Möbius inversion form. I think we should add it to en.wikipedia.org/wiki/… – reuns Jul 31 '20 at 21:04
• @reuns Sorry could you please elaborate on this point? – chaiKaram Jul 31 '20 at 21:19
• @chaiKaram One cannot use this geometric series formula when the common ratio equals $1$ (of course, in that case then the sum is just the number of terms). So you've correctiy identified the place where the proof depends upon $r$ being irrational, and where a different calculation would be used to recover the usual information on the Ramanujan sum. – Greg Martin Aug 1 '20 at 4:40