We all know the formula for the modular inverse: $a\bar{a} \equiv 1$ (mod m), but sometimes you see the formula $\bar{a}\equiv a^{\phi(m)-1}$ (mod m).
How do you become $\bar{a}\equiv a^{\phi(m)-1}$ (mod m) from $a\bar{a} \equiv 1$ (mod m)?
We all know the formula for the modular inverse: $a\bar{a} \equiv 1$ (mod m), but sometimes you see the formula $\bar{a}\equiv a^{\phi(m)-1}$ (mod m).
How do you become $\bar{a}\equiv a^{\phi(m)-1}$ (mod m) from $a\bar{a} \equiv 1$ (mod m)?
Eulers theorem states that if $\gcd(a,m) = 1$ then $a^{\phi(m)} \equiv 1 \pmod{m}$
Knowing that then
$a \cdot a^{\phi(m) -1} \equiv a^{\phi(m)} \equiv 1 \pmod{m}$
So as you can see if we multiply $a$ by $a^{\phi(m) -1}$ we get 1, and the definition of modular inverse tells us the thing we multiplied $a$ by to get 1, is the modular inverse of $a$ and in this case that thing is $a^{\phi(m) -1}$.
Therefore $\overline{a} \equiv a^{\phi(m) -1} \pmod{m}$