Consider the following:

-x+2 = 3 (mod 5)

4x = 1 (mod 5)

As the gcd(4,5) = 1 therefore there's one unique solution, namely x = 4 (mod 5)

Also...

-x + 2 = 3 (mod 8)

7x = 1 (mod 8)

Again there is a unique solution, namely x = 1 (mod 8)

Can anyone explain where these solutions come from? I understand how to get to 4x = 1 (mod 5) and 7x = 1 (mod 8) but I dont get how we get the 'unique solutions' at the end? I'd appreciate a clear explanation please. Thank you