Transcript
Page 1: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Functions

Givenafunctionf:A→B:•  WesayfmapsAtoBorfisamappingfromAtoB.

•  Aiscalledthedomainoff.

•  Biscalledthecodomainoff.

•  Iff(a)=b,•  thenbiscalledtheimageofaunderf.

•  aiscalledthepreimageofb.

•  TherangeoffisthesetofallimagesofpointsinAunderf.Wedenoteitbyf(A).

•  Twofunctionsareequalwhentheyhavethesamedomain,thesamecodomainandmapeachelementofthedomaintothesameelementofthecodomain.

Page 2: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Questions

f(a)=? z

Theimageofdis? z

Thedomainoffis? A

Thecodomainoffis? B

Thepreimageofyis? b

f(A)=? {y,z}–thisistherangeoff

Thepreimage(s)ofzis(are)? {a,c,d}

Page 3: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

RepresentingFunctions

Functionsmaybespecifiedindifferentways

•  Anexplicitstatementoftheassignment

Exampleonpreviousslide

•  Aformula

( ) 1f x x= +

•  Acomputerprogram

•  AJavaprogramthatwhengivenanintegern,producesthenthFibonacciNumber

Page 4: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Injections

Definition:Afunctionfissaidtobeone-to-one,orinjective,ifandonlyiff(a)=f(b)impliesthata=bforallaandbinthedomainoff.Afunctionissaidtobeaninjectionifitisone-to-one.

Page 5: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Surjections

Definition:AfunctionffromAtoBiscalledontoorsurjective,ifandonlyifforevery b B∈thereisanelement a A∈ with ( ) .f a b=Afunctionfiscalledasurjectionifitisonto.

Page 6: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Showingthatfisone-to-oneoronto1

Supposethatf:A→B.

ToshowthatfisinjectiveShowthatiff(x)=f(y)forarbitraryx,y∈A,thenx=y.

ToshowthatfisnotinjectiveFindparticularelementsx,y∈Asuchthatx≠yandf(x)=f(y).

ToshowthatfissurjectiveConsideranarbitraryelementy∈Bandfindanelementx∈Asuchthatf(x)=y.

ToshowthatfisnotsurjectiveFindaparticulary∈Bsuchthatf(x)≠yforallx∈A.

Page 7: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Bijections

Definition:Afunctionfisaone-to-onecorrespondence,orabijection,ifitisbothone-to-oneandonto(surjectiveandinjective).

Page 8: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

InverseFunctions1

Definition:LetfbeabijectionfromAtoB.Thentheinverseoff,denoted 1,f − isthefunctionfromBtoAdefinedas ( ) ( )1 iff f y x f x y− = =

Noinverseexistsunlessfisabijection.(Why?)

Page 9: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Questions1

Example1:Letfbethefunctionfrom{a,b,c}to{1,2,3}suchthatf(a)=2,f(b)=3,andf(c)=1.Isfinvertibleandifsowhatisitsinverse?

Solution:Thefunctionfisinvertiblebecauseitisaone-to-onecorrespondence.Theinversefunctionf−1reversesthecorrespondencegivenbyf,sof−1(1)=c,f−1(2)=a,andf−1(3)=b.

Page 10: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Questions2

Example2:Letf:Z→Zbesuchthatf(x)=x+1.Isfinvertible,andifso,whatisitsinverse?

Solution:Thefunctionfisinvertiblebecauseitisaone-to-onecorrespondence.Theinversefunctionf−1reversesthecorrespondencesof−1(y)=y−1.

Page 11: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Questions3

Example3:Letf:R→Rbesuchthat( ) 2f x x=

Isfinvertible,andifso,whatisitsinverse?

Solution:Thefunctionfisnotinvertiblebecauseitneitherone-to-onenoronto.

Page 12: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Composition1

Definition:Letf:B→C,g:A→B.Thecompositionoffwithg,denoted f go isthefunctionfromAtoCdefinedby

( ) ( )( )f g x f g x=o

Page 13: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Composition2

Page 14: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Composition3

Example1:If

( ) ( )

( )( ) ( )

( )( )

2

2

2

and 2 1,then

2 1

and

2 1

f x x g x x

f g x x

g f x x

= = +

= +

= +

Page 15: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

CompositionQuestions1

Example2:Letgbethefunctionfromtheset{a,b,c}toitselfsuchthatg(a)=b,g(b)=c,andg(c)=a.Letfbethefunctionfromtheset{a,b,c}totheset{1,2,3}suchthatf(a)=3,f(b)=2,andf(c)=1.Whatisthecompositionoffandg,andwhatisthecompositionofgandf?Solution:Thecompositionf∘gisdefinedby

( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )

2.

1.

3.

g

g

f g a f a f b

f g b f b f c

f g c f ag c f

= = =

= = =

= = =

o

o

o

Thecompositiong∘fisnotdefined,becausetherangeoffisnotasubsetofthedomainofg.

Page 16: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

GraphsofFunctionsLetfbeafunctionfromthesetAtothesetB.Thegraphofthefunctionfisthesetoforderedpairs( ) ( ){ }, and .|a b a A f a b∈ =

Graphoff(n)=2n+1fromZtoZ

Graphoff(x)=x2fromZtoZ

Page 17: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

SomeImportantFunctions

Thefloorfunction,denoted

( )f x x= ⎣ ⎦

isthelargestintegerlessthanorequaltox.Theceilingfunction,denoted

( )f x x= ⎡ ⎤

isthesmallestintegergreaterthanorequaltoxExample: 3.5 3.5

1.5 1.5

⎡ ⎤ = 4 ⎣ ⎦ = 3

⎡− ⎤ = −1 ⎣− ⎦ = −2

Page 18: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

FloorandCeilingFunctions2TABLE1UsefulPropertiesoftheFloorandCeilingFunctions.(nisaninteger,xisarealnumber)( )( )( )( )

1a if and only if 1

1b if and only if 1

1c if and only if 1

1d if and only if 1

x n n x n

x n n x n

x n x n x

x n x n x

⎣ ⎦ = = < +

⎡ ⎤ = − < =

⎣ ⎦ = − < =

⎡ ⎤ = = < +

( )2 1 1x x x x x− ⎣ ⎦ ≤ ≤ ⎡ ⎤ +< <

( )( )3a

3b

x x

x x

⎣− ⎦ = − ⎡ ⎤

⎡− ⎤ = − ⎣ ⎦

( )( )4a

4b

x n x n

x n x n

⎣ + ⎦ = ⎣ ⎦ +

⎡ + ⎤ = ⎡ ⎤ +

Page 19: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

ProvingPropertiesofFunctions

Example:TrueorFalse?Ifxisarealnumber,then(Page159) ⌊2x⌋=⌊x⌋+⌊x+1/2⌋

Solution:Letx=n+ε,wherenisanintegerand0≤ε<1.Case1:ε<½•  2x=2n+2εand⌊2x⌋=2n,since0≤2ε<1.•  ⌊x+1/2⌋=n,sincex+½=n+(1/2+ε)and0≤½+ε<1.•  Hence,⌊2x⌋=2nand⌊x⌋+⌊x+1/2⌋=n+n=2n.

Case2:ε≥½•  2x=2n+2ε=(2n+1)+(2ε−1)and⌊2x⌋=2n+1,since0≤2ε−1<1.•  ⌊x+1/2⌋=⌊n+(1/2+ε)⌋=⌊n+1+(ε–1/2)⌋=n+1since0≤ε−

1/2<1.•  Hence,⌊2x⌋=2n+1and⌊x⌋+⌊x+1/2⌋=n+(n+1)=2n+1.

Page 20: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

ProvingPropertiesofFunctions

Example:Proveordisprove:(Example32,p160) ⌊x+y⌋=⌊x⌋+⌊y⌋forallrealnumbersxandy

Page 21: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

FactorialFunction

Definition:f:N→Z+,denotedbyf(n)=n!istheproductofthefirstnpositiveintegerswhennisanonnegativeinteger.

( ) ( ) ( ) 1 2 –1 , 0 0! 1f nn n f= ⋅ ⋅ ⋅ ⋅ ⋅ = =

Examples:( )( )( )( )

1 1! 1 2 2! 1 2 2 6 6! 1 2 3 4 5 6 720 20 2,432,902,008,176,640,000.

ffff

= =

= = ⋅ =

= = ⋅ ⋅ ⋅ ⋅ ⋅ =

=

Stirling’sApproximation: n!∼ 2πn n / e( )

n

f n( ) ∼ g n( ) ! limn →∞f n( ) / g n( ) =1

Page 22: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Sequences

•  Definition&notation

•  Arithmeticprogressions

•  Geometricprogressions

•  Recurrencerelations

•  TheFibonaccisequence

•  Closedformofarecurrencerelation

•  Summationsofsequences

Page 23: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Introduction

Sequencesareorderedlistsofelements.

•  1,2,3,5,8

•  1,3,9,27,81,…….

Sequencesarisethroughoutmathematics,computerscience,andinmanyotherdisciplines,rangingfrombotanytomusic.

Wewillintroducetheterminologytorepresentsequencesandsumsofthetermsinthesequences.

Page 24: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Sequences1

Definition:Asequenceisafunctionfromasubsetoftheintegers(usuallyeithertheset{0,1,2,3,4,…..}or{1,2,3,4,….})toasetS.

Thenotationanisusedtodenotetheimageoftheintegern.Wecanthinkofanastheequivalentoff(n)wherefisafunctionfrom{0,1,2,…..}toS.

Wecallanaterm(often,thenthterm)ofthesequence.

Page 25: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

Sequences2

Example:Considerthesequence{an}where

{ } { }1 2 31 , , ...

1 1 11, , ,2 3 4

n na a a a an

= =

Page 26: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

ArithmeticProgression

Definition:Anarithmeticprogressionisasequenceoftheform: , , 2 ,..., ,...a a d a d a nd+ + +wheretheinitialtermaandthecommondifferencedarerealnumbers.

{ } { } { }

{ } { } { }

{ } { } { }

0 1 2 3 4

0 1 2 3 4

0 1 2 3 4

1. Let 1and 4 :, , , , ,... 1, 1, 1, 1, 1,...

2. Let 7and 3 :, , , , ,... 7, 4, 1, 2, 5,...

3. Let 1and 2 :, , , , ,... 1, 3, 5, 7, 9,...

n

n

n

a ds s s s s sa d

t t t t t ta d

u u u u u u

= − =

= = − −

= = −

= = − −

= =

= =

Examples :Discreteversionofthelinearfunctionf(x)=a+dx

Page 27: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

GeometricProgression

Definition:Ageometricprogressionisasequenceoftheform: 2, , , ,na ar ar… …wheretheinitialtermaandthecommonratiorarerealnumbers.

{ } { } { }

{ } { } { }

{ } { }

0 1 2 3 4

0 1 2 3 4

0 1 2 3 4

1. Let 1and 1. Then :, , , , ,... 1, 1, 1, 1, 1,...

2. Let 2and 5. Then :, , , , ,... 2, 10, 50, 250, 1250,...

3. Let 6and 1/ 3. Then :2 2 2, , , , ,... 6, 2, , , ,...3 9 27

n

n

n

a rb b b b b ba r

c c c c c ca r

d d d d d d

= = −

= = − −

= =

= =

= =

⎧ ⎫= = ⎨ ⎬⎩

Examples :

Discreteversionoftheexponentialfunctionf(x)=adx

Page 28: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

RecurrenceRelations

Definition:Arecurrencerelationforthesequence{an}isanequationthatexpressesanintermsofoneormoreoftheprevioustermsofthesequence,namely,a0,a1,…,an−1,forallintegersnwithn≥n0,wheren0isanonnegativeinteger.

Asequenceiscalledasolutionofarecurrencerelationifitstermssatisfytherecurrencerelation.

Theinitialconditionsforasequencespecifythetermsthatprecedethefirsttermwheretherecurrencerelationtakeseffect.

Page 29: Functions - research.engineering.wustl.edubaruah/TEACHING/2018-2Fa/Lecs/... · Functions Given a function f: A → B: • We say f maps A to B or f is a mapping from A to B. • A

©2019McGraw-HillEducation

FibonacciSequence

Definition:DefinetheFibonaccisequence,f0,f1,f2,…,by:•  InitialConditions:f0=0,f1=1•  RecurrenceRelation:fn=fn−1+fn−2Example:Findf2,f3,f4,f5andf6.

2 1 0

3 2 1

4 3 2

5 4 3

6 5 4

1 0 1, 1 1 2,

2 1 3,3 2 5,5 3 8.

f f ff f ff f ff f ff f f

= + = + =

= + = + =

= + = + =

= + = + =

= + = + =

Answer :


Top Related