Let $p$ be an odd prime number. Prove that $$1^2 3^2 5^2 \cdots (p-4)^2 (p-2)^2 \equiv (-1)^{(p+1)/2} \pmod p.$$ I know I can use Wilson's Theorem somehow. It would make sense if I could show that all the factors $(p-2k)^2$ is congrunt to $-1 \pmod p$ because then the product would result in congruent to $(-1)^{(p+1)/2}\pmod p$. But I'm not quite sure how to go about that. Can you help?
EDIT: Okay, I think I have it now. So, using that $1^2 \equiv (-1) \cdot 1 \cdot (p-1)$, $3^2\equiv (-1) \cdot 3 \cdot (p-3)$ etc., we get $$1^2 3^2 5^2 \cdots (p-4)^2 (p-2)^2 \equiv (-1) \cdot 1 \cdot (p-1) \cdot (-1) \cdot 3 \cdot (p-3) \cdots (-1) \cdot (p-4) \cdot (4) \cdot (-1) \cdot (p-2) \cdot 2 \pmod p \Leftrightarrow \\ 1^2 3^2 5^2 \cdots (p-4)^2 (p-2)^2 \equiv (-1)^{(p-1)/2}(p-1)! \equiv (-1)^{(p+1)/2} \pmod p.$$ Correct?