Presentation is loading. Please wait.

Presentation is loading. Please wait.

9/8/2011Lecture 2.4 -- Functions1 Lecture 2.4: Functions CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda.

Similar presentations


Presentation on theme: "9/8/2011Lecture 2.4 -- Functions1 Lecture 2.4: Functions CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda."— Presentation transcript:

1 9/8/2011Lecture 2.4 -- Functions1 Lecture 2.4: Functions CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren, Zeph Grunschlag

2 9/8/2011Lecture 2.4 -- Functions2 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

3 9/8/2011Lecture 2.4 -- Functions3 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

4 9/8/2011Lecture 2.4 -- Functions4 Outline Functions compositions common examples

5 9/8/2011Lecture 2.4 -- Functions5 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

6 9/8/2011Lecture 2.4 -- Functions6 Composition: Examples Q: Compute g  f 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

7 9/8/2011Lecture 2.4 -- Functions7 Composition: Examples 1.f : Z  R, f (x ) = x 2 and g : R  R, g (x ) = x 3 g  f : Z  R, g  f (x ) = x 6 2. f : Z  Z, f (x ) = x + 1 and g = f -1 g  f (x ) = x (true for any function composed with its inverse) 3. f : {people}  {people}, f (x ) = g(x ) = the father of x g  f (x ) = grandfather of x from father’s side

8 9/8/2011Lecture 2.4 -- Functions8 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 f 4 Q2: Given g : Z  Z, g (x ) = x + 1 find g n Q3: Given h(x ) = the father of x, find h n

9 9/8/2011Lecture 2.4 -- Functions9 Repeated Composition A1: f : Z  Z, f (x ) = x 2. f 4 (x ) = x (2*2*2*2) = x 16 A2: g : Z  Z, g (x ) = x + 1 g n (x ) = x + n A3: h (x ) = the father of x, h n (x ) = x ’s n’th patrilineal ancestor

10 9/8/2011Lecture 2.4 -- Functions10 Composition - a little problem Let f:A  B, and g:B  C be functions. Prove that if f and g are one to one, then g o f :A  C 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.

11 9/8/2011Lecture 2.4 -- Functions11 Commonly Encountered Functions Polynomials: f(x) = a 0 x n + a 1 x n-1 + … + a n-1 x 1 + a n x 0 Ex: f(x) = x 3 - 2x 2 + 15; f(x) = 2x + 3 Exponentials: f(x) = c dx Ex: f(x) = 3 10x, f(x) = e x Logarithms: log 2 x = y, where 2 y = x.

12 9/8/2011Lecture 2.4 -- Functions12 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  ? 0

13 9/8/2011Lecture 2.4 -- Functions13 Today’s Reading Rosen 2.3


Download ppt "9/8/2011Lecture 2.4 -- Functions1 Lecture 2.4: Functions CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda."

Similar presentations


Ads by Google