Functions Jason Filippou CMSC250 @ UMCP 06-22-2016 Jason Filippou - - PowerPoint PPT Presentation

functions
SMART_READER_LITE
LIVE PREVIEW

Functions Jason Filippou CMSC250 @ UMCP 06-22-2016 Jason Filippou - - PowerPoint PPT Presentation

Functions Jason Filippou CMSC250 @ UMCP 06-22-2016 Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 1 / 19 Outline 1 Basic definitions and examples 2 Properties of functions 3 The pigeonhole principle Jason Filippou (CMSC250 @ UMCP)


slide-1
SLIDE 1

Functions

Jason Filippou

CMSC250 @ UMCP

06-22-2016

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 1 / 19

slide-2
SLIDE 2

Outline

1 Basic definitions and examples 2 Properties of functions 3 The pigeonhole principle

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 2 / 19

slide-3
SLIDE 3

Basic definitions and examples

Basic definitions and examples

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 3 / 19

slide-4
SLIDE 4

Basic definitions and examples

Functions, intuitively

We all have an intuitive understanding of functions. Can we recognize those?

f(x) = sin(x).

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 4 / 19

slide-5
SLIDE 5

Basic definitions and examples

Functions, intuitively

We all have an intuitive understanding of functions. Can we recognize those?

f(x) = sin(x). g(y) = cos(y)

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 4 / 19

slide-6
SLIDE 6

Basic definitions and examples

Functions, intuitively

We all have an intuitive understanding of functions. Can we recognize those?

f(x) = sin(x). g(y) = cos(y) f(z) = arctan(z)

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 4 / 19

slide-7
SLIDE 7

Basic definitions and examples

Functions, intuitively

We all have an intuitive understanding of functions. Can we recognize those?

f(x) = sin(x). g(y) = cos(y) f(z) = arctan(z) f(x) =

  • 1,

0 ≤ x ≤ 1 0,

  • therwise

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 4 / 19

slide-8
SLIDE 8

Basic definitions and examples

Functions, intuitively

We all have an intuitive understanding of functions. Can we recognize those?

f(x) = sin(x). g(y) = cos(y) f(z) = arctan(z) f(x) =

  • 1,

0 ≤ x ≤ 1 0,

  • therwise

c(x, y) = x2 + y2

In this lecture, we will formally define functions and talk about some of their properties. Warning: We won’t do calculus today!

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 4 / 19

slide-9
SLIDE 9

Basic definitions and examples

Basic definitions

Definition (Function) A function f from set A to set B, denoted f : A → B, is a mapping from A to B such that each element of A is mapped to a unique element of B.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 5 / 19

slide-10
SLIDE 10

Basic definitions and examples

Basic definitions

Definition (Function) A function f from set A to set B, denoted f : A → B, is a mapping from A to B such that each element of A is mapped to a unique element of B. Definition (Domain) Let f be a function from set A to set B. Then, A is f’s domain. Definition (Co-domain) Let f be a function from set A to set B. Then, B is f’s co-domain. What are the domains and co-domains for the following functions? (whiteboard)

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 5 / 19

slide-11
SLIDE 11

Basic definitions and examples

More definitions

Definition (Image / Range) Suppose f : A → B. The set {b ∈ B | ∃a ∈ A | f(a) = b} is called the image (or range) of f. The image and co-domain don’t necessarily coincide! Examples will follow.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 6 / 19

slide-12
SLIDE 12

Basic definitions and examples

Arrow diagrams

A convenient representation for finding the domain, co-domain and range of a function. Can also help us weed out mappings that are not functions! Infeasible for all but the smallest domains and co-domains.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 7 / 19

slide-13
SLIDE 13

Basic definitions and examples

Arrow diagrams: examples

Which one of these are functions? For every function, provide the domain, co-domain, and image.

X Y a b c 1 2 3 X Y a b c 1 2 3 X Y a b c 1 2 3 X Y a b c 1 2 3

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 8 / 19

slide-14
SLIDE 14

Properties of functions

Properties of functions

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 9 / 19

slide-15
SLIDE 15

Properties of functions

Surjective (“onto”) functions

Definition (Surjective function) Let f : X → Y . f is surjective (“onto”) if, and only if, ∀y ∈ Y, ∃x ∈ X : f(x) = y.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 10 / 19

slide-16
SLIDE 16

Properties of functions

Surjective (“onto”) functions

Definition (Surjective function) Let f : X → Y . f is surjective (“onto”) if, and only if, ∀y ∈ Y, ∃x ∈ X : f(x) = y. Intuitively: Onto functions have a “full” co-domain.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 10 / 19

slide-17
SLIDE 17

Properties of functions

Surjective (“onto”) functions

Definition (Surjective function) Let f : X → Y . f is surjective (“onto”) if, and only if, ∀y ∈ Y, ∃x ∈ X : f(x) = y. Intuitively: Onto functions have a “full” co-domain. Example of onto function: f(x) = 4x + 1, f : R → R

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 10 / 19

slide-18
SLIDE 18

Properties of functions

Surjective (“onto”) functions

Definition (Surjective function) Let f : X → Y . f is surjective (“onto”) if, and only if, ∀y ∈ Y, ∃x ∈ X : f(x) = y. Intuitively: Onto functions have a “full” co-domain. Example of onto function: f(x) = 4x + 1, f : R → R Examples of non-onto function: g(n) = 4n − 1, g : Z → Z

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 10 / 19

slide-19
SLIDE 19

Properties of functions

Surjective (“onto”) functions

Definition (Surjective function) Let f : X → Y . f is surjective (“onto”) if, and only if, ∀y ∈ Y, ∃x ∈ X : f(x) = y. Intuitively: Onto functions have a “full” co-domain. Example of onto function: f(x) = 4x + 1, f : R → R Examples of non-onto function: g(n) = 4n − 1, g : Z → Z What about this? z(n) = 4n − 1, z : R → Z

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 10 / 19

slide-20
SLIDE 20

Properties of functions

Surjective (“onto”) functions

Definition (Surjective function) Let f : X → Y . f is surjective (“onto”) if, and only if, ∀y ∈ Y, ∃x ∈ X : f(x) = y. Intuitively: Onto functions have a “full” co-domain. Example of onto function: f(x) = 4x + 1, f : R → R Examples of non-onto function: g(n) = 4n − 1, g : Z → Z What about this? z(n) = 4n − 1, z : R → Z

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 10 / 19

slide-21
SLIDE 21

Properties of functions

Injective (“one-to-one”) functions

Definition (Injective function) Let f : X → Y . f is injective (or “one-to-one”) if, and only if ∀x ∈ X, ∃!y a ∈ Y : y = f(x)

a“Exists a unique y”. Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 11 / 19

slide-22
SLIDE 22

Properties of functions

Injective (“one-to-one”) functions

Definition (Injective function) Let f : X → Y . f is injective (or “one-to-one”) if, and only if ∀x ∈ X, ∃!y a ∈ Y : y = f(x)

a“Exists a unique y”.

Equivalently: ∀x1, x2 ∈ X, f(x1) = f(x2) ⇒ x1 = x2

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 11 / 19

slide-23
SLIDE 23

Properties of functions

Injective (“one-to-one”) functions

Definition (Injective function) Let f : X → Y . f is injective (or “one-to-one”) if, and only if ∀x ∈ X, ∃!y a ∈ Y : y = f(x)

a“Exists a unique y”.

Equivalently: ∀x1, x2 ∈ X, f(x1) = f(x2) ⇒ x1 = x2 Intuitively: no two arrows from the domain will start from the same point. Graphical intuition: At most one intersection of graph with a horizontal line.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 11 / 19

slide-24
SLIDE 24

Properties of functions

Injective (“one-to-one”) functions

Definition (Injective function) Let f : X → Y . f is injective (or “one-to-one”) if, and only if ∀x ∈ X, ∃!y a ∈ Y : y = f(x)

a“Exists a unique y”.

Equivalently: ∀x1, x2 ∈ X, f(x1) = f(x2) ⇒ x1 = x2 Intuitively: no two arrows from the domain will start from the same point. Graphical intuition: At most one intersection of graph with a horizontal line. Examples of injective functions: f(x) = ax ∀a ∈ R∗, g(x) = tan(x), x ∈ R − { π

2 + kπ, k ∈ Z}

Examples of non-injective functions: r(x) = x2, sin(x), cos(x)

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 11 / 19

slide-25
SLIDE 25

Properties of functions

Bijections

Definition (Bijection) f : A → B is a bijection from A to B if, and only if, it is surjective and injective. Perfect correspondences. Interesting properties.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 12 / 19

slide-26
SLIDE 26

Properties of functions

Bijections

Definition (Bijection) f : A → B is a bijection from A to B if, and only if, it is surjective and injective. Perfect correspondences. Interesting properties. Examples of bijections: f(x) = x3, exp(x), log(x)

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 12 / 19

slide-27
SLIDE 27

Properties of functions

Bijections

Definition (Bijection) f : A → B is a bijection from A to B if, and only if, it is surjective and injective. Perfect correspondences. Interesting properties. Examples of bijections: f(x) = x3, exp(x), log(x) Examples of non-bijections: Whichever function is either non-injective or non-surjective!

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 12 / 19

slide-28
SLIDE 28

Properties of functions

Function Composition

Definition Let f : A → B0 and g : B1 → C be two functions, and B1 ⊆ B0. The composition of f and g, denoted g ◦ fa is a function from A to C such that, ∀a ∈ A, (g ◦ f)(a) = g(f(a)).

aWe typically read this as “ef-oh-gee”.

Examples:

1 Composition of r(z) = z2 and h(x) = 5x? Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 13 / 19

slide-29
SLIDE 29

Properties of functions

Function Composition

Definition Let f : A → B0 and g : B1 → C be two functions, and B1 ⊆ B0. The composition of f and g, denoted g ◦ fa is a function from A to C such that, ∀a ∈ A, (g ◦ f)(a) = g(f(a)).

aWe typically read this as “ef-oh-gee”.

Examples:

1 Composition of r(z) = z2 and h(x) = 5x? 2 Composition of sin(x) and cos(y)? Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 13 / 19

slide-30
SLIDE 30

Properties of functions

Function Composition

Definition Let f : A → B0 and g : B1 → C be two functions, and B1 ⊆ B0. The composition of f and g, denoted g ◦ fa is a function from A to C such that, ∀a ∈ A, (g ◦ f)(a) = g(f(a)).

aWe typically read this as “ef-oh-gee”.

Examples:

1 Composition of r(z) = z2 and h(x) = 5x? 2 Composition of sin(x) and cos(y)? 3 Composition of f1(x) = −(x + 1)2 and f2(x) = x2? Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 13 / 19

slide-31
SLIDE 31

Properties of functions

Function Composition

Definition Let f : A → B0 and g : B1 → C be two functions, and B1 ⊆ B0. The composition of f and g, denoted g ◦ fa is a function from A to C such that, ∀a ∈ A, (g ◦ f)(a) = g(f(a)).

aWe typically read this as “ef-oh-gee”.

Examples:

1 Composition of r(z) = z2 and h(x) = 5x? 2 Composition of sin(x) and cos(y)? 3 Composition of f1(x) = −(x + 1)2 and f2(x) = x2? 4 Composition of f3(x) = −(x + 1)2 and f4(n) = n2 + 1, n ∈ N? Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 13 / 19

slide-32
SLIDE 32

Properties of functions

Inverse functions

Definition (Function inverse) Suppose f : X → Y is a bijection. Then, there exists a function f−1 : Y → X : ∀y ∈ Y, f−1(y) = x ∈ x : f(x) = y.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 14 / 19

slide-33
SLIDE 33

Properties of functions

Inverse functions

Definition (Function inverse) Suppose f : X → Y is a bijection. Then, there exists a function f−1 : Y → X : ∀y ∈ Y, f−1(y) = x ∈ x : f(x) = y. How many of those x’s are there?

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 14 / 19

slide-34
SLIDE 34

Properties of functions

Inverse functions

Definition (Function inverse) Suppose f : X → Y is a bijection. Then, there exists a function f−1 : Y → X : ∀y ∈ Y, f−1(y) = x ∈ x : f(x) = y. How many of those x’s are there? Let’s find the inverses of the following functions:

1 f(x) = 5x

3

2 h(x) = logb(x) 3 g(x) = (x + 1)2 Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 14 / 19

slide-35
SLIDE 35

The pigeonhole principle

The pigeonhole principle

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 15 / 19

slide-36
SLIDE 36

The pigeonhole principle

Look at these pigeons.

Figure 1: Look.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 16 / 19

slide-37
SLIDE 37

The pigeonhole principle

Statement of the principle

Pigeonhole Principle Let m, n ∈ N∗. If n pigeons fly into m pigeonholes and n > m, then at least one pigeonhole will contain more than one pigeon.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 17 / 19

slide-38
SLIDE 38

The pigeonhole principle

Statement of the principle

Pigeonhole Principle Let m, n ∈ N∗. If n pigeons fly into m pigeonholes and n > m, then at least one pigeonhole will contain more than one pigeon. Can I have empty pigeonholes?

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 17 / 19

slide-39
SLIDE 39

The pigeonhole principle

Statement of the principle

Pigeonhole Principle Let m, n ∈ N∗. If n pigeons fly into m pigeonholes and n > m, then at least one pigeonhole will contain more than one pigeon. Can I have empty pigeonholes? More mathematically: Pigeonhole Principle (mathematically) Let A and B be finite sets such that |A| > |B|. Then, there does not exist a one-to-one function f : A → B.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 17 / 19

slide-40
SLIDE 40

The pigeonhole principle

Examples

1 Is there a pair of you with the same birthday month? Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 18 / 19

slide-41
SLIDE 41

The pigeonhole principle

Examples

1 Is there a pair of you with the same birthday month? 2 Is there a pair of you with the same birthday week? Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 18 / 19

slide-42
SLIDE 42

The pigeonhole principle

Examples

1 Is there a pair of you with the same birthday month? 2 Is there a pair of you with the same birthday week? 3 Is there a pair of New Yorkers with the same number of hairs on

their heads?

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 18 / 19

slide-43
SLIDE 43

The pigeonhole principle

Examples

1 Is there a pair of you with the same birthday month? 2 Is there a pair of you with the same birthday week? 3 Is there a pair of New Yorkers with the same number of hairs on

their heads?

4 Let A = {1, 2, 3, 4, 5, 6, 7, 8}. If I pick 5 integers, is it the case that

at least one pair of integers has a sum of 9?

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 18 / 19

slide-44
SLIDE 44

The pigeonhole principle

Examples

1 Is there a pair of you with the same birthday month? 2 Is there a pair of you with the same birthday week? 3 Is there a pair of New Yorkers with the same number of hairs on

their heads?

4 Let A = {1, 2, 3, 4, 5, 6, 7, 8}. If I pick 5 integers, is it the case that

at least one pair of integers has a sum of 9?

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 18 / 19

slide-45
SLIDE 45

The pigeonhole principle

Generalization

Generalized Pigeonhole Principle Let n and m be positive integers. Then, if there exists a positive integer k such that n > km and n pigeons fly into m pigeonholes, there will be at least one pigeonhole with at least k + 1 pigeons.

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 19 / 19

slide-46
SLIDE 46

The pigeonhole principle

Generalization

Generalized Pigeonhole Principle Let n and m be positive integers. Then, if there exists a positive integer k such that n > km and n pigeons fly into m pigeonholes, there will be at least one pigeonhole with at least k + 1 pigeons. Examples:

1 Prove that within a group of 86 people, there exist at least 4 with

the same last initial (e.g B for Justin Bieber).

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 19 / 19

slide-47
SLIDE 47

The pigeonhole principle

Generalization

Generalized Pigeonhole Principle Let n and m be positive integers. Then, if there exists a positive integer k such that n > km and n pigeons fly into m pigeonholes, there will be at least one pigeonhole with at least k + 1 pigeons. Examples:

1 Prove that within a group of 86 people, there exist at least 4 with

the same last initial (e.g B for Justin Bieber).

2 Is it true that within a group of 700 people, there must be 2 who

have the same first and last initials?

Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 19 / 19