1 / 35

# CSci 2011 Discrete Mathematics Lecture 15 - PowerPoint PPT Presentation

CSci 2011 Discrete Mathematics Lecture 15. Yongdae Kim. Admin. Due dates and quiz Groupwork 7 is due on Oct 26 th . Homework 4 is due on Oct 28 th . Quiz 4: Nov 4 th . 1 page cheat sheet is allowed. E-mail: [email protected] Put [2011] in front. Check class web site

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'CSci 2011 Discrete Mathematics Lecture 15' - jeb

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### CSci 2011 Discrete MathematicsLecture 15

Yongdae Kim

CSci 2011

• Due dates and quiz

• Groupwork 7 is due on Oct 26th.

• Homework 4 is due on Oct 28th.

• Quiz 4: Nov 4th.

• 1 page cheat sheet is allowed.

• E-mail: [email protected]

• Put [2011] in front.

• Check class web site

CSci 2011

• Propositional operation summary

• Check translation

• Definition

CSci 2011

CSci 2011

• Quantifiers

• Universal quantifier: x P(x)

• Negating quantifiers

• ¬x P(x) = x ¬P(x)

• ¬x P(x) = x ¬P(x) xy P(x, y)

• Nested quantifiers

• xy P(x, y): “For all x, there exists a y such that P(x,y)”

• xy P(x,y): There exists an x such that for all y P(x,y) is true”

• ¬x P(x) = x ¬P(x), ¬x P(x) = x ¬P(x)

CSci 2011

CSci 2011

• p→q

• Direct Proof: Assume p is true. Show that q is also true.

• Indirect Proof: Assume ¬q is true. Show that p is true.

• Proving p: Assume p is not true. Find a contradiction.

• Proving p→q

• ¬(p→q)   (p  q)  p  ¬q

• Assume p is tue and q is not true. Find a contradiction.

• Proof by Cases: [(p1p2…pn)q]  [(p1q)(p2q)…(pnq)]

• If and only if proof: pq (p→q)(q→p)

• Existence Proof: Constructive vs. Non-constructive Proof

• Uniqueness: 1) Show existence 2) find contradiction if not unique

• Forward and backward reasoning

• Counterexample

CSci 2011

• A set is a unordered collection of “objects”

• set-builder notation: D = {x | x is prime and x > 2}

• a S if an elementa is an element of a set S. a S if not.

• U is the universal set.

• empty (or null) set  = { }, if a set has zero elements.

• S  T if  x (x  S  x  T), S = T if S  T and if T  S.

• S  T if S is a subset of T, and S is not equal to T.

• The cardinality of a set, |A| is the number of elements in a set.

• The power set of S, P(S), is the set of all the subsets of S.

• If a set has n elements, then the power set will have 2n elements

• A x B = { (a,b) | a A and b  B }

• A U B = { x | x  A or x  B }

• A ∩ B = { x | x  A and x  B }

• two sets are disjoint if their intersection is the empty set

• A - B = { x | x  A and x  B }

• Ac = { x | x  A }

CSci 2011

CSci 2011

• A function takes an element from a set and maps it to a UNIQUE element in another set

• Domain, co-domain, range

• A function f is one-to-one (injection) if f(x) = f(y) implies x = y.

• A function f is onto (surjection) if for all y  C, there exists x  D such that f(x)=y.

• A function f is bijection if it is 1-1 and onto.

• A function f is an identity function if f(x)=x.

• Composition of functions: (f°g)(x) = f(g(x)).

• f-1 is an inverse function of f if (f°f-1)(x)=(f-1°f)(x)=x.

CSci 2011

• Useful functions

• x = n if and only if n ≤ x < n+1

• x = n if and only if n-1 < x ≤ n

• round(x) =  x+0.5 

• n! = n * (n-1) * (n-2) * … * 2 * 1

• Sequence and Series

• Arithmetic Progression: a, a+d, a+2d, …, a+nd, …

• an = a + (n-1) d

• Geometric Progression: a, ar, ar2, ar3, …, arn-1, …

• an = arn-1

• 1 + 2 + 3 + … + n = n(n+1)/2

n

1

ar

a

+

-

n

if

r

1



j

ar

r

1

=

-

j

0

(

n

1

)

a

if

r

1

=

+

=

CSci 2011

• For finite and infinite sets, two sets A and B have the same cardinality if there is a one-to-one correspondence from A to B

• Countably infinite: elements can be listed

• Anything that has the same cardinality as the integers

• Uncountably infinite: elements cannot be listed

• An algorithm is “a finite set of precise instructions for performing a computation or for solving a problem”

• Complexity

• f(x)O(g(x)) if kR, cR, xR, xk  0f(x)|cg(x)|.

• f(x)(g(x)) if kR, cR, xR, xk  f(x)|  c g(x)|.

• f(x)(g(x)) if f(x)O(g(x)) and f(x)(g(x)). Equivalently, if kR, c1,c2R, xR, xk  c1 |g(x)|  |f(x)|  c2 |g(x)|.

• Def: a | b (a (a0) divides b) if  c such that b = ac.

• Theorem: Let a, b, c be integers. Then

• a | b, a | c  a | (b + c).

• a | b  a | bc  c  Z.

• a | b, b | c  a | c.

CSci 2011

• Theorem: Let a be an integer and d a positive integer. Then there exist unique q and r, with 0r<d, such that a = dq + r.

• Definition

• q = a div d, quotient

• r = a mod d, remainder

• 101 = 7  14 + 3

• -11 = 7  (-2) + 3

CSci 2011

• Def: a, b: integers, m: positive integer, a is congruent to b modulo m if m | (a - b).

• a  b mod m

• a  b (mod m) iff a mod m = b mod m.

• 17  12 mod 5, 17 mod 5 = 2, 12 mod 5 = 2

• -3  17 mod 10, -3 mod 10 = 7, 17 mod 10 = 7

CSci 2011

• Theorem: Let m be a positive integer. a  b mod m iff  k such that a = b + km.

CSci 2011

• Theorem: Let m be a positive integer. If a  b mod m and c  d mod m, then

• a + c  b + d mod m.

• ac  bd mod m.

CSci 2011

• Prove or Disprove

• If ac  bc (mod m), where a, b, c, m Z (with m  2), then a  b (mod m).

• a, b, c, d, m Z, c, d > 0, m  2, if a  b (mod m) and c  d (mod m) then ac bd mod m.

• a = 2, b = 5, c = 4, d = 1, m = 3

CSci 2011

• Alphabet to number: a~0, b~1, … , z~25.

• Encryption: EK(x) = x + K mod 26.

• Decryption:

• Caesar used K = 3.

• If you don’t know K and you have a secret text, would you be able to find K? How?

CSci 2011

### ch3.5

Yongdae Kim

CSci 2011

• Show that 113 is prime

• Solution

• The only prime factors less than 113 = 10.63 are 2, 3, 5, and 7

• Neither of these divide 113 evenly

• Thus, by the fundamental theorem of arithmetic, 113 must be prime

CSci 2011

• Theorem (Euclid): There are infinitely many prime numbers

Assume there are a finite number of primes

List them as follows: p1, p2 …, pn.

Consider the number q = p1p2 … pn + 1

Since we have only finite number of primes and q is not one of them, pi should divide q for some i.

Obviously pi | p1p2 … pn.

Recall that a | b, a | c  a | b + c.

Therefore, pi | (q - p1p2 … pn) = 1. (*)

CSci 2011

• The radio of the number of primes not exceeding x and x/ln(x) approaches 1 as x grows without bound

• Rephrased: the number of prime numbers less than x is approximately x/ln(x)

• When x = 2512, # of primes = 2512/512  2503

CSci 2011

• The greatest common divisor of two integers a and b is the largest integer d such that d | a and d | b

• Denoted by gcd(a,b)

• Examples

• gcd (24, 36) = 12

• gcd (17, 22) = 1

• gcd (100, 17) = 1

CSci 2011

• Two numbers are relatively prime if they don’t have any common factors (other than 1)

• Rephrased: a and b are relatively prime if gcd (a,b) = 1

• gcd (25, 39) = 1, so 25 and 39 are relatively prime

CSci 2011

• A set of integers a1, a2, … an are pairwise relatively prime if, for all pairs of numbers, they are relatively prime

• Formally: The integers a1, a2, … an are pairwise relatively prime if gcd(ai, aj) = 1 whenever 1 ≤ i < j ≤ n.

• Example: are 10, 17, and 21 pairwise relatively prime?

• gcd(10,17) = 1, gcd (17, 21) = 1, and gcd (21, 10) = 1

• Thus, they are pairwise relatively prime

• Example: are 10, 19, and 24 pairwise relatively prime?

• Since gcd(10,24) ≠ 1, they are not

CSci 2011

• Given two numbers a and b, rewrite them as:

• Example: gcd (120, 500)

• 120 = 23*3*5 = 23*31*51

• 500 = 22*53 = 22*30*53

• Then compute the gcd by the following formula:

• Example: gcd(120,500) = 2min(3,2)3min(1,0)5min(1,3) = 223051 = 20

CSci 2011

• The least common multiple of the positive integers a and b is the smallest positive integer that is divisible by both a and b.

• Denoted by lcm (a, b)

• Example: lcm(10, 25) = 50

• What is lcm (95256, 432)?

• 95256 = 233572, 432=2433

• lcm (233572, 2433) = 2max(3,4)3max(5,3)7max(2,0) = 243572 = 190512

CSci 2011

• Let a and b be positive integers. Then a*b = gcd(a,b) * lcm (a, b)

• Example: gcd (10,25) = 5, lcm (10,25) = 50

• 10*25 = 5*50

• Example: gcd (95256, 432) = 216, lcm (95256, 432) = 190512

• 95256*432 = 216*190512

CSci 2011

• Prove or disprove that n2 - 79n + 1601 is prime, whenever n is a positive integer.

(Disprove)

When n = 1601,

n2 - 79n + 1601 = 1601 (1601 - 79 + 1)

• Prove or disprove that p_1p_2…p_n+1 is a prime, whenever n is a positive integer.

2*3*5*7*11*13+1 = 30031 = 59 * 509

CSci 2011

### ch 3.6

Yongdae Kim

CSci 2011

• Positive integer n can be uniquely written as n = akbk+ ak-1bk-1+ … + a1b + a0

• k  N, 0 < ai < b

• The base b expansion of n is denoted by (akak-1… a1a0)b.

• b = 2 Binary representation

• b = 16 Hexadecimal representation

• (245)8 = 2 82 + 4 8 + 5 = 165

= (11110101)2

= (F5)16

CSci 2011

• Let a = b q + r, where a, b, q, r be integers. Then gcd (a, b) = gcd (b, r).

• Proof on book is not enough!

CSci 2011

• procedure gcd (a, b: positive integer)

• x := a, y := b

• while y  0

• r := x mod y

• x := y

• y := r

• Return r

CSci 2011

• 213mod 17 = 223+22+1mod 17 =(((22)2)2) ((22)2) 2

• INPUT: a  Zn, and k < n where k = Sti=0ki2i

• OUTPUT: ak mod n.

• Algorithm

• Set b = 1. If k = 0 then return(b).

• Set A = a.

• If k0 = 1 then set b = a.

• For i from 1 to t do the following:

• Set A = A2 mod n.

• If ki = 1 then set b = A b mod n.

• Return(b).

CSci 2011

• a = 2

• k = 13

• n = 17

• k = Sti=0ki2i

• Set A = a.

• If k0 = 1 then set b = a.

• For i from 1 to t

• Set A = A2 mod n.

• If ki = 1, set b = Ab mod n.

CSci 2011