$\sum_{x \in \mathbb Z_9}w^{x^2-cx}=?$,where $c \in \mathbb Z_9$ and $w=e^{2\pi i/9}$ $$\sum_{x \in \mathbb Z_9}w^{x^2-cx}=?$$
where $c \in \mathbb Z_9$, $w=e^{2\pi i/9}$ and $\mathbb Z_9$ is the ring of integers modulo 9.
 A: By completing the square you have
$$x^2-cx=(x-\frac{c}{2})^2 +\frac{c^2}{4}$$
where in $\mathbb Z_9$ we have $\frac{1}{2}=5$ and $\frac{1}{4}=7$.
Thus
$$x^2-cx=(x-5c)^2+7c^2 \,.$$
Then
$$\sum_{x \in \mathbb Z_9}w^{x^2-cx} = \sum_{x \in \mathbb Z_9}w^{(x-5c)^2+7c^2}$$
Now, using $y=x-5c$, and the fact that $x \to 5$ is a permutation of $\mathbb Z_9$, we get
$$\sum_{x \in \mathbb Z_9}w^{x^2-cx} = \sum_{y \in \mathbb Z_9}w^{y^2+7c^2}=w^{7c^2}  \sum_{y \in \mathbb Z_9}w^{y^2}$$
Now the last sum is easy to calculate....
A: The method in the answer by N.S. tells you how to take into account the effect of the parameter $c$. The point of this answer is to prove that the basic result
$$
S=\sum_{x\in\Bbb{Z}/p^2\Bbb{Z}}\zeta^{x^2}=p,
$$
where $\zeta=e^{2\pi i/p^2}$ holds for all odd primes $p$.
We write $x=a+pb$. If we let both $a$ and $b$ range over the set $\{0,1,\ldots,p-1\}$ (or to be more pedantic, over the corresponding cosets modulo $p^2$),
then $x$ will range over the ring $\Bbb{Z}/p^2\Bbb{Z}$. Then
$$
x^2=(a+pb)^2=a^2+2pab+p^2b^2\equiv a^2+2pab \pmod{p^2}.
$$
Thus
$$
\begin{aligned}
S&=\sum_{a=0}^{p-1}\sum_{b=0}^{p-1}\zeta^{a^2+2pab}\\
&=\sum_{a=0}^{p-1}\zeta^{a^2}\left(\sum_{b=0}^{p-1}\omega^{2ab}\right),
\end{aligned}
$$
where I denote $\omega=\zeta^p=e^{2\pi i/p}.$
The inner sum is a common character sum over the additive group $\Bbb{Z}/p\Bbb{Z}.$ It is explained in all the textbooks that this sum is equal to $p$,
when $2a\equiv0\pmod p$, and $=0$ otherwise. The former case occurs, iff $a=0$, so we get
$$
S=\zeta^{0^2}p=p.
$$
