Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.

Similar presentations


Presentation on theme: "CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett."— Presentation transcript:

1 CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett

2 Today’s Topics: 1. Functions 2. Properties of functions 3. Inverse 2

3 1. Functions 3

4 Definition of a function 4

5 What is a function?  Is the following a function from X to Y? A. Yes B. No 5 XY

6 What is a function?  Is the following a function from X to Y? A. Yes B. No 6 XY

7 What is a function?  Is the following a function from X to Y? A. Yes B. No 7 XY

8 What is a function?  Is the following a function from X to Y? A. Yes B. No 8 X Y

9 What is a function?  Is the following a function from Y to X? A. Yes B. No 9 X Y

10 What is a function  A function f:X  Y maps any element of X to an element of Y  Every element of X is mapped – f(x) is always defined  Every element of X is mapped to just one value in Y 10

11 Properties of functions Injective, surjective, bijective 11

12 Injective, Surjective, Bijective…  Function f:X  Y  f is injective if: f(x)=f(y)  x=y  That is, no two elements in X are mapped to the same value  f is surjective if:  y  Y  x  X s.t. f(x)=y  There is always an “pre-image”  Could be more than one x!  f is bijective if it is both injective and surjective 12

13 Injective, Surjective, Bijective…  Is the following function A. Injective B. Surjective C. Bijective D. None 13 XY

14 Injective, Surjective, Bijective…  Is the following function A. Injective B. Surjective C. Bijective D. None 14 XY

15 Injective, Surjective, Bijective…  Is the following function A. Injective B. Surjective C. Bijective D. None 15 XY

16 Injective, Surjective, Bijective…  Which of the following functions f:N  N is not injective A. f(x)=x B. f(x)=x 2 C. f(x)=x+1 D. f(x)=2x E. None/other/more than one 16

17 Injective, Surjective, Bijective…  Which of the following functions f:N  N is not surjective A. f(x)=x B. f(x)=x 2 C. f(x)=x+1 D. f(x)=2x E. None/other/more than one 17

18 Inverses 18

19 Inverse functions 19

20 Inverse functions  Does the following function have an inverse: f:R  R, f(x)=2x A. Yes B. No 20

21 Inverse functions  Does the following function have an inverse: f:Z  Z, f(x)=2x A. Yes B. No 21

22 Inverse functions  Does the following function have an inverse: f:{1,2}  {1,2,3,4}, f(x)=2x A. Yes B. No 22

23 Functions with an inverse are surjective  Let f:X  Y, g:Y  X be inverse functions  Theorem : f is surjective  Proof (by contradiction):  Assume not. That is, there is y  Y such that for any x  X, f(x)  y.  Let x’=g(y). Then, x’  X and f(x’)=y.  Contradiction. Hence, f is surjective. QED 23

24 Functions with an inverse are injective  Let f:X  Y, g:Y  X be inverse functions  Theorem : f is injective  Proof (by contradiction):  Assume not. That is, there are distinct x 1,x 2  X such that f(x 1 )=f(x 2 ).  Then g(f(x 1 ))=g(f(x 2 )).  But since f,g are inverses, g(f(x 1 ))=x 1 and g(f(x 2 ))=x 2.  So x 1 =x 2.  Contradiction. Hence, f is injective. QED 24

25 Functions with an inverse are bijective  Let f:X  Y, g:Y  X be inverse functions  We just showed that f must be both surjective and injective  Hence, bijective  It turns out that the opposite is also true – any bijective function has an inverse. We might prove it later. 25


Download ppt "CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett."

Similar presentations


Ads by Google