Summary: Cogrueces j whe divided by, ad determiig the additive order of a iteger mod. As described i the Prelab sectio, cogrueces ca be thought of i terms of coutig with rows, ad for some questios this gives a good ituitive feel for cogrueces. However, as poited out i the lab otebook, the algebraic defiitio The mai goal of this chapter is to provide a itroductio to cogrueces, ad to preset differet ways of thikig about cogruece classes. We ca look at cogrueces mod i terms of coutig with rows, i terms of remaiders, or i terms of differeces beig multiples of. We looked at arithmetic i terms of cogrueces ad foud that additio, subtractio, ad multiplicatio are all well defied for cogrueces classes. Fially, we ivestigated two additive questios related to cogrueces: the remaider of P j=1 of cogruece is ofte the most useful i proofs. defiitio our official defiitio here. So, we ow make the algebraic Deitio If is a positive iteger ad a, b Z, the we write a b (mod ) if j (b a). I Research Questio 1, we ivestigate oe way to characterize the relatioship betwee differet elemets i the same cogruece class. I this case, we will give two proofs. The first oe deals with cogruece i terms of coutig with rows, ad the secod oe uses our defiitio of cogruece as stated above. Theorem 3.1 (RQ1) I the output of modcogclasses[], 1 all of the etries i a give row are the same. Moreover, the commo value i a give row is the remaider whe each elemet is divided by. The fuctio modcogclasses[] is the same as cogclasses[], except that each umber is replaced by its remaider whe divided by. If we start coutig with 0 for cogclasses[], we see that each row gets exactly oe of the umbers 0, 1,..., 1. Sice there is exactly oe remaider (for divisio by ) ieachrowof cogclasses[], it suffices to prove this more fudametal result. Theorem 3. Suppose that a b (mod ). The a ad b have the same remaider whe divided by. Proof. It is eough to show that ay iteger a is i the same cogruece class as its remaider whe divided by. The cojecture would the follow because if a ad b are i the same cogruece class, we would kow that the remaider for a ad the 1 Here we use the Mathematica sytax for the fuctio. I Maple worksheets, the fuctio is writte modcogclasses(). I the web pages, the Java applet is titled Cogruece Classes modulo. The Java applet i the same sectio which correspods to cogclasses[] is titled simply Cogruece Classes. 177
178 CHAPTER 3. remaider for b would also be i this cogruece class. However, there is exactly oe remaider i each cogruece class modulo. So, a ad b would have to have the same remaider whe divided by. We ow show that a is i the same cogruece class as its remaider. From the Divisio Algorithm, we ca write a = q + r where r is the remaider whe a is divided by. The, a r = q ad so a r is a multiple of. Therefore, a r (mod ). Here is the more algebraic proof of RQ1 we promised above. Proof. By the Divisio Algorithm, we kow that we ca write a = q 1 + r 1 b = q + r where 0 r 1 <ad 0 r <. Therefore it follows that a b =(q 1 q ) +(r 1 r ). (3.1) Furthermore, sice a b (mod ), we kow that a b = k for some iteger k. Combiig this observatio with equatio (3.1), we get which implies k =(q 1 q ) +(r 1 r ), (k q 1 + q ) = r 1 r. (3.) It is clear that the left side of equatio (3.) is a multiple of, ad so the right side must be a multiple of as well. However, the restrictios o r 1 ad r impose the iequalities <r 1 r <. Therefore the oly possibility is that r 1 r =0 =0, ad so r 1 = r. Aother way of statig this theorem would be to say: If a b (mod ), the (a % ) =(b % ). The proof of this theorem is very similar to part of the proof of the Divisio Algorithm. Alteratively, we ca apply the Divisio Algorithm for yet aother proof: With the otatio as i this proof, we substitute b = q + r ito a b = k to get a q r = k. Rearragig a bit gives a =(q + k) + r. But a = q 1 + r 1, ad both r 1 ad r lie betwee 0 ad 1, so by the uiqueess of quotiet ad remaider we must have r 1 = r (ad q + k = q 1 ).
I fact, the if ad oly if versio of this statemet is true. Because of this equivalece, statemets ivolvig cogrueces ca ofte be made i either otatio. We will use the otatio uless the values of a remaider a % is particularly relevat to the statemet. Sice the cogruece classes modulo are i 1-1 correspodece with the possible remaiders for divisio by, it is useful to have a otatio for the remaiders. We let 3 Z = f0, 1,,..., 1g. Whe workig with cogrueces modulo, we like to thik of their beig differet umbers. Cocretely, we thik of these as the elemets of Z. To get from a iteger a to the uique elemet of Z to which it is cogruet modulo, we simply compute its remaider: a %. We refer to this process as reducig a modulo, or as fidig its value mod. I the Prelab sectio ad the electroic otebook, you have see examples that illustrate the fact that additio, subtractio, ad multiplicatio of cogruece classes are well defied. Not oly does this property make it possible to do arithmetic with cogruece classes, but it also ca ofte be exploited to make hard computatios much easier. Theorem 3.3 (RQ) Suppose that a b (mod ) ad c d (mod ). The a+c b + d (mod ), a c b d (mod ), ad ac bd (mod ). Proof. Sice a b (mod ), we kow that a b = k 1 for some iteger k 1. Similarly, sice c d (mod ) it follows that c d = k for some iteger k. Therefore we have ad so (a b)+(c d) =k 1 + k, (a + c) (b + d) =(k 1 + k ). Therefore a + c b + d (mod ). To prove the claim for multiplicatio, we first ote that we have, as above, a = b + k 1 ad c = d + k. Therefore ac bd =(b + k 1 )(d + k ) bd = bd + bk + dk 1 + k 1 k bd = bk + dk 1 + k 1 k =(bk + dk 1 + k 1 k ), 3 Note that abstract algebra books ofte use a defiitio of Z which is formally differet from this oe to capture essetially the same idea. 179
180 CHAPTER 3. ad so ac bd (mod ). The claim for subtractio ca be proved i a maer similar to the proof give for additio. Alteratively, we ca use our results for additio ad multiplicatio as follows: a c = a +( 1) c b +( 1) c (mod ) b +( 1) d (mod ) b d (mod ) Oe iterpretatio of the fact that cogruece arithmetic is well defied is that we ca thik of doig arithmetic with the elemets of Z. To add two elemets, we simply add them ad the take the remaider of the sum modulo. If we start with two itegers a ad b, we ca add them ad the reduce mod to get (a + b)%. For this to be a sesible operatio o elemets of Z, we do t wat the result to chage if we replace oe or both of the origial itegers a ad b with other itegers to which they are cogruet modulo. RQ assures us of just that. Oe way to prove the cojecture associated with Research Questio 3 is to take advatage of the fact that ay elemet of a cogruece class ca be used whe doig arithmetic. We frequetly use the umbers 0, 1,,..., 1 whe doig arithmetic modulo, but sometimes other choices are more useful. The proof give below illustrates this icely. Theorem 3.4 (RQ3) Let S()=1++ +. If is odd, the S()% =0, ad if is eve, the S()% = /. Proof. I each case, we will rearrage the sum, pairig 1 with 1, pairig with, ad so o. The we use the fact that 0 (mod ) to simplify the expressios. First suppose that is odd. There are a eve umber of itegers from 1 to 1, so we ca pair them up clealy: 1++ + =(1+( 1))+(+( )) + 1 1 + + + (1+( 1))+(+( )) + 1 1 + + + 0 (mod ) 0 (mod ). Sice 0 is a possible remaider for divisio by, S()% =0.
Now suppose that is eve. Whe we apply our pairig strategy, / has o mate: 1++ + =(1+( 1))+(+( )) + + 1 + 1 + + (1+( 1))+(+( )) + + 1 + 1 + + 0 (mod ) (mod ) Sice 0 / <, we have that / is a possible remaider for divisio by. So, S()% = /. You may recogize this pairig strategy. It is ofte used to deduce a simple formula for the sum of the itegers from 1 to. If you remembered this formula, you could have used it to give a differet proof of this cojecture: Proof. We start with the stadard formula that ( +1) 1++3+ + =. If is odd, the + 1 is eve which implies that ( +1)/ is a iteger. Thus, 181 ( +1) 1++3+ + = = +1 0 (mod ). As above, this implies that S()% = 0 sice 0 is a possible remaider from divisio by. O the other had, if is eve we have that 1++3+ + = ( +1) =( +1) 1 (mod ). I the last lie, we replaced + 1 with 1 because we are workig mod. Sice / is a possible remaider for divisio by, S()% = /. Research Questio 4 provides a warm-up for determiig the form of all solutios to ma 0 (mod ), which is the subject of Research Questio 5.
18 CHAPTER 3. Theorem 3.5 (RQ4) If a b (mod ), the the output from fidkillers[a,] will be idetical to the output from fidkillers[b,]. 4 Proof. The output from fidkillers[a,] is a list of itegers m such that m 8 ad ma 0 (mod ). Sice a b (mod ), it follows that ka kb (mod ) for ay iteger k. Therefore ma 0 (mod ) if ad oly if mb 0 (mod ), ad so the output from fidkillers[a,] is exactly the same as the output from fidkillers[b,]. The fial Research Questio focuses o the additive order of a iteger a modulo. Let s recall the defiitio. Deitio The additive order of a iteger a modulo is the least positive iteger j such that ja 0 (mod ). Our theorem states that ma 0 (mod ) if ad oly if m is a multiple of the additive order of a. The theorem also provides a formula for the additive order of a. Theorem 3.6 (RQ5) Let a Z ad let be a positive iteger. The, 1. The additive order of a modulo is gcd(a, ).. A iteger m satisfies the cogruece ma 0 (mod ) if ad oly if m = k gcd(a, ) for some iteger k. Proof. Note that the secod statemet implies the first sice the smallest positive iteger of the form k(/gcd(a, )) is clearly /gcd(a, ). So, we cocetrate o determiig the itegers m which satisfy ma 0 (mod ). Let d = gcd(a, ). If m = k(/d) for some iteger k, the ma = k d a = k a d which implies j ma, ad so ma 0 (mod ). Now assume the coverse, that ma 0 (mod ). The ma = c for some iteger c, ad so m(a/d) = c(/d). Because gcd(a/d, /d) = 1 (by exercise 1.14), it follows that (/d) j m. Thus, there is a iteger k such that m = k(/d), which is the form required. 4 This is the Mathematica sytax; i Maple worksheets, the fuctio is writte as fidkillers(a,). I the web pages, the Java applet is titled Fid Killers.,