Modular Arithmetic/Modular Arithmetic

From testwiki
Revision as of 13:08, 24 August 2023 by imported>Wikigucoder (Small corrections.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Navigation

Introduction

Previously we gave examples of some modular congruences using the analogy of clock arithmetic – 27 hours from now will be the same time as 3 hours from now. In English we would say 27 is congruent to 3 modulo 24. Expressed mathematically, we would write:

273(mod24).

Note the congruent sign has three horizontal lines and not two like an equals sign.

In general, for any integers a,b and any integer c0 , the congruence ab(modc) is equivalent to the following:

  1. abc is an integer
  2. c|(ab) (c divides a minus b)
  3. there exists some integer x such that cx+b=a

Using our previous example 273(mod24) , we see that:

  1. 27324=1
  2. 24|(273)
  3. 241+3=27

Now that we have a definition of modular congruence, we can go on to state some basic properties of the congruence relation () itself. The congruence relation is an equivalence relation, which means that the congruence relation is reflexive, symmetric, and transitive. Since the equality relation (=) is also an equivalence relation we can demonstrate these three properties easily; for any integers a,b,c :

  1. Reflexive: a=a
  2. Symmetric: if a=b then b=a
  3. Transitive: if a=b and b=c then a=c

Analogously, for the congruence relation () satisfies these three properties; for any integers a,b,d and any integer c0 :

  1. Reflexive: aa(modc)
  2. Symmetric: if ab(modc) then ba(modc)
  3. Transitive: if ab(modc) and bd(modc) then ad(modc)

Template:ExerciseRobox

Prove that the congruence relation () is reflexive, symmetric, and transitive.

Which of the following relations are congruence relations:

  • Less than (<)
  • Greater than (>)
  • Less than or equal to ()
  • Greater than or equal to ()
  • Not equal to ()

Template:Robox/Close

Addition, Subtraction, Multiplication

We took what appears to be a detour through equivalence relations, because those three properties allow us to define addition, subtraction, and multiplication for congruences. Addition, subtraction, and multiplication work exactly the same way as they do with integers with the only constraint being that addition, subtraction, and multiplication is only allowed when the congruences have the same moduli. Mathematically, suppose we have some a1b1(modc) and a2b2(modc) then:

  1. a1±a2b1±b2(modc) (Addition and Subtraction)
  2. a1a2b1b2(modc) (Multiplication)

For example, since 23 ≡ 3 (mod 4) and 6 ≡ 2 (mod 4) the following are true:

  1. (23 + 6) ≡ (2 + 3) (mod 4) = 29 ≡ 5 (mod 4) = 29 ≡ 1 (mod 4) (Addition)
  2. (23 - 6) ≡ (2 - 3) (mod 4) = 17 ≡ -1 (mod 4) = 17 ≡ 3 (mod 4) (Subtraction)
  3. (23 * 6) ≡ (2 * 3) (mod 4) = 138 ≡ 6 (mod 4) = 138 ≡ 2 (mod 4) (Multiplication)

Again, as long as we have the same moduli between two congruences, we can add, subtract, and multiply them together.

Template:ExerciseRobox

Using the definition of congruences and the fact that it is an equivalence relationship, prove that addition, subtraction, and multiplication are valid for congruences with the same moduli.

Template:Robox/Close

Division

Just as we cannot divide by zero in normal arithmetic, division for modular congruences is only allowed under certain circumstances. For example, just because 144(mod10) we cannot divide both sides by two because 7≢2(mod10) . Mathematically, if bd1bd2(modc) and if gcd(b,c)=1 then d1d2(modc) .

gcd(b,c) means the greatest common divisor for b,c – the greatest number that divides both b and c . When the greatest common divisor of two numbers is 1, that means there are no other common divisors (i.e. they are relatively prime). Our example of 144(mod10) fails to divide by 2, because both 2 and 10 are divisible by 2. Again, we can only divide provided that there are no common divisors between the number we are trying to divide by and the modulus. Note that if the modulus is a prime number, then division is defined for all divisors. Template:BookCat