<s>[INST] Let $p=q+4a$. Prove that $\left( \frac{a}{p} \right) = \left( \frac{a}{q} \right)$. Here's a little number theory problem I'm wrestling with.
Let $p$ and $q$ be odd prime numbers with $p=q+4a$ for some $a \in \mathbb{Z}$. Prove that $$\left( \frac{a}{p} \right) = \left( \frac{a}{q} \right),$$
where $\left( \frac{a}{p} \right)$ is the Legendre symbol. I have been trying to use the law of quadratic reciprocity but to no avail. Can you help?
 [/INST] Note that $p \equiv q \pmod{4}$, so $\frac{p-1}{2}\frac{q+1}{2} \equiv \frac{p-1}{2}\frac{p+1}{2} \equiv 0 \pmod{2}$.
\begin{align}
\left(\frac{a}{p}\right)=\left(\frac{4a}{p}\right)=\left(\frac{p-q}{p}\right)& =\left(\frac{-q}{p}\right) \\
& =\left(\frac{-1}{p}\right)\left(\frac{q}{p}\right) \\
&=(-1)^{\frac{p-1}{2}}\left(\frac{p}{q}\right)(-1)^{\frac{p-1}{2}\frac{q-1}{2}} \\
&=(-1)^{\frac{p-1}{2}\frac{q+1}{2}}\left(\frac{p-q}{q}\right) \\
&=\left(\frac{4a}{q}\right) \\
&=\left(\frac{a}{q}\right)
\end{align}
</s>