Overview of Sets an Functions for ICS 6D

Slides:



Advertisements
Similar presentations
More Set Definitions and Proofs 1.6, 1.7. Ordered n-tuple The ordered n-tuple (a1,a2,…an) is the ordered collection that has a1 as its first element,
Advertisements

Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Section 1.6: Sets Sets are the most basic of discrete structures and also the most general. Several of the discrete structures we will study are built.
2.1 Sets. DEFINITION 1 A set is an unordered collection of objects. DEFINITION 2 The objects in a set are called the elements, or members, of the set.
Lecture 3 Set Operations & Set Functions. Recap Set: unordered collection of objects Equal sets have the same elements Subset: elements in A are also.
CS5371 Theory of Computation Lecture 1: Mathematics Review I (Basic Terminology)
Sets 1.
Sets 1.
modified from UCI ICS/Math 6D, Fall Sets+Functions-1 Sets “Set”=Unordered collection of Objects “Set Elements”
CS 2210 (22C:019) Discrete Structures Sets and Functions Spring 2015 Sukumar Ghosh.
Sets.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Partially borrowed from Florida State University
Sets Set Operations Functions. 1. Sets 1.1 Introduction and Notation 1.2 Cardinality 1.3 Power Set 1.4 Cartesian Products.
Mathematical preliminaries Episode 2 0 Sets Sequences Functions Relations Strings.
ICS 253: Discrete Structures I
R. Johnsonbaugh, Discrete Mathematics 5 th edition, 2001 Chapter 2 The Language of Mathematics.
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (2)
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
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.
Sets Define sets in 2 ways  Enumeration  Set comprehension (predicate on membership), e.g., {n | n  N   k  k  N  n = 10  k  0  n  50} the set.
Mathematical Proofs. Chapter 1 Sets 1.1 Describing a Set 1.2 Subsets 1.3 Set Operations 1.4 Indexed Collections of Sets 1.5 Partitions of Sets.
Discrete Mathematics R. Johnsonbaugh
CompSci 102 Discrete Math for Computer Science
Section 2.1. Section Summary Definition of sets Describing Sets Roster Method Set-Builder Notation Some Important Sets in Mathematics Empty Set and Universal.
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.
ELEMENTARY SET THEORY.
Module Code MA1032N: Logic Lecture for Week Autumn.
Mathematical Preliminaries
Chapter 2 With Question/Answer Animations. Section 2.1.
Sets.
Basic Structures: Sets, Functions, Sequences, and Sums.
Introduction Episode 0 What is TOC (Theory of Computation) about? Giorgi Japaridze Theory of Computability Subject: The fundamental mathematical properties.
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.
Chapter 2 With Question/Answer Animations. Section 2.1.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Discrete Mathematics CS 2610 August 31, Agenda Set Theory Set Builder Notation Universal Set Power Set and Cardinality Set Operations Set Identities.
Section 2.1. Sets A set is an unordered collection of objects. the students in this class the chairs in this room The objects in a set are called the.
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.
Chapter 2 1. Chapter Summary Sets The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions and sequences.
“It is impossible to define every concept.” For example a “set” can not be defined. But Here are a list of things we shall simply assume about sets. A.
CPCS 222 Discrete Structures I
Set. Outline Universal Set Venn Diagram Operations on Sets.
ICS 253: Discrete Structures I
The set of whole numbers less than 7 is {1, 2, 3, 4, 5, 6}
Set Definition: A set is unordered collection of objects.
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.
Discrete Math (2) Haiming Chen Associate Professor, PhD
CS100: Discrete structures
Set and Set Operations Grab a sheet from front.
2.1 Sets Dr. Halimah Alshehri.
CS 220: Discrete Structures and their Applications
Advanced Algorithms Analysis and Design
Sets. EXAMPLE 1 The set O of odd positive integers less than 10 can be expressed by O = { l, 3, 5, 7, 9}. * This way of describing a set is known as.
Mathematical Background 1
Mathematical Background 1
Discrete Mathematics CS 2610
The aim of education is to teach students how to think rather than what to think. Sets The set is the fundamental discrete structure on which all other.
Introduction to Relations and Functions
ICS 253: Discrete Structures I
Math/CSE 1019N: Discrete Mathematics for Computer Science Winter 2007
Discrete Mathematics 7th edition, 2009
Introduction A set is a collection of objects.
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
Terminology and Symbols
Presentation transcript:

Overview of Sets an Functions for ICS 6D Prof. Sandy Irani

Sets A set is an unordered collection of items. For example, S = {a, b, c, d} Curly braces {} denote that order does not matter: {a, b, c, d} = {b, a, d, c} Each item is called an element of the set. b is an element of S (b ∈ S) e is not an element of S (e ∉ S)

Cardinality of Sets An infinite set has an infinite number of elements. Example: the set of all integers. A finite set has a finite number of elements. Example: the set of students enrolled in ICS 6D Spr 2016. If S is a finite set, then the cardinality of S (denoted |S|) is the number of elements in S. Example: S = {a, b, c, d}. |S| =

Famous Sets ℤ = the set of all integers ℝ = the set of real numbers ℚ = the set of rational numbers (A number x is rational if x = c/d, where c and d are integers and d ≠ 0.) ℕ = natural numbers (positive integers)  the empty set (sometimes denoted as {})

Specifying a Set Roster notation: List the elements with curly braces {1, 3, 5, 9} List elements with an inferred pattern in ellipses {1, 3, 5, …., 99} Set builder notation {x : x ∈ S and some additional conditions on x} {x ∈ S : additional conditions on x} S is a larger set that has already been defined “:” is read as “such that”

Subsets T is a subset of S (T ⊆ S): To show T ⊈ S, Example: If x ∈ T then x ∈ S To show T ⊈ S, Find x ∈ T and x ∉ S. Example: S = {a, b, c, d} T = {a, b, c} V = {a, e}

Set Operations Union: x ∈ A ∪ B ↔ x ∈ A ∨ x ∈ B Intersection: Complement: x ∈ A ↔ (x ∈ A) (all elements and sets contained in a Universe set, usually denoted by U)

Set Operations Example A = { x ∈ ℤ : x is odd } U = ℤ B = { x ∈ ℤ : 0 < x 20 } C = {4, 5, 6, 7} A ∩ B C ∩ A C ⊆ B? B ⊆ A? 6 ∈ A ∪ C ? 26 ∈ A ∪ C ?

Power Set Let A be a finite set. Power set of A (denoted P(A)) is the set of all subsets of A. Example: A = {a, b, c} P(A) = { , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} } {a, b} ∈ P(A) ? { {a} } ⊆ P(A) ? {a, b} ⊆ P(A) ? Ø ⊆ P(A) ? a ∈ P(A) ? Ø ∈ P(A) ? {a} ∈ P(A) ?

Pairs, Triplets and Tuples (a, b) is an ordered pair. Parens (as opposed to {}) indicate that order matters: (a, b) ≠ (b, a) {a, b} = {b, a} (a, b, c) is an ordered triplet b is the second entry of the triplet (a, b, c) (a, b, c, d) is an ordered 4-tuple (a1, a2 , …, an) is an ordered n-tuple.

Cartesian Product S x T = { (s, t) : s ∈ S and t ∈ T } Let S and T be sets Cartesian product of S and T is S x T = { (s, t) : s ∈ S and t ∈ T } Example: S = {a, b, c} T = {1, 2} S x T = { (a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2) }

Cartesian Product T = {1, 2} T x T = T2 = { (1, 1), (1, 2), (2, 1), (2, 2) } T ⊆ T2 ? What is ℝ x ℝ? ℤ x ℤ?

Cartesian Product A1, …, An sets: Example: Drink = {OJ, Coffee} Main = {Waffles, Eggs, Pancakes} Side = {Hash browns, Toast} Breakfast Selections = Drink x Main x Side (OJ, Eggs, Toast) ∈ Drink x Main x Side A1, …, An sets: A1x … x An = { (a1, …, an) : ai in Ai for 1 ≤ i ≤ n }

Cartesian Product Let S be a set: Sn = S x S x … x S = { (s1, .., sn) : each si in S, for 1 ≤ i ≤ n } Example: {0, 1}5 Example: ℝ4

N-tuples and Strings If  is a set of single characters, elements in n can be denoted without the punctuation, in which case they are called strings. Example:  = {a, b} (a, b, a, b) ∈ 4 (denoted as an n-tuple) abab ∈ 4 (denoted as a string) {0, 1}3 = set of all binary strings with 3 bits: {0, 1}3 = { 000, 001, 010, 011, 100, 101, 110, 111 } n-tuple punctuation is important if the underlying set is not a set of single characters!

Strings x  = x = x Example: |abba| = 4. Concatenation: x = abba y = bab Concatenation of x and y is xy = abbabab Concatenation of x and a is abbaa Empty string  has no characters: x  = x = x The length of a string x (denoted by |x|) is the number of characters in the string: Example: |abba| = 4.

Infinite sets of strings The set of all strings of any length over an alphabet : * = 0 ∪ 1 ∪ 2 ∪ ….. Example: {0, 1}* = {, 0, 1, 00, 01, 10, 11, 000,….} + = 1 ∪ 2 ∪ 3 ∪ ….. Example: {0, 1}+ = {0, 1, 00, 01, 10, 11, 000,….}

Functions f: A → B A function maps elements of one set onto another: A is the domain A = {a, b, c, d} B is the target B = {1, 2, 3, 4, 5} 1 a 2 b A function maps each element of the domain to a unique element in the target set. 3 c 4 d 5

Functions f: A → B A function maps elements of one set onto another: A is the domain A = {a, b, c, d} B is the target B = {1, 2, 3, 4, 5} 1 a 2 b The range is the set of elements y in the target for which there is an element x in the domain such that f(x) = y. 3 c 4 d 5

Functions on ℝ specified by an explicit formula f(x) = x2 - 4x + 3 Examples of non-functions: f(x) = ±√x f(x) = 2/x

Functions: one-to-one A function f: D → T is one-to-one if no two elements in the domain map on to the same element in the target: ∀ x ∈ D, x’ ∈ D, (x ≠ x’) → f(x) ≠ f(x’) 1 a 1 a 2 b 2 b 3 c 3 c 4 d 4 d 5 5

One-to-one Examples f: ℝ → ℝ f(x) = x2 f: ℤ → ℤ f(x) = 2x + 3 f: {0, 1}3 → {0, 1}3 replace the last bit with 0, f(111) = 110 f: {0, 1}3 → {0, 1}4 add a 0 to the end f(101) = 1010 A = {a, b, c} f: P(A) → ℤ. For X ⊆ A, f(X) = |X|

One-to-one examples f: {0, 1}3 → {0, 1}2 drop the last bit f(101) = 10 000 001 00 010 01 If f: D → T is one-to-one, then |D| ≤ |T| 011 10 100 11 101 If f: D → T and |D| > |T| The f can not be one-to-one. 110 111

Functions: onto A function f: D → T is onto if every element in the target is mapped to by some element in the domain For every y ∈ T, there is an x ∈ D, such that f(x) = y a 1 a 1 b 2 b 2 c 3 c 3 d d

Onto Examples f: ℝ → ℝ f(x) = x2 f: ℤ → ℤ f(x) = 2x + 3 f: {0, 1}3 → {0, 1}3 replace the last bit with 0, f(111) = 110 f: {0, 1}3 → {0, 1}2 drop the last bit f(101) = 10 f: {0, 1}3 → {0, 1}3 remove the last bit and concatenate it at the beginning of the string: f(101) = 110 f(100) = 010

Onto Examples If f:D →T is onto, then |T| ≤ |D| If f:D →T and Example f: {0, 1}2 → {0, 1}3 add a 0 to the end f(10) = 100 000 001 00 010 If f:D →T is onto, then |T| ≤ |D| 01 011 10 100 11 101 If f:D →T and |T| > |D| The f can not be onto. 110 111

Bijections Definition: A function f:D→T is a bijection if it is one-to-one and onto a 1 b 2 c 3 d 4 If f:D→T and f is a bijection, then |D| = |T|

Inverse of a function A function f is a bijection if and only if f: D → T The inverse of f (if it exists) is a function f-1: T → D For every x ∈ D and y ∈ T, f(x) = y ↔ f-1(y) = x a 1 1 a A function f is a bijection if and only if f has an inverse b 2 2 b c 3 3 c d 4 4 d f f-1

Inverse of a function example A string is a palindrome if it is the same after it is reversed. Let P6 be the set of all 6-bit strings that are also palindromes. Bijection between {0, 1}3 and P6 f: {0, 1}3 → P6 f(x) = xxR (xR is the reverse of x)