Ask your own question, for FREE!
Mathematics 18 Online
OpenStudy (anonymous):

Number theory: As a practical matter, is there a simple way to determine the inverse of a number mod n?

OpenStudy (anonymous):

For example, if I have 504s congruent to 14 (mod 35), is there an easy way to find \[504^{-1}(14) \mod35\]

ganeshie8 (ganeshie8):

you want to solve \[504x\equiv 14\pmod{35}\] right ?

OpenStudy (anonymous):

Yes, as part of a Chinese Remainder Theorem problem

ganeshie8 (ganeshie8):

reduce 504 first

OpenStudy (anonymous):

Would you also need to reduce the 35 at the same time?

OpenStudy (anonymous):

Oh, their GCD is 7

ganeshie8 (ganeshie8):

504 =35*14 + 14

ganeshie8 (ganeshie8):

so \(504 \equiv 14 \pmod{35}\)

OpenStudy (anonymous):

If we do that, don't we need to divide 35 by GCD(35, 504)?

ganeshie8 (ganeshie8):

you want to solve \[504x\equiv 14\pmod{35}\] reduces to \[14x\equiv 14\pmod{35}\]

ganeshie8 (ganeshie8):

we are not dividing anything yet we are just using the fact that \(504\equiv 14\)

OpenStudy (anonymous):

I think I'm having trouble with the difference between the idea of reducing versus dividing

ganeshie8 (ganeshie8):

lets divide 14 through out you will see the difference then i hope :)

OpenStudy (anonymous):

So 14x is congruent to 14 mod(35) and we have x=1?

ganeshie8 (ganeshie8):

\[14x\equiv 14\pmod{35}\] dividing 14 though out gives you \[\dfrac{14x}{14}\equiv \dfrac{14}{14}\pmod{\dfrac{35}{\gcd(35,14)}}\]

ganeshie8 (ganeshie8):

\[x\equiv 1 \pmod{5}\]

OpenStudy (anonymous):

Ah, I see the difference now. Thanks for your help!

ganeshie8 (ganeshie8):

we have been using two properties of congruences

ganeshie8 (ganeshie8):

\(a\equiv b\pmod{n}\) and \(b\equiv c\pmod{n} \implies a\equiv c\pmod{n}\) that allows you to replace 504 by 14

OpenStudy (anonymous):

One's using the transitive property, and the other is using an inverse property?

ganeshie8 (ganeshie8):

yes :) in the end you have used \[ac \equiv bc\pmod{n} \implies a\equiv b\pmod{\frac{n}{\gcd(c,n)}}\]

OpenStudy (anonymous):

:)

OpenStudy (anonymous):

Thank you for your help - this clarifies things a lot!

ganeshie8 (ganeshie8):

you must be knowing solving a congruence is same as solving the diophantine eqn : \[ax \equiv b \pmod{n}\] is equivalent to solving \[ax -ny = b\] so you can use all the methods that work for diophantine equations to solve ur congruence

ganeshie8 (ganeshie8):

you're welcome :)

OpenStudy (anonymous):

Huh, I haven't seen it put in terms of a Diophantine Equation like this

ganeshie8 (ganeshie8):

\(ax\equiv b\pmod{n}\) means \(ax = ny + b\) for some integer \(y\) rearrange to get the standard linear diophantine eqn form

ganeshie8 (ganeshie8):

so your original problem is same as solving the diophantine eqn \(504x-35y = 14\)

ganeshie8 (ganeshie8):

it is now a regular equation so we can divide 7 through out \(72x-5y = 2\)

ganeshie8 (ganeshie8):

this is actually the standard method for finding inverse when no other simplification is possible this method works always

OpenStudy (anonymous):

That's much easier to think about. I hadn't really been thinking of these things as Diophantine equations or linear combinations of variables, and I suppose I should.

ganeshie8 (ganeshie8):

you could also use chinese remainder thm

ganeshie8 (ganeshie8):

you said you want to solve it using chinese remainder thm , so.. lets work it using chinese remainder thm quick maybe

ganeshie8 (ganeshie8):

\(504x\equiv 14\pmod{35} \) split it into two congruences \(504x\equiv 14\pmod{5} \) \(504x\equiv 14\pmod{7} \) work each congruence separately and combine them using chinese remainder thm

ganeshie8 (ganeshie8):

chinese remainder thm helps here because mod 5 and mod 7 are simpler to work compared to mod 35

OpenStudy (anonymous):

In the first equation, we have 4x congruent to 4 (mod5), and so x = 1 In the second equation, could use any integer, so we could take x = 0 (?)

OpenStudy (anonymous):

Oh, we want x to be the same in each case, so x=1

ganeshie8 (ganeshie8):

Oh yes we can drop second congruence because x could be any integer

ganeshie8 (ganeshie8):

we're done yeah no need to apply chinese remainder thm

OpenStudy (anonymous):

So suppose it didn't work out that way, how would the Chinese Remainder Theorem help?

OpenStudy (anonymous):

Say, if we used 505 instead of 504?

ganeshie8 (ganeshie8):

lets cookup an example

ganeshie8 (ganeshie8):

ohk lets use 505

ganeshie8 (ganeshie8):

it has no inverse because gcd(505, 35) does not divide 14

ganeshie8 (ganeshie8):

pick some other good number

OpenStudy (anonymous):

How about 25 congruent to 1 (mod 6)

OpenStudy (anonymous):

25x*

ganeshie8 (ganeshie8):

knw what, there is nothing to solve there 25 = 1 mod 6 :P

ganeshie8 (ganeshie8):

so 25x = 1 mod 6 can be solved trivially by reducing to x = 1 mod 6

OpenStudy (anonymous):

Right, but just as a demonstration of the Chinese Remainder Theorem when you use 2 and 3

ganeshie8 (ganeshie8):

Ahh okay I see what you mean

ganeshie8 (ganeshie8):

\(25x \equiv 1 \pmod{6}\) split into two \(25x \equiv 1 \pmod{2}\) \(25x \equiv 1 \pmod{3}\)

OpenStudy (anonymous):

*Sorry, brb

ganeshie8 (ganeshie8):

solving each gives \(x\equiv 1\pmod{2}\) \(x\equiv 1\pmod{3}\) by chinese remainder thm the solution would be below expression mod 6 : \[1\times 3 \times 3^{-1}\pmod 2 + 1\times 2\times 2^{-1}\pmod{3}\] right ?

OpenStudy (anonymous):

I'm with you

ganeshie8 (ganeshie8):

**\[1\times 3 \times [3^{-1}\pmod 2 ]+ 1\times 2\times [2^{-1}\pmod{3}]\]

ganeshie8 (ganeshie8):

inverse of 3 in mod2 is 1 and inverse of 2 in mod 3 is 2 plug them

ganeshie8 (ganeshie8):

lets work a not so simple congruence after this

OpenStudy (anonymous):

1(3)(1)+1(2)(2) congruent to a mod 6 7 congruent to a mod 6 And we get 1 mod 6

ganeshie8 (ganeshie8):

yes that was easy, try solving this using chinese remainder thm \[17x\equiv 9 \pmod{276}\]

OpenStudy (anonymous):

17x congruent to 9 mod 12 17x congruent to 9 mod 23

ganeshie8 (ganeshie8):

yes

OpenStudy (anonymous):

I suppose we could further split these up to 17x congruent to 9 mod 3 17x congruent to 9 mod 4 2x congruent to 0 mod 3, x=0 x congruent to 1 mod 4, x=1

OpenStudy (anonymous):

Oh, yeah, I got stuck with the 5x congruent to 9 mod 12

ganeshie8 (ganeshie8):

looks good!

ganeshie8 (ganeshie8):

``` I suppose we could further split these up to 17x congruent to 9 mod 3 17x congruent to 9 mod 4 2x congruent to 0 mod 3, x=0 x congruent to 1 mod 4, x=1 ``` use chinese remainder thm to cookup solution for 17x congruent to 9 mod 12

OpenStudy (anonymous):

So we have 0 + 1(4)(1) [mod 12]?

OpenStudy (anonymous):

Lol, 4 mod 12

ganeshie8 (ganeshie8):

im getting 9 mod 12

ganeshie8 (ganeshie8):

By I i mean wolfram :)

ganeshie8 (ganeshie8):

whats the inverse of 3 in mod4 ?

OpenStudy (anonymous):

3

ganeshie8 (ganeshie8):

x = 0 mod 3 x = 1 mod 4 chinese remainder thm gives 0 + 1*3*3 mod 12

OpenStudy (anonymous):

OH, haha, I was looking at the wrong modulus

ganeshie8 (ganeshie8):

\[0 + 1\times 3\times [3^{-1}\pmod{4}]\]

OpenStudy (anonymous):

Yeah, I'm with you. Stupid mistake.

OpenStudy (anonymous):

So now there's the part with the 17x congruent to 9 mod 23

ganeshie8 (ganeshie8):

17x congruent to 9 mod 12 : solution ` x = 9 mod 12` 17x congruent to 9 mod 23

ganeshie8 (ganeshie8):

lets work second congruence quick

ganeshie8 (ganeshie8):

17x congruent to 9 mod 23 reduces to -6x congruent to 9 mod 23 yes ?

OpenStudy (anonymous):

Yes

ganeshie8 (ganeshie8):

divide 3 through out : -2x congruent to 3 mod 23

OpenStudy (anonymous):

Ah, clever

ganeshie8 (ganeshie8):

we can eyeball now x = 10

OpenStudy (anonymous):

Isn't it -10?

ganeshie8 (ganeshie8):

17x congruent to 9 mod 12 : solution `x = 9 mod 12` 17x congruent to 9 mod 23 : solution `x = 10 mod 23`

ganeshie8 (ganeshie8):

-2x congruent to 3 mod 23 -2(10) = 3 mod 23 -20 = 3 mod 23 which is true right

OpenStudy (anonymous):

*head bonk* Sorry

OpenStudy (anonymous):

K, good now

ganeshie8 (ganeshie8):

below is the most useful definition of congruence : \(a \equiv b \pmod{n}\) means \(a -b\) is divisible by \(n\)

ganeshie8 (ganeshie8):

you have solutions work chinese remainder thm again and call it a day !

OpenStudy (anonymous):

So we still need to work the inverses for 9 mod 12 and 10 mod 23, right?

ganeshie8 (ganeshie8):

basically we are doing this : we have 17x congruent to 9 mod 276 to solve we solved below baby congruences and hoping to stitch the final solution using chinese remainder theorem : 17x congruent to 9 mod 12 : solution `x = 9 mod 12` 17x congruent to 9 mod 23 : solution `x = 10 mod 23`

OpenStudy (anonymous):

Right

ganeshie8 (ganeshie8):

yes

ganeshie8 (ganeshie8):

repeat the same story :)

ganeshie8 (ganeshie8):

just the numbers are different now

ganeshie8 (ganeshie8):

method is same

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!