Discrete Mathematics R. Johnsonbaugh

Slides:



Advertisements
Similar presentations
Lecture 1 RMIT University, Taylor's University Learning Objectives
Advertisements

Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Instructor: Hayk Melikya
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Week 21 Basic Set Theory A set is a collection of elements. Use capital letters, A, B, C to denotes sets and small letters a 1, a 2, … to denote the elements.
Functions Section 2.3 of Rosen Fall 2008
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
Sets 1.
1 Discrete Math CS 2800 Prof. Bart Selman Module Basic Structures: Functions and Sequences.
Sets 1.
modified from UCI ICS/Math 6D, Fall Sets+Functions-1 Sets “Set”=Unordered collection of Objects “Set Elements”
1 Section 1.8 Functions. 2 Loose Definition Mapping of each element of one set onto some element of another set –each element of 1st set must map to something,
CS 2210 (22C:019) Discrete Structures Sets and Functions Spring 2015 Sukumar Ghosh.
Mathematics.
Operations on Sets – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Operations on Sets Reading: Kolman, Section 1.2.
Chapter 7 Functions Dr. Curry Guinn. Outline of Today Section 7.1: Functions Defined on General Sets Section 7.2: One-to-One and Onto Section 7.3: The.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
Course Outline Book: Discrete Mathematics by K. P. Bogart Topics:
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sifth Edition, Mc Graw-Hill, 2007 Chapter 2: Basic Structures: Sets, Functions, Sequences.
FUNCTION Discrete Mathematics Asst. Prof. Dr. Choopan Rattanapoka.
February 12, 2015Applied Discrete Mathematics Week 2: Functions and Sequences 1Exercises Question 1: Given a set A = {x, y, z} and a set B = {1, 2, 3,
Chapter 3 – Set Theory  .
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
ICS 253: Discrete Structures I
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
R. Johnsonbaugh, Discrete Mathematics 5 th edition, 2001 Chapter 2 The Language of Mathematics.
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
1.4 Sets Definition 1. A set is a group of objects . The objects in a set are called the elements, or members, of the set. Example 2 The set of positive.
Example Prove that: “IF 3n + 2 is odd, then n is odd” Proof by Contradiction: -p = 3n + 2 is odd, q = n is odd. -Assume that ~(p  q) is true OR -(p 
Basic Structures: Sets, Functions, Sequences, and Sums CSC-2259 Discrete Structures Konstantin Busch - LSU1.
CS201: Data Structures and Discrete Mathematics I
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (1)
Discrete Mathematics Relation.
MATH 224 – Discrete Mathematics
CompSci 102 Discrete Math for Computer Science
Sets. Definitions (I) Collection of elements such that: There are no duplicates There is no order Special sets Universe (U or E): all elements under consideration.
Discrete Mathematical Structures 4 th Edition Kolman, Busby, Ross © 2000 by Prentice-Hall, Inc. ISBN
Mathematical Preliminaries
Chapter 2 With Question/Answer Animations. Section 2.1.
Basic Structures: Sets, Functions, Sequences, and Sums.
Introduction to Set theory. Ways of Describing Sets.
1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Chapter 5 Relations and Functions.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
Review 2 Basic Definitions Set - Collection of objects, usually denoted by capital letter Member, element - Object in a set, usually denoted by lower.
Discrete Mathematics Set.
1 Discrete Mathematical Functions Examples.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
FUNCTIONS.
Week 8 - Wednesday.  What did we talk about last time?  Relations  Properties of relations  Reflexive  Symmetric  Transitive.
Introduction to Set Theory (§1.6) A set is a new type of structure, representing an unordered collection (group, plurality) of zero or more distinct (different)
ICS 253: Discrete Structures I
Dr. Ameria Eldosoky Discrete mathematics
CHAPTER 3 SETS, BOOLEAN ALGEBRA & LOGIC CIRCUITS
CSNB 143 Discrete Mathematical Structures
Unit-III Algebraic Structures
Set, Combinatorics, Probability & Number Theory
CS 2210:0001 Discrete Structures Sets and Functions
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
CS100: Discrete structures
Set Operations Section 2.2.
Discrete Mathematics R. Johnsonbaugh
ICS 253: Discrete Structures I
Math/CSE 1019N: Discrete Mathematics for Computer Science Winter 2007
Discrete Mathematics 7th edition, 2009
Presentation transcript:

Discrete Mathematics R. Johnsonbaugh Chapter 2 The Language of Mathematics

2.1 Sets Set = a collection of distinct unordered objects Members of a set are called elements How to determine a set Listing: Example: A = {1,3,5,7} = {7, 5, 3, 1, 3} Description Example: B = {x | x = 2k + 1, 0 < k < 30}

Finite and infinite sets Examples: A = {1, 2, 3, 4} B = {x | x is an integer, 1 < x < 4} Infinite sets Z = {integers} = {…, -3, -2, -1, 0, 1, 2, 3,…} S={x| x is a real number and 1 < x < 4} = [0, 4]

Some important sets The empty set  = { } has no elements. Also called null set or void set. Universal set: the set of all elements about which we make assertions. Examples: U = {all natural numbers} U = {all real numbers} U = {x| x is a natural number and 1< x<10}

Cardinality Cardinality of a set A (in symbols |A|) is the number of elements in A Examples: If A = {1, 2, 3} then |A| = 3 If B = {x | x is a natural number and 1< x< 9} then |B| = 9 Infinite cardinality Countable (e.g., natural numbers, integers) Uncountable (e.g., real numbers)

Subsets X is a subset of Y if every element of X is also contained in Y (in symbols X  Y) Equality: X = Y if X  Y and Y  X, i.e., X = Y whenever x  X, then x  Y, and whenever x  X, then x  X X is a proper subset of Y if X  Y but Y  X Observation:  is a subset of every set

Power set The power set of X is the set of all subsets of X, in symbols P(X),i.e. P(X)= {A | A  X} Example: if X = {1, 2, 3}, then P(X) = {, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} Theorem 2.1.4: If |X| = n, then |P(X)| = 2n. See proof by induction in textbook

Set operations: Union and Intersection Given two sets X and Y The union of X and Y is defined as the set X  Y = { x | x  X or x  Y} The intersection of X and Y is defined as the set X  Y = { x | x  X and x  Y} Two sets X and Y are disjoint if X  Y = 

Complement and Difference The difference of two sets X – Y = { x | x  X and x  Y} The difference is also called the relative complement of Y in X Symmetric difference X Δ Y = (X – Y)  (Y – X) The set of all elements that belong to X or to Y but not both X and Y. The complement of a set A contained in a universal set U is the set Ac = U – A In symbols Ac = U - A

Example If X={1, 4, 7, 10}, Y={1, 2, 3, 4, 5} X  Y = X  Y = X – Y = X Δ Y = (how else can you write this?)

Example If X={1, 4, 7, 10}, Y={1, 2, 3, 4, 5} X  Y = {1, 2, 3, 4, 5, 7, 10} X  Y = {1, 4} X – Y = {7, 10} Y – X = {2, 3, 5} X Δ Y = (X – Y)  (Y – X) = {2, 3, 5, 7, 10}

Venn diagrams A Venn diagram provides a graphic view of sets Set union, intersection, difference, symmetric difference and complements can be easily and visually identified U C A B

Properties of set operations Theorem 2.1.10: Let U be a universal set, and A, B and C subsets of U. The following properties hold: Associativity: (A  B)  C = A  (B  C) (A  B)  C = A  (B C) Commutativity: A  B = B  A A  B = B  A

Properties of set operations Distributive laws: A(BC) = (AB)(AC) A(BC) = (AB)(AC) Identity laws: AU=A A = A Complement laws: AAc = U AAc = 

Properties of set operations Idempotent laws: AA = A AA = A Bound laws: AU = U A =  Absorption laws: A(AB) = A A(AB) = A

Properties of set operations Involution law: (Ac)c = A 0/1 laws: c = U Uc =  De Morgan’s laws for sets: (AB)c = AcBc (AB)c = AcBc

Addition Principle A.K.A The Inclusion-Exclusion Principle If A and B are finite sets then, | A  B | = |A| + |B| - | A  B | U A  B A B

Addition Principle for Disjoint Sets | A  B  C | = |A| + |B| + |C| - |A  B| - |B  C| - |A  C| + |A  B  C| A = { a, b, c, d, e } B = { a, b, e, g, h } C = { b, d, e, g, h, k, m, n} A company wants to hire 25 programmers to handle systems Programming jobs and 40 programmers for applications programming. Of those hired, ten will be expected to perform jobs of both types. How many programmers must be hired?

One more example A survey was taken on methods of commuter travel. Each respondent was asked to check BUS, TRAIN, or CAR as a major mode of traveling. More than one answer is allowed. The results are: BUS 30 TRAIN 35 CAR 100 BUS and TRAIN 15 BUS and CAR 15 TRAIN and CAR 20 All three modes 5 How many people drank coffee while traveling? How many people completed a survey form

2.2 Functions A function f from X to Y (in symbols f : X  Y) is a relation from X to Y such that Dom(f) = X and if two pairs (x,y) and (x,y’)  f, then y = y’ Example: Dom(f) = X = {a, b, c, d}, Rng(f) = {1, 3, 5} f(a) = f(b) = 3, f(c) = 5, f(d) = 1.

Domain and Range Domain of f = X Range of f = { y | y = f(x) for some x X} A function f : X  Y assigns to each x in Dom(f) = X a unique element y in Rng(f)  Y. Therefore, no two pairs in f have the same first coordinate.

Algebraically speaking Note that such definitions on functions are consistent with what you have seen in your Calculus courses. function not a function  1 intersection  violations when > 1

Modulus operator Let x be a nonnegative integer and y a positive integer r = x mod y is the remainder when x is divided by y Examples: 1 = 13 mod 3 6 = 234 mod 19 4 = 2002 mod 111 Basically, remove the complete y’s and count what’s left mod is called the modulus operator

One-to-one functions A function f : X  Y is one-to-one  for each y  Y there exists at most one x  X with f(x) = y. (therefore, f(x) = c is out of play) Alternative definition: f : X  Y is one-to-one  for each pair of distinct elements x1, x2  X there exist two distinct elements y1, y2  Y such that f(x1) = y1 and f(x2) = y2. Examples: 1. The function f(x) = 2x from the set of real numbers to itself is one-to-one 2. The function f : R  R defined by f(x) = x2 is not one-to-one, since for every real number x, f(x) = f(-x).

Onto functions A function f : X  Y is onto (or, subjective)  for each y  Y there exists at least one x  X with f(x) = y, i.e. Rng(f) = Y. Example: The function f={1,a),(2,c),(3,b)} from X={1,2,3} to Y={a,b,c} is 1-to-1 and onto. If Y={a,b,c,d}, then still 1-to-1, but not onto. Example: The function f(x) = ex from the set of real numbers to itself is not onto Y = the set of all real numbers. However, if Y is restricted to Rng(f) = R +, the set of positive real numbers, then f(x) is onto. Why? Look at the several visual examples illustrated in the textbook

Bijective functions A function f : X Y is bijective  f is one-to-one and onto Examples: 1. Is A linear function f(x) = ax + b a bijective function from the set of real numbers to itself. Why? 2. Is the function f(x) = x3 a bijective from the set of real numbers to itself. Why?

Inverse function Given a function y = f(x), the inverse f -1 is the set {(y, x) | y = f(x)} The inverse f -1 of f is not necessarily a function Example: if f(x) = x2, then f -1 (4) = 4 = ± 2, not a unique value and therefore f is not a function However, if f is a bijective function, it can be shown that f -1 is a function See Example 2.2.35.

Exponential and logarithmic functions Let f(x) = 2x and g(x) = log 2 x = lg x f ◦ g(x) = f(g(x)) = f(lg x) = 2 lg x = x g ◦ f(x) = g(f(x)) = g(2x) = lg 2x = x Exponential and logarithmic functions are inverse functions

Composition of functions Given two functions g : X  Y and f : Y  Z, the composition f ◦ g is defined as follows: f ◦ g (x) = f(g(x)) for every x  X. Example: g(x) = x2 –1 f(x) = 3x + 5 g ◦ f(x) = g(f(x)) = g(3x + 5) = (3x + 5)2 - 1 Composition of functions is associative f ◦ (g ◦h) = (f ◦ g) ◦ h In general, it is not commutative f ◦ g  g ◦ f.

Binary operators A binary operator on a set X is a function f that associates a single element of X to every pair of elements in X, i.e. f : X x X  X and f(x1, x2)  X for every pair of elements x1, x2. Examples of binary operators are addition,subtraction and multiplication of real numbers, taking unions or intersections of sets, concatenation of two strings over a set X, etc.

Unary operators A unary operator on a set X associates to each single element of X one element of X. Examples: Let X = U be a universal set and P(U) the power set of U Define f : P(U)  P(U) the function defined by f (A) = A‘ the set complement of A in U, for every A  U. Then f defines a unary operator on P(U). (The operator here is the “complement” itself).

2.3 Sequences and strings A sequence is an ordered list of numbers, usually defined according to a formula function, sn, n = 1, 2, 3,... is the index of the sequence If s is a sequence {sn| n = 1, 2, 3,…}, s1 denotes the first element, s2 the second element,… sn the nth element… {n} is called the indexing set of the sequence. Usually the indexing set is N (natural numbers) or an infinite subset of N.

Examples of sequences Let s = {sn} be the sequence defined by sn = 1/n , for n = 1, 2, 3,… The first few elements of the sequence are: 1, ½, 1/3, ¼, 1/5,1/6,… sn = n2 + 1, for n = 1, 2, 3,… The first few elements of s are: 2, 5, 10, 17, 26, 37, 50,…

Increasing and decreasing A sequence s = {sn} is said to be increasing if sn < sn+1 decreasing if sn > sn+1, for every n = 1, 2, 3,… Examples: Sn = 4 – 2n, n = 1, 2, 3,… is decreasing: 2, 0, -2, -4, -6,… Sn = 2n -1, n = 1, 2, 3,… is increasing: 1, 3, 5, 7, 9, …

Subsequences A subsequence of a sequence s = {sn} is a sequence t = {tn} that consists of certain elements of s retained in the original order they had in s Example: let s = {sn = n | n = 1, 2, 3,…} 1, 2, 3, 4, 5, 6, 7, 8,… Let t = {tn = 2n | n = 1, 2, 3,…} 2, 4, 6, 8, 10, 12, 14, 16,… t is a subsequence of s

Sigma notation  ak = a1 + a2 + … + am If {an} is a sequence, then the sum m  ak = a1 + a2 + … + am k = 1 This is called the “sigma notation”, where the Greek letter  indicates a sum of terms from the sequence

Pi notation  ak = a1a2…am If {an} is a sequence, then the product m This is called the “pi notation”, where the Greek letter  indicates a product of terms of the sequence

Strings Let X be a nonempty set. A string over X is a finite sequence of elements from X. Example: if X = {a, b, c} Then  = bbaccc is a string over X Notation: bbaccc = b2ac3 The length of a string  is the number of elements of  and is denoted by ||. If  = b2ac3 then || = 6 The null string is the string with no elements and is denoted by the Greek letter  (lambda). It has length zero.

More on strings Let X* = {all strings over X including } Let X+ = X* - {}, the set of all non-null strings Concatenation of two strings  and  is the operation on strings consisting of writing  followed by  to produce a new string  Example:  = bbaccc and  = caaba, then  = bbaccccaaba = b2ac4a2ba Clearly, || = | | + ||