slides8a MA103

  • Upload
    kush96

  • View
    218

  • Download
    0

Embed Size (px)

DESCRIPTION

Abstract Mathematics

Citation preview

  • MA 103

    Introduction to Abstract Mathematics

    2015/16

    Slides 8a

    Introduction to Modular Arithmetic

    1

  • Clock arithmetic

    You go to sleep at 11 oclock and sleep for 8 hours. At what timedo you wake?

    Well, this is simple: you wake at 7 oclock.

    What we are doing in this calculation is arithmetic modulo 12.

    The answer is not 11 + 8 = 19,because the clock re-starts once the hour of 12 is reached.

    This fairly simple idea is part of modular arithmetic.

    2

  • Weekday arithmetic

    Today, 16 November 2015, is a Monday.

    What day of the week is 25 December 2015?

    November has 30 days. So 25 December is 39 days after 16November.

    Weekdays repeat after 7 days. Since 39 = 5 7 + 4,

    25 December is 4 weekdays after Monday, which is a Friday.

    To determine the day of the week, we do arithmetic modulo 7.

    Many calendar problems involve repetitions after a certain cycleof days, as in a week, or the days until the new moon repeats.Some of them have been studied for thousands of years.

    3

  • The congruence relationTheorem

    Let m N be a positive integer.Define the relation Rm on Z by: a Rm b if and only if b a is amultiple of m. In other words, for a, b Z we have

    a Rm b m |(b a) b a = k m,for some k Z.

    Then R is an equivalence relation.

    ProofWe need to prove that Rm is reflexive, symmetric and transitive:

    for all a Z: a Rm a; for all a, b Z: a Rm b b Rm a; for all a, b, c Z: (a Rm b b Rm c ) a Rm c.

    4

  • Congruent modulo m

    The described equivalence relation on Z, which depends on m,has a special name and notation.

    Definition

    If a Rm b, that is, if m |(b a), then we say that a and b arecongruent modulo m.

    We write this as: a b (mod m).

    If a, b are not congruent modulo m, we write a 6 b (mod m).

    We sometimes only write a b if mod m is clear from thecontext.

    5

  • Congruence via the remainder function

    Recall that if we have a function f : X Y ,then we can define an equivalence relation R on X as follows:

    a R b f (a) = f (b).

    We can use this to define the congruence relation as well, usingdivision with remainder.

    We saw that for m N and a Z, there are unique integers qand r such that

    a = q m + r and 0 r < b.

    Now for a Z, let fm(a) be the remainder r upon division by m.This defines a function fm : Z {0, 1, . . . ,m 1}.

    6

  • Congruence via the remainder function

    So, the function fm : Z {0, 1, . . . ,m 1} is defined asfor a Z, fm(a) is the remainder r upon division by m.

    And we can use this function to define the equivalence relationcongruent modulo m on Z:

    a b (mod m) fm(a) = fm(b).

    In order to make sure this is all correct, we need to prove:

    for all a, b Z: fm(a) = fm(b) a b (mod m).

    7

  • Same last digit in base m

    So weve seen that a b (mod m) if and only if a and b differ by a multiple of m, or, equivalently, if they have the same remainder upon division by m. (Note

    that this remainder is a number in {0, 1, . . . ,m 1}.)

    If a and b are positive, then this remainder can also be seen asthe last digit when a and b are written in base m.

    The most familiar case is m = 10: a b (mod 10) means thata and b have the same last digit (when written in decimals).

    Note that when a < 0 this is no longer true.

    For example: 6 4 (mod 10).

    8

  • Add and multiply modulo m

    An important property of remainders is that we can add, subtractand multiply them just as we can do this with the original numbers.

    Theorem

    Let m N and a, a, b, b Z such that a a (mod m) andb b (mod m). Then we have(i) (a + b) (a + b) (mod m);(ii) (a b) (a b) (mod m);(iii) a b a b (mod m);(iv) c Z : c a c a (mod m);(v) n N : an (a)n (mod m).

    9

  • Proof of the theorem

    The proof is fairly straightforward, provided we use precisely whatx y (mod m) means.

    We are given that a a (mod m) and b b (mod m). This means that m |(a a) and m |(b b). And this means in turn that there exist k , ` Z such thata a = k m and b b = ` m.

    And now we can start looking at the statements we have to prove. . .

    Part (v) is done by induction on n, using that for n = 2 if followsfrom (iii).

    10

  • One corollary testing divisibility by 9

    Since 10 = 9 + 1, we have that 10 1 (mod 9).By (v), this means that 10n 1n 1 (mod 9) for all n N.

    So we can calculate for a decimal number amam1 . . . a1a0:

    amam1 . . . a1a0 am 10m + am1 10m1 + + a1 10 + a0 am 1 + am1 1 + + a1 1 + a0 am + am1 + + a1 + a0 (mod 9)

    11

  • One corollary testing divisibility by 9

    In particular we get:

    amam1 . . . a1a0 is divisible by 9

    amam1 . . . a1a0 0 (mod 9) am + am1 + + a1 + a0 0 (mod 9)

    Example

    Which of the following numbers (written in normal decimalnotation) are divisible by 9:

    1232 ? 12672 ? 120672 ?

    12

  • Second corollary testing divisibility by 11

    We can do something similar for divisibility by 11.

    For that we observe that 10 1 (mod 11).

    Which leads to 10n (1)n {

    1, if n even1, if n odd (mod 11).

    So we can calculate for a decimal number amam1 . . . a1a0:

    amam1 . . . a1a0 a0 + a1 10 + a2 102 + + am 10m a0 + a1 (1) + a2 1 + + am (1)m a0 a1 + a2 a3 + am (mod 11)

    13

  • Second corollary testing divisibility by 11

    In particular we get:

    amam1 . . . a1a0 is divisible by 11

    amam1 . . . a1a0 0 (mod 11) a0 a1 + a2 a3 + am 0 (mod 11)

    Example

    Which of the following numbers are divisible by 11:

    1232 ? 12672 ? 120672 ?

    14