TITLE: Find the modular inverse of $19\pmod{141}$
QUESTION [7 upvotes]: I'm doing a question that states to find the inverse of $19 \pmod {141}$.
So far this is what I have:
Since $\gcd(19,141) = 1$, an inverse exists to we can use the Euclidean algorithm to solve for it.
$$
141 = 19\cdot 7 + 8
$$
$$
19 = 8\cdot 2 + 3
$$
$$
8 = 3\cdot 2 + 2
$$
$$
3 = 2\cdot 1 + 1
$$
$$
2 = 2\cdot 1
$$
The textbook says that the answer is 52 but I have no idea how they got the answer and am not sure if I'm on the right track. An explanation would be appreciated! Thanks!

REPLY [2 votes]: Using method of Gauss and modulo 141: 1/19 = 8/152 = 8/11 = 104/143 = 104/2 = 52
As asked by Nate Eldredge, I am explaining it in detail:
We have to find 1/19 (mod 141). So, we take fraction 1/19, now multiply 19 with a number that is nearest to 141. If we multiply 19 with 8, we get 1/19 = 8/152. On taking modulo 141, 8/152 becomes 8/11. Now, multiply 11 with a number that makes it near to 141. This number is 13. So, when 8/11 is multiplied with 13, we get 104/143. Taking modulo 141, we get 104/2 = 52.
This can also be solved in the following manner:
Let x = 1/19 (mod 141). So, 19x = 141y + 1. This can be written as 19x - 1 = 141y. Now, we can compute y = -1/141 (mod 19) = -1/8 = -2/16 = -2/-3 = 2/3 = 12/18 = -12 = +7.
As y = 7, x = (141*7+1)/19 = 52. In this way, we obtained the same answer but using much simpler computation.