discrete_mathematics_with_a.../chapter_7/exercises.md
2026-07-26 20:38:24 -07:00

1332 lines
33 KiB
Markdown

Page 458
**Exercise Set 7.1**
1. Let $X = \{1, 3, 5\}$ and $Y = \{s, t, u, v\}$. Define $f: X \to Y$ by the
following arrow diagram.
(See page 458 for image)
a. Write the domain of $f$ and the co-domain of $f$.
Domain: $\{1, 3, 5\}$
Co-domain: $\{s, t, u, v\}$
b. Find $f(1)$, $f(3)$, and $f(5)$.
$f(1) = v, f(3) = s, f(5) = v$
c. What is the range of $f$?
$\{s, v\}$
d. Is $3$ an inverse image of $s$? Is $1$ an inverse image of $u$?
yes; no
e. What is the inverse image of $s$? of $u$? of $v$?
$\{3\}$;$\emptyset$;$\{1, 5\}$
f. Represent $f$ as a set of ordered pairs.
$\{(1, v), (3, s), (5, v)\}$
2. Let $X = \{1, 3, 5\}$ and $Y = \{a, b, c, d\}$. Define $g: X \to Y$ by the
following arrow diagram.
(See page 459 for image)
a. Write the domain of $g$ and the co-domain of $g$.
Domain: $\{1, 3, 5\}$
Co-domain: $\{a, b, c, d\}$
b. Find $g(1)$, $g(3)$, and $g(5)$.
$g(1) = b, g(3) = b, g(5) = b$
c. What is the range of $g$?
$\{b\}$
d. Is $3$ an inverse image of $a$? Is $1$ an inverse image of $b$?
no;yes
e. What is the inverse image of $b$? of $c$?
$\{1, 3, 5\}, \emptyset$
f. Represent $g$ as a set of ordered pairs.
$$ \{(1, b), (3, b), (5, b)\} $$
3. Indicate whether the statements in parts (a)-(d) are true or false for all
functions. Justify your answers.
a. If two elements in the domain of a function are equal, then their images in
the co-domain are equal.
True. The definition of a function states that every input element in the domain
must have an output element in the co-domain. Since two elements in the domain
of the function are equal, then their outputs in the co-domain must be equal by
this definition.
b. If two elements in the co-domain of a function are equal, then their
preimages in the domain are also equal.
This is false. A function can have the same output for two different inputs.
c. A function can have the same output for more than one input.
True, the definition of a function only states that every input to the function
must have an output, not necessarily unique outputs.
d. A function can have the same input for more than one output.
This is false. A single input can only map to a single output, not multiple
outputs.
4.
a. Find all functions from $X = \{a, b\}$ to $Y = \{u, v\}$.
$$ f(a) = u, f(a) = v, f(b) = u, f(b) = v $$
b. Find all functions from $X = \{a, b, c\}$ to $Y = \{u\}$.
$$ f(a) = u, f(b) = u, f(c) = u $$
c. Find all functions from $X = \{a, b, c\}$ to $Y = \{u, v\}$.
$$ f(a) = u, f(a) = v, f(b) = u, f(b) = v, f(c) = u, f(c) k v $$
5. Let $I_{\mathbb{z}}$ bee the identity function defined on the set of all
integers, and suppose that $e$, $b_i^{jk}$, $K(t)$, and $u_{kj}$ all
represent integers. Find the following:
a. $I_{\mathbb{Z}}(e)$
$$ I_{\mathbb{Z}}(e) = e $$
b. $I_{\mathbb{Z}}\left(b_i^{jk}\right)$
$$ I_{\mathbb{Z}}\left(b_i^{jk}\right) = b_i^{jk}\right $$
c. $I_{\mathbb{Z}}(K(t))$
$$ I_{\mathbb{Z}}(K(t)) = K(t) $$
d. $I_{\mathbb{Z}}(u_{kj})$
$$ I_{\mathbb{Z}}(u_{kj}) = u_{kj} $$
6. Find functions defined on the set of nonnegative integers that can be used to
define the sequences whose first six terms are given below.
a. $1, -\dfrac{1}{3}, \dfrac{1}{5}, -\dfrac{1}{7}, \dfrac{1}{9}, -\dfrac{1}{11}$
$$ f: \mathbb{Z}^{\text{nonneg}} \to \mathbb{R} $$
$$ f(n) = \frac{(-1)^n}{2n + 1} $$
b. $0, -2, 4, -6, 8, -10$
$$ f: \mathbb{Z}^{\text{nonneg}} \to \mathbb{R} $$
$$ f(n) = (-1)^n \cdot 2n $$
7. Let $A = \{1, 2, 3, 4, 5\}$, and define a function
$F: \mathscr{P}(A) \to \mathbb{Z}$ as follows: For each set $X$ in
$\mathscr{P}(A)$,
$$
F(x) =
\begin{cases}
0& \text{if } X \text{ has an even number of elements} \\
1 & \text{if } X \text{ has an odd number of elements}
\end{cases}
$$
Find the following:
a. $F(\{1, 3, 4\})$
$$ F(\{1, 3, 4\}) = 1 $$
because $\{1, 3, 4\}$ has an odd number of elements.
b. $F(\emptyset)$
$$ F(\emptyset) = 0 $$
because $\emptyset$ has an even number of elements.
c. $F(\{2, 3\})$
$$ F(\{2, 3\}) = 0 $$
because $\{2, 3\}$ has an even number of elements.
d. $F(\{2, 3, 4, 5\})$
$$ F(\{2, 3, 4, 5\}) = 0 $$
because $\{2, 3, 4, 5\}$ has an even number of elements.
8. Let $J_5 = \{0, 1, 2, 3, 4\}$, and define a function $F: J_5 \to J_5$ as
follows: For each $x \in J_5$, $F(x) = (x^3 + 2x + 4) \mod 5$.
Find the following:
a. $F(0)$
$$ F(0) = ((0)^3 + 2(0) + 4) \mod 5 $$
$$ = (0 + 0 + 4) \mod 5 $$
$$ = 4 \mod 5 $$
$$ = 4 $$
b. $F(1)$
$$ F(1) = ((1)^3 + 2(1) + 4) \mod 5 $$
$$ = (1 + 2 + 4) \mod 5 $$
$$ = 7 \mod 5 $$
$$ = 2 $$
c. $F(2)$
$$ F(2) = ((2)^3 + 2(2) + 4) \mod 5 $$
$$ = (8 + 4 + 4) \mod 5 $$
$$ = 16 \mod 5 $$
$$ = 1 $$
d. $F(3)$
$$ F(3) = ((3)^3 + 2(3) + 4) \mod 5 $$
$$ = (27 + 6 + 4) \mod 5 $$
$$ = 37 \mod 5 $$
$$ = 2 $$
e. $F(4)$
$$ F(4) = ((4)^3 + 2(4) + 4) \mod 5 $$
$$ = (64 + 8 + 4) \mod 5 $$
$$ = 76 \mod 5 $$
$$ = 1 $$
9. Define a function $S: \mathbb{Z}^+ \to \mathbb{Z}^+$ as follows: For each
positive integer $n$,
$$ S(n) = \text{ the sum of the positive divisors of } n $$
Find the following:
a. $S(1)$
$$ S(1) = 1 $$
b. $S(15)$
$$ S(15) = 1 + 3 + 5 + 15 = 24 $$
c. $S(17)$
$$ S(17) = 1 + 17 = 18 $$
d. $S(5)$
$$ S(5) = 1 + 5 = 6 $$
e. $S(18)$
$$ S(18) = 1 + 2 + 3 + 6 + 9 + 18 = 39 $$
f. $S(21)$
$$ S(21) = 1 + 3 + 7 + 21 = 32 $$
10. Let $D$ be the set of all finite subsets of positive integers.
Define a function $T: \mathbb{Z}^+ \to D$ as follows: For each positive integer
$n$, $T(n) =$ the set of positive divisors of $n$.
Find the following:
a. $T(1)$
$$ T(1) = \{1\} $$
b. $T(15)$
$$ T(15) = \{1, 3, 5, 15\} $$
c. $T(17)$
$$ T(17) = \{1, 17\} $$
d. $T(5)$
$$ T(5) = \{1, 5\} $$
e. $T(18)$
$$ T(18) = \{1, 2, 3, 6, 9, 18\} $$
f. $T(21)$
$$ T(21) = \{1, 3, 7, 21\} $$
11. Define $F: \mathbb{Z} \times \mathbb{Z} \to \mathbb{Z} \times \mathbb{Z}$ as
follows: For every ordered pair $(a, b)$ of integers,
$F(a, b) = (2a + 1, 3b - 2)$.
Find the following:
a. $F(4, 4)$
$$ F(4, 4) = (2(4) + 1, 3(4) - 2) $$
$$ = (8 + 1, 12 - 2) $$
$$ = (9, 10) $$
b. $F(2, 1)$
$$ F(2, 1) = (2(2) + 1, 3(1) - 2) $$
$$ = (4 + 1, 3 - 2) $$
$$ = (5, 1) $$
c. $F(3, 2)$
$$ F(3, 2) = (2(3) + 1, 3(2) - 2) $$
$$ = (6 + 1, 6 - 2) $$
$$ = (7, 4) $$
d. $F(1, 5)$
$$ F(1, 5) = (2(1) + 1, 3(5) - 2) $$
$$ = (2 + 1, 15 - 2) $$
$$ = (3, 13) $$
12. Let $J_5 = \{0, 1, 2, 3, 4\}$, and define
$G: J_5 \times J_5 \to J_5 \times J_5$ as follows: For each
$(a, b) \in J_5 \times J_5$,
$$ G(a, b) = ((2a + 1) \mod 5, (3b - 2) \mod 5) $$
Find the following:
a. $G(4, 4)$
$$ G(4, 4) = ((2(4) + 1) \mod 5, (3(4) - 2) \mod 5) $$
$$ = ((8 + 1) \mod 5, (12 - 2) \mod 5) $$
$$ = (9 \mod 5, 10 \mod 5) $$
$$ = (4, 0) $$
b. $G(2, 1)$
$$ G(2, 1) = ((2(2) + 1) \mod 5, (3(1) - 2) \mod 5) $$
$$ = ((4 + 1) \mod 5, (3 - 2) \mod 5) $$
$$ = (5 \mod 5, 1 \mod 5) $$
$$ = (0, 1) $$
c. $G(3, 2)$
$$ G(3, 2) = ((2(3) + 1) \mod 5, (3(2) - 2) \mod 5) $$
$$ = ((6 + 1) \mod 5, (6 - 2) \mod 5) $$
$$ = (7 \mod 5, 4 \mod 5) $$
$$ = (2, 4) $$
d. $G(1, 5)$
$$ G(1, 5) = ((2(1) + 1) \mod 5, (3(5) - 2) \mod 5) $$
$$ = ((2 + 1) \mod 5, (15 - 2) \mod 5) $$
$$ = (3 \mod 5, 13 \mod 5) $$
$$ = (3, 3) $$
13. Let $J_5 = \{0, 1, 2, 3, 4\}$, and define functions $f: J_5 \to J_5$ and
$g: J_5 \to J_5$ as follows: For each $x \in J_5$,
$$ f(x) = (x + 4)^2 \mod 5 \quad \text{ and } \quad g(x) = (x^2 + 3x + 1) \mod 5 $$
Is $f = g$? Explain.
| $x$ | $f(x)$ | $g(x)$ |
| --- | ------ | ------ |
| $0$ | $1$ | $1$ |
| $1$ | $0$ | $0$ |
| $2$ | $1$ | $1$ |
| $3$ | $4$ | $4$ |
| $4$ | $4$ | $4$ |
The table shows that $f(x) = g(x)$ for every $x \in J_5$. Therefore $f = g$ by
definition of equality of functions.
14. Define functions $H$ and $K$ from $\mathbb{R}$ to $\mathbb{R}$ by the
following formulas:
For every $x \in \mathbb{R}$,
$$ H(x) = \lfloor x \rfloor + 1 \quad \text{ and } \quad K(x) = \lceil x \rceil $$
Does $H = K$? Explain.
No. For example say $x = 0$, then $H(0) = \lfloor 0 \rfloor + 1 = 0 + 1 = 1$ and
$K(0) = \lceil 0 \rceil = 0$. Therefore it cannot be said that for every
$x \in \mathbb{R}$ that $H(x) = K(x)$, and thus $H \neq K$.
15. Let $F$ and $G$ be functions from the set of all real numbers to itself.
Define the product functions $F \cdot G: \mathbb{R} \to \mathbb{R}$ and
$G \cdot F: \mathbb{R} \to \mathbb{R}$ as follows: For every
$x \in \mathbb{R}$,
$$ (F \cdot G)(x) = F(x) \cdot G(x) $$
$$ (G \cdot F)(x) = G(x) \cdot F(x) $$
Does $F \cdot G = G \cdot F$? Explain.
Yes, by the commutative law of multiplication of Real numbers:
$$ (F \cdot G)(x) = F(x) \cdot G(x) = G(x) \cdot F(x) = (G \cdot F)(x) $$
Therefore, since $(F \cdot G)(x) = (G \cdot F)(x)$ for all $x \in \mathbb{R}$,
it can be concluded that $F \cdot G = G \cdot F$ by the definition of equality
of functions.
16. Let $F$ and $G$ be function sfrom the set of all real numbers to itself.
Define new functions $F - G: \mathbb{R} \to \mathbb{R}$ and
$G - F: \mathbb{R} \to \mathbb{R}$ as follows: For every $x \in \mathbb{R}$,
$$ (F - G)(x) = F(x) - G(x) $$
$$ (G - F)(x) = G(x) - F(x) $$
Does $F - G = G - F$? Explain.
No. Consider the definition of the difference of sets:
$$ (F - G)(x) = F(x) - G(x) = F(x) $$
and:
$$ (G - F)(x) = G(x) - F(x) = G(x) $$
Since $F(x) \neq G(x)$ for all $x \in \mathbb{R}$, it can be concluded that
$F - G \neq G - F$ by the definition of the equality of functions.
17. Use the definition of logarithm to fill in the blanks below.
a. $\log_28 = 3$ because _____.
$$ 2^3 = 8 $$
b. $\log_5\left(\dfrac{1}{25}\right) = -2$ because _____.
$$ 5^{-2} = \frac{1}{5^2} = \frac{1}{25} $$
c. $\log_44 = 1$ because _____.
$$ 4^1 = 4 $$
d. $\log_3(3^n) = n$ because _____.
$$ 3^n = 3^n $$
e. $\log_41 = 0$ because _____.
$$ 4^0 = 1 $$
18. Find exact values for each of the following quantities without using a
calculator.
a. $\log_{3}81$
$$ 3^{\text{?}} = 81 $$
$$ \log_{3}81 = 4 $$
b. $\log_{2}1024$
$$ 2^{\text{?}} = 1024 $$
$$ \log_{2}1024 = 10 $$
c. $\log_{3}\left(\dfrac{1}{27}\right)$
$$ \log_{3}\left(\frac{1}{27}\right) = -3 $$
d. $\log_{2}1$
$$ \log_{2}1 = 0 $$
e. $\log_{10}\left(\dfrac{1}{10}\right)$
$$ \log_{10}\left(\dfrac{1}{10}\right) = -1 $$
f. $\log_{3}3$
$$ \log_{3}3 = 1 $$
g. $\log_{2}(2^k)$
$$\log_{2}(2^k) = k $$
19. Use the definition of logarithm to prove that for any positive real number
$b$ with $b \neq 1$, $\log_{b}b = 1$.
**Proof:**
Let $b$ be any positive real number with $b \neq 1$. Since $b^1 = b$, then
$\log_{b}b = 1$ by definition of logarithm.
Q.E.D.
20. Use the definition of logarithm to prove that for any positive real number
$b$ with $b \neq 1$, $\log_{b}1 = 0$.
**Proof:**
Let $b$ be any positive real number with $b \neq 1$. Since $b^0 = 1$, then
$\log_{b}1 = 0$ by definition of logarithm.
Q.E.D.
21. If $b$ is any positive real number with $b \neq 1$ and $x$ is any real
number, $b^{-x}$ is defined as follows:
$b^{-x} = \dfrac{1}{b^x}$. Use this definition and the definition of logarithm
to prove that $\log_{b}\left(\dfrac{1}{u}\right) = -\log_{b}u$ for all positive
real numbers $u$ and $b$, with $b \neq 1$.
**Proof:**
Let $b$ be any positive real number with $b \neq 1$. Let $u$ be any positive
real number.
Let $v = \log_{b}\left(\dfrac{1}{u}\right)$. By the definition of logarithm,
this means that $b^v = \dfrac{1}{u}$. It follows by algebra that:
$$ b^v = \frac{1}{u} $$
$$ u \cdot b^v = 1 $$
$$ u = \frac{1}{b^v} $$
$$ u = b^{-v} $$
Hence, by the definition of logarithm:
$$ -v = \log_{b}(u) $$
and by algebra:
$$ v = -\log_{b}(u) $$
Since $v = \log_{b}\left(\dfrac{1}{u}\right)$ and $v = -\log_{b}(u)$, it follows
by the definition of equality that:
$$ \log_{b}\left(\frac{1}{u}\right) = -\log{b}(u) $$
This is what was to be shown.
Q.E.D.
22. Use the unique factorization for the integers theorem (Section 4.4) and the
definition of logarithm to prove that $\log_{3}(7)$ is irrational.
_Hint:_ Use a proof by contradiction. Suppose $\log_{3}7$ is rational. Then
$\log_{3}7 = \dfrac{a}{b}$ for some integers $a$ and $b$ with $b \neq 0$.
Apply the definition of logarithm and rewrite $\log_{3}7 = \dfrac{a}{b}$ in
exponential form.
**Proof (by contradiction):**
Suppose $\log_{3}(7)$ is rational, that is $\log_{3}(7) = \dfrac{a}{b}$ for some
integers $a$ and $b$ where $b \neq 0$.
By the definition of logarithm, this would mean that:
$$ 3^{\frac{a}{b}} = 7 $$
Then by algebra:
$$ 3^a = 7^b $$
Since $b \neq 0$, we know that $7^b \neq 1$, and by equality it follows that
$3^a \neq 1$. Additionally, by the definition of exponentiation, it is known
that $7^b > 0$ and $3^a > 0$ (they are both positive numbers).
But, by the unique factorization for integers theorem, this means that $7^b$ and
$3^a$ are two different prime factorizations of the same positive integer. This
is only possible if the positive integer is equal to $1$.
Hence $3^a = 7^b = 1$, but it has already been established that
$3^a = 7^b \neq 1$. This is a contradiction.
Therefore the supposition is false, and $\log_{3}(7)$ is irrational.
Q.E.D.
23. If $b$ and $y$ are positive real numbers such that $\log_{b}y = 3$, what is
$\log_{\frac{1}{b}}y$? Explain.
**Proof:**
Suppose $b$ and $y$ are positive real numbers such that $\log_{b}y = 3$.
By the definition of logarithm, this means that:
$$ b^3 = y $$
To find $\log_{\frac{1}{b}}y$, first, replace $y$ by substitution:
$$ \log_{\frac{1}{b}}y $$
$$ = \log_{\frac{1}{b}}(b^3) $$
Then notice that $\dfrac{1}{b} = b^{-1}$, and then substitute:
$$ = \log_{b^{-1}}(b^3) $$
By the definition of logarithm, this means that:
$$ (b^{-1})^x = b^3 $$
Where $x$ is $\log_{\frac{1}{b}}y$, or our answer. By the multiplication of
exponents, this means that:
$$ b^{-1 \cdot x} = b^3 $$
And by multiplication of negative numbers:
$$ b^{-1 \cdot -3} = b^3 $$
Therefore $x = -3$, or:
$$ \log_{\frac{1}{b}}y = -3 $$
This is what was to be found.
Q.E.D.
24. If $b$ and $y$ are positive real numbers such that $\log_{b}y = 2$, what is
$\log_{b^2}(y)$? Explain.
**Proof:**
Suppose $b$ and $y$ are positive real numbers such that $\log_{b}y = 2$. By the
definition of logarithm, this means that:
$$ \log_{b}y = 2 $$
$$ b^2 = y $$
To find $\log_{b^2}(y)$, first substitute in for $y$:
$$ \log_{b^2}(b^2) $$
By the definition of logarithm, this means that:
$$ \log_{b^2}(b^2) = 1 $$
because $(b^2)^1 = b^2$.
This is what was to be found.
Q.E.D.
25. Let $A = \{2, 3, 5\}$ and $B = \{x, y\}$. Let $p_1$ and $p_2$ be the
**projections of $A \times B$ onto the first and second coordinates.** That
is, for each pair $(a, b) \in A \times B$, $p_1(a, b) = a$ and
$p_2(a, b) = b$.
a. Find $p_1(2, y)$ and $p_1(5, x)$. What is the range of $p_1$?
$$ p_1(2, y) = 2 $$
$$ p_1(5, x) = 5 $$
Range of $p_1$:
$$ \{2, 3, 5\} $$
b. Find $p_2(2, y)$ and $p_2(5, x)$. What is the range of $p_2$?
$$ p_2(2, y) = y $$
$$ p_2(5, x) = x $$
Range of $p_2$:
$$ \{x, y\} $$
26. Observe that $\mod$ and $\text{div}$ can be defined as functions from
$\mathbb{Z}^{\text{nonneg}}$ \times \mathbb{Z}^+$ to $\mathbb{Z}$. For each
ordered pair $(n, d)$ consisting of a nonnegative integer $n$ and a positive
integer $d$, let
$\mod(n, d) = n \mod d$ (the nonnegative remainder obtained when $n$ is divided
by $d$).
$\text{div}(n, d) = n \text{ div } d$ (the integer quotient obtained when $n$ is
divided by $d$).
Find each of the following:
a. $\mod(67, 10)$ and $\text{div}(67, 10)$
$$ \mod(67, 10) = 7 $$
$$ \text{div}(67, 10) = 6 $$
b. $\mod(59, 8)$ and $\text{div}(59, 8)$
$$ \mod(59, 8) = 3 $$
$$ \text{div}(59, 8) = 7 $$
c. $\mod(30, 5)$ and $\text{div}(30, 5)$
$$ \mod(30, 5) = 0 $$
$$ \text{div}(30, 5) = 6 $$
27. Let $S$ be the set of all strings of $a$'s and $b$'s.
a. Define $f: S \to \mathbb{Z}$ as follows: For each string $s$ in $S$
$$
f(s) =
\begin{cases}
& \text{ the number of b's to the left-most a in s} \\
0 & \text{if s contains no a's}
\end{cases}
$$
Find $f(aba)$, $f(bbab)$, and $f(b)$. What is the range of $f$?
$$ f(aba) = 0 $$
$$ f(bbab) = 2 $$
$$ f(b) = 0 $$
The range of $f$: $\mathbb{Z}^{\text{nonneg}}$
b. Define $g: S \to S$ as follows: For each string $s$ in $S$,
$$ g(s) = \text{ the string obtained by writing the characters of s in reverse order} $$
Find $g(aba)$, $g(bbab)$, and $g(b)$. What is the range of $g$?
$$ g(aba) = aba $$
$$ g(bbab) = babb $$
The range of $g$ is $S$.
28. Consider the coding and decoding functions $E$ and $D$ defined in Example
7.1.9.
a. Find $E(0110)$ and $D(111111000111)$.
$$ E(0110) = 000111111000 $$
$$ D(111111000111) = 1101 $$
b. Find $E(1010)$ and $D(000000111111)$.
$$ E(1010) = 111000111000 $$
$$ D(000000111111) = 0011 $$
29. Consider the Hamming distance function defined in Example 7.1.10.
a. Find $H(10101, 00011)$.
$$ H(10101, 00011) = 3 $$
b. Find $H(00110, 10111)$.
$$ H(00110, 10111) = 2 $$
30. Draw arrow diagrams for the Boolean functions defined by the following
input/output tables.
a.
| Input | Intput | Output |
| ------- | ------ | ------ |
| $P$ | $Q$ | $R$ |
| ------- | - | |
| 1 | 1 | 0 |
| 1 | 0 | 1 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |
Omitted.
b.
| Input | Intput | Input | Output |
| ----- | ------ | ----- | ------ |
| $P$ | $Q$ | $R$ | $S$ |
| - | - | - | - |
| 1 | 1 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 0 | 0 | 1 |
Omitted.
31. Fill in the following table to show the values of all possible two-place
Boolean functions.
| Input | Input | $f_1$ | $f_2$ | $f_3$ | $f_4$ | $f_5$ | $f_6$ | $f_7$ | $f_8$ | $f_9$ | $f_{10}$ | $f_{11}$ | $f_{12}$ | $f_{13}$ | $f_{14}$ | $f_{15}$ | $f_{16}$ |
| ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
| 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 |
32. Consider the three-place Boolean function $f$ defined by the following rule:
For each triple $(x_1, x_2, x_3)$ of $0$'s and $1$'s,
$$ f(x_1, x_2, x_3) = (4x_1 + 3x_2 + 2x_3) \mod 2 $$
a. Find $f(1, 1, 1)$ and $f(0, 0, 1)$.
$$ f(1, 1, 1) = (4(1) + 3(1) + 2(1)) \mod 2 $$
$$ f(1, 1, 1) = (4 + 3 + 2) \mod 2 $$
$$ f(1, 1, 1) = 9 \mod 2 $$
$$ f(1, 1, 1) = 1 $$
$$ f(0, 0, 1) = (4(0) + 3(0) + 2(1)) \mod 2 $$
$$ f(0, 0, 1) = (0 + 0 + 2) \mod 2 $$
$$ f(0, 0, 1) = 2 \mod 2 $$
$$ f(0, 0, 1) = 0 $$
b. Describe $f$ using an input/output table.
| $x_1$ | $x_2$ | $x_3$ | $f(x_1, x_2, x_3)$ |
| ----- | ----- | ----- | ------------------ |
| $0$ | $0$ | $0$ | $0$ |
| $0$ | $0$ | $1$ | $0$ |
| $0$ | $1$ | $0$ | $1$ |
| $0$ | $1$ | $1$ | $1$ |
| $1$ | $0$ | $0$ | $0$ |
| $1$ | $0$ | $1$ | $0$ |
| $1$ | $1$ | $0$ | $1$ |
| $1$ | $1$ | $1$ | $1$ |
33. Student A tries to define a function $g: \mathbb{Q} \to \mathbb{Z}$ by the
rule
$g\left(\dfrac{m}{n}\right) = m - n$, for all integers $m$ and $n$ with
$n \neq 0$.
Student B claims that $g$ is not well defined. Justify student B's claim.
Suppose $\dfrac{m}{n} = \dfrac{1}{2}$, this would mean that
$g\left(\dfrac{m}{n}\right) = 1 - 2 = -1$.
Since $\dfrac{m}{n} = \dfrac{1}{2}$, this means that
$\dfrac{m}{n} = \dfrac{1}{2} = \dfrac{2}{4}$. Since they are equivalent, this
means that
$g\left(\dfrac{1}{2}\right) = g\left(\dfrac{2}{4}\right) = 2 - 4 = -2$.
But notice that:
$$ g\left(\frac{1}{2}\right) = -1 \neq -2 = g\left(\frac{2}{4}\right) $$
Since the function $g$ gives two different outputs for the same input, the
function $g$ is not well defined.
34. Student C tries to define a function $h: \mathbb{Q} \to \mathbb{Q}$ by the
rule
$h\left(\dfrac{m}{n}\right) = \dfrac{m^2}{n}$, for all integers $m$ and $n$ with
$n \neq 0$.
Student D claims that $h$ is not well defined. Justify student D's claim.
Suppose $\dfrac{m}{n} = \dfrac{2}{3}$, then
$h\left(\dfrac{2}{3}\right) = \dfrac{(2)^2}{3} = \dfrac{4}{3}$.
Notice that $\dfrac{2}{3} = \dfrac{4}{6}$, so
$h\left(\dfrac{4}{6}\right) = \dfrac{(4)^2}{6} = \dfrac{16}{6} = \dfrac{8}{3}$.
Notice that:
$$ h\left(\frac{2}{3}\right) = \frac{4}{3} \neq \frac{8}{3} = h\left(\frac{4}{6}\right) $$
Since the function $h$ does not produce the same output given the same input,
the function is not well defined.
35. Let $U = \{1, 2, 3, 4\}$. Student A tries to define a function
$R: U \to \mathbb{Z}$ as follows: For each $x \in U$,
$R(x)$ is the integer $y$ so that $(xy) \mod 5 = 1$.
Student B claims that $R$ is not well defined. Who is correct: student A or
student B? Justify your answer.
Consider $R(3) = 2$ since $(3 \cdot 2) \mod 5 = 1$. On the other hand,
$R(3) = 7$ since $(3 \cdot 7) \mod 5 = 1$.
Since $R$ returns multiple outputs for the same input, it is not well defined,
and Student B is correct.
36. Let $V = \{1, 2, 3\}$. Student C tries to define a function $S: V \to V$ as
follows: For each $x \in V$,
$S(x)$ is the integer $y$ in $V$ so that $(xy) \mod 4 = 1$.
Student D claims that $S$ is not well defined. Who is right: student C or
student D? Justify your answer.
Consider $S(1) = 17$ since $(1 \cdot 17) \mod 4 = 1$. On the other hand
$S(1) = 13$ since $(1 \cdot 13) \mod 4 = 1$.
Since $S$ returns multiple outputs for the same input, it is not well defined,
and Student D is correct.
37. On certain computers the integer data type goes from $-2,147,483,648$
through $2,147,483,647$. Let $S$ be the set of all integers from
$-2,147,483,648$ through $2,147,483,647$. Try to define a function
$f: S \to S$ by the rule $f(n) = n^2$ for each $n$ in $S$. Is $f$ well
defined? Explain.
No, $2,147,483,247 = 2^{31} - 1$, so for values of $n$ greater than $2^{16}$,
$f(n) = n^2$ will be greater than $2^{32}$, which falls outside of $S$.
38. Let $X = \{a, b, c\}$ and $Y = \{r, s, t, u, v, w\}$. Define $f: X \to Y$ as
follows: $f(a) = v$, $f(b) = v$, and $f(c) = t$.
a. Draw an arrow diagram for $f$.
Omitted.
b. Let $A = \{a, b\}$, $C = \{t\}$, $D = \{u, v\}$, and $E = \{r, s\}$. Find
$f(A)$, $f(X)$, $f^{-1}(C)$, $f^{-1}(D)$, $f^{-1}(E)$, and $f^{-1}(Y)$.
$$ f(A) = \{v\} $$
$$ f(X) = $\{t, v\} $$
$$ f^{-1}(C) = \{c\} $$
$$ f^{-1}(D) = \{a, b\} $$
$$ f^{-1}(E) = \emptyset $$
$$ f^{-1}(Y) = \{a, b, c\} $$
39. Let $X = \{1, 2, 3, 4\}$ and $Y = \{a, b, c, d, e\}$. Define $g: X \to Y$ as
follows: $g(1) = a$, $g(2) = a$, $g(3) = a$, and $g(4) = d$.
a. Draw an arrow diagram for $g$.
Omitted.
b. Let $A = \{2, 3\}$, $C = \{a\}$, and $D = \{b, c\}$. Find $g(A)$, $g(X)$,
$g^{-1}(C)$, $g^{-1}(D)$, and $g^{-1}(Y)$.
$$ g(A) = \{a\} $$
$$ g(X) = \{a, d\} $$
$$ g^{-1}(C) = \{1, 2, 3\} $$
$$ g^{-1}(D) = \emptyset $$
$$ g^{-1}(Y) = \{1, 2, 3, 4\} $$
40. Let $X$ and $Y$ be sets, let $A$ and $B$ be any subsets of $X$, and let $F$
be a function from $X$ to $Y$. Fill in the blanks in the following proof
that $F(A) \cup F(B) \subseteq F(A \cup B)$.
**Proof:**
Let $y$ be any element in $F(A) \cup F(B)$. _[We must show that $y$ is in
$F(A \cup B)$.]_ By definition of union, __ (i) __.
_Case 1 $y \in F(A)$:_
In this case, by definition of $F(A)$, $y = F(x)$ for __ (ii) __ $x \in A$.
Since $A \subseteq A \cup B$, it follows from the definition of union that
$x \in$ __ (iii) __. Hence, $y = F(x)$ for some $x \in A \cup B$, and thus, by
definition of $F(A \cup B)$, $y \in$ __ (iv) __.
_Case 2, $y \in F(B)$:_
In this case, by definition of $F(B)$, __ (v) __ for some $x \in B$. Since
$B \subseteq A \cup B$ it follows from the definition of union that __ (vi) __.
Thus $y \in F(A \cup B)$.
Therefore, regardless of whether $y \in F(A)$ or $y \in F(B)$, we have that
$y \in F(A \cup B)$ _[as was to be shown]_.
i. $y \in F(A) \cup F(B)$
ii. some
iii. $A \cup B$
iv. $F(A \cup B)$
v. $y = F(x)$
vi. $x \in A \cup B$
In 41-49 let $X$ and $Y$ be sets, let $A$ and $B$ be any subsets of $X$, and let
$C$ and $D$ be any subsets of $Y$. Determine which of the properties are true
for every function $F$ from $X$ to $Y$ and which are false for at least one
function $F$ from $X$ to $Y$. Justify your answers.
41. If $A \subseteq B$ then $F(A) \subseteq F(B)$
**Proof:**
Let $F$ be a function from $X$ to $Y$ and suppose $A \subseteq X$,
$B \subseteq X$, and $A \subseteq B$.
Then, let $y$ be some element such that $y \in F(A)$.
By definition of image of a set, $y = F(x)$ for some $x \in A$. Thus since
$A \subseteq B$, $x \in B$, and so $y = F(x)$ for some $x \in B$. Hence
$y \in F(B)$, and therefore $F(A) \subseteq F(B)$.
Q.E.D.
42. $F(A \cap B) \subseteq F(A) \cap F(B)$
**Proof:**
Suppose $y$ is some element such that $y \in F(A \cap B)$.
By the supposition and the definition of $A \cap B$, this means that $y = F(x)$
for some $x \in A \cap B$.
By the definition of intersection, it follows that $x \in A$ and $x \in B$.
By the definition of $F(A)$ and $F(B)$, $y = F(x)$ is in $F(A)$ and in $F(B)$.
Hence, by the definition of intersection, $y \in F(A) \cap F(B)$.
Since $y \in F(A) \cap F(B)$, it can be concluded that
$F(A \cap B) \subseteq F(A) \cap F(B)$.
Q.E.D.
43. $F(A) \cap F(B) \subseteq F(A \cap B)$
**Disproof (by counterexample):**
Let $X = \{1, 2, 3\}$ and $Y = \{a, b\}$. Then, define a function $F: X \to Y$
such that $F(1) = a, F(2) = b, F(3) = b$.
Let $A = \{1, 2\}$ and $B = \{1, 3\}$. Then $F(A) = \{a, b\}$ and
$F(B) = \{a, b\}$.
So $F(A) \cap F(B) = \{a, b\}$, and $F(A \cap B) = F(\{1\}) = \{a\}$.
Since $\{a\} \neq \{a, b\}$, the given statement is false.
Q.E.D.
44. For all subsets $A$ and $B$ of $X$, $F(A - B) = F(A) - F(B)$.
**Disproof (by counterexample):**
Let $X = \{1, 2\}$ and $Y = \{a\}$. Then, define a function $F: X \to Y$ such
that $F(1) = a$ and $F(2) = a$.
Let $A = \{1\}$ and $B = \{2\}$. Then $F(A - B) = F(\{1\}) = \{a\}$.
Then $F(A) - F(B) = F(\{1\}) - F(\{2\}) = \{a\} - \{a\} = \emptyset$.
Since $\{a\} \neq \emptyset$, the given statement is false.
Q.E.D.
45. For all subsets $C$ and $D$ of $Y$, if $C \subseteq D$, then
$F^{-1}(C) \subseteq F^{-1}(D)$.
**Proof:**
Let $F$ be a function from a set $X$ to a set $Y$, and suppose $C \subseteq Y$,
$D \subseteq Y$, and $C \subseteq D$.
Suppose $x \in F^{-1}(C)$. Then $F(x) \in C$. Since $C \subseteq D$,
$F(x) \in D$ also. Hence, by definition of inverse image, $x \in F^{-1}(D)$.
Therefore $F^{-1}(C) \subseteq F^{-1}(D)$.
Q.E.D.
46. For all subsets $C$ and $D$ of $Y$,
$$ F^{-1}(C \cup D) = F^{-1}(C) \cup F^{-1}(D) $$
**Proof:**
In order to prove:
$$ F^{-1}(C \cup D) = F^{-1}(C) \cup F^{-1}(D) $$
We must prove:
$$ F^{-1}(C \cup D) \subseteq F^{-1}(C) \cup F^{-1}(D) $$
and:
$$ F^{-1}(C) \cup F^{-1}(D) \subseteq F^{-1}(C \cup D) $$
_Proof $F^{-1}(C \cup D) \subseteq F^{-1}(C) \cup F^{-1}(D)$:_
Suppose $x \in F^{-1}(C \cup D)$. Then $F(x) \in C \cup D$. By the definition of
union, this means that $F(x) \in C$ or $F(x) \in D$.
_Case $F(x) \in C$:_
Since $F(x) \in C$, this means that $x \in F^{-1}(C)$. By the definition of
union, this means that $x \in F^{-1}(C) \cup F^{-1}(D)$.
_Case $F(x) \in D$:_
Since $F(x) \in D$, this means that $x \in F^{-1}(D)$. By the definition of
union, this means that $x \in F^{-1}(C) \cup F^{-1}(D)$.
In both cases, $x \in F^{-1}(C) \cup F^{-1}(D)$. Therefore, any element in
$F^{-1}(C \cup D)$ is also in $F^{-1}(C)$, and
$F^{-1}(C \cup D) \subseteq F^{-1}(C) \cup F^{-1}(D)$, as was to be shown.
_Proof $F^{-1}(C) \cup F^{-1}(D) \subseteq F^{-1}(C \cup D)$:_
Suppose $x \in F^{-1}(C) \cup F^{-1}(D)$. By definition of union, this means
that $x \in F^{-1}(C)$ or $x \in F^{-1}(D)$.
_Case $x \in F^{-1}(C)$:_
Since $x \in F^{-1}(C)$, this means that $F(x) \in C$. It follows by definition
of union that $F(x) \in C \cup D$, or $x \in F^{-1}(C \cup D)$.
_Case $x \in F^{-1}(D)$:_
Since $x \in F^{-1}(D)$, this means that $F(x) \in D$. It follows by definition
of union that $F(x) \in C \cup D$, or $x \in F^{-1}(C \cup D)$.
In both cases, $x \in F^{-1}(C \cup D)$. Therefore any element in
$F^{-1}(C) \cup F^{-1}(D)$ is in $F^{-1}(C \cup D)$, and so
$F^{-1}(C) \cup F^{-1}(D) \subseteq F^{-1}(C \cup D)$. This is what was to be
shown.
_Conclusion:_
Since both subset relations have been proved, it can be concluded that
$F^{-1}(C \cup D) = F^{-1}(C) \cup F^{-1}(D)$. This is what was to be shown.
Q.E.D.
47. For all subsets $C$ and $D$ of $Y$,
$$ F^{-1}(C \cap D) = F^{-1}(C) \cap F^{-1}(D) $$
**Proof:**
In order to prove:
$$ F^{-1}(C \cap D) = F^{-1}(C) \cap F^{-1}(D) $$
it must be shown that:
$$ F^{-1}(C \cap D) \subseteq F^{-1}(C) \cap F^{-1}(D) $$
and also that:
$$ F^{-1}(C) \cap F^{-1}(D) \subseteq F^{-1}(C \cap D) $$
_Proof $F^{-1}(C \cap D) \subseteq F^{-1}(C) \cap F^{-1}(D)$:_
Suppose $x \in F^{-1}(C \cap D)$, or $F(x) \in C \cap D$. By definition of
intersection, this means that $F(x) \in C$ and $F(x) \in D$, or
$x \in F^{-1}(C) \cap F^{-1}(D)$. This is what was to be shown.
_Proof $F^{-1}(C) \cap F^{-1}(D) \subseteq F^{-1}(C \cap D)$:_
Suppose $x \in F^{-1}(C) \cap F^{-1}(D)$, or $F(x) \in C$ and $F(x) \in D$. By
definition of intersection, $F(x) \in C \cap D$, or $x \in F^{-1}(C \cap D)$.
This is what was to be shown.
_Conclusion:_
Since both subset relations have been proved, it can be concluded that
$F^{-1}(C \cap D) = F^{-1}(C) \cap F^{-1}(D)$. This is what was to be shown.
Q.E.D.
48. For all subsets $C$ and $D$ of $Y$,
$$ F^{-1}(C - D) = F^{-1}(C) - F^{-1}(D) $$
**Proof:**
In order to prove:
$$ F^{-1}(C - D) = F^{-1}(C) - F^{-1}(D) $$
it must be shown that:
$$ F^{-1}(C - D) \subseteq F^{-1}(C) - F^{-1}(D) $$
and also that:
$$ F^{-1}(C) - F^{-1}(D) \subseteq F^{-1}(C - D) $$
_Proof $F^{-1}(C - D) \subseteq F^{-1}(C) - F^{-1}(D)$:_
Suppose $x \in F^{-1}(C - D)$, or $F(x) \in C - D$. By definition of difference
of sets, this means that $F(x) \in C$ and $F(x) \notin D$. By the definition of
inverse image, this means $x \in F^{-1}(C)$ and $x \notin F^{-1}(D)$. By the
definition of difference, this is $x \in F^{-1}(C) - F^{-1}(D)$. Thus
$F^{-1}(C - D) \subseteq F^{-1}(C) - F^{-1}(D)$, which is what was to be shown.
_Proof $F^{-1}(C) - F^{-1}(D) \subseteq F^{-1}(C - D)$:_
Suppose $x \in F^{-1}(C) - F^{-1}(D)$, or $F(x) \in C$ and $F(x) \notin D$. By
the definition of inverse image, this means that $F(x) \in C - D$, or
$x \in F^{-1}(C - D)$. Thus $F^{-1}(C) - F^{-1}(D) \subseteq F^{-1}(C - D)$,
which is what was to be shown.
_Conclusion:_
Since both subset relations have been proved, it can be concluded that
$F^{-1}(C - D) = F^{-1}(C) - F^{-1}(D)$, which is what was to be shown.
Q.E.D.
49. $F(F^{-1}(C)) \subseteq C$
**Proof:**
Suppose $x \in F(F^{-1}(C))$. By definition of image, there exists some
$a \in F^{-1}(C)$ such that $F(a) = x$. By definition of inverse image,
$a \in F^{-1}(C)$ means $F(a) \in C$. Since $F(a) = x$, we have $x \in C$.
Therefore $F(F^{-1}(C)) \subseteq C$.
Q.E.D.
50. Given a set $S$ and a subset $A$, the **characteristic function of $A$**,
denoted $\chi_A$, is the function defined from $S$ to $\mathbb{Z}$ with the
property that for each $u \in S$,
$$
\chi_{A}(u) =
\begin{cases}
1 & \text{if } u \in A \\
0 & \text{if } u \notin A
\end{cases}
$$
Show that each of the following holds for all subsets $A$ and $B$ of $S$ and
every $u \in S$.
a. \chi_{A \cap B}(u) = \chi_{A}(u) \cdot \chi_{B}(u)
Omitted.
b.
$\chi_{A \cup B}(u) = \chi_{A}(u) + \chi_{B}(u) - \chi_{A}(u) \cdot \chi_{B}(u)$
Omitted.
Each of exercises 51-53 refers to the Euler phi function, denoted $\phi$, which
is defined as follows: For each integer $n \geq 1$, $\phi(n)$ is the number of
positive integers less than or equal to $n$ that have no common factors with $n$
except $\pm 1$. For example $\phi(10) = 4$ because there are four positive
integers less than or equal to $10$ that have no common factors with $10$ except
$\pm 1$ - namely, $1$, $3$, $7$, and $9$.
51. Find each of the following:
a. $\phi(15)$
Omitted.
b. $\phi(2)$
Omitted.
c. $\phi(5)$
Omitted.
d. $\phi(12)$
Omitted.
e. $\phi(11)$
Omitted.
f. $\phi(1)$
Omitted.
52. Prove that if $p$ is a prime number and $n$ is an integer with $n \geq 1$,
then $\phi(p^n) = p^n - p^{n - 1}$.
Omitted.
53. Prove that there are infinitely many integers $n$ for which $\phi(n)$ is a
perfect square.
Omitted.