I've got a question concerning fields used in RSA.
Let's use the following symbols for my example:
{p,q} = primes
{e,n} = public key
{d,n] = private key
I learnt that an inverse element exists if a is coprime to m.
Applied to RSA I would have guessed that e needs to be coprime to n in order to find it's inverse element, because n is used as mod. But according to the rules of RSA it has to be coprime to ϕ(n) (gcd(ϕ(n),e)=1). Why?