Hello, everyone! Just wanted some ideas regarding the following problems.

1) Let a and b be integers and p be a prime number. Prove the following:

a) a^2 = b^2 mod p implies that a = ħb mod p.

b) a^2 = a mod p implies that a = 0 mod p or a = 1 mod p.

2) Let p be prime and (a,p) = (b,p) = 1. Prove the following:

a) a^p = b^p mod p implies that a = b mod p.

b) a^p = b^p mod p implies that a^p = b^p mod p^2.

Thanks!