The problem is actually slightly simpler than that, but I couldn't fit it all into the topic title. Let p be a prime satisfying p = 5 (mod 8) and suppose that 'a' is a quadratic residue modulo p. I need to show that one of the values: x = a^(p+3)/8 or x = 2a*(4a)^(p-5)/8 is a solution to the congruence x^2 = a (mod p). I really have no idea how to even start this. If it was just a single case, I think I would be able to make some progress, but since I have to prove that one or the other works (depending on the situation), I'm totally lost. Any help is appreciated. Thanks!