CS0441 Discrete Structure Recitation 2

CS0441 Discrete Structures Recitation 5

Xiang Xiao

Section 2.3 Q6

Find the domain and range of these functions

? The function that assigns the next largest integer to a positive integer

Domain: Z

Range: {x Z | x 1}

? The function that assigns to each positive integer its largest decimal digit

Domain: Z

Range: {x Z | x 10}

? The function that assigns to a bit string the number of ones minus the

number of zeros in the string

Domain: a set of all bit strings

Range: Z

? The function that assigns to a bit string the longest string of ones in the

string

Range: bit string containing only ones,

Domain: a set of all bit strings and the empty string

Section 2.3 Q20

Give an example of a function from N to N that is a. one-to-one but not onto

f (x) 2x

Yes

f (x) x2

Yes

f (x) 2x 1

No

f (x) 1

No

x

Section 2.3 Q20

Give an example of a function from N to N that is

b. onto, but not one-to-one

f (x) 2x

No

f (x) x

No

f

(

x)

0, 1,

when x is even

No

when x is odd

f

(x)

0, x 1,

x 1

Yes

x > 1

Section 2.3 Q20

Give an example of a function from N to N that is

c. both onto and one-to-one

f (x) x 1

No

f (x) x

Yes

x 1,

f

(

x)

x

1,

when x is even Yes when x is odd

f (x) 3x 5

No

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download