Let $n$ be a positive integer, $n\geq 2$. Let $M=\{0,1,2,\ldots n-1\}$. For an integer nonzero number $a$ we define the function $f_{a}: M\longrightarrow M$, such that $f_{a}(x)$ is the remainder when dividing $ax$ at $n$. Find a necessary and sufficient condition such that $f_{a}$ is bijective. And if $f_{a}$ is bijective and $n$ is a prime number, prove that $a^{n(n-1)}-1$ is divisible by $n^{2}$.