I know how to do modular inverses in a hypothetical sense with the Euclidian method, and have been trying to do the, but I seem to keep getting the incorrect answer.
I'm trying to find the inverse of $\;5\pmod {13}$, for example.
The answer should be 8, but I can't seem to get that. These are my steps:
\begin{align}
13 & = 2(5)+3\\
5 & = 1(3)+2\\
3 & =1(2)+1
\end{align}
\begin{align} 1 & =3-1(2)\\ & =3-1(5-1(3))\\ & = 2(3)-5\\ & = 2(13-2(5))-5\\ & = 2(13)-4(5)-5\\ & = 2(13)-5(5) \end{align}
I'm sure I'm just misunderstanding the steps, but I don't know how.
Also, can the same method to used to find the inverse of $5\pmod{11}$, since $11=2(5)+1$? I immediately don't know how to proceed from here.