# How can residue of a number whose exponent is negative can exist?

We define $a \mod n$ as the value of the remainder of $a$ when it is divided by $n$. But we can't find the residue of a number whose exponent is negative (i.e. for a non-integer rational number) because the residue we are getting in modular arithmetic can only be obtained for integers according to Euclidean division over which modular arithmetic is based.

But Wikipedia not only says that it exists but also gives a method to compute it here.

So, how is this all possible?

$$a^{-n}=(a^{-1})^n$$
$$a^{-n}\cdot a^n=a^0=1\space \Rightarrow a^{-n}=(a^n)^{-1}$$