| Problem 3.1: cartesian products
Prove or disprove the following two propositions: a) (A ∩ B) × (C ∩ D) = (A × C) ∩ (B × D) b) (A ∪ B) × (C ∪ D) = (A × C) ∪ (B × D) |
|
| Problem 3.2: reflexive, symmetric, transitive |
For each of the following relations, determine whether they are reflexive, symmetric, or transitive. Provide a reasoning.
- The absolute difference of the integer numbers a and b is less than or equal to 3.
- = {(a,b)|a,b ∈ Z ∧ |a − b| ≤ 3}
- The last digit of the decimal representation of the integer numbers a and b is the same.
- = {(a,b)|a,b ∈ Z ∧ (a mod 10) = (b mod 10)}
Problem 3.3: total, injective, surjective, bijective functions
Are the following functions total, injective, surjective, or bijective? Expain why or why not.
- f : N 7→ N with f(x) = 2x2
- f : R 7→ R with f(x) = x2 + 6
Problem 3.4: function composition
Given the functions f(x) = x + 1. g(x) = 2x, and h(x) = x2, determine an expression for the following function compositions:
- f ◦ g
- f ◦ h
- g ◦ f
- g ◦ h
- h ◦ f
- h ◦ g
- f ◦ (g ◦ h)
- h ◦ (g ◦ f)
Problem 3.5: list comprehensions (haskell)
Your list comprehensions should be correct, they do not have to be efficient. You are not getting points for a list comprehension simply returning a hard coded solution list. In other words, your list comprehensions should continue to function correctly if parameters are changed.
- Write a list comprehension that returns all positive factors of the number 210. Try to write the list comprehension in such a way that 210 can easily be replaced by a different number.
- Write a list comprehension that returns a list of Pythagorean triads (a,b,c), where a,b,c are positive integers in the range 1..100 and the Pythagorean triad is defined as a2 + b2 = c2. The list should not contain any “duplicates” where a and b are swapped. If the list contains (3,4,5) (since 32 + 42 = 25 = 52), then is should not also include (4,3,5).



