Functions f( ) = A B Lecture 15: Nov 4.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Countability. The cardinality of the set A is equal to the cardinality of a set B if there exists a bijection from A to B cardinality? bijection? injection.
Week 7 - Wednesday.  What did we talk about last time?  Set proofs and disproofs  Russell’s paradox.
1 Diagonalization Fact: Many books exist. Fact: Some books contain the titles of other books within them. Fact: Some books contain their own titles within.
Functions, Pigeonhole Principle Lecture 14: Nov 4 A B f( ) =
Great Theoretical Ideas in Computer Science.
Discrete Structures Chapter 5 Pigeonhole Principle Nurul Amelina Nasharuddin Multimedia Department.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Functions Lecture 12 A B f( ) =. Functions function, f, from set A to set B associates an element, with an element The domain of f is A. The codomain.
Terminology Domain: set which holds the values to which we apply the function Co-domain: set which holds the possible values (results) of the function.
Discrete Mathematics Lecture 7 Alexander Bukharovich New York University.
Terminology Domain: set which holds the values to which we apply the function Co-domain: set which holds the possible values (results) of the function.
Pigeonhole.
Functions Goals Introduce the concept of function Introduce injective, surjective, & bijective functions.
Functions Lecture 12 A B f( ) =. Functions function, f, from set A to set B associates an element, with an element The domain of f is A. The codomain.
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,
Discrete Mathematics Lecture 7 Harper Langston New York University.
CS 2210 (22C:019) Discrete Structures Sets and Functions Spring 2015 Sukumar Ghosh.
Great Theoretical Ideas in Computer Science.
Functions.
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.
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.
Functions A B f( ) =. This Lecture We will define a function formally, and then in the next lecture we will use this concept in counting. We will also.
Cardinality of Sets Section 2.5.
Relations & Functions CISC1400, Fall 2011 Fordham Univ.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sifth Edition, Mc Graw-Hill, 2007 Chapter 2: Basic Structures: Sets, Functions, Sequences.
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.
Lecture 6: Signal Processing III EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 2/25/13.
1 Lecture 3 (part 3) Functions – Cardinality Reading: Epp Chp 7.6.
Week 7 - Friday.  What did we talk about last time?  Set disproofs  Russell’s paradox  Function basics.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
1 Annoucement n Skills you need: (1) (In Thinking) You think and move by Logic Definitions Mathematical properties (Basic algebra etc.) (2) (In Exploration)
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
Chapter 1 SETS, FUNCTIONs, ELEMENTARY LOGIC & BOOLEAN ALGEBRAs BY: MISS FARAH ADIBAH ADNAN IMK.
Basic Structures: Sets, Functions, Sequences, and Sums CSC-2259 Discrete Structures Konstantin Busch - LSU1.
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.1 and 7.2.
Agenda Week 10 Lecture coverage: –Functions –Types of Function –Composite function –Inverse of a function.
Functions Section 2.3. Section Summary Definition of a Function. – Domain, Cdomain – Image, Preimage Injection, Surjection, Bijection Inverse Function.
COMPSCI 102 Introduction to Discrete Mathematics.
Discrete Structures Li Tak Sing ( 李德成 ) Lectures
Basic Structures: Sets, Functions, Sequences, and Sums.
Great Theoretical Ideas in Computer Science.
CompSci 102 Discrete Math for Computer Science February 7, 2012 Prof. Rodger Slides modified from Rosen.
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.3, 7.4 and 7.5.
CS 285- Discrete Mathematics
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.
Functions CSRU1400 Spring 2008Ellen Zhang 1 CISC1400, Fall 2010 Ellen Zhang.
Pigeonhole Principle. If n pigeons fly into m pigeonholes and n > m, then at least one hole must contain two or more pigeons A function from one finite.
Week 7 - Wednesday.  What did we talk about last time?  Proving the subset relationship  Proving set equality  Set counterexamples  Laws of set algebra.
Section 2.5. Cardinality Definition: A set that is either finite or has the same cardinality as the set of positive integers (Z + ) is called countable.
1 Lecture 5 Functions. 2 Functions in real applications Curve of a bridge can be described by a function Converting Celsius to Fahrenheit.
FUNCTIONS.
Russell’s Paradox Is W in W? In words, W is the set that contains all the sets that don’t contain themselves. If W is in W, then W contains itself. But.
Function Hubert Chan (Chapter 2.1, 2.2) [O1 Abstract Concepts]
Discrete Mathematics Lecture 6
Discrete Mathematics CS 2610
Functions 1.
Discrete Mathematics Lecture 7
Function Hubert Chan (Chapter 2.1, 2.2) [O1 Abstract Concepts]
Cardinality of Sets Section 2.5.
Discrete Math (2) Haiming Chen Associate Professor, PhD
Lecture 7 Functions.
Discrete Structures for Computer Science
CSE15 Discrete Mathematics 02/27/17
Functions Rosen 2.3, 2.5 f( ) = A B Lecture 5: Oct 1, 2.
Cardinality Definition: The cardinality of a set A is equal to the cardinality of a set B, denoted |A| = |B|, if and only if there is a one-to-one correspondence.
Intro to Theory of Computation
Presentation transcript:

Functions f( ) = A B Lecture 15: Nov 4

Functions function, f, from set A to set B associates an element , with an element The domain of f is A. The codomain of f is B. For every input there is exactly one output.

Functions domain = R codomain = R+-{0} domain = R+-{0} codomain = R

Functions f(S) = |S| f(string) = length(string) domain = the set of all sets codomain = non-negative integers f(S) = |S| domain = the set of all strings codomain = non-negative integers f(string) = length(string) not a function, since one input could have more than one output f(student-name) = student-ID f(x) = is-prime(x) domain = positive integers codomain = {T,F}

A B f( ) = |A| ≤ |B| Injections (One-to-One) ≤ 1 arrow in is an injection iff no two inputs have the same output. ≤ 1 arrow in f( ) = A B |A| ≤ |B|

A B f( ) = |A| ≥ |B| Surjections (Onto) 1 arrow in is a surjection iff every output is possible. f( ) = 1 arrow in A B |A| ≥ |B|

A B f( ) = |A| = |B| Bijections exactly one arrow in is a bijection iff it is surjection and injection. exactly one arrow in f( ) = A B |A| = |B|

In-Class Exercises Function Domain Codomain Injective? Surjective? Bijective? f(x)=sin(x) Real f(x)=2x Positive real f(x)=x2 Non-negative real Reverse string Bit strings of length n No No No Yes Yes Yes No Yes No Yes Yes Yes Whether a function is injective, surjective, bijective depends on its domain and the codomain.

Inverse Sets A B Given an element y in B, the inverse set of y := f-1(y) = {x in A | f(x) = y}.

A B f( ) = Inverse Function exactly one arrow in Informally, an inverse function f-1 is to “undo” the operation of function f. exactly one arrow in f( ) = A B There is an inverse function f-1 for f if and only if f is a bijection.

Composition of Functions Two functions f:X->Y’, g:Y->Z so that Y’ is a subset of Y, then the composition of f and g is the function g。f: X->Z, where g。f(x) = g(f(x)). f g Y’ X Z Y

In-Class Exercises Function f Function g g。f injective? g。f surjective? bijective? f:X->Y f surjective g:Y->Z g injective g surjective f injective f bijective g bijective f-1:Y->X No No No No Yes No No No No Yes Yes Yes Yes Yes Yes

Pigeonhole Principle If more pigeons than pigeonholes,

then some hole must have at least two pigeons! Pigeonhole Principle then some hole must have at least two pigeons! Pigeonhole principle A function from a larger set to a smaller set cannot be injective. (There must be at least two elements in the domain that have the same image in the codomain.)

Example Question: Let A = {1,2,3,4,5,6,7,8} If five integers are selected from A, must a pair of integers have a sum of 9? Consider the pairs {1,8}, {2,7}, {3,6}, {4,5}. The sum of each pair is equal to 9. If we choose 5 numbers from this set, then by the pigeonhole principle, both elements of some pair will be chosen, and their sum is equal to 9.

Birthday Paradox In a group of 366 people, there must be two people having the same birthday. Suppose n <= 365, what is the probability that in a random set of n people, some pair of them will have the same birthday? We can think of it as picking n random numbers from 1 to 365 without repetition. There are 365n ways of picking n numbers from 1 to 365. There are 365·364·363·…·(365-n+1) ways of picking n numbers from 1 to 365 without repetition. So the probability that no pairs have the same birthday is equal to 365·364·363·…·(365-n+1) / 365n This is smaller than 50% for 23 people, smaller than 1% for 57 people.

♠ ♥ ♣ ♦ Generalized Pigeonhole Principle If n pigeons and h holes, then some hole has at least pigeons. ♠ ♥ ♣ ♦ Cannot have < 3 cards in every hole.

Subset Sum Two different subsets of the 90 25-digit numbers shown above have the same sum.

Subset Sum 90 numbers, each with at most 25 digits. So the total sum is at most 90x1025 Let A be the set of all subsets of the 90 numbers. (pigeons) Let B be the set of integers from 0 to 90x1025. (pigeonholes) By pigeonhole principle, there are two different subsets with the same sum. This is an example of a non-constructive proof.

Cardinality Functions are useful to compare the sizes of two different sets. Question: Are all infinite sets having the same cardinality? Two sets A and B have the same cardinality if and only if there is a bijection between A and B. A set is countable if it has the same cardinality as the set of positive integers.

Integers vs Positive Integers Is the set of integers countable? Define a bijection between the positive integers and all integers 1 2 3 4 5 6 7 8 . . . 0 1 −1 2 −2 3 −3 4 . . . n/2, if n is even; −(n − 1)/2, if n is odd. f(n) = So, the set of integers is countable.

Rational Numbers vs Positive Integers Question: Is the set of rational number countable? The set of “pair of integers” (a,b) is not smaller than the set of rational number. We want to show that the set of “pair of integers” is countable, by defining a bijection to the set of positive integers. This would then imply the set of rational is countable.

Rational Numbers vs Positive Integers (0, 0), (0, 1), (0,−1), (0, 2), (0,−2), (0, 3), (0,−3), . . . (1, 0), (1, 1), (1,−1), (1, 2), (1,−2), (1, 3), (1,−3), . . . (−1, 0),(−1, 1),(−1,−1),(−1, 2),(−1,−2),(−1, 3), (−1,−3), . . . (2, 0), (2, 1), (2,−1), (2, 2), (2,−2), (2, 3), (2,−3), . . . (−2, 0),(−2, 1),(−2,−1),(−2, 2),(−2,−2), (−2, 3),(−2,−3), . . . If you map the set of positive integers to the top row first, then you will not be able to reach the second row. The trick is to visit the rational numbers diagonal by diagonal. Each diagonal is finite, so eventually every pair will be visited. Therefore, there is a bijection from the set of positive integers, to the set of pair of integers, and so the set of rational numbers is countable.

The opposite of the diagonal Real Numbers vs Positive Integers Question: Is the set of real number countable? Theorem: No surjection mapping positive integers to real numbers. The string map to the first natural number The string map to the fifth natural number It can not be in any row i because its i-th bit is different, and so this string is not mapped! The opposite of the diagonal

Diagonal Argument Similarly, power sets can be shown to be uncountable. This argument is called Cantor’s diagonal argument. http://en.wikipedia.org/wiki/Cantor's_diagonal_argument This has been used in many places; for example the Russell’s paradox.

Cardinality and Computability The set of all computer programs in a given computer language is countable. The set of all functions is uncountable. There must exist a non-computable function! (page 453-454 of the textbook)