How to do a modular arithmetic with negative exponents? I was reading a solution which writes:so we need to compute $2^{-11} \pmod{25}$. But this is simply, by Fermat's Little Theorem, $2^9 = 512 \equiv 12 \pmod{25}$. 
However I don't really understand the process here: how should I apply the theorem to get this? Thanks in advance
 A: The author actually uses Euler's stronger version of Fermat's little theorem: $a^{\phi(n)}\equiv 1 \pmod{n}$. In this case $2^{\phi(25)}\equiv2^{20}\equiv1 \pmod{25}$. So $2^{-11}\equiv2^{-11}2^{20}\equiv2^9\equiv12 \pmod{25}$.
A: You have to be careful about what the negative in the exponent means, namely $2^{-1}$ is the element $a$ that satisfies 
$$
2a\cong 1\mod 25
$$
With a little thought, this is seen to be $a=13$. Then 
$$
2^{-11}=13^{11}
$$
which you may compute by finding a pattern.
A: IF (and it is a big if) $\gcd (a,n) = 1$ then we know that there a power $k$ ($\phi(n)$ is one such possible $k$) so that $a^k \equiv 1 \mod n$ and that and the $a^j$ form a group under multiplication modulo $n$.  And further that $a^{j+k}\equiv a^j \mod 25$.
[It does NOT follow that $k = \phi(n)$ is the smallest such power, nor that the order of the group is $\phi(n)$. But it does follow that smallest such power will divide $\phi(n)$]
So as $\gcd(2,25)=1$ then we know, among several other things, 1) $2^{\pi(25)} = 2^{20} \equiv 1 \mod 25$[$*$] and that 2) That if is a unique $a$ so that $2a \equiv 1 \mod 25$ and for notation purposes we may notate $a$ as $2^{-1}$ and that 3) for $2^j$ that $2^j*2^{20-j} = 2^20 \equiv 1 \mod 25$ and for notation purposes we may notate $2^{20 - j}$ as $2^{-j}$ and $2^j*2^{-j} \equiv 1 \mod 25$.
So what is the value of $2^{-11}$?  Well $2^{-11} \equiv 2^{-11}*1\equiv 2^{-11}*2^{20} \equiv 2^9\mod 25$.
[$*$] as it turns out $20$ is the smallest such power so that $2^k \equiv 1 \mod 25$ but we can not tell that without testing that $2^{10} \equiv -1 \not \equiv 1 \mod 15$ or that $2^4 \equiv 16\mod 25$.  But we do not need to know that $20$ is the smallest such power.  Just that $2^{20} \equiv 1 \mod 25$.
A: For example:
$$2^{-1}=13\pmod{25}\;,\;\;\text{because}\;\;2\cdot13=1\pmod{25}$$
It's exactly the same (when possible) as with real ("usual") numbers. For example, $\;7^{-1}=\frac17\;$ because $\;7\cdot\frac17=1\;$ .
Thus, you actually want to solve
$$2^{-11}=\left(2^{-1}\right)^{11}=13^{11}\pmod{25}$$
...and now you can do as usual.
