In , the inverse of x is an element of such that if you multiply it by x (mod n), the answer is 1.

So in the inverse of 2 is , because when you multiply 2 by 3 you get 6, which is equal to 1 (mod 5).

But in , does not exist, because whatever you multiply 2 by you will always get an even number, so the answer can never be equal to 1 (mod 4).

In general, an element x in will have an inverse provided that the numbers x and n have no common factor.