Docsity

Functions, Sequences, Summations, and Countability, Study notes of Discrete Structures and Graph Theory

Partial preview of the text

Download Functions, Sequences, Summations, and Countability and more Study notes Discrete Structures and Graph Theory in PDF only on Docsity!

Functions;

Sequences, Sums, Countability

Zeph Grunschlag

Announcements

HW 2 is due

As explained last lecture,

announcement went up over week-end

moving last 3 problems to HW3.

Functions

In high-school, functions are often identified with the formulas that define them.

EG: f (x ) = x 2

This point of view does not suffice in Discrete Math. In discrete math, functions are not necessarily defined over the real numbers.

EG: f (x ) = 1 if x is odd, and 0 if x is even.

So in addition to specifying the formula one needs to define the set of elements which are acceptable as inputs, and the set of elements into which the function outputs.

Functions. Basic-Terms.

DEF: A function f : A  B is given by a

domain set A, a codomain set B, and a rule which for every element a of A, specifies a unique element f (a) in B. f (a) is called the image of a, while a is called the pre-image of f (a). The range (or image ) of f is defined by f (A) = {f (a) | a  A }.

Functions. Basic-Terms.

f : ZR is given by f (x ) = x 2

A1: domain is Z , co-domain is R

A2: image of -3 = f (-3) = 9

A3: pre-images of 3: none as 3 isn’t an

integer! pre-images of 4: -2 and 2

A4: range is the set of perfect squares

f ( Z ) = {0,1,4,9,16,25,…}

One-to-One, Onto, Bijection.

Intuitively.

Represent functions using “node and arrow” notation: One-to-One means that no clashes occur.  BAD: a clash occurred, not 1-to-

 GOOD: no clashes, is 1-to-

Onto means that every possible output is hit  BAD: 3 rd^ output missed, not onto

 GOOD: everything hit, onto

One-to-One, Onto, Bijection.

Formal Definition.

DEF: A function f : A  B is:

one-to-one (or injective ) if different elements of A always result in different images in B. onto (or surjective ) if every element in B is hit by f. I.e., f ( A ) = B. a one-to-one correspondence (or a bijection , or invertible ) if f is both one-to-one as well as onto. If f is invertible, its inverse f -1^ : B  A is well defined by taking the unique element in the pre- image of b, for each b  B.

One-to-One, Onto, Bijection.

Examples.

Q: Which of the following are 1-to-1, onto, a bijection? If f is invertible, what is its inverse?

  1. f : ZR is given by f (x ) = x 2
  2. f : ZR is given by f (x ) = 2x
  3. f : RR is given by f (x ) = x 3
  4. f : ZN is given by f (x ) = |x |
  5. f : {people}  {people} is given by f (x ) = the father of x.

Composition

When a function f spits out elements of the same kind that another function g eats, f and g may be composed by letting g immediately eat each output of f.

DEF: 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) )

Composition. Examples.

Q: Compute g  f where

  1. f : ZR , f (x ) = x 2

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

  1. f : ZZ , f (x ) = x + 1

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

  1. f : {people}  {people},

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

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 : ZZ , f (x ) = x 2 find f 4

Q2: Given g : ZZ , g (x ) = x + 1 find g n

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

n

Repeated Composition

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

f 4 (x ) = x (222*2)^ = x 16

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

gn^ (x ) = x + n

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

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

Ceiling and Floor

A: 1.7 = 1, -1.7 = -2,

Q: What’s the difference between the

floor function and the (int) casting

function in Java?

Ceiling and Floor

A: Casting to int in Java always

truncates towards 0. Ceiling and floor

are not symmetric in this way.

EG: (int)(-1.7) == -