I am new to number theory, and I was reading about using fermat's theroem to find the modular multiplicative inverse on Wikipedia here.
They wrote that by Fermat's theorem, if $m$ is prime, $a^{m-1} \equiv 1\text{ (mod } m)$. Then, they wrote $a^{m-2} \equiv a^{-1}\text{ (mod } m)$ to find the modular inverse. It seems as if they muliplied $a^{-1}$ to both sides. I thought $a^{-1}$ is just a notation to represent a number $x$ such that $a \cdot x \equiv 1 \text{ (mod } m)$. How can this be multipied like that if it's just notation? It says $a^{m-2} \text{ (mod } m) $ can hence be calculated by methods like binary exponentiation.
They didn't "multiply" by anything. The equality $a^{m-1}\equiv1$ can be written as $a\cdot a^{m-2}\equiv1$. So, exactly as you said, $a^{m-2} $ is a number that multiplied by $a $ gives $1$.