so apparently 3^-1 mod 5 = 2 so (1/3) mod 5 = 2
I don't get how this works, can someone explain?
In the rational numbers, 1/3 represents the solution to 3 * x = 1. For integers mod 5, we mean the same thing: 3 * x = 1 mod 5. But you can see that 3 * 2 = 1 mod 5, so 3^-1 is just 2.
If gcd(a,m) = 1 and ab = 1 (mod m) then b = 1/a (mod m). If you want to find what integer b is congruent to modulo m and you only know a, then you can first use the euclidean algorithm to find it.
look up "modular inverse" (see Wiki article and Wolfram article).
There is also an older thread here
Separate names with a comma.