Chapte : Theoy of Modula Aithmetic 8 Sectio D Chiese Remaide Theoem By the ed of this sectio you will be able to pove the Chiese Remaide Theoem apply this theoem to solve simultaeous liea cogueces The Chiese Remaide Theoem helps us to solve the followig poblem: Suppose you ae i chage of a amy ad you eed to cout the umbe of soldies you have. You ca cout them oe by oe but this is a tedious tas ad is poe to eos. A easie way to cout them is to goup them ito ows. Suppose the followig: If you place them i ows of soldies the 2 soldies ae left ove. If you place them i ows of 5 soldies the soldies ae left ove. If you place them i ows of 7 soldies the 2 soldies ae left ove. We ca covet this poblem ito modula aithmetic which meas we eed to solve the followig simultaeous liea cogueces fo the umbe of soldies which satisfies: 2 mod [Dividig by leaves emaide 2] mod 5 [Dividig by 5 leaves emaide ] 2 mod 7 [Dividig by 7 leaves emaide 2] The umbe of soldies eeds to satisfy all thee of these equatios. This poblem is equivalet to the followig: Fid the itege which leaves a emaide of 2 whe divided by, leaves a emaide of whe divided by 5 ad leaves a emaide of 2 whe divided by 7. We will solve this poblem late i this sectio. D Solvig Simultaeous Liea Cogueces Up to ow we have solved a sigle liea coguece such as a b mod I this sectio we eamie solvig a set of simultaeous liea cogueces. We ll begi by looig at a eample befoe goig o to develop the geeal method. Eample 2 Fid the value of which satisfies both the followig equatios:
Chapte : Theoy of Modula Aithmetic 9 mod 5 4 mod 7 2 Note that we have oe uow which satisfies both [() ad (2)] coguet equatios. Solutio We eed to fid a value of such that equatios () ad (2) ae tue. Let us fist use bute foce to esolve these equatios. Ceatig a table of values: 4 5 6 7 8 9 0 2 4 5 mod 5 4 0 4 0 4 0 mod 7 4 5 6 0 4 5 6 0 Table Shows the juctios of mod 5 ad mod 7 We ca see i the table that the oly value of that will satisfy both ou equatios is : ad 4 mod 7 mod 5 Of couse we ca apply bute foce fo simple itege values. Howeve we eed a systematic appoach to solve these because modulus may be a lage umbe ad we just do ot have the time o willpowe to ceate a table fo lage. Say if 70 the this would mea we would have to ceate a table with 70 colums. What does the fist equatio mod 5 i the above eample mea? This meas that is a multiple of 5 o 5 fo some itege. Reaagig this we have 5. Similaly the othe equatio 4 mod 7 meas 4 7c fo some itege c ad so 4 7c. Equatig these two equatios, 5 ad 4 7c, gives 5 4 7c 7c 5 Sice is a itege we eed 7c to be a multiple of 5. If c the 7 0 7c 7 0 ad 2. 5 5 Substitutig this, c, ito 4 7c gives 4 7 This is ou solutio fom the pevious eample.
Chapte : Theoy of Modula Aithmetic 40 Eample 22 Solve the simultaeous equatios: Solutio mod 49 6 mod 20 Fom these equatios ad defiitio of coguece we have 49 implies 49 6 20c implies 6 20c whee ad c ae iteges. Equatig these last two equatios because both ae equal to gives the Diophatie equatio: 25 49 6 20c 49 implies c 20 Sice we wat itege solutios so we ty values of such that the umeato 25 49 is a multiple of 20. (Multiplyig 49 by multiples of 5 will give esults edig i 5 o 0. Oly esults edig i 5 will be divisible by 20 afte addig 25.) Hece we tial multiples of 5 fo, that is 5, 0, 5,. Note that 5, 0 does ot give a multiple of 20 but 5 does because 25 49 5 c 8 20 Substitutig c 8 ito 6 20c 6 20 8 766. Chec that this 766 gives satisfies both the give equatios: mod 49 766 mod 49 6 mod 20 766 6 mod 20 Eample 2 Fid a itege such that whe divided by 2, ad 5 the emaide is. Solutio We ca wite the itege satisfies the followig coguece equatios: What does this mea? Meas that mod 2 Dividig by 2 with emaide mod Dividig by with emaide mod 5 Dividig by 5 with emaide is a multiple of 2, ad 5 which we ca wite as:
Chapte : Theoy of Modula Aithmetic 4 2, c ad 5m whee, c ad m ae iteges Which umbe is a multiple of 2, ad 5? Sice gcd2, gcd, 5 gcd2, 5 so the smallest umbe which is a multiple of 2, ad 5 is This meas that 2 5 0 [LCM of 2, ad 5 is 0] is a multiple of 0 o 0 implies 0 The geeal solutio of the give thee equatios is 0. Puttig i vaious values of such as, 2,, ito 0 gives 0, 02 6, 0 9, Ou solutio is a multiple of 0 plus. You may chec that each of these solutios satisfies the give equatios: mod 2, mod ad mod 5 We ca also wite the solutios, 6, 9, satisfies mod 0 i modula aithmetic as whee 0 2 5 is the LCM of 2, ad 5 which ae the give moduli. I the et subsectio we ecoute the Chiese Remaide Theoem which povides us with a stuctued way of solvig simultaeous coguece equatios. D2 Poof of the Chiese Remaide Theoem I the above eample we say the umbes 2, ad 5 ae paiwise pime. What does paiwise pime mea? It meas that the oly facto i commo betwee ay pai of umbes is : gcd 2,, gcd2, 5 ad We say iteges 2, ad 5 ae paiwise pime. Be caeful it is ot good eough just to say if gcd,, Fo eample gcd2,, 4 but paiwise pime. Defiitio (.2). gcd, 5 a b c the a, b ad c ae paiwise pime gcd 2, 4 2. The iteges 2, ad 4 ae ot
Chapte : Theoy of Modula Aithmetic 42 Let,,,, a commo facto apat fom, that is be iteges such that ay two of these umbes do ot have gcd, fo i j This meas that evey pai of umbes ae elatively pime. We say this list of iteges,,,, ae paiwise pime. Fo eample the umbes 25, 26 ad 27 ae paiwise pime because gcd 25, 26 i j, gcd26, 27 ad gcd 25, 27 Chiese Remaide Theoem (.22): Let,,,, The the simultaeous liea cogueces be positive iteges which ae paiwise pime. a mod a mod 2 2 a mod has a solutio satisfyig all these equatios. Moeove the solutio is uique modulo 2. How do we pove this esult? We eed to show two thigs () eistece of solutio ad (2) uiqueess of solutio. Poof. () Eistece. Fo each itege, 2,,,, let Let N This meas that 2 Cacellig out 2 We ae give that i j gcd, Why? N is the poduct of all the moduli with the umbe i gcd, fo i j which implies that N whee N 2 Because by poblem 6(ii) of Eecise (c) we have: If gcd a, gcd a, 2 gcd a, the a 2 missig. gcd,.
Chapte : Theoy of Modula Aithmetic 4 Coside the liea coguece equatio N Does this equatio have ay solutios? gcd, N this equatio Sice has a uique solutio. Why? N mod mod Because by Coollay (.9) of the pevious sectio: Let a b mod has a uique solutio povided g a be the uique solutio of N mod N mod ( ) is the multiplicative ivese of mod. Note that gcd, fo each which meas that We eed to costuct a solutio which satisfies all the give simultaeous coguece equatios. The solutio we coside is a N a N a N a N ' 2 2 2 Let us see if this solutio ' satisfies the fist give equatio: a mod Taig the solutio ude cosideatio to modulus gives ' a N a N a N a N mod (*) By the above defiitio of 2 2 2 N : N [Poduct of s with 2 missig] The umbes N, N, N,, N ae multiplies of because is peset i the 2 4 poduct. Theefoe these umbes N, N, N,, N ae coguet to zeo 2 4 modulo that is N N N N 0 2 4 mod so we have 0 mod, 0 mod,, 0 mod a N a N a N 2 2 2 Substitutig this ito (*) gives ' a N 0 0 0 a N mod By the above ( ) we have N mod ' a N mod gives. Substitutig this ito the above
Chapte : Theoy of Modula Aithmetic 44 Hece ' a N a a mod ' satisfies the fist coguece equatio a mod vey simila lies we ca show that the solutio costucted '. Aguig alog satisfies the emaiig coguece equatios. Theefoe thee is a solutio to all the give cogueces, (2) Uiqueess '. Suppose thee is aothe solutio y which satisfies the give equatios. This meas we have a y mod Fom this coguece y mod y fo, 2,, ad fo, 2,, ad we have, y, y,, y 2 ( ) Remembe we ae give that the s ae paiwise pime - i j Applyig the esult of questio (ii) of Eecise(c): a c, a c,, a c If 2 To the above ( ) list gives with j a c the gcd, y This meas that y is a multiple of coguece we have y mod gcd, fo i j. a a a c. 2 so by the defiitio of Hece ad y ae the same solutio modulo 2. This completes ou poof. The poof gives us a systematic appoach o how to costuct the solutio of ay give liea simultaeous cogueces. I the poof the solutio we costucted was give by: a N a N a N a N (.2) 2 2 2 Note the vaious compoets of this fomula ae:. The a s ae the umbes o the ight-had-side of the give equatios a mod. 2. The lowe case s ae the give moduli i a mod.. The uppe casen s ae poduct of the give moduli with missig,
Chapte : Theoy of Modula Aithmetic 45 4. is the multiplicative ivese of N N 2 N modulo, that is satisfies mod We use this fomula (.2) to solve the emaiig eamples. D Applyig the Chiese Remaide Theoem Eample 24 Let us ow solve the soldies poblem stated at the begiig of this sectio. Remembe this poblem was equivalet to solvig the followig simultaeous equatios: 2 mod, mod 5 ad 2 mod 7 Fid the eact umbe of soldies give that you ow thee ae betwee 500 ad 600 soldies. Solutio How do we solve this poblem? We use the above fomula: a N a N a N a N (.2) 2 2 2 I this case because we ae give simultaeous equatios: a N a N a N (*) 2 2 2 We ca oly use this fomula if the give moduli, 5 ad 7 ae paiwise pime: gcd, 5, gcd, 7 ad gcd5, 7 Hece the give moduli, 5 ad 7 ae paiwise pime. Each of these N s is give by Theefoe whee is the poduct of the give moduli: 57 05 [Because we ae give moduli, 5 ad 7] N N N 2 57 5 missig i the poduct 5 7 2 5 5 missig i the poduct 57 5 7 7 missig i the poduct
Chapte : Theoy of Modula Aithmetic 46 We eed to fid the, 2 ad : s which ae give by N mod N N N 5 mod 2 mod 5 2 2 2 We ae equied to fid the umbe that 5 2 mod so we have: Similaly solvig the othe two equatios: Sice we ae give So the a s ae: 5 mod 7 fo which satisfies 5 mod 5 2 mod implies 2 2 mod 5 implies 2 2 2 Because 2 mod 5. Note 5 mod 7 implies Because 5 mod 7 2 mod, mod 5 ad 2 mod 7 [Because a mod a 2, a ad a 2 ] Substitutig a 2, a 2, a 2, N 5, N 2, N 5, 2, 2 2 ad We have 2 ito (*) gives 2 2 2 2 5 2 2 2 5 2 a N a N a N satisfyig all the give simultaeous equatios. Howeve thee may be a smalle umbe which also satisfies all the equatios. How ca we fid this umbe? I the poof we ae give that the solutio is uique modulo 2. I ou case we have 57 05 Hece 2 2 mod 05. The geeal solutio is give by 2 05t Theefoe, ou solutio is a multiple of 05 plus 2.
Chapte : Theoy of Modula Aithmetic 47 We ae give that thee ae betwee 500 ad 600 soldies so substitute t 5 2 05t : 2 055 548 We have 548 soldies i ou as. ito Net, we epad the Chiese Remaide Theoem to cove liea cogueces of the type a b mod because (.2) oly applies to cogueces lie b mod Popositio (.24). Let,,,, a s satisfy cogueces. be positive iteges which ae paiwise pime. Also iteges gcd a, fo, 2,,. The the simultaeous liea a b mod a b mod 2 2 2 a b mod has a solutio satisfyig all these equatios. Moeove, the solutio is uique modulo 2. Poof. See Eecise (d). Eample 25 Solve the followig simultaeous liea cogueces: Solutio 2 mod 5, 9 mod 6 ad 4 mod 7 This time we do ot have? mod m but a? mod m these? We covet them ito? mod m. How do we solve by fist multiplyig each of these equatios by a appopiate facto. Multiplyig the fist liea coguece 2 mod 5 by gives 6 mod 5 Because 6 mod 5
Chapte : Theoy of Modula Aithmetic 48 We ca simplify the secod 9 mod 6 because 9 mod 6 mod 6 By Popositio (.0): so we have ac bc mod a b mod g Applyig this to mod 6 with 6 mod whee g gcd c, g gcd, 6 meas dividig by : implies mod 2 We multiply the thid give equatio 4 mod 7 by 2: 8 2 mod 7 Because 8 mod 7 By combiig the above evaluatios we ow solve the equivalet system: mod 5, mod 2 ad 2 mod 7 Fist we chec that the moduli 2, 5 ad 7 ae paiwise pime: gcd2, 5 gcd2, 7 gcd5, 7 The solutio is give by usig fomula (.2): a N a N a N a N (.2) 2 2 2 Sice we ae give equatios so we use this fomula with : a N a N a N ( ) 2 2 2 The modulus is the poduct of all the give moduli theefoe 527 70 [We have moduli 5, 2 ad 7 ] Evaluatig N, N ad N 2 We eed to fid the, 2 ad : N gives 5 27 N 4 5 52 7 N 5 2 2 52 7 N 0 7 s which ae give by N mod fo 4 mod 5 [Remembe 5 ]
Chapte : Theoy of Modula Aithmetic 49 N N 2 2 2 5 mod 2 [Remembe 2 ] 2 0 mod 7 [Remembe 7 ] Simplifyig each of these cogueces ad solvig gives: 4 mod 5 implies 4 Because 44 mod 5 5 mod 2 implies 2 2 2 0 mod 7 implies 5 What othe igediets do we eed i ode to use ( )? The give a s ae a, a ad a 2 because we ae solvig mod 5, mod 2 ad 2 mod 7 Puttig all these umbes a, a, a 2, N 4, N 5, N 0, 4, ad 5 ito ( ) gives: 2 2 2 2 4 4 5 2 0 5 0 a N a N a N We wite this 0 i modulo 2 which i this case is 527 70. Theefoe 0 2 mod 70. Checig that 2 mod 70 22 mod 5, 2 9 mod 6 ad 42 mod 7 satisfied the thee give simultaeous equatios: Summay To solve simultaeous coguece equatios we apply the Chiese Remaide Theoem to esolve fo the uow.