Hello, I was to find the inverse of \(\displaystyle 2\enspace (mod\enspace 5)\) by using Euclidean's Algorithm and I can't do it for this simple problem.
forwards steps:
\(\displaystyle 2\enspace (mod\enspace 5)\)
\(\displaystyle 2 = 5(0)+2\)
\(\displaystyle 5 = 2(2) + 1\)
\(\displaystyle 2 = 1(2) + 0\)
Now find inverse (backwards steps):
\(\displaystyle 1 = 5 - 2(2)\)
\(\displaystyle 2 = 2 - 5(0)\) (this is what we'll substitute 2 from the previous equation for)
\(\displaystyle 1 = 5 - (2 - 5(0))(2)\)
\(\displaystyle 1 = 5 - 2(2)\)
this is wrong because it should be 2(3) (the 3 is the inverse of 2 mod 5)
If i do it for a problem like \(\displaystyle 5\enspace (mod\enspace 7)\) I get the right answer
forwards steps:
\(\displaystyle 5\enspace (mod\enspace 7)\)
\(\displaystyle 5 = 7(0)+5\)
\(\displaystyle 7 = 5(1) + 2\)
\(\displaystyle 5 = 2(2) + 1\)
\(\displaystyle 2 = 1(2) + 0\)
backward steps:
\(\displaystyle 1 = 5 - 2(2)\)
\(\displaystyle 2 = 7 - 5(1)\) (this is what we'll substitute 2 from the previous equation for)
\(\displaystyle 1 = 5 - (7 - 5(1))(2)\)
\(\displaystyle 1 = 5 - 7(2) + 5(2)\) (simplify)
\(\displaystyle 1 = 5(3) - 7(2)\) (simplify)
\(\displaystyle 5 = 5 - 7(0)\) (this is what we'll substitute 5 from the previous equation for)
\(\displaystyle 1 = (5 - 7(0))(3) - 7(2)\)
\(\displaystyle 1 = 5(3) - 7(2)\)
this gives me the right solution because 3 is the inverse for 5 mod 7.
forwards steps:
\(\displaystyle 2\enspace (mod\enspace 5)\)
\(\displaystyle 2 = 5(0)+2\)
\(\displaystyle 5 = 2(2) + 1\)
\(\displaystyle 2 = 1(2) + 0\)
Now find inverse (backwards steps):
\(\displaystyle 1 = 5 - 2(2)\)
\(\displaystyle 2 = 2 - 5(0)\) (this is what we'll substitute 2 from the previous equation for)
\(\displaystyle 1 = 5 - (2 - 5(0))(2)\)
\(\displaystyle 1 = 5 - 2(2)\)
this is wrong because it should be 2(3) (the 3 is the inverse of 2 mod 5)
If i do it for a problem like \(\displaystyle 5\enspace (mod\enspace 7)\) I get the right answer
forwards steps:
\(\displaystyle 5\enspace (mod\enspace 7)\)
\(\displaystyle 5 = 7(0)+5\)
\(\displaystyle 7 = 5(1) + 2\)
\(\displaystyle 5 = 2(2) + 1\)
\(\displaystyle 2 = 1(2) + 0\)
backward steps:
\(\displaystyle 1 = 5 - 2(2)\)
\(\displaystyle 2 = 7 - 5(1)\) (this is what we'll substitute 2 from the previous equation for)
\(\displaystyle 1 = 5 - (7 - 5(1))(2)\)
\(\displaystyle 1 = 5 - 7(2) + 5(2)\) (simplify)
\(\displaystyle 1 = 5(3) - 7(2)\) (simplify)
\(\displaystyle 5 = 5 - 7(0)\) (this is what we'll substitute 5 from the previous equation for)
\(\displaystyle 1 = (5 - 7(0))(3) - 7(2)\)
\(\displaystyle 1 = 5(3) - 7(2)\)
this gives me the right solution because 3 is the inverse for 5 mod 7.