I have a math problem, that I've been trying to solve. It has literally took me at least 10 hours, and I just can't understand one part of this. I've been watching videos that explain these things but usually they use more simple numbers and the whole thing is much shorter so it doesn't get me very far.
The problem itself and where I'm currently stuck on:
Find the inverse of $359 \bmod 457.$
$$33 + 32(-1) = 1 $$ $$65 + 33(-1) = 32 $$ $$98 + 65(-1) = 33 $$ $$359 + 98(-3) = 65 $$ $$457 + 359(-1) = 98 $$
And after this backwards:
$$33 + [65 + 33(-1)](-1) = 1$$
$$33 + 65(-1) + 33 = 1 $$
$$2(33) + 65(-1) = 1 $$
$$2[98 + 65(-1)] + 65(-1) = 1 $$
$$2 · 98 + 65(-2) + 65(-1) = 1 $$
$$2(98) + 65(-3) = 1 $$
I know that I need to apply $359 + 98(-3) = 65$ next, and $457 + 359(-1) = 98$ after that but I just can't understand this.
I would assume that next lines would be something like this:
$$2(98) + [359 + 98(-3)] = 261 $$
but this doesn't look right to me because of the answer. I've been really frustrated with this problem.
Thank you in advance.
There are two things:
Thing One:
You are trying to find some $A,B$ so that $359A + 457B = 1$.
Once you find those you know that $359 A = 1 - 457B$ so $359A \equiv 1 \mod 457$.
And so $A \equiv 359^{-1}$.
(We don't actually care about $B$.)
Thing Two:
You got:
$33 + 32(-1) = 1$
$65 + 33(-1) = 32$
$98 + 65(-1) = 33$
$359 + 98(-3) = 65$
$457 + 359(-1) = 98 $
(Presumably you worked this in the opposite order.)
You can use these to figure out Thing One.
A) $33 + 32(-1) = 1$ and $65 + 33(-1) = 32$
So $33 + (65 + 33(-1))(-1) = 1$ or
$33(2) + 65(-1) = 1$.
B) And we have $98 + 65(-1) = 33$
So $(98 + 65(-1))(2) + 65(-1) = 1$ or
$98(2) + 65(-3) = 1$
C) And we have $359 + 98(-3) = 65$.
So $98(2) + (359 + 98(-3))(-3) = 1$ or
$98(11) + 359(-3) = 1$
D) And we have $457 + 359(-1) = 98 $
So $(457 + 359(-1))(11) + 359(-3) = 1$ or
$457(11) + 359(-14) = 1$
And that's the $A$ and $B$ we needed for Thing One.
.....
$457*11 + 359*(-14) = 1$ so
$359*(-14) \equiv 1 \mod 457$
And $359^{-1} \equiv -14 \equiv 443 \mod 457$
....
If you wish to verify:
$359*(-14) = -5026 = 1 - 5027 = 1 - 11*457$.
Which in turns means $359*443 = 359*457 - 359*14 = 359*457 - 5026 = 1 + 359*457 -5027 = 1 + 359*457 - 11*457 = 1 + 348*457$.