23
1 Functions Functions If the domain of our function f is large, If the domain of our function f is large, it is convenient to specify f with a it is convenient to specify f with a formula formula , e.g.: , e.g.: f: f: R R R R f(x) = 2x f(x) = 2x This leads to: This leads to: f(1) = 2 f(1) = 2 f(3) = 6 f(3) = 6 f(-3) = -6 f(-3) = -6

DISCRETE MATH

Embed Size (px)

DESCRIPTION

FUNCTIONS

Citation preview

Page 1: DISCRETE MATH

1

FunctionsFunctions

If the domain of our function f is large, it is If the domain of our function f is large, it is convenient to specify f with a convenient to specify f with a formulaformula, e.g.:, e.g.:

f:f:RRRR f(x) = 2xf(x) = 2x

This leads to:This leads to:f(1) = 2f(1) = 2f(3) = 6f(3) = 6f(-3) = -6f(-3) = -6……

Page 2: DISCRETE MATH

2

FunctionsFunctions

Let fLet f11 and f and f22 be functions from A to be functions from A to RR..Then the Then the sumsum and the and the productproduct of f of f11 and f and f22 are also are also functions from A to functions from A to RR defined by: defined by:(f(f11 + f + f22)(x) = f)(x) = f11(x) + f(x) + f22(x)(x)(f(f11ff22)(x) = f)(x) = f11(x) f(x) f22(x)(x)

Example:Example:ff11(x) = 3x, f(x) = 3x, f22(x) = x + 5(x) = x + 5(f(f11 + f + f22)(x) = f)(x) = f11(x) + f(x) + f22(x) = 3x + x + 5 = 4x + 5(x) = 3x + x + 5 = 4x + 5(f(f11ff22)(x) = f)(x) = f11(x) f(x) f22(x) = 3x (x + 5) = 3x(x) = 3x (x + 5) = 3x22 + 15x + 15x

Page 3: DISCRETE MATH

3

FunctionsFunctions

We already know that the We already know that the rangerange of a function f:A of a function f:AB B is the set of all images of elements ais the set of all images of elements aA.A.

If we only regard a If we only regard a subsetsubset S SA, the set of all images A, the set of all images of elements sof elements sS is called the S is called the imageimage of S. of S.

We denote the image of S by f(S):We denote the image of S by f(S):

f(S) = {f(s) | sf(S) = {f(s) | sS}S}

Page 4: DISCRETE MATH

4

FunctionsFunctions

Let us look at the following well-known function:Let us look at the following well-known function:f(A) = 1f(A) = 1f(B) = 2f(B) = 2f(C) = 3f(C) = 3f(D) = 2f(D) = 2

What is the image of S = {A, C} ?What is the image of S = {A, C} ?f(S) = {1, 3}f(S) = {1, 3}

What is the image of S = {B, D} ?What is the image of S = {B, D} ?f(S) = {2}f(S) = {2}

Page 5: DISCRETE MATH

5

Properties of FunctionsProperties of Functions

A function f:AA function f:AB is said to be B is said to be one-to-oneone-to-one (or (or injectiveinjective), if and only if), if and only if

x, yx, yA (f(x) = f(y) A (f(x) = f(y) x = y) x = y)

In other words:In other words: f is one-to-one if and only if it does f is one-to-one if and only if it does not map two distinct elements of A onto the same not map two distinct elements of A onto the same element of B.element of B.

Page 6: DISCRETE MATH

6

Properties of FunctionsProperties of Functions

And again…And again…f(A) = 1f(A) = 1f(B) = 2f(B) = 2f(C) = 3f(C) = 3f(D) = 2f(D) = 2

Is f one-to-one?Is f one-to-one?

No, B and D are No, B and D are mapped onto the same mapped onto the same element of the image.element of the image.

g(A) = 1g(B) = 4g(C) = 3g(D) = 2

Is g one-to-one?Is g one-to-one?

Yes, each element is Yes, each element is assigned a unique assigned a unique element of the image.element of the image.

Page 7: DISCRETE MATH

7

Properties of FunctionsProperties of Functions

A function f:AA function f:AB with A,B B with A,B RR is called is called strictly strictly increasingincreasing, if , if x,yx,yA (x < y A (x < y f(x) < f(y)), f(x) < f(y)),and and strictly decreasingstrictly decreasing, if, ifx,yx,yA (x < y A (x < y f(x) > f(y)). f(x) > f(y)).

Obviously, a function that is either strictly increasing Obviously, a function that is either strictly increasing or strictly decreasing is or strictly decreasing is one-to-oneone-to-one..

Page 8: DISCRETE MATH

8

Properties of FunctionsProperties of Functions

A function f:AA function f:AB is called B is called ontoonto, or , or surjectivesurjective, if and , if and only if for every element bonly if for every element bB there is an element aB there is an element aA A with f(a) = b.with f(a) = b.

In other words, f is onto if and only if its In other words, f is onto if and only if its rangerange is its is its entire codomainentire codomain..

A function f: AA function f: AB is a B is a one-to-one correspondenceone-to-one correspondence, or , or a a bijectionbijection, if and only if it is both one-to-one and onto., if and only if it is both one-to-one and onto.

Obviously, if f is a bijection and A and B are finite sets, Obviously, if f is a bijection and A and B are finite sets, then |A| = |B|.then |A| = |B|.

Page 9: DISCRETE MATH

9

Properties of FunctionsProperties of Functions

Is f injective?Is f injective?No.No.Is f surjective?Is f surjective?No.No.Is f bijective?Is f bijective?No.No.

AA

BB

CC

DD

11

22

33

44

Page 10: DISCRETE MATH

10

Properties of FunctionsProperties of Functions

Is f injective?Is f injective?No.No.Is f surjective?Is f surjective?Yes.Yes.Is f bijective?Is f bijective?No.No.

AA

BB

CC

DD

11

22

33

44

EE

Page 11: DISCRETE MATH

11

Properties of FunctionsProperties of Functions

Is f injective?Is f injective?Yes.Yes.Is f surjective?Is f surjective?No.No.Is f bijective?Is f bijective?No.No.

AA

BB

CC

DD

11

22

33

44

55

Page 12: DISCRETE MATH

12

Properties of FunctionsProperties of Functions

Is f injective?Is f injective?No! f is not evenNo! f is not evena function!a function!

AA

BB

CC

DD

11

22

33

44

55

Page 13: DISCRETE MATH

13

Properties of FunctionsProperties of Functions

Is f injective?Is f injective?Yes.Yes.Is f surjective?Is f surjective?Yes.Yes.Is f bijective?Is f bijective?Yes.Yes.

AA

BB

CC

DD

11

22

33

44

55 EE

Page 14: DISCRETE MATH

14

Page 15: DISCRETE MATH

15

InversionInversion

An interesting property of bijections is that they An interesting property of bijections is that they have an have an inverse functioninverse function..

The The inverse functioninverse function of the bijection f:A of the bijection f:AB is the B is the function ffunction f-1-1:B:BA with A with ff-1-1(b) = a whenever f(a) = b. (b) = a whenever f(a) = b.

Page 16: DISCRETE MATH

16

InversionInversion

AA

BB

CC

DD

11

22

33

44

55 EE

ff

ff-1-1

Page 17: DISCRETE MATH

17

InversionInversion

Example:Example:

f(A) = 1f(A) = 1f(B) = 2f(B) = 2f(C) = 3f(C) = 3f(D) = 4f(D) = 4f(E) = 5f(E) = 5

Clearly, f is bijective.Clearly, f is bijective.

The inverse function fThe inverse function f-1-1 is given by:is given by:

ff-1-1(1) = A(1) = Aff-1-1(2) = B(2) = Bff-1-1(3) = C(3) = Cff-1-1(4) = D(4) = Dff-1-1(5) = E(5) = E

Inversion is only Inversion is only possible for bijectionspossible for bijections(= invertible functions)(= invertible functions)

Page 18: DISCRETE MATH

18

InversionInversion

AA

BB

CC

DD

11

22

33

44

55 EE

ff

ff-1-1

ff-1-1 is no function, is no function, because it is not because it is not defined for all defined for all elements in elements in codomain and codomain and assigns two images assigns two images to the pre-image 2.to the pre-image 2.

Page 19: DISCRETE MATH

19

CompositionCompositionThe The compositioncomposition of two functions g:A of two functions g:AB and B and f:Bf:BC, denoted by fC, denoted by fg, is defined by g, is defined by

(f(fg)(a) = f(g(a))g)(a) = f(g(a))

This means that This means that • firstfirst, function g is applied to element a, function g is applied to element aA,A, mapping it onto an element of B, mapping it onto an element of B,• thenthen, function f is applied to this element of , function f is applied to this element of B, mapping it onto an element of C. B, mapping it onto an element of C.• ThereforeTherefore, the composite function maps , the composite function maps from A to C. from A to C.

Page 20: DISCRETE MATH

20

CompositionComposition

Example:Example:

f(x) = 7x – 4, g(x) = 3x,f(x) = 7x – 4, g(x) = 3x,f:f:RRRR, g:, g:RRRR

(f(fg)(5) = f(g(5)) = f(15) = 105 – 4 = 101g)(5) = f(g(5)) = f(15) = 105 – 4 = 101

(f(fg)(x) = f(g(x)) = f(3x) = 21x - 4g)(x) = f(g(x)) = f(3x) = 21x - 4

Page 21: DISCRETE MATH

21

CompositionComposition

Composition of a function and its inverse:Composition of a function and its inverse:

(f(f-1-1f)(x) = ff)(x) = f-1-1(f(x)) = x(f(x)) = x

The composition of a function and its inverse is The composition of a function and its inverse is the the identity functionidentity function i(x) = x. i(x) = x.

Page 22: DISCRETE MATH

22

GraphsGraphs

TheThe graphgraph of a functionof a function f:Af:AB is the set of B is the set of ordered pairs {(a, b) | aordered pairs {(a, b) | aA and f(a) = b}.A and f(a) = b}.

The graph is a subset of AThe graph is a subset of AB that can be used B that can be used to visualize f in a two-dimensional coordinate to visualize f in a two-dimensional coordinate system.system.

Page 23: DISCRETE MATH

23

Floor and Ceiling FunctionsFloor and Ceiling Functions

The The floorfloor and and ceilingceiling functions map the real functions map the real numbers onto the integers (numbers onto the integers (RRZZ).).

The The floorfloor function assigns to r function assigns to rRR the largest z the largest zZZ with zwith zr, denoted by r, denoted by rr..

Examples:Examples: 2.32.3 = 2, = 2, 22 = 2, = 2, 0.50.5 = 0, = 0, -3.5-3.5 = -4 = -4

The The ceilingceiling function assigns to r function assigns to rRR the smallest the smallest zzZZ with z with zr, denoted by r, denoted by rr..

Examples:Examples: 2.32.3 = 3, = 3, 22 = 2, = 2, 0.50.5 = 1, = 1, -3.5-3.5 = -3 = -3