Jessie Zhao Course page: 1.

Slides:



Advertisements
Similar presentations
Functions Reading: Epp Chp 7.1, 7.2, 7.4
Advertisements

Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (1)
1.6 Functions. Chapter 1, section 6 Functions notation: f: A B x in A, y in B, f(x) = y. concepts: –domain of f, –codomain of f, –range of f, –f maps.
Jessie Zhao Course page: 1.
RELATIONRELATIONAA Age (years)Weight (kg) Consider the relationship between the weight of five students and their ages as shown.
More Functions and Sets
modified from UCI ICS/Math 6D, Fall Sets+Functions-1 Sets “Set”=Unordered collection of Objects “Set Elements”
Functions Goals Introduce the concept of function Introduce injective, surjective, & bijective functions.
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,
CSC 2300 Data Structures & Algorithms January 16, 2007 Chapter 1. Introduction.
CS 2210 (22C:019) Discrete Structures Sets and Functions Spring 2015 Sukumar Ghosh.
RMIT University; Taylor's College
Sets.
Functions.
Functions. Let A and B be sets A function is a mapping from elements of A to elements of B and is a subset of AxB i.e. can be defined by a set of tuples!
1 CMSC 250 Chapter 7, Functions. 2 CMSC 250 Function terminology l A relationship between elements of two sets such that no element of the first set is.
Section 1.8: Functions A function is a mapping from one set to another that satisfies certain properties. We will first introduce the notion of a mapping.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Sets Set Operations Functions. 1. Sets 1.1 Introduction and Notation 1.2 Cardinality 1.3 Power Set 1.4 Cartesian Products.
2.1 Sets 2.2 Set Operations 2.3 Functions ‒Functions ‒ Injections, Surjections and Bijections ‒ Inverse Functions ‒Composition 2.4 Sequences and Summations.
Functions. Copyright © Peter Cappello2 Definition Let D and C be nonempty sets. A function f from D to C, for each element d  D, assigns exactly 1 element.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
Fall 2002CMSC Discrete Structures1 … and the following mathematical appetizer is about… Functions.
10/26/20151 … and the following mathematical appetizer is about… Functions.
FUNCTIONS.
MSU/CSE 260 Fall Functions Read Section 1.8.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
1 Discrete Structures – CNS 2300 Text Discrete Mathematics and Its Applications (5 th Edition) Kenneth H. Rosen Chapter 1 The Foundations: Logic, Sets,
Chapter 1 SETS, FUNCTIONs, ELEMENTARY LOGIC & BOOLEAN ALGEBRAs BY: MISS FARAH ADIBAH ADNAN IMK.
321 Section, Week 3 Natalie Linnell. Functions A function from A to B is an assignment of exactly one element of B to each element of A. We write f(a)
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.
Basic Structures: Functions Muhammad Arief download dari
CSE 2353 – October 1 st 2003 Functions. For Real Numbers F: R->R –f(x) = 7x + 5 –f(x) = sin(x)
Agenda Week 10 Lecture coverage: –Functions –Types of Function –Composite function –Inverse of a function.
MATH 224 – Discrete Mathematics
Basic Structures: Sets, Functions, Sequences, and Sums.
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.
CSC102 - Discrete Structures Functions
1 Functions CS 202 Epp section ??? Aaron Bloomfield.
FUNCTIONS COSC-1321 Discrete Structures 1. Function. Definition Let X and Y be sets. A function f from X to Y is a relation from X to Y with the property.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Discrete Mathematics 3. MATRICES, RELATIONS, AND FUNCTIONS Lecture 6 Dr.-Ing. Erwin Sitompul
Section 2.3. Section Summary  Definition of a Function. o Domain, Cdomain o Image, Preimage  One-to-one (Injection), onto (Surjection), Bijection 
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.
FUNCTIONS.
Functions Goals Introduce the concept of function
Functions Section 2.3.
Relations, Functions, and Matrices
Sets Section 2.1.
CS 2210:0001 Discrete Structures Sets and Functions
Cartesian product Given two sets A, B we define their Cartesian product is the set of all the pairs whose first element is in A and second in B. Note that.
Functions.
… and the following mathematical appetizer is about…
Functions.
Functions Section 2.3.
Discrete Math (2) Haiming Chen Associate Professor, PhD
Functions.
Yet another important mathematical concept
… and the following mathematical appetizer is about…
Functions CS 202 Epp section 7.1.
Functions.
ICS 253: Discrete Structures I
… and the following mathematical appetizer is about…
Functions Rosen 6th ed., §2.3.
Math/CSE 1019N: Discrete Mathematics for Computer Science Winter 2007
Lecture Sets 2.2 Set Operations.
Functions Section 2.3.
Copyright © Zeph Grunschlag,
Presentation transcript:

Jessie Zhao Course page: 1

 No Assignment is released today!  No Class on Thanks Giving! Oct 8 th  Test 1 on Oct 15 th, ◦ Ch ◦ 7pm-8:20pm ◦ Location: SLH F ◦ Lecture: 8:40pm, SLH A. 2

 What is a set? ◦ Unordered collection of distinct elements  How to describe a set?  Roster method: A={5,7,3}  set builder (predicates): S = {x | P(x)}  Cardinality |S|  number of (distinct) elements |A| = 3 3

1. What is the cardinality of {∅,{∅,{∅}}}? What is its power set? 2. Prove that A ⊂ B iff P(A) ⊂P(B). 3. Draw the Venn Diagrams for 4

 A function from A to B is an assignment of exactly one element of B to each element of A.  grade: S → G 5 S G

This is not a function!  Every member of the domain must be mapped to a member of the co-domain 6 Jason S G

This is not a function!  No member of the domain may map to more than one member of the co-domain 7 S G

 Surjections (onto)  Injections (1-1)  Bijections (1-1 correspondence): Invertible 8

 Let f: A ➝ B. The graph of f is the set of ordered pairs {(a,b) | a∈A and f(a)=b}  Example: The graph of f:Z->Z where f(x)=2x+1 9

 The Graph of Floor function R->Z ◦ ⌊x⌋ is the largest integer that is less than or equal to x. 10

 The Graph of Ceiling function R->Z ◦ ⌈x⌉ is the smallest integer that is greater than or equal to x. 11

 Let f and g be functions from A to R. Then f 1 +f 2 and f 1 f 2 are also functions from A to R ◦ (f 1 +f 2 )(x) = f 1 (x) + f 2 (x) ◦ (f 1 f 2 )(x) =f 1 (x) f 2 (x)  Example:  f 1 (x)=x, f 2 (x)=x²  (f 1 +f 2 )(x)=x + x²  (f 1 f 2 )(x)= x³  Notice the difference between and fg 12

The domain and codomain of f are subsets of R. x, y are in the domain of f and x<y. f is (monotonically) increasing if f(x)≤f(y) f is strictly increasing if f(x)<f(y) f is (monotonically) decreasing if f(x)≥f(y) f is strictly decreasing if f(x)>f(y) 13 Increasing Decreasing Not Monotonic Monotonic Functions

 Show that ⌈x+n⌉ is ⌈ x ⌉ +n for x∈R and n∈Z.  Proof: ◦ Assume ⌈ x ⌉ = m. ◦ m-1 < x ≤ m ◦ n+m-1 < x+n ≤ m+n ◦ ⌈ x+n ⌉ = m+n = ⌈ x ⌉ +n ◦ Q.E.D. 14

 Show that ⌊2x⌋ is ⌊ x ⌋ + ⌊ x+1/2 ⌋ for x∈R.  Proof: ◦ Assume x=n+e where n∈Z, e∈R and 0≤e<1. ◦ Case 1: 0≤e<1/2 ◦ ⌊ 2x⌋= ⌊ 2n+2e ⌋ = 2n (0≤2e<1) ◦ ⌊ x ⌋ = ⌊ n+e ⌋ = n (0≤e<1/2) ◦ ⌊ x+1/2 ⌋ = ⌊ n+e+1/2 ⌋ = n (1/2≤e+1/2<1) ◦ So, ⌊ 2x ⌋ = ⌊ x ⌋ + ⌊ x+1/2 ⌋ ◦ Case 2: 1/2≤e<1 ◦ ⌊ 2x⌋ = ⌊ 2n+2e ⌋ =2n+1 (1≤2e<2) ◦ ⌊ x ⌋ = ⌊ n+e ⌋= n (1/2≤e<1) ◦ ⌊ x+1/2 ⌋ = ⌊ n+e+1/2 ⌋ = n +1 (1≤e+1/2<1 1/2) 15

16  Changing bases: In general need to go through the decimal representation  E.g: = ? 9  = 1*7 2 +0* *7 0 = 50  Decimal to Base 9:  d 1 = n rem 9 = 5, n = n div 9 = 5  b 2 = n rem 9 = 5, n = n div 9 = 0.  STOP  So = 55 9

17  Changing bases that are powers of 2:  Can often use shortcuts.  Binary to Octal:  =  Binary to Hexadecimal:  = BD 16  Hexadecimal to Octal: Go through binary, not decimal.

 1. Prove that a strictly increasing function from R to itself is one to one  2. Suppose that f:Y->Z and g:X->Y are invertible. Show that 18

 A sequence is an ordered list, possibly infinite, of elements notated by {a₁, a₂, a₃...} or where k is the upper limit (usually ∞)  A sequence is a function from a subset of the Z (usually {0,1,2,...}) to another set  a n is the image of the the integer n. We call a n a term of the sequence, and n is its index or subscript 19

 An arithmetic progression is a sequence of the form a, a+d, a+2d, a+3d,..., a+(n-1)d,... a is the initial term d is the common difference  E.g. ◦ {-1, 3, 7, 11,...} ◦ {7,4,1,-2,...} 20

 An geometric progression is a sequence of the form a, ar, ar², ar³,..., arⁿ,... a is the initial term r is the common ratio  E.g. ◦ {1,-1,1,-1,1,...} ◦ {2,10,50,250,1250,...} 21

 {n²}: 1, 4, 9, 16, 25,....  {n³}: 1, 8, 27, 64, 125,...  {n ⁴}: 1, 16, 81, 256, 343,...  {2ⁿ}: 2, 4, 8, 16, 32,...  {3ⁿ}: 3, 9, 27, 81, 243,...  {n!}: 1, 2, 6, 24, 120,...  {f n }: 1, 1, 2, 3, 5, 8, … 22

 A series is the sum of the terms of a sequence S = a 1 + a 2 + a 3 + a 4 + …  Consider the sequence S 1, S 2, S 3, … S n, where S i = a 1 + a 2 + … + a i In general we would like to evaluate sums of series – useful in algorithm analysis. e.g. what is the total time spent in a nested loop? 23

 Given a sequence {a i } the summation notation for its terms a m, a m+1,..., a n represent a m + a m+1 + … + a n  E.g. 24

 Given a arithmetic progression a, a+d, a+2d, a+3d,..., a+nd, its summation is  Proof on board  You should also be able to determine the sum if the index starts at k and/or ends at n-1, n+1, etc.  Page 166: useful summation formula 25

 Given a geometric progression a, ar², ar³,..., arⁿ, its summation is  Proof on board  You should also be able to determine the sum if the index starts at k and/or ends at n-1, n+1, etc. 26

 Let x be a real number with |x|<1. Find  How about |x|≥1?  Need to be very careful with infinite series  In general, tools from calculus are needed to know whether an infinite series sum exists. 27

 loop 1: for i=1 to 4  loop 2: for j=1 to 3  S = S + ij 28

 Recall: A set is finite if its cardinality is some (finite) integer n  For two sets A and B ◦ |A| = |B| if and only if there is a bijection from A to B ◦ |A| ≤ |B| if there is an injection from A to B ◦ |A| = |B| if |A| ≤ |B| and |B| ≤ |A| ◦ |A| ≤ |B| if A⊆B 29

30  Why do we care?  Cardinality of infinite sets  Do all infinite sets have the same cardinality?

 A set is countable if ◦ it is finite or ◦ it has the same cardinality as the set of the positive integers Z⁺ i.e. |A| = |Z⁺|. The set is countably infinite  We write |A| = |Z+| = ℵ 0 = aleph null  A set that is not countable is called uncountable 31

 Countability implies that there is a listing of the elements of the set.  Fact (Will not prove): Any subset of a countable set is countable.  Proving the set is countable involves (usually) constructing an explicit bijection with Z⁺ 32

 Show that the set of odd positive integers S is countable.  Proof: ◦ To show that S is countable, we will show a bijective function between Z ⁺ and S. ◦ Consider f: Z ⁺ ->S be such that f(n) = 2n-1. ◦ To see f is one-to-one, suppose that f(n)=f(m), then 2n- 1=2m-1, so n=m. ◦ To see f is onto, suppose that t ∈ S, i.e. t=2k-1 for some positive integer k. Hence t=f(k). ◦ Q.E.D. 33

34  Write them as 0, 1, -1, 2, -2, 3, -3, 4, -4, ……  Find a bijection between this sequence and 1,2,3,4,….. Notice the pattern: 1  0 2  1 3  -1 4  2 5  -2 6  3 So f(n) = n/2 if n even -(n-1)/2 o.w.

35  Union of two countable sets A, B is countable: Say f: N  A, g:N  B are bijections New bijection h: N  A  B h(n) = f(n/2) if n is even = g((n-1)/2) if n is odd.

36  Step 1. Show that Z + x Z + is countable.  Step 2. Show injection between Q +, Z + x Z +.  Step 3. Construct a bijection from Q + to Q