-1

Below is text from the book Joseph H. Silverman: A Friendly Introduction to Number Theory, 4th Edition, chapter 8, page 56.


To solve

$4x\equiv 3 \pmod{19}$

we will multiply both sides by $5$. This gives

$20x\equiv 15 \pmod{19}$

But $20\equiv 1\pmod{19}$, so $20x\equiv x\pmod{19}$

Thus the solution is

$x\equiv 15\pmod{19}$


I was wondering if I can document the steps on how this is done to solve a generic congruence - I know this can be done only for solving congruences with small numbers

To solve
$Ax\equiv B \pmod{m}$

Find P & Q such that they satisfy the following conditions

  • Q = A * n
  • P = B * n
  • $Q \equiv 1 \pmod{m}$

Once you do this - you can easily solve the congruence.


I have 2 questions

  1. Is this correct - i.e. my description of the steps of how the example in the book was solved?

  2. This seems to work when gcd(A, m) = 1. Will this work if the gcd is not 1.

user93353
  • 466
  • 2
  • 18
  • I believe this has been closed incorrectly. The other question is not a duplicate. I am trying to document one method & the other question tries to document a different method. Both are "by hand" methods - but diff ones. – user93353 Sep 15 '20 at 07:40
  • Please first read the linked posts before making unfounded claims. We have hundreds of prior answers on how to solve linear congruences. The above dupe links likely contain most all known methods. Generally the quickest is the (fractional) Extended Euclidean algorithm - see the examples in the 2nd and 3rd links. The method you mention is already described in these linked threads, as well as many other methods. If you have questions on any of these methods please ask them first in comments on the prior answers. – Bill Dubuque Sep 15 '20 at 07:40
  • As for what method the book used to compute the inverse that is impossible to say without further info, since the are many possible methods as you will learn when you peruse the dupe links. – Bill Dubuque Sep 15 '20 at 07:50
  • Btw, Silverman's proof is incorrect. The argument only proves that if the congruence is solvable then the solution is $,x\equiv 15\pmod{19}.,$ To deduce that this is actually a solution you either need to check it, or else use bidirectional arrows connecting the congruences. This is a common beginner mistake that can lead to errors. For further info on this see Beware here and the Remark here. – Bill Dubuque Sep 15 '20 at 08:02
  • I just perused the book, It is impossible for anyone but the author to say what method he used. He has not even introduced modular inverses at this point. The only thing he says about the method is "We solved the last congruence by a trick". One should not appeal to undefined "tricks" when there are well-known simple algorithms. Magic is not math. Thankfully, you'll find much better exposition here. – Bill Dubuque Sep 15 '20 at 08:18

2 Answers2

0

Well, you need to find the inverse of $A$ modulo $m$. For this, let $\gcd(A,m)=1$ as you already mentioned Then by the extended Euclidean algorithm, we obtain $$1 = Q\cdot A + R\cdot m$$ for some integers $Q$ and $R$. Taking the equation modulo $m$ gives $$1\equiv Q\cdot A\mod m.$$ Thus $$QB\equiv QAx \equiv x\mod m.$$

Wuestenfux
  • 20,964
  • I am not trying to find a method to solve any general congruence. I know the inverse method for that. What I am trying to do is try to document the steps used by the author to solve that congruences with small, manageable numbers. The author multiples both sides by 5 - why 5, though? I am trying to document that – user93353 Sep 15 '20 at 07:25
  • Why 5? Because 5 is the inverse of 4 modulo 19. – Wuestenfux Sep 15 '20 at 07:26
  • Ok, got it. However, is my method correct? I tried it on a few congruences where gcd = 1 & it seems to work – user93353 Sep 15 '20 at 07:30
0

To complement the other answer, I will answer $2$.

If $m$ is composite, we will use the Chinese Remainder Theorem and break $m$ down into a product of powers of primes and solve those congruences. However there may not be a solution if that happens.

e.g. $2x \equiv 5 \pmod {14}$ has no solutions.

player3236
  • 16,413
  • I am not trying to find a method to solve congruences. I am trying to document how the author solves that congruence - he multiples both sides by 5 - why 5 - that's what I am trying to document – user93353 Sep 15 '20 at 07:27
  • Well, I am answering "will this work if gcd is not $1$". More directly: your documentation is correct. It will always work if gcd is $1$ (like the other answer has shown) but not always if gcd is not $1$. – player3236 Sep 15 '20 at 07:28