Modular Multiplicative Inverse and RSA? In trying to understand this specific part of the RSA algorithm, I found this online:


  $$e \cdot d = 1 \pmod{(p-1)\cdot(q-1)}$$
  Therefore:
  $$e \cdot d \cdot d^{-1}= d^{-1} \cdot 1 \pmod{(p-1)\cdot(q-1)}$$
  
  Substituing in $d^{\phi((p-1)\cdot(q-1))} \mod{((p-1)\cdot(q-1))}\ $  for $1 \pmod{(p-1)\cdot(q-1)}$, we get:
  $$e\cdot1 = d^{\phi((p-1)\cdot(q-1))-1} \mod{(p-1)\cdot(q-1)}$$


I understand by Euler's theorem, that $d^{\phi(n)}$ = 1 mod $n$

What I don't understand is the substitution part.  Most descriptions I've found online either gloss over this part of RSA or go into Extended Euclidean Algorithm.  But this method seems to be the easiest way of calculating since it ends up just being modular math.

If I substitute, wouldn't that just leave me with...

$$e = d^{-1} \times d^{\phi(n)} = d^{\phi(n)-1}$$

without the mod part.
The multiplicative group $Z_m$ of integers modulo $m$ has exactly $\phi(m)$ elements by definition. Thus for any element $a$ of $Z_m$ the equation
$$
a^{\phi(m)}=1~(mod~m)
$$
holds, where $1$ is the multiplicative identity of $Z_m$ (the residue class $km+1$ of all integers congruent to 1 modulo $m$). 

In RSA, $e$ and $d$ are indeed inverses modulo $\phi(\phi(n))$ in the exponent arithmetic, since the order of the multiplicative group $Z_n=Z_{pq}$ is $\phi(n)=\phi(pq)=(p-1)(q-1).$

So the last line of the image is correct and you get
$$
e=d^{\phi(\phi(n))-1}=d^{-1}~(mod~\phi(n))
$$
in the exponent multiplicative group which is what you want, since
$$
M^{ed}~(mod~ n)=M
$$
if and only if
$$
ed~(mod~\phi(n))=1,
$$
if and only if
$$
e=d^{-1}~(mod~\phi(n))
$$
by uniqueness of inverses in any group.