- By
**tilly** - Follow User

- 53 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'Lecture 2.4: Functions' - tilly

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

### Lecture 2.4: Functions

CS 250, Discrete Structures, Fall 2011

Nitesh Saxena

*Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

Lecture 2.4 -- Functions

Course Admin

- HW1
- Due at 11am 09/09/11
- Please follow all instructions
- Recall: late submissions will not be accepted

- Mid-Term 1 on Thursday, Sep 22
- In-class (from 11am-12:15pm)
- Will cover everything until the lecture on Sep 15

- No lecture on Sep 20
- As announced previously, I will be traveling to Beijing to attend and present a paper at the Ubicomp 2012 conference
- This will not affect our overall topic coverage
- This will also give you more time to prepare for the exam

Lecture 2.4 -- Functions

Course Admin

- HW1 grading potentially delayed
- TA/grader is sick with chicken pox
- We will try to finish it up as soon as possible. Apologies for the delay.
- In any case, HW1 solution will be released in a few days from now. So, you can prepare for your exam without any interruptions

Lecture 2.4 -- Functions

Function Composition

When a function f outputs elements of the same kind that another function g takes as input, f and g may be composed by letting g immediately take as an input each output of f

Definition: Suppose that g : A B and f : B C are functions. Then the composite

f g : A C is defined by setting

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

f g is also called fog

Lecture 2.4 -- Functions

Composition: Examples

Q: Compute gf where

1.f: Z R, f (x ) =x 2

and g: R R, g (x ) =x 3

2. f : Z Z, f (x ) =x + 1

and g = f -1 so g (x ) =x – 1

3. f : {people} {people},

f (x ) = the father of x, and g = f

Lecture 2.4 -- Functions

Composition: Examples

1.f: Z R, f (x ) =x 2

and g: R R, g (x ) =x 3

gf: Z R , gf(x ) = x 6

2. f : Z Z, f (x ) =x + 1

and g = f -1

gf(x ) = x (true for any function composed with its inverse)

3. f : {people} {people},

f (x ) = g(x ) = the father of x

gf(x ) = grandfather of x from father’s side

Lecture 2.4 -- Functions

Repeated Composition

When the domain and codomain are equal, a function may be self composed. The composition may be repeated as much as desired resulting in functional exponentiation. The whole process is denoted by

f n (x ) = f f f f … f (x )

where f appears n –times on the right side.

Q1: Given f: Z Z, f (x ) =x 2 find f4

Q2: Given g: Z Z, g (x ) =x + 1 find gn

Q3: Given h(x ) = the father of x, find hn

Lecture 2.4 -- Functions

Repeated Composition

A1: f: Z Z, f (x ) =x 2.

f4(x ) =x (2*2*2*2) = x 16

A2: g: Z Z, g (x ) =x + 1

gn (x ) =x + n

A3: h (x ) = the father of x,

hn (x ) =x ’s n’th patrilineal ancestor

Lecture 2.4 -- Functions

Composition - a little problem

Let f:AB, and g:BC be functions.

Prove that if f and g are one to one, then g o f :AC is one to one.

Recall defn of one to one: f:A->B is 1to1 if f(a)=b and f(c)=b a=c.

Suppose g(f(x)) = y and g(f(w)) = y. Show that x=w.

f(x) = f(w) since g is 1 to 1.

Then x = w since f is 1 to 1.

Lecture 2.4 -- Functions

Commonly Encountered Functions

Polynomials:

f(x) = a0xn + a1xn-1 + … + an-1x1 + anx0

Ex: f(x) = x3 - 2x2 + 15; f(x) = 2x + 3

Exponentials:

f(x) = cdx

Ex: f(x) = 310x, f(x) = ex

Logarithms:

log2 x = y, where 2y = x.

Lecture 2.4 -- Functions

Some New functions

Ceiling:

f(x) = x the least integer y so that x y.

Ex: 1.2 = 2; -1.2 = -1; 1 = 1

Floor:

f(x) = x the greatest integer y so that x y.

Ex: 1.8 = 1; -1.8 = -2; -5 = -5

Quiz: what is -1.2 + 1.1 ?

Lecture 2.4 -- Functions

Download Presentation

Connecting to Server..