V55.0106 Quantitative Reasoning: Computers, Number Theory and Cryptography The Euler Method This is a method to solve a linear Diophantine equation ax + by = c. It is equally a way of solving a congruence ax ≡ c mod b. In fact these ideas are the same. We illustrate with an example. Reviewing the definition of congruence: When we have a ≡ b mod n, this means that n divides (a − b) or a − b = nt for some t, or a = b + nt. So it is useful to be able to convert a ≡ b mod n to a = b + nt for some t. Conversely, if you have an equation a = b + nt, we can take it mod n, remembering that n ≡ 0 mod n. So from a = b + nt we get a ≡ b + 0t mod n, or a ≡ b mod n. For example: The congruence 13x ≡ 4 mod 37, can be converted to the equation 13x = 4 + 37y. The equation 43x = 4 + 31y can be converted to 43x ≡ 4 mod 31, or more simply 12x ≡ 4 mod 31 since 43 ≡ 12 mod 31. The same equation 43x = 4 + 31y can be taken mod 43 to get 0 ≡ 4 + 31y mod 43. As we shall see, the Euler method for solving ax + by = c involves taking congruences, and also changing congruences to equations. A few examples: Example 1. Change 41x ≡ 23 mod 101 to an equation. Answer: 41x = 23 + 101y. (Any letter t, z, r, etc. can be used instead of y.) Example 2. Change 15x + 7 = 43y to a congruence mod 15, and also to a congruence mod 43, and also to a congruence mod 7. Answer: For mod 15, we get 7 ≡ 43y mod 15. We can go further, to get 7 ≡ 13y mod 15. since 43 ≡ 13 mod 15. For mod 43, we get 15x + 7 ≡ 0 mod 43, or 15x ≡ −7 mod 43. For mod 7, we get 15x ≡ 43y mod 7, since 7 ≡ 0 mod 7. We can reduce further to get x ≡ y mod 7. Do you see why? Before proceeding it would be well to be able to do the following problems/ I. Change the equation 41x − 5 = 30z to a congruence mod 30. II. Change the congruence 15x ≡ 7 mod 58 to an equation. We can now move on to Euler’s method for solving Linear Diophantine equations or linear congruences. The trick is as follows: Change a congruence to an equation. And take the 1 equation and change it to a congruence modulo the smallest coefficient. Simplify and repeat as necessary. Let’s illustrate with an example. Example. Solve the Diophantine Linear Equation 23x + 49y = 102 (1) Method. Take this equation modulo 23 (the smallest coefficient). This yields 49y ≡ 101 mod 23. Reduce this mod 23 to 3y ≡ 10 mod 23. Now change this to an equality using the above method. We get 3y = 10 + 23a, (2) where a is a new variable. (Keep track of these variables.) Now reduce this to a congruence mod 3 (the smallest coefficient) to get 0 ≡ 10 + 2a mod 3, or 0 = equiv1 + 2a mod 3. Reduce this to an equation to get 0 = 1 + 2a + 3b (3) where we have introduced a new variable b. Take this mod 2, to get 0 ≡ 1 + 3b mod 2, or simply, 0 ≡ 1 + b mod 2. This gives b ≡ −1 mod 2. The procedure stops here. We know b mod 2. Now choose any b satisfying this congruence, say b = −1. 1 . Now go back to the “a” equation (2) to get 1 + 2a + 3(−1) = 0. This gives 1 + 2a − 3 = 0 so a = 1. Now go to the “y” equation (2) to get 3y = 10 + 23a = 10 + 23 = 33, so y = 11.2 Finally go back to the original equation (1) to get 23x + 49 · 11 = 102. This gives 23x = 102 − 539 = 437 so x = 19. So one solution of the equation is (x, y) = (19, 11). The general theory show that all solutions are given by x = 19 + 49t; y = 11 − 23t Note: The same method allows us to solve a congruence ax ≡ b mod c. Just write as an equation, reduce it mod the smallest coefficient. Write that as an equation, reduce it modulo the smallest coefficient, and so on, till you get the solution x ≡ d mod c. 1 2 We are looking for only one solution to the original equation If it doesn’t come out even, check your work! 2