# MATH 302 – Discrete Mathematics – Section 501 Homework 5

```Dr. Timo de Wolff
Institute of Mathematics
www.math.tamu.edu/~dewolff/Fall14/math302.html
MATH 302 – Discrete Mathematics – Section 501
Homework 5
Fall 2014
Due: Friday, October 17th, 2014, 9:10 a.m.
Exercise 1. Storing sets in a computer unordertly is not very effective since set operations
then have a long runtime. An alternative way is to represent finite sets is to equip the
universal (countable) set with a total ordering and represent the particular set by 01-vectors.
I.e., the j-th entry of a such a vector is 1 if and only if the j-th element of the universe
is contained in the particular set, which is represented, and 0 otherwise. In practise, one
represents sets A1 , . . . , Ar by k-tuples, where k is the maximal element in A1 ∪ &middot; &middot; &middot; ∪ Ar .
1. Let A := {2, 4, 5, 7} and B := {1, 2, 3, 5}. Represent both sets as 01-vector as well as
A ∩ B, A ∪ B and A \ B.
2. Let k ∈ N be fixed. Write a pseudocode that takes two sets A, B ⊆ {0, . . . , k} as input
and returns A ∩ B such that the computation is done via 01-vector representation.
Exercise 2. For a function f : A → B the graph G(f ) of f is the set
{(a, b) : a ∈ A and f (a) = b} ⊆ A &times; B.
1. Give the graphs for f : {0, . . . , 5} → Q, x 7→ x3 and g : {0, . . . , 5} → N, n 7→ fibn ,
where fibn denotes the n-th Fibonacci number.
2. Draw the graph of the function f : R → R, x 7→ x3 . Explain, why it coincides the
usual notion from calculus and earlier.
3. Show: if f : A → B and g : B → C, then
G(g ◦ f ) = {(a, c) : ∃ b ∈ B : (a, b) ∈ G(f ) and (b, c) ∈ G(g)}.
Exercise 3. The floor function ⌊&middot;⌋ : R → Z assigns to every real x the largest integer k,
which satisfies k ≤ x.
1
1. Show that for every x ∈ R there exists a maximal k ∈ Z such that 0 ≤ x − k &lt; 1.
I.e., ⌊&middot;⌋ is well defined.
2. Write a pseudocode for the floor function.
3. Show that the floor function is surjective but not injective.
Hint: Essentially, 1. solves 2. and vice versa. Make use of that!
2
```