# Jacobi Symbol: $\sum_{n=1}^{p}\left(\sum_{m=1}^{h}\left(\frac{m+n}{p}\right)\right)^2=h(p-h)$

Show that if $$p$$ is and odd prime and $$h$$ is an integer, $$1\le h \le p$$, then

$$\displaystyle\sum_{n=1}^{p}\left(\sum_{m=1}^{h}\left(\frac{m+n}{p}\right)\right)^2=h(p-h)$$ where $$\left(\frac{m+n}{p}\right)$$ denotes the Jacobi symbol.

My solution:

For $$h=1$$, we have $$\left(\frac{1+n}{p}\right)^2$$ is always 1 or 0. It is 0 only when $$n=p-1$$. So the sum comes out to be $$p-1$$, which is accordance with $$h(p-h)$$. Similarly, for $$h=p$$, and the sum is zero.

But I am having trouble when $$h \neq 1 or p$$, how will I proceed in that case?

This question has been taken from the book : An introduction to theory of numbers by Niven, Zuckerman, Montgomery. Section 3.3., question 19. Thanks in advance.

The square of the inner sum is $$\sum_{m_1,m_2=1}^h\left(\frac{(m_1+n)(m_2+n)}{p}\right).$$ The whole sum is $$\sum_{m_1,m_2=1}^h\sum_{n=1}^p\left(\frac{(m_1+n)(m_2+n)}{p}\right) =\sum_{m_1,m_2=1}^hS(m_1,m_2)$$ say. When $$m_1=m_2$$ then $$S(m_1,m_2)=p-1$$. When $$m_1\ne m_2$$ then $$S(m_1,m_2)=\sum_{n=1}^p\left(\frac{n(n+2m')}p\right)$$ where $$2m'\equiv m_1-m_2\not\equiv0\pmod p$$. We can drop the $$n=p$$ term, and then let $$n'$$ be the mod $$p$$ inverse of $$n$$ gives $$S(m_1,m_2)=\sum_{n=1}^{p-1}\left(\frac{n(n+2m')}p\right) =\sum_{n'=1}^{p-1}\left(\frac{1+2m'n'}p\right)=-1.$$ Therefore the original sum is $$h(p-1)-(h^2-h)=h(p-1-(h-1))=h(p-h).$$
• I am having difficult in understanding the following:$$S(m_1,m_2)=\sum_{n=1}^p\left(\frac{n(n+2m')}p\right)$$ where $2m'\equiv m_1-m_2\not\equiv0\pmod p$. We can drop the $n=p$ term, and then let $n'$ be the mod $p$ inverse of $n$ gives $$S(m_1,m_2)=\sum_{n=1}^{p-1}\left(\frac{n(n+2m')}p\right) =\sum_{n'=1}^{p-1}\left(\frac{1+2m'n'}p\right)=-1.$$ can you please explain this part? Thanks for the solution. – Epsilon Delta Oct 17 at 6:47
• @EpsilonDelta (i) is just a change of variable, (ii) is extracting a factor $(n^2/p)$. – Lord Shark the Unknown Oct 17 at 17:38