Rosen 5th ed., §1.8 ~44 slides, ~2 lectures

Slides:



Advertisements
Similar presentations
Lecture adapted from CS3511,Discrete Methods Kees van Deemter
Advertisements

Functions Section 2.3 of Rosen Fall 2008
Great Theoretical Ideas in Computer Science.
CSE115/ENGR160 Discrete Mathematics 02/22/11 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 02/21/12
Functions f( ) = A B Lecture 15: Nov 4.
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,
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.
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.
Functions.
Relation, function 1 Mathematical logic Lesson 5 Relations, mappings, countable and uncountable sets.
© 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.
ICS 253: Discrete Structures I
1 Lecture 3 (part 3) Functions – Cardinality Reading: Epp Chp 7.6.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFunctions.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
4.1 CompSci 102© Michael Frank Today’s topics FunctionsFunctions – –Notations and terms – –One-to-One vs. Onto – –Floor, ceiling, and identity Reading:
Functions Section 2.3 of Rosen Spring 2012 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions: Use Piazza.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl Module #4.
Basic Structures: Sets, Functions, Sequences, and Sums CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Functions Section 2.3. Section Summary Definition of a Function. – Domain, Cdomain – Image, Preimage Injection, Surjection, Bijection Inverse Function.
Relations, Functions, and Countability
11 DISCRETE STRUCTURES DISCRETE STRUCTURES UNIT 5 SSK3003 DR. ALI MAMAT 1.
MATH 224 – Discrete Mathematics
COMPSCI 102 Introduction to Discrete Mathematics.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl 1/18 Module.
Basic Structures: Sets, Functions, Sequences, and Sums.
Great Theoretical Ideas in Computer Science.
CS 285- Discrete Mathematics
1 Functions CS 202 Epp section ??? Aaron Bloomfield.
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.
Sets (2.1) A set is a collection or group of objects or elements or members. (Cantor 1895) A set is said to contain its elements. There must be an underlying.
Function Hubert Chan (Chapter 2.1, 2.2) [O1 Abstract Concepts]
Relations, Functions, and Matrices
Applied Discrete Mathematics Week 2: Functions and Sequences
COT 3100, Spring 2001 Applications of Discrete Structures
MATH 224 – Discrete Mathematics
COT 3100, Spring 2001 Applications of Discrete Structures
Functions.
Chapter 2 Sets and Functions.
Function Hubert Chan (Chapter 2.1, 2.2) [O1 Abstract Concepts]
2.4 Sequences and Summations
Cardinality of Sets Section 2.5.
… and the following mathematical appetizer is about…
Functions.
Functions Section 2.3.
CS201: Data Structures and Discrete Mathematics I
Lecture 7 Functions.
Functions.
CSE15 Discrete Mathematics 02/27/17
Discrete Mathematics and its Applications
… and the following mathematical appetizer is about…
Lesson 5 Relations, mappings, countable and uncountable sets
Module #4.5, Topic #∞: Cardinality & Infinite Sets
Discrete Mathematics and its Applications
Lesson 5 Relations, mappings, countable and uncountable sets
Dept. of Mathematics 이산수학 Discrete Mathematics Dr. Chae, Gab-Byung
ICS 253: Discrete Structures I
… and the following mathematical appetizer is about…
Functions Rosen 6th ed., §2.3.
SE-561 Math Foundations of Software Engineering VIII. Functions
Module #4.5, Topic #∞: Cardinality & Infinite Sets
Functions Rosen 2.3, 2.5 f( ) = A B Lecture 5: Oct 1, 2.
Properties of Functions
Discrete Mathematics and its Applications
Functions Section 2.3.
Discrete Mathematics and its Applications
Presentation transcript:

Rosen 5th ed., §1.8 ~44 slides, ~2 lectures Module #4: Functions Rosen 5th ed., §1.8 ~44 slides, ~2 lectures 12/1/2018 (c)2001-2003, Michael P. Frank

On to section 1.8… Functions From calculus, you are familiar with the concept of a real-valued function f, which assigns to each number xR a particular value y=f(x), where yR. But, the notion of a function can also be naturally generalized to the concept of assigning elements of any set to elements of any set. 12/1/2018 (c)2001-2003, Michael P. Frank

Function: Formal Definition For any sets A, B, we say that a function f from (or “mapping”) A to B (f:AB) is a particular assignment of exactly one element f(x)B to each element xA. Some further generalizations of this idea: A partial (non-total) function f assigns zero or one elements of B to each element xA. Functions of n arguments; relations (ch. 6). 12/1/2018 (c)2001-2003, Michael P. Frank

Graphical Representations Functions can be represented graphically in several ways: A B f • • f • • • • y • a b • • • • x A B Bipartite Graph Plot Like Venn diagrams 12/1/2018 (c)2001-2003, Michael P. Frank

Functions We’ve Seen So Far A proposition can be viewed as a function from “situations” to truth values {T,F} A logic system called situation theory. p=“It is raining.”; s=our situation here,now p(s){T,F}. A propositional operator can be viewed as a function from ordered pairs of truth values to truth values: ((F,T)) = T. Another example: →((T,F)) = F. 12/1/2018 (c)2001-2003, Michael P. Frank

More functions so far… A predicate can be viewed as a function from objects to propositions (or truth values): P :≡ “is 7 feet tall”; P(Mike) = “Mike is 7 feet tall.” = False. A bit string B of length n can be viewed as a function from the numbers {1,…,n} (bit positions) to the bits {0,1}. E.g., B=101  B(3)=1. 12/1/2018 (c)2001-2003, Michael P. Frank

Still More Functions A set S over universe U can be viewed as a function from the elements of U to {T, F}, saying for each element of U whether it is in S. S={3}; S(0)=F, S(3)=T. A set operator such as ,, can be viewed as a function from pairs of sets to sets. Example: (({1,3},{3,4})) = {3} 12/1/2018 (c)2001-2003, Michael P. Frank

A Neat Trick Sometimes we write YX to denote the set F of all possible functions f:XY. This notation is especially appropriate, because for finite X, Y, |F| = |Y||X|. If we use representations F0, T1, 2:{0,1}={F,T}, then a subset TS is just a function from S to 2, so the power set of S (set of all such fns.) is 2S in this notation. 12/1/2018 (c)2001-2003, Michael P. Frank

Some Function Terminology If f:AB, and f(a)=b (where aA & bB), then: A is the domain of f. B is the codomain of f. b is the image of a under f. a is a pre-image of b under f. In general, b may have more than 1 pre-image. The range RB of f is {b | a f(a)=b }. 12/1/2018 (c)2001-2003, Michael P. Frank

Range versus Codomain The range of a function might not be its whole codomain. The codomain is the set that the function is declared to map all domain values into. The range is the particular set of values in the codomain that the function actually maps elements of the domain to. 12/1/2018 (c)2001-2003, Michael P. Frank

Range vs. Codomain - Example Suppose I declare to you that: “f is a function mapping students in this class to the set of grades {A,B,C,D,E}.” At this point, you know f’s codomain is: __________, and its range is ________. Suppose the grades turn out all As and Bs. Then the range of f is _________, but its codomain is __________________. {A,B,C,D,E} unknown! {A,B} still {A,B,C,D,E}! 12/1/2018 (c)2001-2003, Michael P. Frank

Operators (general definition) An n-ary operator over the set S is any function from the set of ordered n-tuples of elements of S, to S itself. E.g., if S={T,F},  can be seen as a unary operator, and , are binary operators on S. Another example:  and  are binary operators on the set of all sets. 12/1/2018 (c)2001-2003, Michael P. Frank

Constructing Function Operators If  (“dot”) is any operator over B, then we can extend  to also denote an operator over functions f:AB. E.g.: Given any binary operator :BBB, and functions f,g:AB, we define (f  g):AB to be the function defined by: aA, (f  g)(a) = f(a)g(a). 12/1/2018 (c)2001-2003, Michael P. Frank

Function Operator Example ,× (“plus”,“times”) are binary operators over R. (Normal addition & multiplication.) Therefore, we can also add and multiply functions f,g:RR: (f  g):RR, where (f  g)(x) = f(x)  g(x) (f × g):RR, where (f × g)(x) = f(x) × g(x) 12/1/2018 (c)2001-2003, Michael P. Frank

Function Composition Operator For functions g:AB and f:BC, there is a special operator called compose (“○”). It composes (creates) a new function out of f,g by applying f to the result of g. (f○g):AC, where (f○g)(a) = f(g(a)). Note g(a)B, so f(g(a)) is defined and C. Note that ○ (like Cartesian , but unlike +,,) is non-commuting. (Generally, f○g  g○f.) 12/1/2018 (c)2001-2003, Michael P. Frank

Images of Sets under Functions Given f:AB, and SA, The image of S under f is simply the set of all images (under f) of the elements of S. f(S) : {f(s) | sS} : {b |  sS: f(s)=b}. Note the range of f can be defined as simply the image (under f) of f’s domain! 12/1/2018 (c)2001-2003, Michael P. Frank

One-to-One Functions May Be Larger A function is one-to-one (1-1), or injective, or an injection, iff every element of its range has only 1 pre-image. Formally: given f:AB, “x is injective” : (x,y: xy  f(x)f(y)). Only one element of the domain is mapped to any given one element of the range. Domain & range have same cardinality. What about codomain? Each element of the domain is injected into a different element of the range. Compare “each dose of vaccine is injected into a different patient.” May Be Larger 12/1/2018 (c)2001-2003, Michael P. Frank

One-to-One Illustration Bipartite (2-part) graph representations of functions that are (or not) one-to-one: • • • • • • • • • • • • • • • • • • • • • • • • • • • Not one-to-one Not even a function! One-to-one 12/1/2018 (c)2001-2003, Michael P. Frank

Sufficient Conditions for 1-1ness For functions f over numbers, f is strictly (or monotonically) increasing iff x>y  f(x)>f(y) for all x,y in domain; f is strictly (or monotonically) decreasing iff x>y  f(x)<f(y) for all x,y in domain; If f is either strictly increasing or strictly decreasing, then f is one-to-one. E.g. x3 Converse is not necessarily true. E.g. 1/x 12/1/2018 (c)2001-2003, Michael P. Frank

Onto (Surjective) Functions A function f:AB is onto or surjective or a surjection iff its range is equal to its codomain (bB, aA: f(a)=b). An onto function maps the set A onto (over, covering) the entirety of the set B, not just over a piece of it. E.g., for domain & codomain R, x3 is onto, whereas x2 isn’t. (Why not?) 12/1/2018 (c)2001-2003, Michael P. Frank

Illustration of Onto Some functions that are or are not onto their codomains: • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Onto (but not 1-1) Not Onto (or 1-1) Both 1-1 and onto 1-1 but not onto 12/1/2018 (c)2001-2003, Michael P. Frank

Bijections A function f is a one-to-one correspondence, or a bijection, or reversible, or invertible, iff it is both one-to-one and onto. For bijections f:AB, there exists an inverse of f, written f 1:BA, which is the unique function such that (the identity function) 12/1/2018 (c)2001-2003, Michael P. Frank

The Identity Function For any domain A, the identity function I:AA (variously written, IA, 1, 1A) is the unique function such that aA: I(a)=a. Some identity functions you’ve seen: ing 0, ·ing by 1, ing with T, ing with F, ing with , ing with U. Note that the identity function is both one-to-one and onto (bijective). 12/1/2018 (c)2001-2003, Michael P. Frank

Identity Function Illustrations The identity function: • • • y • • • • • • x Domain and range 12/1/2018 (c)2001-2003, Michael P. Frank

A Fun Application In a computer, the function mapping state at clock cycle #t to state at clock cycle #t+1 is called the computer’s transition function. If the transition function is reversible (a bijection), then the computer’s operation in theory requires no energy expenditure. The study of low-power reversible computing techniques based on this idea is my primary research area. 12/1/2018 (c)2001-2003, Michael P. Frank

Graphs of Functions We can represent a function f:AB as a set of ordered pairs {(a,f(a)) | aA}. Note that a, there is only 1 pair (a,f(a)). Later (ch.6): relations loosen this restriction. For functions over numbers, we can represent an ordered pair (x,y) as a point on a plane. A function is then drawn as a curve (set of points) with only one y for each x. 12/1/2018 (c)2001-2003, Michael P. Frank

Comment About Representations You can represent any type of discrete structure (propositions, bit-strings, numbers, sets, ordered pairs, functions) in terms of virtually any of the other structures (or some combination thereof). Probably none of these structures is truly more fundamental than the others (whatever that would mean). However, strings, logic, and sets are often used as the foundation for all else. E.g. in  12/1/2018 (c)2001-2003, Michael P. Frank

A Couple of Key Functions In discrete math, we will frequently use the following functions over real numbers: x (“floor of x”) is the largest (most positive) integer  x. x (“ceiling of x”) is the smallest (most negative) integer  x. 12/1/2018 (c)2001-2003, Michael P. Frank

Visualizing Floor & Ceiling Real numbers “fall to their floor” or “rise to their ceiling.” Note that if xZ, x   x & x   x Note that if xZ, x = x = x. 3 . 1.6=2 2 . 1.6 . 1 1.6=1 . 1.4= 1 1 . 1.4 . 2 1.4= 2 . . . 3 3 3=3= 3 12/1/2018 (c)2001-2003, Michael P. Frank

Plots with floor/ceiling Note that for f(x)=x, the graph of f includes the point (a, 0) for all values of a such that a0 and a<1, but not for a=1. We say that the set of points (a,0) that is in f does not include its limit or boundary point (a,1). Sets that do not include all of their limit points are called open sets. In a plot, we draw a limit point of a curve using an open dot (circle) if the limit point is not on the curve, and with a closed (solid) dot if it is on the curve. 12/1/2018 (c)2001-2003, Michael P. Frank

Plots with floor/ceiling: Example Plot of graph of function f(x) = x/3: f(x) Set of points (x, f(x)) +2 3 x +3 2 12/1/2018 (c)2001-2003, Michael P. Frank

Review of §1.8 (Functions) Function variables f, g, h, … Notations: f:AB, f(a), f(A). Terms: image, preimage, domain, codomain, range, one-to-one, onto, strictly (in/de)creasing, bijective, inverse, composition. Function unary operator f 1, binary operators , , etc., and ○. The RZ functions x and x. 12/1/2018 (c)2001-2003, Michael P. Frank

Module #4, Topic #∞: Cardinality & Infinite Sets Rosen 5th ed., §3.2 ~1 lecture 12/1/2018 (c)2001-2003, Michael P. Frank

Infinite Cardinalities (from §3.2) Using what we learned about functions in §1.8, it’s possible to formally define cardinality for infinite sets. We show that infinite sets come in different sizes of infinite! This gives us some interesting proof examples, in anticipation of chapter 3. 12/1/2018 (c)2001-2003, Michael P. Frank

Cardinality: Formal Definition For any two (possibly infinite) sets A and B, we say that A and B have the same cardinality (written |A|=|B|) iff there exists a bijection (bijective function) from A to B. When A and B are finite, it is easy to see that such a function exists iff A and B have the same number of elements nN. 12/1/2018 (c)2001-2003, Michael P. Frank

Countable versus Uncountable For any set S, if S is finite or |S|=|N|, we say S is countable. Else, S is uncountable. Intuition behind “countable:” we can enumerate (generate in series) elements of S in such a way that any individual element of S will eventually be counted in the enumeration. Examples: N, Z. Uncountable: No series of elements of S (even an infinite series) can include all of S’s elements. Examples: R, R2, P(N) 12/1/2018 (c)2001-2003, Michael P. Frank

Countable Sets: Examples Theorem: The set Z is countable. Proof: Consider f:ZN where f(i)=2i for i0 and f(i) = 2i1 for i<0. Note f is bijective. Theorem: The set of all ordered pairs of natural numbers (n,m) is countable. Consider listing the pairs in order by their sum s=n+m, then by n. Every pair appears once in this series; the generating function is bijective. 12/1/2018 (c)2001-2003, Michael P. Frank

Uncountable Sets: Example Theorem: The open interval [0,1) : {rR| 0  r < 1} is uncountable. Proof by diagonalization: (Cantor, 1891) Assume there is a series {ri} = r1, r2, ... containing all elements r[0,1). Consider listing the elements of {ri} in decimal notation (although any base will do) in order of increasing index: ... (continued on next slide) Georg Cantor 1845-1918 12/1/2018 (c)2001-2003, Michael P. Frank

Uncountability of Reals, cont’d Discrete Mathematics and its Applications 12/1/2018 Uncountability of Reals, cont’d A postulated enumeration of the reals: r1 = 0.d1,1 d1,2 d1,3 d1,4 d1,5 d1,6 d1,7 d1,8… r2 = 0.d2,1 d2,2 d2,3 d2,4 d2,5 d2,6 d2,7 d2,8… r3 = 0.d3,1 d3,2 d3,3 d3,4 d3,5 d3,6 d3,7 d3,8… r4 = 0.d4,1 d4,2 d4,3 d4,4 d4,5 d4,6 d4,7 d4,8… . . . Why? Because it’s first digit is different from the first digit of r1, its second digit is different from the second digit of r2, and in general its nth digit is different from the nth digit of rn. Therefore it is different from every number in the list. We may want to restrict ourselves to change the digit to one other than 9 because if we change it to a nine, the resulting number could be say .1239999999999… infinitely which is equal to .1240000000000… (which could be in the list) even though the digits don’t match. But, actually this imagined problem doesn’t actually arise because since there are an infinite number of reals that don’t include any 9’s, it is impossible for the diagonal to be all 9’s beyond some finite point. Now, consider a real number generated by taking all digits di,i that lie along the diagonal in this figure and replacing them with different digits. That real doesn't appear in the list! 12/1/2018 (c)2001-2003, Michael P. Frank (c)2001-2002, Michael P. Frank

Uncountability of Reals, fin. E.g., a postulated enumeration of the reals: r1 = 0.301948571… r2 = 0.103918481… r3 = 0.039194193… r4 = 0.918237461… OK, now let’s add 1 to each of the diagonal digits (mod 10), that is changing 9’s to 0. 0.4103… can’t be on the list anywhere! 12/1/2018 (c)2001-2003, Michael P. Frank

Discrete Mathematics and its Applications 12/1/2018 Transfinite Numbers The cardinalities of infinite sets are not natural numbers, but are special objects called transfinite cardinal numbers. The cardinality of the natural numbers, 0:|N|, is the first transfinite cardinal number. (There are none smaller.) The continuum hypothesis claims that |R|=1, the second transfinite cardinal. In other words, the continuum hypothesis has been shown to be independent from the other axioms of set theory that led to the definition of transfinite cardinals. Proven impossible to prove or disprove! 12/1/2018 (c)2001-2003, Michael P. Frank (c)2001-2002, Michael P. Frank

Do Uncountable Sets Really Exist? The set of objects that can be defined using finite-length strings of symbols (“descriptions”) is only countable. Therefore, any uncountable set must consist primarily of elements which individually have no finite description. Löwenheim-Skolem theorem: No consistent theory can ever force an interpretation involving uncountables. The “constructivist school” asserts that only objects constructible from finite descriptions exist. (e.g. R) Most mathematicians are happy to use uncountable sets anyway, because postulating their existence has not led to any demonstrated contradictions (so far). 12/1/2018 (c)2001-2003, Michael P. Frank

Countable vs. Uncountable You should: Know how to define “same cardinality” in the case of infinite sets. Know the definitions of countable and uncountable. Know how to prove (at least in easy cases) that sets are either countable or uncountable. 12/1/2018 (c)2001-2003, Michael P. Frank