# Changing the variable in a double sum

I want to chase up some aspects of the question Change of variable in a double sum, which so far has not received an accepted answer. To recall what is discussed there, we have the double sum:

$$\sum_{m=1}^p\sum_{n=1}^p\exp(2\pi ik(m^2-n^2)/p),$$

and we are prompted to make use of the substitution $$m=n+h$$, which yields,

$$\sum_{m=1}^p\sum_{n=1}^p\exp(2\pi ik(m^2-n^2)/p)=\sum_{\color\red{h}=1}^p\sum_{n=1}^p\exp(2\pi ik(2nh+h^2)/p)$$

$$=\sum_{\color\red{h}=1}^p\sum_{n=1}^p\exp(2\pi i kh^2/p)\exp(4\pi ikhn/p)$$ $$=\sum_{\color\red{h}=1}^p\exp(2\pi i kh^2/p)\sum_{n=1}^p\exp(4\pi ikhn/p).$$ Here are the aspects which I am unsure on:

1. Why is it that the first sum in the double sum is now over $$\color\red{h}$$ and not over, say $$n+h$$, once we employ the substitution? Why is it just over $$h$$ now, and why are we allowed to ignore the $$'+n'$$ part of the substitution?

2. With the above question in mind, employing this substitution allows the elements of the double sum to "pass" to the relevant parts in the product of the exponentials. From the substitution we have that $$h=m-n$$, yet, the sum over $$n$$ passes over the exponent involving $$h$$ - despite $$h$$ being defined in terms of $$n$$. Why doesn't the sum over $$n$$ recognise the $$h$$ component?

In both cases, it seems a little 'hand-wavey' to me, so I would appreciate being able to understand exactly what the procedure being employed is.

The crucial point is $$p$$ periodicity, so the sum doesn't change in either variable $$m,n,h$$ as long as we use $$p$$ consecutive numbers in the respective variable. So fix $$n$$, then for each $$m$$ the $$(m,n)$$ term corresponds to a $$(n+h,n)$$ term, so when $$m$$ runs from $$1,p$$, $$h$$ runs from $$1-n,p-n$$, but by periodicity we can also run $$h$$ from $$1,p$$ instead so we are done with the rewriting and the rest follows immediately
• This has certainly helped me to grasp the idea - thanks. I'm still a little unsure on the technicalities of this '$p$ periodicity' (to be honest, I have never heard of it before). Can you recommend a source where I can read about this periodicity aspect in more detail? – Jeremy Jeffrey James Apr 10 at 10:31
• It all follows from the integral (or $1$) periodicity of the function $e(z)=\exp{2\pi iz}$ which satisfies $e(z+1)=e(z)$ by the $2\pi i$ periodicity of the usual exponential function. Here we divide the argument by $p$ so we get $p$ periodicity, $e(\frac{z+p}{p})=e(\frac{z}{p})$ and that clearly applies in each variable separately since $(m+p)^2-m^2$ divides by $p$ also etc; Gauss sums, large sieve and more generally exponential sums (modulo $p$ also) are topics one might want to consult for more detail. Aso note that $p$ in the sum and $p$ in the argument being same is crucial – Conrad Apr 10 at 11:54
• Does the same idea hold if I had a more rudimentary term inside the double sum? Say there was no exponential and I had $\sum_{m=1}^p\sum_{n=1}^p2\pi ik(m^2-n^2)$; would I still be able to apply the substitution and take the former sum from $h=1$ to $p$? What if both sums had dissimilar limits, both different from $p$? – Jeremy Jeffrey James Apr 10 at 12:50
• No for all questions - first is not periodic (the $\exp{2\pi i}$ crucial for periodicity), though the sum above is trivially 0 by elementary algebra switching the variables; only complete sums (running through all mod p remainders, so, for example, $1$ to $p$ but could be any p consecutive integers) allow that (obviously any multiple of p also works for indices but the sum just multiplies by that multiple, so if you sum from $1$ to $2p$ works but it is twice sum from $1$ to $p$ nothing new); incomplete sums (where you run the variable only in a subset of the residues mod p) are trickier by far – Conrad Apr 10 at 14:40