What is the distribution of the modular inverse of a uniformly random element in $\mathrm{Z}_{n}\setminus\{0\}$

112 Views Asked by At

I have a uniformly random element between one and $n-1$

$k\xleftarrow{\$}\mathrm{Z}_{n}\setminus\{0\}$

What is the distribution of the inverse of $k$, $k^{-1}$?

If it makes it much easier, would the distribution be uniformly random if k were in the range zero to $n-1$?

I found a paper online which clarifies that the inverse map $k\mapsto k^{-1}$ is a signed involution, from which I infer that if $k$ is chosen uniformly and at random then so is the distribution of inverse elements.

1

There are 1 best solutions below

0
On BEST ANSWER

Note: You need $n$ to be prime for each element $1, \dots, n-1$ to have an inverse. (And also, you can't include zero in the range, since it doesn't have an inverse.)

Yes, it's correct that the distribution of the inverse is also uniform:

$P(\text{we get x as the inverse}) = P(\text{the original pick is } x^{-1}) = \frac{1}{n-1}$.