{"id":133,"date":"2018-07-21T11:41:32","date_gmt":"2018-07-21T11:41:32","guid":{"rendered":"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=133"},"modified":"2022-01-06T11:52:32","modified_gmt":"2022-01-06T11:52:32","slug":"chinese-remainder-theorem","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/chapter\/chinese-remainder-theorem\/","title":{"rendered":"Chinese Remainder Theorem"},"content":{"raw":"<div><span style=\"float: right;\"><a href=\"https:\/\/youtu.be\/ZZoVnuc2jMk\" target=\"_blank\" rel=\"noopener noreferrer\"><img src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a>\r\n<\/span><\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>Learning Objectives<\/strong>\r\n\r\n\u00d8\u00a0 To introduce prime numbers and their applications in cryptography.\r\n\r\n\u00d8\u00a0\u00a0 To discuss about Euler\u2019s and Fermat\u2019s Theorem.\r\n\r\n\u00d8\u00a0\u00a0 To discuss various examples Euler\u2019s and Fermat\u2019s Theorem.\r\n\r\n\u00d8\u00a0\u00a0 To describe the Chinese remainder theorem and its application.\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>10.1. <\/strong><strong>Chinese Remainder Theorem<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">This theorem has this name because it is a theorem about <em>remainders<\/em> and was first discovered in the 3rd century AD by the Chinese mathematician Sunzi in <a href=\"https:\/\/en.wikipedia.org\/wiki\/Sunzi_Suanjing\"><em>Sunzi Suanjing<\/em>.<\/a><\/p>\r\n&nbsp;\r\n\r\n<img class=\"size-full wp-image-136 aligncenter\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-43.png\" alt=\"\" width=\"204\" height=\"251\" \/>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The <strong>Chinese remainder theorem<\/strong> is a theorem of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Number_theory\">number theory, <\/a>which states that, if one knows the remainders of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Euclidean_division\">division <\/a>of an <a href=\"https:\/\/en.wikipedia.org\/wiki\/Integer\">integer <\/a><em>n<\/em> by several integers, then one can determine\u00a0<span style=\"text-align: initial; font-size: 1em;\">uniquely the remainder of the division of <\/span><em style=\"text-align: initial; font-size: 1em;\">n<\/em><span style=\"text-align: initial; font-size: 1em;\"> by the product of these integers, under the condition that the <\/span><a style=\"text-align: initial; font-size: 1em;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Divisor\">divisors <\/a><span style=\"text-align: initial; font-size: 1em;\">are <\/span><a style=\"text-align: initial; font-size: 1em;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Pairwise_coprime\">pairwise coprime.<\/a><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The Chinese remainder theorem is widely used for computing with large integers, as it allows replacing a computation for which one knows a bound on the size of the result by several similar computations on small integers.<\/p>\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>10.2. Theorem Statement<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Let <em>n<\/em>1, ..., <em>n<\/em><em>k<\/em> be integers greater than 1, which are often called <a href=\"https:\/\/en.wikipedia.org\/wiki\/Modular_arithmetic\"><em>moduli<\/em> <\/a>or <a href=\"https:\/\/en.wikipedia.org\/wiki\/Euclidean_division\"><em>divisors<\/em>. <\/a>Let us denote by <em>N<\/em> the product of the <em>n<\/em><em>i<\/em>.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The Chinese remainder theorem asserts that if the <em>n<\/em><em>i<\/em> are <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pairwise_coprime\">pairwise coprime, <\/a>and if <em>a<\/em>1, ..., <em>a<\/em><em>k<\/em> are integers such that 0 \u2264 <em>a<\/em><em>i<\/em> &lt; <em>n<\/em><em>i<\/em>for every <em>i<\/em>, then there is one and only one integer <em>x<\/em>, such that 0 \u2264\u00a0 <em>x <\/em>&lt;<em> N <\/em>and the remainder of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Euclidean_division\">Euclidean division <\/a>of x by niis ai for every i.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">This may be restated as follows in term of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Congruence_relation\">congruences: <\/a>If the <em>n<\/em><em>i<\/em> are pairwise coprime, and if <em>a<\/em>1, ..., <em>a<\/em><em>k<\/em> are any integers, then there exists an integer <em>x<\/em> such that<\/p>\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<img class=\"size-full wp-image-137 aligncenter\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-44.png\" alt=\"\" width=\"114\" height=\"67\" \/>\r\n\r\n&nbsp;\r\n\r\nand any two such <em>x<\/em> are congruent modulo <em>N<\/em>.\r\n\r\n&nbsp;\r\n\r\nIn <a href=\"https:\/\/en.wikipedia.org\/wiki\/Abstract_algebra\">abstract algebra, <\/a>the theorem is often restated as: if the <em>n<\/em><em>i<\/em> are pairwise coprime, the map\r\n\r\n&nbsp;\r\n\r\n<img class=\"size-full wp-image-138 aligncenter\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-45.png\" alt=\"\" width=\"224\" height=\"25\" \/>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\ndefines a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ring_isomorphism\">ring isomorphism[12]<\/a>\r\n\r\n<img class=\"size-full wp-image-139 aligncenter\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-46.png\" alt=\"\" width=\"218\" height=\"38\" \/>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\nbetween the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ring_(mathematics)\">ring <\/a>of <span style=\"text-decoration: underline;\"><a href=\"https:\/\/en.wikipedia.org\/wiki\/Integers_modulo_n\">integers modulo <em>N<\/em> <\/a><\/span>and the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Direct_product\">direct product <\/a>of the rings of integers modulo the <em>n<\/em><em>i<\/em>. This means that for doing a sequence of arithmetic operations in z\/nz one may do the same computation independently in each\u00a0 z\/n<sub>i<\/sub>z and then get the result by applying the isomorphism (from the right to the left). This may be much faster than the direct computation\u00a0<span style=\"text-align: initial; font-size: 1em;\">if <\/span><em style=\"text-align: initial; font-size: 1em;\">N<\/em><span style=\"text-align: initial; font-size: 1em;\">and the number of operations are large. This is widely used, under the name <\/span><em style=\"text-align: initial; font-size: 1em;\">multi-modular<\/em> <em style=\"text-align: initial; font-size: 1em;\">computation<\/em><span style=\"text-align: initial; font-size: 1em;\">, for <\/span><a style=\"text-align: initial; font-size: 1em;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Linear_algebra\">linear algebraover <\/a><span style=\"text-align: initial; font-size: 1em;\">the integers or the <\/span><a style=\"text-align: initial; font-size: 1em;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Rational_number\">rational numbers.<\/a>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The theorem can also be restated in the language of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Combinatorics\">combinatorics <\/a>as the fact that the infinite <a href=\"https:\/\/en.wikipedia.org\/wiki\/Arithmetic_progression\">arithmetic progressions <\/a>of integers form a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Helly_family\">Helly family.<\/a><\/p>\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>10.3. CRT \u2013 Problem<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">An old woman goes to market and a horse steps on her basket and crushes the eggs. The rider offers to pay for the damages and asks her how many eggs she had brought. She does not remember the exact number, but when she had taken them out two at a time, there was one egg left. The same happened when she picked them out three, four, five, and six at a time, but when she took them seven at a time they came out even. What is the smallest number of eggs she could have had?<\/p>\r\n&nbsp;\r\n\r\nThis problem can be expressed as a system of congruences\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\nx\u22612(mod3)\r\n\r\nx\u22613(mod5)\r\n\r\nx\u22612(mod7)\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>What does (mod n) mean?<\/strong>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<em>x \u2261 a<\/em><em>1<\/em><em> ( mod m<\/em><em>1<\/em><em> )<\/em>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The Chinese remainder theorem states the above equations have a unique solution if the moduli are relatively prime.<\/p>\r\n\r\n<\/div>\r\n&nbsp;\r\n<div>\r\n\r\n\u00a0 \u00a0Example:\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\nThe following is an example of a set of equations with different moduli:\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\nX\u2261 2 (mod 3)\r\n\r\nX\u2261 3 (mod 5)\r\n\r\nX\u2261 2 (mod 7)\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">The solution to this set of equations is given in the next section; for the moment, note that the answer to this set of equations is x = 23. This value satisfies all equations: 23 \u2261 2 (mod 3), 23 \u2261 3 (mod 5), and 23 \u2261 2 (mod 7).<\/p>\r\n&nbsp;\r\n\r\n<strong>Solution To Chinese Remainder Theorem<\/strong>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n1.\u00a0 Find M = m1 \u00d7 m2 \u00d7 \u2026 \u00d7 mk. This is the common modulus.\r\n\r\n2.\u00a0 Find M1 = M\/m1, M2 = M\/m2, \u2026, Mk = M\/mk.\r\n<p style=\"text-align: justify;\">3.\u00a0 Find the multiplicative inverse of M1, M2, \u2026, Mk using the corresponding moduli (m1, m2, \u2026, mk). Call the inverses M1<sup>\u22121<\/sup>, M2<sup>\u22121<\/sup>, \u2026, Mk <sup>\u22121<\/sup>.<\/p>\r\n&nbsp;\r\n\r\n4.\u00a0 The solution to the simultaneous equations is\r\n\r\n&nbsp;\r\n\r\n<img class=\"size-full wp-image-140 aligncenter\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-47.png\" alt=\"\" width=\"444\" height=\"23\" \/>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Note that the set of equations can have a solution even if the moduli are not relatively prime but meet other condition. However , in cryptography only interested in solving equations with coprime moduli.<\/p>\r\n&nbsp;\r\n\r\n<strong>Example<\/strong>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\nFind the solution to the simultaneous equations:\r\n\r\n&nbsp;\r\n\r\n<strong style=\"text-align: initial; font-size: 1em;\">solution<\/strong>\r\n\r\n<\/div>\r\n<div>\r\n\r\nWe follow the four steps.\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\nX\u2261 2 (mod 3)\r\n\r\nX\u2261 3 (mod 5)\r\n\r\nX\u2261 2 (mod 7)\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n1. M = 3 \u00d7 5 \u00d7 7 = 105\r\n\r\n2. M1 = 105 \/ 3 = 35, M2 = 105 \/ 5 = 21, M3 = 105 \/ 7 = 15\r\n\r\n3. The inverses are M1\u22121 = 2, M2\u22121 = 1, M3 \u22121 = 1\r\n\r\n4. x = (2 \u00d7 35 \u00d7 2 + 3 \u00d7 21 \u00d7 1 + 2 \u00d7 15 \u00d7 1) mod 105 = 23 mod 105\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>Solution for Egg Problem<\/strong>\r\n\r\nTo solve for x, let M=3\u22c55\u22c57=105\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\nM1=35\r\n\r\nM2=21\r\n\r\nM3=15\r\n\r\n&nbsp;\r\n\r\nHere we see that 2 is an inverse of M1=35 modulo 3 because 35\u22c52\u22612\u22c52\u22611(mod3);\r\n\r\n1 is an inverse of M2=21 modulo 5, because 21\u22611(mod5);\r\n\r\nand 1 is an inverse of M3=15(mod7), because 15\u22611(mod7)\r\n\r\nThe solution to this system are those x such that\r\n\r\nx =2\u22c535\u22c52+3\u22c521\u22c51+2\u22c515\u22c51\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">=233\u226123(mod105)<\/span>\r\n\r\n<span style=\"text-align: initial; font-size: 1em;\">The answer is 23 eggs.<\/span>\r\n\r\n<\/div>\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>10.4. The Proof<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Let s and t be positive integers with gcd(s, t) = 1 S and t are therefore coprime Prove that there exists an integer w such that sw == 1 (mod t)<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">For each k, let Mi = m\/mk where m = m1m2m3\u2026mk (product of mods) Prove that the greatest common denominator of Mi &amp; mi = 1 Or, that Mi and mi are coprime<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify;\">Prove that there is an integer <em>x<\/em>i such that <em>m<\/em><em>i<\/em> <em>x<\/em><em>i<\/em> <em>== 1(mod m<\/em><em>i<\/em><em>)<\/em> and <em>a<\/em><em>i<\/em> <em>m<\/em><em>i<\/em> <em>x<\/em><em>i<\/em> == <em>a<\/em><em>i<\/em> (mod <em>m<\/em><em>i<\/em> ) Let x == a<sub>1<\/sub><em>m<\/em><sub>1<\/sub>x<sub>1<\/sub> + a<sub>2<\/sub><em>m<\/em><sub>2<\/sub>x<sub>2<\/sub> + \u2026 + a<sub>n<\/sub><em>m<\/em><sub>n<\/sub><em>x<\/em><sub>n<\/sub> Prove that <em>x == a<\/em><em>i<\/em> <em>(mod m<\/em><em>i<\/em><em>)<\/em><\/p>\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>10.5. Application<\/strong>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify;\">In coding theory, detection and correction of errors is done by adding redundancy to data that is sent via a noisy channel or in a computer.<\/p>\r\n&nbsp;\r\n\r\nThe CRT remainder techniques are useful in developing code that detects errors.\r\n\r\nIn cryptography, the CRT is used in secret sharing through error-correcting code.\r\n\r\nThe CRT is itself a secret-sharing scheme without any need for modification\r\n\r\n&nbsp;\r\n\r\n<strong>Summary<\/strong>\r\n\r\n&nbsp;\r\n\r\n\u00d8 Outlined the CRT and their applications in cryptography\r\n\r\n\u00d8 Discussed about the Chinese Remainder Theorem and algorithms\r\n\r\n\u00d8 Worked with various examples related with Chinese Remainder Theorem\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>you can view video on Chinese Remainder Theorem<\/strong><\/td>\r\n<td><a href=\"https:\/\/youtu.be\/ZZoVnuc2jMk\" target=\"_blank\" rel=\"noopener noreferrer\"><img class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<img class=\"size-full wp-image-141 alignleft\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-48.png\" alt=\"\" width=\"655\" height=\"543\" \/>","rendered":"<div><span style=\"float: right;\"><a href=\"https:\/\/youtu.be\/ZZoVnuc2jMk\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a><br \/>\n<\/span><\/div>\n<div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Learning Objectives<\/strong><\/p>\n<p>\u00d8\u00a0 To introduce prime numbers and their applications in cryptography.<\/p>\n<p>\u00d8\u00a0\u00a0 To discuss about Euler\u2019s and Fermat\u2019s Theorem.<\/p>\n<p>\u00d8\u00a0\u00a0 To discuss various examples Euler\u2019s and Fermat\u2019s Theorem.<\/p>\n<p>\u00d8\u00a0\u00a0 To describe the Chinese remainder theorem and its application.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>10.1. <\/strong><strong>Chinese Remainder Theorem<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">This theorem has this name because it is a theorem about <em>remainders<\/em> and was first discovered in the 3rd century AD by the Chinese mathematician Sunzi in <a href=\"https:\/\/en.wikipedia.org\/wiki\/Sunzi_Suanjing\"><em>Sunzi Suanjing<\/em>.<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-136 aligncenter\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-43.png\" alt=\"\" width=\"204\" height=\"251\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-43.png 204w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-43-65x80.png 65w\" sizes=\"auto, (max-width: 204px) 100vw, 204px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The <strong>Chinese remainder theorem<\/strong> is a theorem of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Number_theory\">number theory, <\/a>which states that, if one knows the remainders of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Euclidean_division\">division <\/a>of an <a href=\"https:\/\/en.wikipedia.org\/wiki\/Integer\">integer <\/a><em>n<\/em> by several integers, then one can determine\u00a0<span style=\"text-align: initial; font-size: 1em;\">uniquely the remainder of the division of <\/span><em style=\"text-align: initial; font-size: 1em;\">n<\/em><span style=\"text-align: initial; font-size: 1em;\"> by the product of these integers, under the condition that the <\/span><a style=\"text-align: initial; font-size: 1em;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Divisor\">divisors <\/a><span style=\"text-align: initial; font-size: 1em;\">are <\/span><a style=\"text-align: initial; font-size: 1em;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Pairwise_coprime\">pairwise coprime.<\/a><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The Chinese remainder theorem is widely used for computing with large integers, as it allows replacing a computation for which one knows a bound on the size of the result by several similar computations on small integers.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>10.2. Theorem Statement<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Let <em>n<\/em>1, &#8230;, <em>n<\/em><em>k<\/em> be integers greater than 1, which are often called <a href=\"https:\/\/en.wikipedia.org\/wiki\/Modular_arithmetic\"><em>moduli<\/em> <\/a>or <a href=\"https:\/\/en.wikipedia.org\/wiki\/Euclidean_division\"><em>divisors<\/em>. <\/a>Let us denote by <em>N<\/em> the product of the <em>n<\/em><em>i<\/em>.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The Chinese remainder theorem asserts that if the <em>n<\/em><em>i<\/em> are <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pairwise_coprime\">pairwise coprime, <\/a>and if <em>a<\/em>1, &#8230;, <em>a<\/em><em>k<\/em> are integers such that 0 \u2264 <em>a<\/em><em>i<\/em> &lt; <em>n<\/em><em>i<\/em>for every <em>i<\/em>, then there is one and only one integer <em>x<\/em>, such that 0 \u2264\u00a0 <em>x <\/em>&lt;<em> N <\/em>and the remainder of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Euclidean_division\">Euclidean division <\/a>of x by niis ai for every i.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">This may be restated as follows in term of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Congruence_relation\">congruences: <\/a>If the <em>n<\/em><em>i<\/em> are pairwise coprime, and if <em>a<\/em>1, &#8230;, <em>a<\/em><em>k<\/em> are any integers, then there exists an integer <em>x<\/em> such that<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-137 aligncenter\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-44.png\" alt=\"\" width=\"114\" height=\"67\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-44.png 114w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-44-65x38.png 65w\" sizes=\"auto, (max-width: 114px) 100vw, 114px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>and any two such <em>x<\/em> are congruent modulo <em>N<\/em>.<\/p>\n<p>&nbsp;<\/p>\n<p>In <a href=\"https:\/\/en.wikipedia.org\/wiki\/Abstract_algebra\">abstract algebra, <\/a>the theorem is often restated as: if the <em>n<\/em><em>i<\/em> are pairwise coprime, the map<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-138 aligncenter\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-45.png\" alt=\"\" width=\"224\" height=\"25\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-45.png 224w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-45-65x7.png 65w\" sizes=\"auto, (max-width: 224px) 100vw, 224px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>defines a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ring_isomorphism\">ring isomorphism[12]<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-139 aligncenter\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-46.png\" alt=\"\" width=\"218\" height=\"38\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-46.png 218w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-46-65x11.png 65w\" sizes=\"auto, (max-width: 218px) 100vw, 218px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>between the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ring_(mathematics)\">ring <\/a>of <span style=\"text-decoration: underline;\"><a href=\"https:\/\/en.wikipedia.org\/wiki\/Integers_modulo_n\">integers modulo <em>N<\/em> <\/a><\/span>and the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Direct_product\">direct product <\/a>of the rings of integers modulo the <em>n<\/em><em>i<\/em>. This means that for doing a sequence of arithmetic operations in z\/nz one may do the same computation independently in each\u00a0 z\/n<sub>i<\/sub>z and then get the result by applying the isomorphism (from the right to the left). This may be much faster than the direct computation\u00a0<span style=\"text-align: initial; font-size: 1em;\">if <\/span><em style=\"text-align: initial; font-size: 1em;\">N<\/em><span style=\"text-align: initial; font-size: 1em;\">and the number of operations are large. This is widely used, under the name <\/span><em style=\"text-align: initial; font-size: 1em;\">multi-modular<\/em> <em style=\"text-align: initial; font-size: 1em;\">computation<\/em><span style=\"text-align: initial; font-size: 1em;\">, for <\/span><a style=\"text-align: initial; font-size: 1em;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Linear_algebra\">linear algebraover <\/a><span style=\"text-align: initial; font-size: 1em;\">the integers or the <\/span><a style=\"text-align: initial; font-size: 1em;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Rational_number\">rational numbers.<\/a><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The theorem can also be restated in the language of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Combinatorics\">combinatorics <\/a>as the fact that the infinite <a href=\"https:\/\/en.wikipedia.org\/wiki\/Arithmetic_progression\">arithmetic progressions <\/a>of integers form a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Helly_family\">Helly family.<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>10.3. CRT \u2013 Problem<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">An old woman goes to market and a horse steps on her basket and crushes the eggs. The rider offers to pay for the damages and asks her how many eggs she had brought. She does not remember the exact number, but when she had taken them out two at a time, there was one egg left. The same happened when she picked them out three, four, five, and six at a time, but when she took them seven at a time they came out even. What is the smallest number of eggs she could have had?<\/p>\n<p>&nbsp;<\/p>\n<p>This problem can be expressed as a system of congruences<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>x\u22612(mod3)<\/p>\n<p>x\u22613(mod5)<\/p>\n<p>x\u22612(mod7)<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>What does (mod n) mean?<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><em>x \u2261 a<\/em><em>1<\/em><em> ( mod m<\/em><em>1<\/em><em> )<\/em><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The Chinese remainder theorem states the above equations have a unique solution if the moduli are relatively prime.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<div>\n<p>\u00a0 \u00a0Example:<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>The following is an example of a set of equations with different moduli:<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>X\u2261 2 (mod 3)<\/p>\n<p>X\u2261 3 (mod 5)<\/p>\n<p>X\u2261 2 (mod 7)<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">The solution to this set of equations is given in the next section; for the moment, note that the answer to this set of equations is x = 23. This value satisfies all equations: 23 \u2261 2 (mod 3), 23 \u2261 3 (mod 5), and 23 \u2261 2 (mod 7).<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Solution To Chinese Remainder Theorem<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>1.\u00a0 Find M = m1 \u00d7 m2 \u00d7 \u2026 \u00d7 mk. This is the common modulus.<\/p>\n<p>2.\u00a0 Find M1 = M\/m1, M2 = M\/m2, \u2026, Mk = M\/mk.<\/p>\n<p style=\"text-align: justify;\">3.\u00a0 Find the multiplicative inverse of M1, M2, \u2026, Mk using the corresponding moduli (m1, m2, \u2026, mk). Call the inverses M1<sup>\u22121<\/sup>, M2<sup>\u22121<\/sup>, \u2026, Mk <sup>\u22121<\/sup>.<\/p>\n<p>&nbsp;<\/p>\n<p>4.\u00a0 The solution to the simultaneous equations is<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-140 aligncenter\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-47.png\" alt=\"\" width=\"444\" height=\"23\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-47.png 444w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-47-300x16.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-47-65x3.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-47-225x12.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-47-350x18.png 350w\" sizes=\"auto, (max-width: 444px) 100vw, 444px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Note that the set of equations can have a solution even if the moduli are not relatively prime but meet other condition. However , in cryptography only interested in solving equations with coprime moduli.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Find the solution to the simultaneous equations:<\/p>\n<p>&nbsp;<\/p>\n<p><strong style=\"text-align: initial; font-size: 1em;\">solution<\/strong><\/p>\n<\/div>\n<div>\n<p>We follow the four steps.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>X\u2261 2 (mod 3)<\/p>\n<p>X\u2261 3 (mod 5)<\/p>\n<p>X\u2261 2 (mod 7)<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>1. M = 3 \u00d7 5 \u00d7 7 = 105<\/p>\n<p>2. M1 = 105 \/ 3 = 35, M2 = 105 \/ 5 = 21, M3 = 105 \/ 7 = 15<\/p>\n<p>3. The inverses are M1\u22121 = 2, M2\u22121 = 1, M3 \u22121 = 1<\/p>\n<p>4. x = (2 \u00d7 35 \u00d7 2 + 3 \u00d7 21 \u00d7 1 + 2 \u00d7 15 \u00d7 1) mod 105 = 23 mod 105<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Solution for Egg Problem<\/strong><\/p>\n<p>To solve for x, let M=3\u22c55\u22c57=105<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>M1=35<\/p>\n<p>M2=21<\/p>\n<p>M3=15<\/p>\n<p>&nbsp;<\/p>\n<p>Here we see that 2 is an inverse of M1=35 modulo 3 because 35\u22c52\u22612\u22c52\u22611(mod3);<\/p>\n<p>1 is an inverse of M2=21 modulo 5, because 21\u22611(mod5);<\/p>\n<p>and 1 is an inverse of M3=15(mod7), because 15\u22611(mod7)<\/p>\n<p>The solution to this system are those x such that<\/p>\n<p>x =2\u22c535\u22c52+3\u22c521\u22c51+2\u22c515\u22c51<\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">=233\u226123(mod105)<\/span><\/p>\n<p><span style=\"text-align: initial; font-size: 1em;\">The answer is 23 eggs.<\/span><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>10.4. The Proof<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Let s and t be positive integers with gcd(s, t) = 1 S and t are therefore coprime Prove that there exists an integer w such that sw == 1 (mod t)<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">For each k, let Mi = m\/mk where m = m1m2m3\u2026mk (product of mods) Prove that the greatest common denominator of Mi &amp; mi = 1 Or, that Mi and mi are coprime<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Prove that there is an integer <em>x<\/em>i such that <em>m<\/em><em>i<\/em> <em>x<\/em><em>i<\/em> <em>== 1(mod m<\/em><em>i<\/em><em>)<\/em> and <em>a<\/em><em>i<\/em> <em>m<\/em><em>i<\/em> <em>x<\/em><em>i<\/em> == <em>a<\/em><em>i<\/em> (mod <em>m<\/em><em>i<\/em> ) Let x == a<sub>1<\/sub><em>m<\/em><sub>1<\/sub>x<sub>1<\/sub> + a<sub>2<\/sub><em>m<\/em><sub>2<\/sub>x<sub>2<\/sub> + \u2026 + a<sub>n<\/sub><em>m<\/em><sub>n<\/sub><em>x<\/em><sub>n<\/sub> Prove that <em>x == a<\/em><em>i<\/em> <em>(mod m<\/em><em>i<\/em><em>)<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>10.5. Application<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">In coding theory, detection and correction of errors is done by adding redundancy to data that is sent via a noisy channel or in a computer.<\/p>\n<p>&nbsp;<\/p>\n<p>The CRT remainder techniques are useful in developing code that detects errors.<\/p>\n<p>In cryptography, the CRT is used in secret sharing through error-correcting code.<\/p>\n<p>The CRT is itself a secret-sharing scheme without any need for modification<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Summary<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>\u00d8 Outlined the CRT and their applications in cryptography<\/p>\n<p>\u00d8 Discussed about the Chinese Remainder Theorem and algorithms<\/p>\n<p>\u00d8 Worked with various examples related with Chinese Remainder Theorem<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>you can view video on Chinese Remainder Theorem<\/strong><\/td>\n<td><a href=\"https:\/\/youtu.be\/ZZoVnuc2jMk\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-141 alignleft\" src=\"http:\/\/csp11.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/55\/2018\/07\/1-48.png\" alt=\"\" width=\"655\" height=\"543\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-48.png 655w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-48-300x249.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-48-65x54.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-48-225x187.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-content\/uploads\/sites\/55\/2018\/07\/1-48-350x290.png 350w\" sizes=\"auto, (max-width: 655px) 100vw, 655px\" \/><\/p>\n","protected":false},"author":3,"menu_order":10,"template":"","meta":{"_acf_changed":false,"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["dr-kulothungan"],"pb_section_license":""},"chapter-type":[],"contributor":[58],"license":[],"class_list":["post-133","chapter","type-chapter","status-publish","hentry","contributor-dr-kulothungan"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/pressbooks\/v2\/chapters\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/wp\/v2\/users\/3"}],"version-history":[{"count":7,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/pressbooks\/v2\/chapters\/133\/revisions"}],"predecessor-version":[{"id":639,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/pressbooks\/v2\/chapters\/133\/revisions\/639"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/pressbooks\/v2\/chapters\/133\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/wp\/v2\/media?parent=133"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/pressbooks\/v2\/chapter-type?post=133"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/wp\/v2\/contributor?post=133"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp11\/wp-json\/wp\/v2\/license?post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}