Upper bound for a higher dimensional Ramanujan sum

Fix an integer vector $\mathbf m\in \mathbb Z^k$. Let $q$ be a positive integer.

Is there a "good" upper bound in terms of $q,\bf m$ for the exponential sum: $\sum_{\mathbf n} e\left(\frac{\langle m, n\rangle}{q}\right).$ Here $\langle \cdot, \cdot \rangle$ is usual inner product and $e(z) = e^{2\pi i z}$. The sum is taken over all ${\mathbf n=(n_1,\cdots,n_k)}$ such that $1\le n_i\le q$ and $gcd(n_1,\cdots,n_k,q)=1$.

When $k=1$, this is the famous Ramanujan sum. I have tried searching relevant results, but could not find any useful reference for $k\ge 2$. Any answers or references are appreciated!

• Don't you need to assume some additional coprimality condition between each $n_i$ and $p$? For $k = 1$, for example, the usual Ramanujan sum includes the condition $(n,p) = 1$, for otherwise the sum is zero. – Peter Humphries Feb 7 '17 at 0:54
• Yes, you are right! I definitely forgot to add that. – Changguang Feb 7 '17 at 1:46
• Doesn't $\sum e((m_1n_1+\cdots+m_kn_k)/p)$ just factor as $\sum e(m_1n_1/p)\times\cdots\times\sum e(m_kn_k/p)$? – Gerry Myerson Feb 7 '17 at 2:16
• Yes, but the coprimality condition doesn't quite factor in a trivial way. – Peter Humphries Feb 7 '17 at 2:16

Call this sum $c_q(m_1,\ldots,m_k)$. The indicator function of the condition $(n_1,\ldots,n_k,q) = 1$ can be written as the sum $\sum_{cd = (n_1,\ldots,n_k,q)} \mu(c)$, so that $d \mid q$, $c = \frac{q}{d}$, and $n_j \equiv 0 \pmod{c}$ for all $j \in \{1,\ldots,k\}$. It follows that $c_q(m_1,\ldots,m_k)$ may be written as $\sum_{cd = (n_1, \ldots, n_k,q)} \mu(c) \prod_{j = 1}^{k} \sum_{n_j = 1}^{q} e\left(\frac{n_j m_j}{q}\right)= \sum_{d \mid q} \mu\left(\frac{q}{d}\right) \prod_{j = 1}^{k} \sum_{\substack{n_j = 1 \\ n_j \equiv 0 \pmod{\frac{q}{d}}}}^{q} e\left(\frac{n_j m_j}{q}\right).$ Writing $n_j = \frac{q}{d} \ell_j$, the inner sum is $\sum_{\ell_j = 1}^{d} e\left(\frac{\ell_j m_j}{d}\right) = \begin{cases} d & \text{if d \mid m_j,} \\ 0 & \text{otherwise.} \end{cases}$ So $c_q(m_1,\ldots,m_k) = \sum_{d \mid (m_1, \ldots, m_k, q)} \mu\left(\frac{q}{d}\right) d^k.$ This is multiplicative as a function of $q$, so that $c_q(m_1,\ldots,m_k) = \prod_{p^r \parallel q} c_{p^r}(m_1,\ldots,m_k).$ So we need only determine $c_q(m_1,\ldots,m_k)$ when $q = p^r$ is a prime power. Since $\mu(p^r) = \begin{cases} 1 & \text{if r = 0,} \\ -1 & \text{if r = 1,} \\ 0 & \text{if r \geq 2,} \end{cases}$ we have that for $q = p$, $c_p(m_1,\ldots,m_k) = \begin{cases} p^k - 1 & \text{if p \mid (m_1,\ldots,m_k),} \\ -1 & \text{if p \nmid (m_1,\ldots,m_k),} \end{cases}$ while for $q = p^r$ with $r \geq 2$, $c_{p^r}(m_1,\ldots,m_k) = \begin{cases} p^{(r - 1)k} (p^k - 1) & \text{if p^r \mid (m_1,\ldots,m_k),} \\ -p^{(r - 1)k} & \text{if p^{r - 1} \parallel (m_1,\ldots,m_k),} \\ -1 & \text{if p^{r - 1} \nmid (m_1,\ldots,m_k).} \end{cases}$

• Peter, thank you very much for your answer. I think it's correct, but could you please double check your formulas? For example, line 4 with line 2; and last two formulas (not consistent). – Changguang Feb 7 '17 at 2:57
• @Changguang, it should be fixed now. – Peter Humphries Feb 7 '17 at 3:19
• For the last two formulas, when $r=1$, I think that should be $p^k-1$, no? – Changguang Feb 7 '17 at 3:21