I have the following question about Ramanujan sums.
(All vectors and matrices here will be understood to have integer entries.)
Let $X_q=\{ (x_1,...,x_R)|1\leq x_i\leq q\} $ and let, for any $R\times R$ matrix $B$ with rows $\mathbf b_i$, \[ c_q(B\mathbf x):=c_q\left (\mathbf b_1\cdot \mathbf x\right )...c_q\left (\mathbf b_r\cdot \mathbf x\right ),\] where $c_q(n)$ is Ramanujan's sum. Suppose an $R\times R$ matrix $A$ with determinant $D$ is given and denote by $I$ the identity matrix. Then my question would be:
Does
\[ S=\sum _{\mathbf x\in X_q\atop {A\mathbf x\equiv \mathbf 0(q)}}c_q(I\mathbf x)\]
depend only on $(q,D)$?
In fact I thought the sum would be zero except for the case (q,D)=1 but I'm not so sure this is true.
Why might it be true? Write $d_i$ for the $i$-th elementary divisor of $A$. Then on considering the Smith normal form of $A$ and after using $c_{dq}(dn)=f(q,d)c_q(n)$ we have, up to a function depending only on $q$ and $(q,d_i)$,
\[ S=\sum_{x\in X_{(q,D)}}c_{(q,D)}\left (QE\mathbf x\right ),\]
where $Q=Q(A)$ is invertible and $E=(e_{i,j})$ is a diagonal matrix with
\[ e_{i,i}=\frac {(q,d_R)}{(q,d_i)}.\]
It seems to me plausible that this last sum is zero except for when $(q,d_R)=1$, which would be perfect. Testing thousands of $3\times 3$ matrices gives me always zero, so I do start to believe it. Could it be true? And along which lines should I be thinking if I want to prove it?
Any suggestions would be very much appreciated!