1 / 42

CSCI 115

CSCI 115. Chapter 1 Fundamentals. CSCI 115. § 1.1 Sets and Subsets. § 1.1 – Sets and Subsets. Definition Element Order does not matter Special Sets (Z, Z + , Z – , Q , , R , C , {}) Other Sets Equality Subsets Cardinality Power Set. CSCI 115. § 1.2 Operations on Sets.

quana
Download Presentation

CSCI 115

An Image/Link below is provided (as is) to download presentation 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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI 115 Chapter 1 Fundamentals

  2. CSCI 115 §1.1 Sets and Subsets

  3. §1.1 – Sets and Subsets • Definition • Element • Order does not matter • Special Sets (Z, Z+, Z–, Q, , R, C, {}) • Other Sets • Equality • Subsets • Cardinality • Power Set

  4. CSCI 115 §1.2 Operations on Sets

  5. §1.2 – Operations on Sets • Union • Intersection • Special notation • Disjoint Sets • Complement (B with respect to A) • Symmetric Difference

  6. §1.2 – Operations on Sets • Theorem 1.2.2 • Addition Principle for 2 sets: |A  B| = |A| + |B| - |A  B| • Theorem 1.2.3 • Addition Principle for 3 sets: |A  B  C| = |A| + |B| + |C| - |A  B| - |B  C| - |A  C| + |A  B  C|

  7. CSCI 115 §1.3 Sequences

  8. §1.3 – Sequences • List of objects in a definite order • Finite • Infinite • Recursively defined • Explicitly defined • Arrays

  9. §1.3 – Sequences • Characteristic Function • For a set A, fA(x) = 1 xA 0 xA • Theorem 1.3.1 • Characteristic functions satisfy the following • i) fAB = fAfB • ii) fAB = fA + fB –fAfB • iii) fA⊕B = fA + fB – 2fAfB {

  10. §1.3 – Sequences • Computer representations of sets • Utilizes the characteristic function • Universal set must be clearly defined • Stored in Arrays • U = {1, 2, 3, 4, 5, 6}A = {1, 3, 6} • Computer representation of A • fA = {1, 0, 1, 0, 0, 1}

  11. §1.3 – Sequences • Cardinality • Finite • Infinitely countable • Infinitely uncountable

  12. §1.3 – Sequences • Strings and Regular Expressions • Given a set A, A* is the set of all finite sequences of elements in A (  A*) • A – alphabet • A* – set of words • Concatenation

  13. §1.3 – Sequences • Regular Expressions – a regular expression over A is a string constructed from the elements of A, (, ), v, *, and  according to: • RE1:  is a regular expression • RE2: If x  A, x is a regular expression • RE3: If a and b are regular expressions, then ab is a regular expression • RE4: If a and b are regular expressions, then a v b is a regular expression • RE5: If a is a regular expression, then a* is a regular expression • We will not be covering regular subsets

  14. CSCI 115 §1.4 Properties of Integers

  15. §1.4 – Properties of Integers • Theorem 1.4.1 • If n and m are integers and n > 0, we can write m = qn + r for integers q and r with 0  r < n. Moreover, there is just one way to do this. • If the r in theorem 1.4.1 is 0, we say n divides m, and write n|m. Then m = qn with n m.

  16. §1.4 – Properties of Integers • Theorem 1.4.2 • Let a, b, and c be integers • If a|b and a|c, then a|(b + c) • If a|b and a|c, where b > c, then a|(b – c) • If a|b or a|c, then a |bc • If a|b and b|c, then a|c

  17. §1.4 – Properties of Integers • A integer p is prime if p > 1 and the only positive integers that divide p are p and 1 • Theorem 1.4.3 • Every positive integer n > 1 can be written uniquely as , where p1<p2<…<ps are distinct primes that divide n and the k’s are positive integers giving the number of times each prime occurs as a factor of n

  18. §1.4 – Properties of Integers • Greatest Common Divisor • If a, b, and k are in Z+, and k|a and k|b, we say that k is a common divisor of a and b. If d is the largest such k, d is called the greatest common divisor, or GCD, of a and b, and we write d = GCD(a, b).

  19. §1.4 – Properties of Integers • Theorem 1.4.4 • If d is GCD(a, b), then • d = sa + tb for some integers s and t. (s and t may not be positive) • If c is any other common divisor of a and b, then c|d • Theorem 1.4.5 • If a and b are in Z+, then: GCD(a, b) = GCD(b, ba)

  20. §1.4 – Properties of Integers • Algorithm 1 to find GCD(a, b) (assume a > b)Euclidean Algorithm • Find q and r such that a = qb + r (as in Thm 1.4.1) • Replace a with b, b with r • Continue process from step 1 until r = 0 • The GCD is the last of the non-zero divisors Ex: Find GCD (5797, 68355) using Algorithm 1

  21. §1.4 – Properties of Integers • Algorithm 2 to find GCD(a, b) • Find the prime factorizations of a and b • Find the product of only those prime numbers represented in both factorizations, to the lowest power represented Ex: Find GCD (5797, 68355) using Algorithm 2

  22. §1.4 – Properties of Integers • Least Common Multiple • If a, b, and k are in Z+, and a|k and b|k, we say k is a common multiple of a and b. The smallest such k, called c, is called the least common multiple, or LCM, of a and b, and we write c = LCM(a, b).

  23. §1.4 – Properties of Integers • Theorem 1.4.6 • If a and b are two positive integers, then GCD(a, b) · LCM(a, b) = ab

  24. §1.4 – Properties of Integers • Algorithm to find LCM(a, b) • Find the prime factorizations of a and b • Find the product each of the prime numbers represented in either factorization, to the greatest power represented Ex: Find LCM (5797, 68355)

  25. §1.4 – Properties of Integers • Theorem 1.4.7 • If b > 1 is an integer, then every positive integer n can be uniquely expressed in the form:where This is called the base b expansion of n. • Example: Find the base 7 representation of 381.

  26. §1.4 – Properties of Integers • Cryptology – Sir Francis Bacon’s codeDISCRETE00011 01000 10010 00010 10001 00100 10011 00100OREGO NISAS TATEI NTHEU NITED STATE SOFAM ERICAMessage sent:OREGON ISASTATE INTHE UNITED STATES OF AMERICA

  27. §1.4 – Properties of Integers • Example – decode the followingWILLIAMIS A FAMOUSAUTHOR FROMTHE SIXTEENTHCENTURYKey: Underlined and bold text stands for 0 • Steganography

  28. CSCI 115 §1.5 Matrices

  29. §1.5 – Matrices • Matrix – Rectangular array • ith row, jth column, i,j element • Square matrix, diagonal • Diagonal matrix • Equality • Zero Matrix (additive identity) • Identity Matrix (multiplicative identity)

  30. §1.5 – Matrices • Addition • Theorem 1.5.1 • i) A + B = B + A • ii) (A + B) + C = A + (B + C) • iii) A + 0 = 0 + A = A

  31. §1.5 – Matrices • Multiplication • Theorem 1.5.2 • i) A(BC) = (AB)C • ii) A(B + C) = AB + AC • iii) (A + B)C = AC + BC

  32. §1.5 – Matrices • Commutativity of Multiplication? • Let A be size m x p, B be size p x n • BA: • May not be defined • May be defined, but a different size than AB • May be defined, same size as AB, but ABBA • May be equal to AB

  33. §1.5 – Matrices • Other properties / definitions: • If A is m x n, then ImA = AIn = A • If A is square (n x n): • Ap = AAA…A (p factors) • A0 = In • ApAq = A(p+q) • (Ap)q = Apq • (AB)p = ApBp if and only if AB = BA

  34. §1.5 – Matrices • Transposition • Theorem 1.5.3 • i) (AT)T = A • ii) (A + B)T = AT + BT • iii) (AB)T = BTAT • Symmetry (AT = A) • A is symmetric if and only if ai,j = aj,i for all i and j

  35. §1.5 – Matrices • Boolean Matrices (all elements are 0 or 1) • Operations on Boolean Matrices: • Let A and B be boolean Matrices • The join of A and B (C = A  B): • Ci,j = 1 if Ai,j = 1 or Bi,j = 1 • Ci,j = 0 if Ai,j = 0 and Bi,j = 0 • The meet of A and B (C = A  B): • Ci,j = 1 if Ai,j = 1 and Bi,j = 1 • Ci,j = 0 if Ai,j = 0 or Bi,j = 0

  36. §1.5 – Matrices • Boolean Matrices (all elements are 0 or 1) • Operations on Boolean Matrices: • Let A and B be boolean Matrices • The boolean product of A (m x p) and B (p xn) is (C = A  B): • Ci,j = 1 if Ai,j =1 and Bk,j = 1 for some k, 1  k  p • Ci,j = 0 otherwise

  37. §1.5 – Matrices • Theorem 1.5.4 (Inverses – not discussed) • Theorem 1.5.5If A, B, and C are boolean matrices of appropriate sizes, then:i) A  B = B  A A  B = B  Aii) (A  B)  C = A  (B  C) (A  B)  C = A  (B  C)iii) A  (B  C) = (A  B)  (A  C) A  (B  C) = (A  B)  (A  C) • iv) (A ⊙ B) ⊙ C = A ⊙ (B ⊙ C)

  38. CSCI 115 §1.6 Mathematical Structures

  39. §1.6 – Mathematical Structures • Mathematical structure (system) • A collection of objects with an operation or operations defined on those objects

  40. §1.6 – Mathematical Structures • Types of operations • Unary – operates on a single object • Binary – operates on two objects • Properties of operations • Closure • Commutativity • Associativity • Distribution of one over another • De Morgan’s laws for a unary operation * and binary operations  and  • (x  y)* = x*  y* and (x  y)* = x *  y*

  41. §1.6 – Mathematical Structures • Identities • A structure with binary operation  may contain a distinguished object e, with the property x  e = e  x = x for all x in the collection. We call e an identity for . • Theorem 1.6.1 • If e is an identity for a binary operation , then e is unique.

  42. §1.6 – Mathematical Structures • Inverses • If a binary operation has an identity e, we say y is a -inverse of x if x  y = y  x = e. • Theorem 1.6.2 • If  is an associative operation and x has a -inverse y, then y is unique.

More Related