Arithmetic and Algebra - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Arithmetic and Algebra

Description:

The easiest way to find the prime factorization of an integer n is repeated division. ... Prime factorization if 12 is (2, 2 and 3) but 12 has 6 divisors (1, 2, ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 17
Provided by: Eri758
Category:

less

Transcript and Presenter's Notes

Title: Arithmetic and Algebra


1
??????
  • ?????(Arithmetic and Algebra)
  • ??(Combinatorics)
  • ??(Number Theory)

2
Last proof we didnt finish
  • Optimal case of Quick Sort
  • an2an/2 n , an?

3
Number Theory and Divisibility
  • The Study of the properties of the Integers,
    specifically integer divisibility.
  • We say b divides a (denotes ba) if abk for some
    integer k.
  • As a consequence of this definition, the smallest
    natural divisor of every non-zero integer is 1.
    In general there is no integer k such that a0k

4
Prime Numbers
  • A prime number is an integer p gt 1 which is only
    divisible by 1 and itself
  • Every Integer can be expressed in only one way as
    the product of primes
  • 1053x5x7
  • 322x2x2x2x2
  • Any number which is not prime is said to be
    composite

5
Primality Testing and Factorization
  • There are infinite number of primes (Euclids
    proof), but there are a lot of them.
  • Roughly x/lnx primes less than or equal to x.
  • The easiest way to find the prime factorization
    of an integer n is repeated division.
  • The smallest prime factor is must at most square
    root of n unless n is prime.
  • Each divisor is the product of some subset of
    these prime factors. Such subset can be
    constructed using backtracking techniques, but we
    must be careful about duplicate prime factors.
  • Prime factorization if 12 is (2, 2 and 3) but 12
    has 6 divisors (1, 2, 3, 4, 6, 12)

6
Greatest Common Divisor
  • The largest divisor shared by a given pair of
    integers
  • Euclid GCD algorithm rests on two observations
  • If ba, then gcd(a,b)b
  • If abtr for integer t and r, then
    gcd(a,b)gcd(b,r)
  • Why? gcd(a,b)gcd(btr,b)
  • Any common divisor of a and b must rest totally
    with r
  • It can also find integers x and y such that
    axbygcd(a,b) which will prove quite useful in
    solving linear congruence

7
Implementation
  • / Find the gcd(p,q) and x,y such that px qy
    gcd(p,q) /
  • long gcd(long p, long q, long x, long y)
  • long x1,y1 / previous coefficients /
  • long g / value of gcd(p,q) /
  • if (q gt p) return(gcd(q,p,y,x))
  • if (q 0)
  • x 1
  • y 0
  • return(p)
  • g gcd(q, pq, x1, y1)
  • x y1

8
Modular Arithmetic
  • Sometimes computing the remainder is more
    important than a quotient
  • What day will your birthday fall on next year?
  • The key to such efficient computations is modular
    arithmetic
  • RSA Diffie-Hellman
  • What is (xy) mod n? We can simplify this to ((x
    mod n)(y mod n)) mod n to avoid adding big
    numbers.
  • Subtraction is just a special case of addition
  • (12 mod 100)-(53 mod 100) -41 mod 100 59 mod
    100

9
Deffie-Hellman Algorithm
  • Negotiate a common private key for end-to-end
    communication by exchanging a public key with
    each other
  • Alice and Bob randomly generate their own private
    keys (XA and XB )
  • They use their own private keys and two common
    numbers aand q to generate their public keys (YA
    and YB )
  • Alice send public key YA to Bob, Bob send public
    key YB to Alice
  • Alice use XA and YB to generate a key same with
    the key generated by Bobs XB and YA

10
Proof by Number Theory
11
Exponentiation
  • Since multiplication is just repeated addition,
  • xy mod n (x mod n)(y mod n) mod n
  • Since exponentiation is just repeated
    multiplication
  • xy mod n (x mod n)y mod n
  • What is the last digit of 2100

12
Congruences(??)
  • Congruences are alternate notation for
    representing modular arithmetic.
  • We say that ab(mod m) if m(a-b)
  • The set of integers with a give remainder n
  • What integers satisfy the congruence x3(mod 9)
  • 9y3
  • What about 2x3(mod 9) and 2x3(mod 4)

13
Operations on Congruences
  • Congruences support addition, subtract and
    multiplication, as well as a limited form of
    division-provided they share the same modulus
  • Addition and Subtraction
  • If ab(mod n) and cd(mod n) , then (ac)bd(mod
    n)
  • 4x7(mod 9) and 3x3(mod 9), then 4x-3x7-3(mod
    9) ?x4(mod 9)
  • Multiplication (general multiplication holds)
  • ab(mod n) and cd(mod n) implies acbd(mod n).
  • Division
  • We cannot cavalierly cancel common factors from
    congruences, note that 62 61(mod 3), but
    clearly 2 ! (1 mod 3)

14
Simplifying and Solving Congruences
  • We can simplify a congruence adbd(mod dn) to
    ab(mod n)
  • A linear congruence is an equation of the form
    axb(mod n), solving the x to satisfy the
    equation.
  • ax1(mod n) has a solution if and only if
    gcd(a,n)1, i.e. axnygcd(a,n)1
  • 3 cases to check possible solution
  • gcd(a,b,n)gt1, then we can divide all three terms
    by this divisor to get an equivalent congruence
  • gcd(a, n) does not divide b, no solution
  • gcd(a, n)1, one solution, xa-1b

15
More Advanced Tools
  • Chinese remainder theorem
  • ??????????????????????????????,???????,???????????
    ,???????????????????????????????????????????????
    ??????,????????????????,????????,?????????,???????
    ,??????????????,????????????????????,?????????????
    ??,???????????????????,???????,???????,??????
    ??????????????,?????????3????????,???70??(??70?5
    ?7???,????3???1?),5????????,???21??(??21? 3?
    7???,???5???1?),7????????,???15??(??15?3?5???,???
    7??? 1?),???????,???105,????105,??????????????????
    ,??????????????????? 170221215-105142-10
    537????????,???????37??
  • Diophantine equations
  • xnynzn

16
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com