{"id":12539,"date":"2021-01-30T01:38:19","date_gmt":"2021-01-29T17:38:19","guid":{"rendered":"https:\/\/www.intmath.com\/blog\/?p=12539"},"modified":"2022-04-27T05:28:15","modified_gmt":"2022-04-26T21:28:15","slug":"how-to-solve-linear-congruences","status":"publish","type":"post","link":"https:\/\/www.intmath.com\/blog\/mathematics\/how-to-solve-linear-congruences-12539","title":{"rendered":"How To Solve Linear Congruences"},"content":{"rendered":"<p>Numbers are\u00a0congruent if they have a property that the difference between them is integrally divisible by a number (an integer). The number is called the modulus, and the statement is treated as congruent to the modulo. Mathematically, this can be expressed as b = c\u00a0(mod m)<\/p>\n<p>Generally, a linear congruence is a problem of finding an integer x\u00a0that satisfies the equation ax\u00a0= b\u00a0(mod m). Thus, a linear congruence is a congruence in the form of ax\u00a0= b\u00a0(mod m), where x\u00a0is an unknown integer. In a linear congruence where x0\u00a0is the solution, all the integers x1 are x1 = x0 (mod m).<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.intmath.com\/chat\/index2.html\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" src=\"https:\/\/www.intmath.com\/includes\/images\/tutor_chat_ad_banner.png\" alt=\"24x7 Tutor Chat\" width=\"632\" height=\"135\" \/><\/a><\/p>\n<h2>Different Methods to Solve Linear Congruences<\/h2>\n<p>You can use several methods to solve linear congruences. The most commonly used methods are\u00a0the Euclidean Algorithm Method and the Euler's Method.<\/p>\n<p><strong>Example:<\/strong>\u00a0Solve the linear congruence ax\u00a0= b (mod m)<\/p>\n<p><strong>Solution:<\/strong>\u00a0ax = b\u00a0(mod m) _____\u00a0(1)<\/p>\n<p>a, b, and m\u00a0are\u00a0integers such that m\u00a0&gt; 0 and c\u00a0= (a, m).<\/p>\n<p>If c\u00a0cannot divide b, the linear congruence\u00a0ax = b\u00a0(mod m) lacks a solution.<\/p>\n<p>If c\u00a0can divide b, the congruences ax = b(mod M) has an incongruent solution for modulo m.<\/p>\n<p>As mentioned, ax = b\u00a0(mod m) is equal to ax - my = b. If we apply Theorem 19, you realize that c\u00a0cannot divide b; thus, it is impossible to get a solution for the equation ax - my = b.<\/p>\n<p>Alternatively, if c\u00a0can divide b, it implies that there are several solutions whose variable is x\u00a0denoted by x\u00a0= x0 + (m\/c)t _____ (2)<\/p>\n<p>Thus, the values of x\u00a0become the solution for the congruence ax = b\u00a0(mod m). You can now easily find the number of all the incongruent solutions.<\/p>\n<p>Assuming the two solutions are incongruent such that:<\/p>\n<p>x0 + (m\/c)t1 = x0 + (m\/c)t2 \u00a0(mod m) _____ (3)<\/p>\n<p>(m\/c)t1 = (m\/c)t2 (mod m) _____ (4)<\/p>\n<p>You now realize that (m, m\/c) = m\/c<\/p>\n<p>Thus t1 = t2 (mod c) _____ (5)<\/p>\n<p>You now have a set of incongruent solutions given by X = X0 + (M\/C)T, where T is given as modulo C.<\/p>\n<p>Mathematically, if C = (A, M) = 1, there is always a definite unique solution for modulo M in the linear congruence AX = B(mod M).<\/p>\n<h3>Solving Linear Congruences Using The Euclidean Algorithm Method<\/h3>\n<p>The Euclidean Algorithm Method is one of the simplest methods of solving linear congruences. The technique works so that if d is the Greatest Common Divisor of two positive integers, say a\u00a0and b, the d\u00a0divides the reminder (r). This remainder (r) results from dividing the smaller of a\u00a0and b\u00a0into the larger.<\/p>\n<p>The Euclidean Algorithm Method allows you to\u00a0find the middle ground pathways of prime numbers while solving linear congruences.<\/p>\n<p><strong>Example:<\/strong>\u00a0Solve the linear congruence 3x\u00a0= 12 (mod 6)<\/p>\n<p><strong>Solution:<\/strong><\/p>\n<p>3x\u00a0= 12 (mod 6)<\/p>\n<p>(3, 6) = 3 and 3\/12<\/p>\n<p>Thus, you get three incongruent solutions for mod 6.<\/p>\n<p>You should use the Euclidean Algorithm Method to find the solution for the resultant linear diophantine equation 3x\u00a0- 6y= 12 to give you x0 = 0.<\/p>\n<p>The three incongruent solutions are given by:<\/p>\n<p>x1\u00a0= 6 (mod 6)<\/p>\n<p>x1 = 6+2 = 2 (mod 6)<\/p>\n<p>x2 = 6+4 = 4 (mod 6)<\/p>\n<h4>Illustration<\/h4>\n<p>The GCD of 24 and 16 is 8.<\/p>\n<p>Thus;\u00a024 = 1(16) + 8<\/p>\n<p>Therefore the remainder is 8 when you divide 24 by 16, which is divisible by 8.<\/p>\n<h4>Examples<\/h4>\n<p>To better understand how to use the Euclidean Algorithm Method, we will use the equation 11x =\u00a01 mod 23.<\/p>\n<p><strong>Example:<\/strong>\u00a0Solve the Linear Congruence 11x\u00a0= 1 mod 23<\/p>\n<p><strong>Solution:<\/strong>\u00a0Find the Greatest Common Divisor of the algorithm.<\/p>\n<p>23 = 2(11) +1<\/p>\n<p>11 = 1(11) + 0<\/p>\n<p>Therefore the GCD is 1.<\/p>\n<p>You can see from the equation that 1 = (1)(23) + (-2)11\u00a0(mod 23)<\/p>\n<p>(-2)(11) =\u00a01 mod 23<\/p>\n<p>Thus, x\u00a0= -2<\/p>\n<p>To write the answer as the value from 0 to 22, you realize that -2 = 21 mod 23; thus, the solution is x = 21.<\/p>\n<p><strong>Example:<\/strong>\u00a0Consider the linear congruence\u00a016x = 5 mod 29<\/p>\n<p><strong>Solution:\u00a0<\/strong><\/p>\n<p>First, solve the congruence 16x = 1 mod 29<\/p>\n<p>29 = 1(16) +13 (2)<\/p>\n<p>16 = 1(13) + 3 (3)<\/p>\n<p>13 = 4(3) + 1 (4)<\/p>\n<p>Hence you get:<\/p>\n<p>1 = 1(13) + (-4)(3).<\/p>\n<p>Substitute in the equation 1 = 1(13) + (-4)(3) using the fact that from (3), 3 = 16 -1(13) you get:<\/p>\n<p>1 = 1(13) + (-4)(16-1(13)) = 5(13) + (-4)(16) (5)<\/p>\n<p>You can now use (2) with the knowledge that 13 = 29 -1(16) to substitute for 13 in (5).<\/p>\n<p>1 = 5(29-1(16)) + (-4)(16) = (-9)(16) +(5)(29)<\/p>\n<p>Therefore the last equation mod 29 results to:<\/p>\n<p>(-9)(16) =\u00a01 modulo 29<\/p>\n<p>The value of x\u00a0is thus -9, which in this case, is congruent to modulo 29 to 30.<\/p>\n<p>It doesn't end here, though.<\/p>\n<p>Now that you know 16(20) is congruent to 1 mod 29, multiply both sides of the equation by 5 to get 100(16), a congruent to modulo 29. And because 100 is congruent to 13 mod 29, the solution to the linear congruence 16x =\u00a05 modulo 29 is 13.<\/p>\n<p>Lastly, verify that 16(13)-5 will leave a zero remainder when you divide it by 29.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.intmath.com\/chat\/index2.html\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" src=\"https:\/\/www.intmath.com\/includes\/images\/tutor_chat_ad_banner.png\" alt=\"24x7 Tutor Chat\" width=\"632\" height=\"135\" \/><\/a><\/p>\n<h3>How to Solve Linear Congruences Using Euler's Method<\/h3>\n<p>This method applies to solve a linear diophantine equation. A linear diophantine equation is any equation expressed as ax + by = c. Euler's method applies the knowledge of solving linear diophantine equations to solve linear congruences.<\/p>\n<p>It is important to note that there exists a close relationship between linear diophantine equations and linear congruences.<\/p>\n<p>This is so because in the equation a = b (mod n), n divides (a-b) or a-b = nt for some t, or a= b + nt.<\/p>\n<p>Also, the equation a = b + nt can be converted to modulo n:<\/p>\n<p>a = b + nt<\/p>\n<p>a = b + 0t mod n<\/p>\n<p>Hence a = b mod n<\/p>\n<h4>Example:<\/h4>\n<p>You can easily convert the linear congruence 13x = 4 mod 37 to a diophantine equation 13x = 4 + 37y.<\/p>\n<p>Solving linear congruences using Euler's Method involves changing congruences to equations. You then change the equation to a congruence modulo using the smallest coefficient.<\/p>\n<h4>Example:<\/h4>\n<p>Solve the following diophantine linear equation.<\/p>\n<p>23x + 49y = 102<\/p>\n<h4>Solution:<\/h4>\n<p>23x + 49y = 102 _____\u00a0(1)<\/p>\n<p>First, change the diophantine equation into a linear congruence. You realize from the equation that mod 23 is the smallest coefficient.<\/p>\n<p>49y = 101 mod 23<\/p>\n<p>Now simplify the equation to get:<\/p>\n<p>3y = 10 mod 23<\/p>\n<p>Now use Euler's Method to change the equation into equality.<\/p>\n<p>3y +10 + 23a _____\u00a0(2)<\/p>\n<p>Now reduce the equation to congruence mod 3, which is the smallest coefficient.<\/p>\n<p>0 = 10 + 2a mod 3 or 0 = equiv 1+ 2a mod 3.<\/p>\n<p>Simplify this further to an equation to get:<\/p>\n<p>0 = 1 + 2a + 3b _____\u00a0(3)<\/p>\n<p>Before we go to the next step, take note of the introduction of a new variable (b).<\/p>\n<p>Next, let us take mode 2 to get:<\/p>\n<p>0 = 1 +3b mod 2<\/p>\n<p>Simplify further to get:<\/p>\n<p>0 = 1 + b mod 2<\/p>\n<p>This results in:<\/p>\n<p>b \u22121 mod 2<\/p>\n<p>Now that you have b mod 2 pick any b integer satisfying this congruence, for example, b = -1.<\/p>\n<p>Go back to the x equation (2) to get:<\/p>\n<p>1 + 2a + 3(\u22121) = 0.<\/p>\n<p>1 + 2a \u2212 3 = 0<\/p>\n<p>Next, go to the y in equation (2) to get:<\/p>\n<p>3y = 10 + 23a = 10 + 23 = 33<\/p>\n<p>Therefore y = 11<\/p>\n<p>Go back to the original equation (1) to get:<\/p>\n<p>23x + 49 11 = 102<\/p>\n<p>23x = 102 \u2212 539 = 437<\/p>\n<p>x = 19<\/p>\n<p>Therefore the final solution is:<\/p>\n<p>x = 19<\/p>\n<p>y = 11<\/p>\n<h2>Final Thoughts<\/h2>\n<p>Understanding the Euclidean Algorithm and Euler's Methods makes solving linear congruences less complicated. The two methods allow us to extend modular arithmetic beyond\u00a0simple addition, multiplication, and subtraction to give room for division. It has cemented a fundamental relationship between integer linear combination of numbers and their GCD.<\/p>\n<p>Take your time to learn the two methods and start solving linear congruences with ease.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.intmath.com\/chat\/index2.html\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" src=\"https:\/\/www.intmath.com\/includes\/images\/tutor_chat_ad_banner.png\" alt=\"24x7 Tutor Chat\" width=\"632\" height=\"135\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p class=\"alt\"><a href=\"#respond\" id=\"comms\">Be the first to comment<\/a> below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Numbers are\u00a0congruent if they have a property that the difference between them is integrally divisible by a number (an integer). The number is called the modulus, and the statement is treated as congruent to the modulo. Mathematically, this can be expressed as b = c\u00a0(mod m) Generally, a linear congruence is a problem of finding [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mo_disable_npp":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts\/12539"}],"collection":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/comments?post=12539"}],"version-history":[{"count":4,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts\/12539\/revisions"}],"predecessor-version":[{"id":13063,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts\/12539\/revisions\/13063"}],"wp:attachment":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/media?parent=12539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/categories?post=12539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/tags?post=12539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}