Calculate the multiplicative inverse of $5$ in $\mathbb{Z}_{12}$ using euclidean algorithm.
I think I got it but the end is a bit confusing, how to know what number is the multiplicative invererse..?
First of all, $5$ must have a multiplicative inverse in $\mathbb{Z}_{12}$ because $\text{gcd}(12,5)=1$
Then
$$5x \equiv1 \text{ mod } 12$$
$$x \equiv 5^{-1} (\text{mod }12)$$
$$12 = 2 \cdot 5+2$$
$$5 = 2 \cdot 2+1$$
$$1 = 5-2 \cdot 2$$
$$1 = 5-2 \cdot (12 - 2 \cdot 5)$$
$$1=5-2 \cdot 12 +4 \cdot 5$$
$$1 = -2 \cdot 12+5 \cdot 5$$
Fine but how do I know that the multiplicative inverse of $5$ in $\mathbb{Z}_{12}$ is $5$?
Because in last line we have several numbers, how to know which one is the one we are looking for?