So might be a dumb question and actually quite simple, but I managed to confuse myself, and I don't really want to be learning the wrong thing.
So $a≡b\;(\bmod n)$ can be defined by $a-b=ln,$ $l\in\mathbb{Z}$ (modular equivalence), and if it exists, the modular inverse $p^{-1}p≡1\;(\bmod q)$.
Bezout's identity states that for some $a,b$ there always exists $m,n$ such that $am + bn = \gcd(a, b)$
How should I show the inverse mod as a modular equivalence? I just kind of know how to do them but not how to work them if that makes sense and I'm confusing myself.
How would I then use that with Bezout's Identity to find the gcd?
$p^{-1}p \equiv 1\;(\bmod q)$ simply means $p^{-1}p=kq+1,k\in\mathbb{Z}$. Using Bézout's Lemma, we can find the modular inverse of $p\; (\bmod q)$. Note that the inverse only exists if $\gcd(p,q)=1$. By the lemma, there exist integers $x,y$ such that $px+qy=1\Rightarrow px=(-y)q+1\Rightarrow px\equiv 1\;(\bmod q)$ and so by definition $x$ is the modular inverse of $p$.
As for finding the gcd, you would use the Extended Euclidean Algorithm.