강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics)  함수 (Functions)

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

Functions Section 2.3 of Rosen Fall 2008
Lecture 3 Set Operations & Set Functions. Recap Set: unordered collection of objects Equal sets have the same elements Subset: elements in A are also.
CSE115/ENGR160 Discrete Mathematics 02/16/12 Ming-Hsuan Yang UC Merced 1.
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,
CS 2210 (22C:019) Discrete Structures Sets and Functions Spring 2015 Sukumar Ghosh.
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!
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.
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.
FUNCTION Discrete Mathematics Asst. Prof. Dr. Choopan Rattanapoka.
Foundations of Discrete Mathematics Chapter 3 By Dr. Dalia M. Gil, Ph.D.
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,
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.
Discrete Mathematics CS 2610 September 12, Agenda Last class Functions  Vertical line rule  Ordered pairs  Graphical representation  Predicates.
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.
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,
Functions1 Elementary Discrete Mathematics Jim Skon.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl Module #4.
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: 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.
CompSci 102 Discrete Math for Computer Science January 31, 2012 Prof. Rodger Slides modified from Rosen AB a b c d x y z.
Functions. L62 Agenda Section 1.8: Functions Domain, co-domain, range Image, pre-image One-to-one, onto, bijective, inverse Functional composition and.
MATH 224 – Discrete Mathematics
2014 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics)  집합 (Set)
Basic Structures: Sets, Functions, Sequences, and Sums.
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.
Functions CSRU1400 Spring 2008Ellen Zhang 1 CISC1400, Fall 2010 Ellen Zhang.
1 Lecture 5 Functions. 2 Functions in real applications Curve of a bridge can be described by a function Converting Celsius to Fahrenheit.
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.
Discrete Mathematics Lecture # 17 Function. Relations and Functions  A function F from a set X to a set Y is a relation from X to Y that satisfies the.
Discrete Mathematics Functions
Functions 7/7/2016COCS - Discrete Structures1. Functions A function f from a set A to a set B is an assignment of exactly one element of B to each element.
Applied Discrete Mathematics Week 2: Functions and Sequences
COT 3100, Spring 2001 Applications of Discrete Structures
Functions.
… and the following mathematical appetizer is about…
Functions.
Functions Section 2.3.
Discrete Math (2) Haiming Chen Associate Professor, PhD
Functions.
Discrete Mathematics and its Applications
… and the following mathematical appetizer is about…
Functions CS 202 Epp section 7.1.
Rosen 5th ed., §1.8 ~44 slides, ~2 lectures
CS 220: Discrete Structures and their Applications
Dept. of Mathematics 이산수학 Discrete Mathematics Dr. Chae, Gab-Byung
… and the following mathematical appetizer is about…
Functions Rosen 6th ed., §2.3.
Discrete Mathematics and its Applications
Functions Section 2.3.
Discrete Mathematics and its Applications
Presentation transcript:

강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics)  함수 (Functions)

Discrete Mathematics by Yang-Sae Moon Page 2 함수의 정의 (1/2) 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 generalized to the concept of assigning elements of any set to elements of any set. ( 함수에 대한 표기는 비단 실수 집합이 아닌 임의의 집합들을 대상으로 일반화시 킬 수 있다.) 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 3 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. ( 함수 f 는 A 의 원소 각각에 대해서 B 의 원소를 단 하나만 대응시킴 ) Definition: A partial function f assigns zero or one elements of B to each element x  A. ( 부분함수 f 는 A 의 일부 (or 전체 ) 원소 각각을 B 의 원소 단 하나에 대응시킴 ) 1.8 Functions 함수의 정의 (2/2)

Discrete Mathematics by Yang-Sae Moon Page 4 Graphical Representations Functions can be represented graphically in several ways: 1.8 Functions A B a b f f x y Plot Bipartite Graph Like Venn diagrams A B

Discrete Mathematics by Yang-Sae Moon Page 5 Examples of 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 → ((T,F)) = F A set operator such as , ,  can be viewed as a function from pairs of sets to sets. ( 집합 연산자 ) Example:  ({1,3},{3,4}) = {3} 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 6 Function Terminologies 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 }.[ 치역 ] 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 7 Range versus Codomain ( 치역과 공역 ) (1/2) The range of a function might not be its whole codomain. ( 함수의 치역은 전체 공역이 아닐 수 ( 다를 수 ) 있다.) The range is the particular set of values in the codomain that the function actually maps elements of the domain to. ( 치역은 공역의 부분집합으로서, 함수에 의해 실제 매핑이 일어난 원소의 집합이다.) 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 8 Range versus Codomain ( 치역과 공역 ) (2/2) 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}.” ( 함수 f 는 {A, B, C, D, E} 의 성적을 부여하는 함수라 하자.) At this point, you know f’s codomain is: {A, B, C, D, E}, and its range is unknown!. ( 성적을 부여하기 전에 공역은 {A, B, C, D, E} 로 알 수 있으나, 그 치역은 알지 못한다.) Suppose the grades turn out all As and Bs. ( 공부들을 잘해서 모두 A 와 B 를 주었다고 하자.) Then the range of f is {A, B}, but its codomain is still {A, B, C, D, E}. ( 치역은 {A, B} 로 결정 되었지만, 공역은 그대로 {A, B, C, D, E} 이다.) 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 9 Function Operators (Example) , × (“plus”, “times”) are binary operators over R. (Normal addition & multiplication.) If f,g:R  R, then the followings hold: ( 정의 ) (f  g):R  R, where (f  g)(x) = f(x)  g(x) (f×g):R  R, where (f × g)(x) = f(x) × g(x) Example ( 예제 4) f,g:R  R, f(x) = x 2, g(x) = x – x 2 (f  g)(x) = f(x)  g(x) = (x 2 )  (x – x 2 ) = x (f×g)(x) = f(x)×g(x) = (x 2 )×(x – x 2 ) = x 3 – x Functions

Discrete Mathematics by Yang-Sae Moon Page 10 Images of Sets under Functions 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 of the elements of S. (S 의 image 는 S 의 모든 원소의 image 의 집합 ) f(S)= {f(s) | s  S} = {b |  s  S(f(s)=b)}. Note the range of f can be defined as simply the image of f’s domain! (f 의 치역은 f 의 정의역에 대한 상 (image) 로 정의할 수 있다.) Example ( 예제 5) A = {a, b, c, d, e}, B = {1, 2, 3, 4}, S = {b, c, d} f(a) = 2, f(b) = 1, f(c) = 4, f(d) = 1, f(e) = 1  f(S) = {1, 4} 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 11 One-to-One Functions ( 단사함수 ) A function is one-to-one (1-1) or injective iff every element of its range has only 1 pre-image. ( 치역의 모든 원소는 오직 하나의 역상 (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? (  may be larger) 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 12 One-to-One Illustration Bipartite (2-part) graph representations of functions that are (or not) one-to-one: 1.8 Functions One-to-one Not one-to-one Not even a function!

Discrete Mathematics by Yang-Sae Moon Page 13 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; (strictly increasing function, 단조 증가 함수 ) f is strictly (or monotonically) decreasing iff x>y  f(x)<f(y) for all x,y in domain; (strictly decreasing function, 단조 감소 함수 ) If f is either strictly increasing or strictly decreasing, then f is one-to-one. E.g. x 3 Converse is not necessarily true. E.g. 1/x 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 14 Onto Functions ( 전사함수 ) A function f:A  B is onto or surjective 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, x 3 is onto, whereas x 2 isn’t. (Why not?) 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 15 Onto Illustration Some functions that are or are not onto their codomains: 1.8 Functions Onto (but not 1-1) Not Onto (or 1-1) Both 1-1 and onto 1-1 but not onto

Discrete Mathematics by Yang-Sae Moon Page 16 Bijection ( 전단사함수 ) 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. ( 전사함수이면서 단사함수이면, 이를 전단사함수라 한다.) 1.8 Functions both 1-1 and onto  bijection

Discrete Mathematics by Yang-Sae Moon Page 17 Identity Functions ( 항등함수 ) For any domain A, the identity function I:A  A (or I A ) is the unique function such that  a  A: I(a)=a. ( 항등함수는 정의역의 각 원소 (a) 를 자기 자신 (I(a)=a) 에 대응시키는 함수이다. Some identity functions we’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). ( 모든 원소에 대해 자기 자신을 대응시키므로 당연 !) 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 18 Identity Function Illustration 1.8 Functions Domain and range x y

Discrete Mathematics by Yang-Sae Moon Page 19 Composite Operator ( 함수의 합성 ) (1/2) 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. ( 함수 g 의 결과에 대해 함수 f 를 적용한다.) (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.) ( 일반적으로, 교환법칙은 성립하지 않는다.) 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 20 Composite Operator ( 함수의 합성 ) (2/2) Example ( 예제 18) f,g:N  N, f(x) = 2x+3, g(x) = 3x+2 (f ◦ g)(x) = f(g(x)) = 2(3x+2)+3 = 6x+7 (g ◦ f)(x) = g(f(x)) = 3(2x+3)+2 = 6x Functions 

Discrete Mathematics by Yang-Sae Moon Page 21 Composition Illustration 1.8 Functions f◦gf◦g (f ◦ g)(a) g(a)g(a)f(b)f(b) ABC ag(a) = bf(g(a)) gf

Discrete Mathematics by Yang-Sae Moon Page 22 Inverse Functions ( 역함수 ) (1/2) For bijections f:A  B, there exists an inverse of f, written f  1 :B  A, which is the unique function such that f  1 ◦ f=I. ( 전단사함수 f 에서 f(a) = b 가 성립할 때, 함수 f 의 역함수 f  1 는 B 의 모든 원소 b 에 대해 A 의 원소 a 를 대응시키는 함수이다.) 1.8 Functions f(a)f(a) AB a = f -1 (b) b = f(a) f -1 (b) f f -1

Discrete Mathematics by Yang-Sae Moon Page 23 Inverse Functions ( 역함수 ) (2/2) Example ( 예제 15) f:Z  Z, f(x) = x + 1 f is a strictly increasing function, and thus, f is bijection. Let f(x) = y, then y = x + 1 and x = y – 1. Therefore, f -1 (y) = y – Functions

Discrete Mathematics by Yang-Sae Moon Page 24 Graphs of Functions (1/2) We can represent a function f:A  B as a set of ordered pairs {(a, f(a))| a  A} called a graph. ( 함수 f 의 그래프는 (a, f(a)) 로 구성되는 순서쌍 (pair) 의 집합이다.) Note that  a, there is only 1 pair (a, f(a)). 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. ( 수에 대한 함수인 경우, 함수를 평면상에 그릴 수 있다.) 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 25 Graphs of Functions (2/2) Example ( 예제 20) f:Z  Z, f(x) = x 2 graph of f = {…, (-2,4), (-1,1), (0,0), (1,1), (2,4), …) 1.8 Functions ● ● ● ● ● ● ●

Discrete Mathematics by Yang-Sae Moon Page 26 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 에 대해서, x 와 같거나 x 보다 작은 수 중에서 x 에 가장 가까운 정수 )  x  (“ceiling of x”) is the smallest (most negative) integer  x. ( 실수 x 에 대해서, x 와 같거나 x 보다 큰 수 중에서 x 에 가장 가까운 정수 ) Example ( 예제 21)  1/2  = 0,  1/2  = 1,  3.1  = 3,  3.1  = 4,  7  = 7,  7  = 7  -1/2  = -1,  -1/2  = 0,  -3.1  = -4,  -3.1  = Functions

Discrete Mathematics by Yang-Sae Moon Page 27 Visualizing Floor & Ceiling Functions Real numbers “fall to their floor” or “rise to their ceiling.” Note that if x  Z,  x     x  (  1.5  =  2    1.5  =  1)  x     x  (  1.5  =  1    1.5  =  2) Note that if x  Z,  x  =  x  = x (  2  = 2 =  2  ) Note that if x  R,  x  =   x  (  1.5  =  2 =   1.5  )  x  =   x  (  1.5  =  1 =   1.5  ) 1.8 Functions 0 1 22 3  1.6  =2  1.4  =  2  1.4  1.4  =  1  1.6  =1 33  3  =  3  =  3

Discrete Mathematics by Yang-Sae Moon Page 28 Plots with Floor/Ceiling: Example Plot of graph of function f(x) =  x/3  : ( 그림 10) 1.8 Functions x Set of points (x, f(x)) +3 22 +2 33

Discrete Mathematics by Yang-Sae Moon Page 29 Bits versus Bytes How many bytes are necessary to store 100 bits? 1 byte = 8 bits  100/8  =  12.5  = 13 bytes 1.8 Functions

Discrete Mathematics by Yang-Sae Moon Page 30 Homework #2 $1.6 의 연습문제 : 2(b), 8(e), 24(c) $1.7 의 연습문제 : 4, 8, 14(b) $1.8 의 연습문제 : 8(e, g), 18(b), 22(b, c) Due Date: 1.8 Functions