<s>[INST] $1\cdot3\cdot5 \cdots (p - 2) = (-1)^{m+k+1} \pmod p$, and $2\cdot4\cdot6\cdots(p - 1) = ( -1)^{m +k} \pmod p$. Prove that if $p$ is a prime having the form $4k + 3$, and if $m$ is the number of quadratic residues less than $\frac p2$, then we have
$$1\cdot3\cdot5 \cdots (p - 2) = (-1)^{m+k+1} \pmod p, \text{ and } 2\cdot4\cdot6\cdots(p - 1) = ( -1)^{m +k} \pmod p.$$
I am stuck with the problem....Help Needed.
 [/INST] Let $\phi: \mathbb{Z}_p \to \{-1,1\}$, where $\phi(n) = 1$ is a homomorphism given by $1$ if $n$ is a quadratic residue modulo $p$ and $-1$ if not.
Now consider $1 \cdot 3 \cdots (p-2)$. Now switch every number $x$ bigger than $\frac p2$ to $(p-x)$. Eventually as you will make $\frac{p-3}{4} = k$ changes we have that:
$$1 \cdot 3 \cdots (p-2) = \left(\frac{p-1}{2}\right)! \cdot (-1)^k$$
It's fairly easy to notice that $\left(\frac{p-1}{2}\right)!$ is equal to either $1$ or $-1$ modulo $p$, so the sum is equal to $-1$ or $1$. Also let's note that $\phi(1) = 1$ and $\phi(-1) = -1$, so therefore it's enough to see whether $ \left(\frac{p-1}{2}\right)!$ is sent by $\phi$ to $1$ or $-1$. But by the definition of $\phi$ we have that $\phi\left(\frac{p-1}{2}\right)! = (-1)^t$, where $t$ is the number of non-equadratic residues modulo $p$ and less than $\frac{p}{2}$. As there are odd amount of numbers less than $\frac{p}{2}$ we have that $t$ and $m$ have a different parity, hence $(-1)^t = (-1)^{m+1}$ and:
$$1 \cdot 3 \cdots (p-2) = \left(\frac{p-1}{2}\right)! \cdot (-1)^k \equiv (-1)^{k+t} \equiv (-1)^{k+m+1} \pmod p$$
Similar reasoning yields the wanted proof for the second part.
</s>