diff --git a/chapter_8/exercises.md b/chapter_8/exercises.md new file mode 100644 index 0000000..32632c6 --- /dev/null +++ b/chapter_8/exercises.md @@ -0,0 +1,200 @@ +Page 516 + +**Exercise Set 8.1** + +1. As in Example 8.1.2, the **congruence modulo $2$** relation $E$ is defined + from $\mathbb{Z}$ to $\mathbb{Z}$ as follows: For every ordered pair + $(m, n) \in \mathbb{Z} \times \mathbb{Z}$, + +$$ m E n \Leftrightarrow m - n \text{ is even} $$ + +a. Is $0 E 0$? Is $5 E 2$? Is $(6, 6) \in E$? Is $(-1, 7) \in E$? + +b. Prove that for any even integer $n$, $n E 0$. + +2. Prove that for all integers $m$ and $n$, $m - n$ is even if, and only if, + both $m$ and $n$ are even or both $m$ and $n$ are odd. + +3. The **congruence modulo $3$** relation, $T$, is defined from $\mathbb{Z}$ to + $\mathbb{Z}$ as follows: For all integers $m$ and $n$, + +$$ m T n \Leftrightarrow 3 | (m - n) $$ + +a. Is $10 T 1$? Is $1 T 10$? Is $(2, 2) \in T$? Is $(8, 1) \in T$? + +b. List five integers $n$ such that $n T 0$. + +c. List five integers $n$ such that $n T 1$. + +d. List five integers $n$ such that $n T 2$. + +e. Make and prove a conjecture about which integers are related by $T$ to $0$, +which integers are related to $T$ to $1$, and which integers are related to $T$ +to $2$. + +4. Define a relation $P$ on $\mathbb{Z}$ as follows: For every ordered pair + $(m, n) \in \mathbb{Z} \times \mathbb{Z}$, + +$$ m P n \Leftrightarrow m \text{ and } n \text{ have a common prime factor} $$ + +a. Is $15 P 25$? + +b. Is $22 P 27$? + +c. Is $0 P 5$? + +d. Is $8 P 8$? + +5. Let $X = \{a, b, c\}$. Recall that $\mathscr{P}(X)$ as follows: For all sets + $A$ and $B$ in $\mathscr{P}(X)$, + +$$ A \mathbf{J} B \Leftrightarrow A \cap B \neq \emptyset $$ + +a. Is $\{a\} \mathbf{J} \{c\}$? + +b. Is $\{a, b\} \mathbf{J} \{b, c\}$? + +c. Is $\{a, b} \mathbf{J} \{a, b, c\}$? + +7. Define a relation $R$ on $\mathbb{Z}$ as follows: For all integers $m$ and + $n$, + +$$ m R n \Leftrightarrow 5 | (m^2 - n^2) $$ + +a. Is $1 R (-9)$? + +b. Is $2 R 13$? + +c. Is $2 R (-8)$? + +d. Is $(-8) R 2$? + +8. Let $A$ be the set of all strings of _a_'s and _b_'s of length $4$. Define a + relation $R$ on $A$ as follows: For every $s, t \in A$, + +$$ s R t \Leftrightarrow s \text{ has the same first two characters as } t $$ + +a. Is _abaa_ $R$ _abba_? + +b. Is _aabb_ $R$ _bbaa_? + +c. Is _aaaa_ $R$ _aaab_? + +d. Is _baaa_ $R$ _abaa_? + +9. Let $A$ be the set of all strings of 0's, 1's, and 2's of length $4$. Define + a relation $R$ on $A$ as follows: For every $s, t \in A$, + +$$ s R t \Leftrightarrow \text{ the same of the characters in } s \text{ equals the sum of the characters in } t $$ + +a. Is 0121 $R$ 2200? + +b. Is 1011 $R$ 2101? + +c. Is 2212 $R$ 2121? + +d. Is 1220 $R$ 2111? + +10. Let $A = \{3, 4, 5\}$ and $B = \{4, 5, 6\}$ and let $R$ be the "less than" + relation. That is, for every ordered pair $(x, y) \in A \times B$, + +$$ x R y \Leftrightarrow x < y $$ + +State explicitly which ordered pairs are in $R$ and $R^{-1}$. + +11. Let $A = \{3, 4, 5\}$ and $B = \{4, 5, 6\}$ and let $S$ be the "divides" + relation. That is, for every ordered pair $(x, y) \in A \times B$, + +$$ x S y \Leftrightarrow x | y $$ + +State explicitly which ordered pairs are in $S$ and $S^{-1}$. + +12. + +a. Suppose a function $F: X \to Y$ is one-to-one but not onto. Is $F^{-1}$ (the +inverse relation for $F$) a function? Explain your answer. + +b. Suppose a function $F: X \to Y$ is onto but not one-to-one. Is $F^{-1}$ (the +inverse relation for $F$) a function? Explain your answer. + +Draw the directed graphs of the relations defined in 13-18. + +13. Define a relation $R$ on $A = \{0, 1, 2, 3\}$ by + $R = \{(0, 0), (1, 2), (2, 2)\}$. + +14. Define a relation $S$ on $B = \{a, b, c, d\}$ by + $S = \{(a, b), (a, c), (b, c), (d, d)\}$. + +15. Let $A = \{2, 3, 4, 5, 6, 7, 8\}$ and define a relation $R$ on $A$ as + follows: For every $x, y \in A$, + +$$ x R y \Leftrightarrow x | y $$ + +16. Let $A = \{5, 6, 7, 8, 9, 10\}$ and define a relation $S$ on $A$ as follows: + For every $x, y \in A$, + +$$ x S y \Leftrightarrow 2 | (x - y) $$ + +17. Let $A = \{2, 3, 4, 5, 6, 7, 8\}$ and define a relation $T$ on $A$ as + follows: For every $x, y \in A$, + +$$ x T y \Leftrightarrow 3 | (x - y) $$ + +18. Let $A = \{0, 1, 3, 4, 5, 6\}$ and define a relation $V$ on $A$ as follows: + For every $x, y \in A$, + +$$ x V y \Leftrightarrow 5 | (x^2 - y^2) $$ + +Exercises 19-20 refer to unions and intersections of relations. Since relations +are subsets of Cartesian products, their unions and intersections can be +calculated as for any subsets. Given two relations $R$ and $S$ from $A$ to $B$, + +$$ R \cup S = \{(x, y) \in A \times B | (x, y) \in R \text{ or } (x, y) \in S\} $$ + +$$ R \cap S = \{(x, y) \in A \times B | (x, y) \in R \text{ and } (x, y) \in S\} $$ + +19. Let $A = \{2, 4\}$ and $B = \{6, 8, 10\}$ and define relations $R$ and $S$ + from $A$ to $B$ as follows: For every $(x, y) \in A \times B$, + +$$ x R y \Leftrightarrow x | y \text{ and } x S y \Leftrightarrow y - 4 = x $$ + +State explicitly which ordered pairs are in $A \times B$, $R$, $S$, $R \cup S$, +and $R \cap S$. + +20. Let $A = \{-1, 1, 2, 4\}$ and $B = \{1, 2\}$ and define relations $R$ and + $S$ from $A$ to $B$ as follows: For every $(x, y) \in A \times B$, + +$$ x R y \Leftrightarrow |x| = |y| \text{ and } x S y \Leftrightarrow x - y \text{ is even} $$ + +State explicitly which ordered pairs are in $A \times B$, $R$, $S$, $R \cup S$, +and $R \cap S$. + +21. Define relations $R$ and $S$ on $\mathbb{R}$ as follows: + +$$ R = \{(x, y) \in \mathbb{R} \times \mathbb{R} | x < y\} \text{ and } S = \{(x, y) \in \mathbb{R} \times \mathbb{R} | x = y\}$$ + +That is, $R$ is the "less than" relation and $S$ is the "equals" relation on +$\mathbb{R}$. Graph $R$, $S$, $R \cup S$, and $R \cap S$ in the Cartesian plane. + +22. Define relations $R$ and $S$ on $\mathbb{R}$ as follows: + +$$ R = \{(x, y) \in \mathbb{R} \times \mathbb{R} | x^2 + y^2 = 4\} \text{ and } S = \{(x, y) \in \mathbb{R} \times \mathbb{R} | x = y\} $$ + +Graph $R$, $S$, $R \cup S$, and $R \cap S$ in the Cartesian plane. + +23. Define relations $R$ and $S$ on $\mathbb{R}$ as follows: + +$$ R = \{(x, y) \in \mathbb{R} \times \mathbb{R} | y = |x|\} \text{ and } S = \{(x, y) \in \mathbb{R} \times \mathbb{R} | y = 1\} $$ + +Graph $R$, $S$, $R \cup S$, and $R \cap S$ in the Cartesian plane. + +24. In Example 8.1.7 consider the query SELECT Patient_ID#, Name FROM S WHERE + Primary_Diagnosis = X. The response query is the projection onto the first + two coordinates of the intersection of the database with the set + $A_1 \times A_2 \times A_3 \times \{X\}$. + +a. Find the result of the query SELECT Patient_ID#, Name FROM S WHERE +Primary_Diagnosis = pneumonia. + +b. Find the result of the query SELECT Patient_ID#, Name FROM S WHERE +Primary_Diagnosis = appendicitis. diff --git a/chapter_8/notes.md b/chapter_8/notes.md new file mode 100644 index 0000000..7bc8a88 --- /dev/null +++ b/chapter_8/notes.md @@ -0,0 +1,28 @@ +Page 512 + +**Definition** + +Let $R$ be a relation from $A$ to $B$. Define the inverse relation $R^{-1}$ from +$B$ to $A$ as follows: + +$$ R^{-1} = \{(y, x) \in B \times A | (x, y) \in R\} $$ + +--- + +Page 513 + +**Definition** + +A **relation on a set** A is a relation from $A$ to $A$. + +--- + +Page 514 + +**Definition** + +Given sets $A_1, A_2, \dots, A_n$ an **$n$-ary relation** $R$ on +$A_1 \times A_2 \times \cdots \times A_n$ is a subset of +$A_1 \times A_2 \times \cdots \times A_n$. The special cases of $2$-ary, +$3$-ary, and $4$-ary relations are called **binary**, **ternary**, and +**quarternary relations**, respectively. diff --git a/chapter_8/test_yourself.md b/chapter_8/test_yourself.md new file mode 100644 index 0000000..8abf076 --- /dev/null +++ b/chapter_8/test_yourself.md @@ -0,0 +1,17 @@ +Page 515 + +**Test Yourself** + +1. If $R$ is a relation from $A$ to $B$, $x \in A$, and $y \in B$, the notation + $x R y$ means that ____. + +2. If $R$ is a relation from $A$ to $B$, $x \in A$, and $y \in B$, the notation + $x \cancel{R} y$ means that ____. + +3. If $R$ is a relation from $A$ to $B$, $x \in A$, and $y \in B$, the notation + $(y, x) \in R^{-1}$ if, and only if, ____. + +4. A relation on a set $A$ is a relation from ____ to ____. + +5. If $R$ is a relation on a set $A$, the directed graph of $R$ has an arrow + from $x$ to $y$ if, and only if, ____.