February 11

advertisement
2.7 Excursion: Modular Arithmetic and Cryptography
Defn. If a and b are integers and m is a positive integer > 1 then a
is congruent to b modulo n iff
Notation: a  b (mod n) or a n b
Theorem 1: For integers a, b and n with n  2, a mod n = b mod n
iff n | (a-b). That is, a n b iff a mod n = b mod n.
Theorem 2: Consider an integer n  2. For all integers a, b, c and d,
if a n b and c n d then
1. (a•c) n (b•d)
2. (a + c) n (b + d)
GCD and related concepts
The greatest common divisor of two integers a and b
Example: gcd(18, 24)
If gcd(a, b) = 1, then a and b are relatively prime.
The least common multiple of integers a and b is
Example: lcm(18, 24)
Using prime factorization to find the gcd and the lcm:
The Euclidean Algorithm
Finding the greatest common divisor of a and b
Notation: gcd(a, b)
find gcd (662, 414)
662 =
find gcd(330, 156)
330 =
function gcd(a, b: positive integers)
xa
yb
while y  0
r  x mod y
xy
yr
return(x)
Chapter 3 Sets and Boolean Algebra
Special Sets (defined earlier): Z, N, Z+,Q,R
Methods of describing sets:
Notational conventions:
1. The notation x  A
2. A is a subset of B (written A  B)
2 ½. A is a proper subset of B written A  B
3. A = B if A  B and B  A
Proving sets equal
4. The empty set denoted { } or  is the set with no elements
Example: Let S be any set. Which of the following are true?
SS
SS
ØS
ØS
5. Universal set
Sets containing other sets. Let C = {a, b, Ø, {e, f} }.
Which of the following statements are true:
{e, f}  C
{e, f}  C
The power set of a set A is
Notation:
The cardinality or size of a set A
Notation:
A set is finite iff
Example: Find smallest set S such that {1, 2} is both an element
of S and a subset of S.
Set Operations
Complement of A
Alternate notations:
union:
Intersection:
Two sets A and B are disjoint if
set difference:
symmetric difference:
Set Identities
Union
Intersection
AB=BA
AB=BA
Name
Commutative
(A  B)  C = A  (B  C) (AB)  C = A  (B  C) Associative
A  (B  C) =
(A  B)  (A  C)
A   = A, A  U = U
A  A' = U
A  (B  C) =
(A  B)  (A  C)
A   = , A  U = A
A  A' = 
(A  B)' = A'  B'
(A  B)' = A'  B'
Distributive
Idempotent,
Domination
Laws
Complement
DeMorgan's
Laws
A'  B' if and only if B  A
A  B if and only if A  B = B
A  B if and only if A  B = A
Identities for Other Set Operations
A'' = A
A B = (A  B) - (A  B)
A A = 
' = U, U' = 
A A' = U
A B = (A - B)  (B - A)
(A B) C = A B C)
A  (A  B) = A
A  (A  B) = A
The Inclusion Exclusion Principle
Theorem 2 (Inclusion-Exclusion Principle) Let A, B, and C be sets
1. n(A  B) =
Let A = {1, 3, 5, 7, 9} and let B = {4, 5, 6, 7, 8}
Two special cases:
2. n(A  B  C) =
Example
The students in a class of size 50 were asked to tell which of three
kinds of pies they liked—apple, cherry or banana cream. The
following results were obtained:
20 liked apple
28 liked cherry
16 liked banana cream
13 liked both apple and cherry
6 liked both apple and banana cream
11 liked both cherry and banana cream
4 liked all three
How many liked none of the three kinds of pies?
How many liked exactly one kind?
How many liked two kinds?
How many liked cherry or banana cream?
How many liked apple but not banana?
Proving Set Identities
(Element-wise proofs)
Example: Proof of one of DeMorgan's Laws: (A  B)' = A'  B'
1st part: Prove (A  B)'  A' B'
Let x  (A  B)'
2nd part: Prove A'  B'  (A  B)'
Let y  A'  B'
Section 3.2 More Operations on Sets
Products and Tuples
Equality of tuples: (a1, a2, …, an) = (b1, b2, …, bn) iff
Cartesian product
Example: Let A = {1, @, #} and let B = {x, y}.
AB=
BA=
Cardinality of a Cartesian Product
Proof Example
Prove that for nonempty sets A and B, if A = B then A  B = B  A
Part 1: Prove A  B  B  A
Part 2: Prove B  A  A  B
Generalizing the Definitions
For n  3, the structure (x1, x2, …, xn) is called an n-tuple
The Cartesian product S1  S2  …  Sn is
Theorem 2: For finite sets S1, S2, …, Sn,
n(S1  S2  …  Sn ) =
A partition of a set S is a collection of disjoint nonempty subsets
of S whose union is S.
Example: Consider mod 5
Section 3.3 Proving Set Properties
Example 1: Prove A  B if and only if A  B = A
Example 2: Prove A - B = A  B′
Download