Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 115 Chapter 1 Fundamentals. CSCI 115 §1.1 Sets and Subsets.

Similar presentations


Presentation on theme: "CSCI 115 Chapter 1 Fundamentals. CSCI 115 §1.1 Sets and Subsets."— 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.1 –Algebraic Properties handout 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, f A (x) = 1x  A 0x  A Theorem 1.3.1 –Characteristic functions satisfy the following i) f A  B = f A f B ii) f A  B = f A + f B –f A f B iii) f A ⊕ B = f A + f B – 2f A f B {

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 f A = {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 1.If a|b and a|c, then a|(b + c) 2.If a|b and a|c, where b > c, then a|(b – c) 3.If a|b or a|c, then a |bc 4.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 p 1 <p 2 <…<p s 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 1.d = sa + tb for some integers s and t. (s and t may not be positive) 2.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 1.Find q and r such that a = qb + r (as in Thm 1.4.1) 2.Replace a with b, b with r 3.Continue process from step 1 until r = 0 4.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) 1.Find the prime factorizations of a and b 2.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) 1.Find the prime factorizations of a and b 2.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 code DISCRETE 00011 01000 10010 00010 10001 00100 10011 00100 OREGO NISAS TATEI NTHEU NITED STATE SOFAM ERICA Message sent: OREGON IS A STATE IN THE UNITED STATES OF AMERICA

27 §1.4 – Properties of Integers Example – decode the following WILLIAM IS A FAMOUS AUTHOR FROM THE SIXTEENTH CENTURY Key: Underlined and bold text stands for 0 Steganography

28 CSCI 115 §1.5 Matrices

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

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

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

32 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 §1.5 – Matrices

33 Other properties / definitions: –If A is m x n, then I m A = AI n = A –If A is square (n x n): A p = AAA … A (p factors) A 0 = I n A p A q = A (p+q) (A p ) q = A pq –(AB) p = A p B p if and only if AB = BA §1.5 – Matrices

34 Transposition Theorem 1.5.3 –i) (A T ) T = A –ii) (A + B) T = A T + B T –iii) (AB) T = B T A T Symmetry (A T = A) –A is symmetric if and only if a i,j = a j,i for all i and j §1.5 – Matrices

35 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): C i,j = 1 if A i,j = 1 or B i,j = 1 C i,j = 0 if A i,j = 0 and B i,j = 0 –The meet of A and B (C = A  B): C i,j = 1 if A i,j = 1 and B i,j = 1 C i,j = 0 if A i,j = 0 or B i,j = 0 §1.5 – Matrices

36 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 x n ) is (C = A  B): C i,j = 1 if A i,j =1 and B k,j = 1 for some k, 1  k  p C i,j = 0 otherwise §1.5 – Matrices

37 Theorem 1.5.4 (Inverses – not discussed) Theorem 1.5.5 If A, B, and C are boolean matrices of appropriate sizes, then: i) A  B = B  A A  B = B  A ii) (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) §1.5 – Matrices

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 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. §1.6 – Mathematical Structures

42 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. §1.6 – Mathematical Structures


Download ppt "CSCI 115 Chapter 1 Fundamentals. CSCI 115 §1.1 Sets and Subsets."

Similar presentations


Ads by Google