diff --git a/chapter_5/exercises.md b/chapter_5/exercises.md index e69de29..e9a0f29 100644 --- a/chapter_5/exercises.md +++ b/chapter_5/exercises.md @@ -0,0 +1,269 @@ +**Exercise Set 5.1** + +Page 296 + +Write the first four terms of the sequences defined by the formulas 1-6. + +1. $a_k = \dfrac{k}{10 + k}$, for every integer $k \geq 1$. + +2. $b_j = \dfrac{5 - j}{5 + j}$, for every integer $j \geq 1$. + +3. $c_i = \dfrac{(-1)^i}{3^i}$, for every integer $i \geq 0$. + +4. $d_m = 1 + \left(\dfrac{1}{2}\right)^m$ for every integer $m \geq 0$. + +5. $e_n = \left\lfloor \dfrac{n}{4} \right\rfloor \cdot 2$, for every integer + $n \geq 0$. + +6. $f_n = \left\lfloor \dfrac{n}{4} \right\rfloor \cdot 4$, for every integer + $n \geq 1$. + +7. Let $a_k = 2k + 1$ and $b_k = (k - 1)^3 + k + 2$ for every integer + $k \geq 0$. Show that the first three terms of these sequences are identical + but that their fourth terms differ. + +Compute the first fifteen terms of each of the sequences in 8 and 9, and +describe the general behavior of these sequences in words. (A definition of +logarithm is given in Section 7.1.) + +8. $g_n = \lfloor \log_{2}n \rfloor$ for every integer $n \geq 1$. + +9 $h_n = n\lfloor \log_{2}n \rfloor$ for every integer $n \geq 1$. + +Find explicit formulas for sequences of the form $a_1, a_2, a_3, \dots$ with the +initial terms given in 10-16. + +10. $-1, 1, -1, 1, -1, 1$ + +11. $0, 1, -2, 3, -4, 5$ + +12. $\dfrac{1}{4}, \dfrac{2}{9}, \dfrac{3}{16}, \dfrac{4}{25}, \dfrac{5}{36}, \dfrac{6}{49}$ + +13. $1 - \dfrac{1}{2}, \dfrac{1}{2} - \dfrac{1}{3}, \dfrac{1}{3} - \dfrac{1}{4}, \dfrac{1}{4} - \dfrac{1}{5}, \dfrac{1}{5} - \dfrac{1}{6}, \dfrac{1}{6} - \dfrac{1}{7}$ + +14. $\dfrac{1}{3}, \dfrac{4}{9}, \dfrac{9}{27}, \dfrac{16}{81}, \dfrac{25}{243}, \dfrac{36}{729}$ + +15. $0, -\dfrac{1}{2}, \dfrac{2}{3}, -\dfrac{3}{4}, \dfrac{4}{5}, -\dfrac{5}{6}, \dfrac{6}{7}$ + +16. $3, 6, 12, 24, 48, 96$ + +17. Consider the sequence defined by $a_n = \dfrac{2n + (-1)^n - 1}{4}$ for + every integer $n \geq 0$. Find an alternative explicit formula for $a_n$ + that uses the floor notation. + +18. Let + $a_0 = 2, a_1 = 3, a_2 = -2, a_3 = 1, a_4 = 0, a_5 = -1, \text{ and } a_6 = -2$. + Compute each of the summations and products below. + +a. $\sum_{i = 0}^{6}{a_i}$ + +b. $\sum_{i = 0}^{0}{a_i}$ + +c. $\sum_{j = 1}^{3}{a_{2j}}$ + +d. $\prod_{k = 0}^{6}{a_k}$ + +e. $\prod_{k = 2}^{2}{a_k}$ + +Compute the summations and products in 19-28. + +19. $\sum_{k = 1}^{5}{(k + 1)}$ + +20. $\prod_{k = 2}^{4}{k^2}$ + +21. $\sum_{k = 1}^{3}{(k^2 + 1)}$ + +22. $\prod_{j = 0}^{4}{(-1)^j}$ + +23. $\sum_{i = 1}^{1}{i(i + 1)}$ + +24. $\sum_{j = 0}^{0}{(j + 2) \cdot 2^j}$ + +25. $\prod_{k = 2}^{2}{\left(1 - \dfrac{1}{k}\right)}$ + +26. $\sum_{k = -1}^{1}{(k^2 + 3)}$ + +27. $\sum_{n = 1}^{6}{\left(\dfrac{1}{n} - \dfrac{1}{n + 1}\right)}$ + +28. $\prod_{i = 2}^{5}{\dfrac{i(i + 2)}{(i - 1) \cdot (i + 1)}}$ + +Write the summations in 29-32 in expanded form. + +29. $\sum_{i = 1}^{n}{(-2)^i}$ + +30. $\sum_{j = 1}^{n}{j(j + 1)}$ + +31. $\sum_{k = 0}^{n + 1}{\dfrac{1}{k!}}$ + +32. $\sum_{i = 1}^{k + 1}{i(i!)}$ + +Evaluate the summations and products in 33-36 for the indicated values of the +variable. + +33. $\dfrac{1}{1^2} + \dfrac{1}{2^2} + \dfrac{1}{3^2} + \dots + \dfrac{1}{n^2}; n = 1$ + +34. $1(1!) + 2(2!) + 3(3!) + \dots + m(m!); m = 2$ + +35. $\left(\dfrac{1}{1 + 1}\right)\left(\dfrac{2}{2 + 1}\right)\left(\dfrac{3}{3 + 1}\right) \dots \left(\dfrac{k}{k + 1}\right); k = 3$ + +36. $\left(\dfrac{1 \cdot 2}{3 \cdot 4}\right)\left(\dfrac{4 \cdot 5}{6 \cdot 7}\right)\left(\dfrac{6 \cdot 7}{8 \cdot 9}\right) \dots \left(\dfrac{m \cdot (m + 1)}{(m + 2) \cdot (m + 3)}\right); m = 1$ + +Write each of 37-39 as a single summation. + +37. $\sum_{i = 1}^{k}{i^3 + (k + 1)^3}$ + +38. $\sum_{k = 1}^{m}{\dfrac{k}{k + 1} + \dfrac{m + 1}{m + 2}}$ + +39. $\sum_{m = 0}^{n}{(m + 1)2^m + (n + 2)2^{n + 1}}$ + +Rewrite 40-42 by separating off the final term. + +40. $\sum_{i = 1}^{k + 1}{i(i!)}$ + +41. $\sum_{k = 1}^{m + 1}{k^2}$ + +42. $\sum_{m = 1}^{n + 1}{m(m + 1)}$ + +Write each of 43-52 using summation or product notation. + +43. $1^2 - 2^2 + 3^2 - 4^2 + 5^2 - 6^2 + 7^2$ + +44. $(1^3 - 1) - (2^3 - 1) + (3^3 - 1) - (4^3 - 1) + (5^3 - 1)$ + +45. $(2^2 - 1) \cdot (3^2 - 1) \cdot (4^2 - 1)$ + +46. $\dfrac{2}{3 \cdot 4} - \dfrac{3}{4 \cdot 5} + \dfrac{4}{5 \cdot 6} - \dfrac{5}{6 \cdot 7} + \dfrac{6}{7 \cdot 8}$ + +47. $1 - r + r^2 - r^3 + r^4 - r^5$ + +48. $(1 - t) \cdot (1 - t^2) \cdot (1 - t^3) \cdot (1 - t^4)$ + +49. $1^3 + 2^3 + 3^3 + \dots + n^3$ + +50. $\dfrac{1}{2!} + \dfrac{2}{3!} + \dfrac{3}{4!} + \dots + \dfrac{n}{(n + 1)!}$ + +51. $n + (n - 1) + (n - 2) + \dots + 1$ + +52. $n + \dfrac{n - 1}{2!} + \dfrac{n - 2}{3!} + \dfrac{n - 3}{4!} + \dots + \dfrac{1}{n!}$ + +Transform each of 53 and 54 by making the change of variable $i = k + 1$. + +53. $\sum_{k = 0}^{5}{k(k - 1)}$ + +54. $\prod_{k = 1}^{n}{\dfrac{k}{k^2 + 4}}$ + +Transform each of 55-58 by making the change of variable $j = i - 1$. + +55. $\sum_{i = 1}^{n + 1}{\dfrac{(i - 1)^2}{i \cdot n}}$ + +56. $\sum_{i = 3}^{n}{\dfrac{i}{i + n - 1}}$ + +57. $\sum_{i = 1}^{n - 1}{\dfrac{i}{(n - i)^2}}$ + +58. $\prod_{i = n}^{2n}{\dfrac{n - i + 1}{n + i}}$ + +Write each of 59-61 as a single summation or product. + +59. $3 \cdot \sum_{k = 1}^{n}{(2k - 3)} + \sum_{k = 1}^{n}{(4 - 5k)}$ + +60. $2 \cdot \sum_{k = 1}^{n}{(3k^2 + 4)} + 5 \cdot \sum_{k = 1}^{n}{(2k^2 - 1)}$ + +61. $\left(\prod_{k = 1}^{n}{\dfrac{k}{k + 1}}\right) \cdot \left(\prod_{k = 1}^{n}{\dfrac{k + 1}{k + 2}}\right)$ + +Compute each of 62-76. Assume the values of the variables are restricted so that +the expressions are defined. + +62. $\dfrac{4!}{3!}$ + +63. $\dfrac{6!}{8!}$ + +64. $\dfrac{4!}{0!}$ + +65. $\dfrac{n!}{(n - 1)!}$ + +66. $\dfrac{(n - 1)!}{(n + 1)!}$ + +67. $\dfrac{n!}{(n - 2)!}$ + +68. $\dfrac{((n + 1)!)^2}{(n!)^2}$ + +69. $\dfrac{n!}{(n - k)!}$ + +70. $\dfrac{n!}{(n - k + 1)!}$ + +71. $\dbinom{5}{3}$ + +72. $\dbinom{7}{4}$ + +73. $\dbinom{3}{0}$ + +74. $\dbinom{5}{5}$ + +75. $\dbinom{n}{n - 1}$ + +76. $\dbinom{n + 1}{n - 1}$ + +77. + +a. Prove that $n! + 2$ is divisible by $2$, for every integer $n \geq 2$. + +b. Prove that $n! + k$ is divisible by $k$, for every integer $n \geq 2$ and +$k = 2, 3, \dots, n$. + +c. Given any integer $m \geq 2$, is it possible to find a sequence of $m - 1$ +consecutive positive integers none of which is prime? Explain your answer. + +78. Prove that for all nonnegative integers $n$ and $r$ with + +$$ r + 1 \leq n, \binom{n}{r + 1} = \frac{n - r}{r + 1}\binom{n}{r} $$ + +79. Prove that if $p$ is a prime number and $r$ is an integer with $0 < r < p$, + then $\dbinom{p}{r}$ is divisible by $p$. + +80. Suppose $a[1], a[2], a[3], \dots, a[m]$ is a one-dimensional array and + consider the following algorithm segment: + +$\text{sum } := 0\\ \text{\textbf{for }} k := 1 \text{\textbf{ to }} m\\ \ \ \text{sum } := \text{ sum } + a[k]\\ \text{\textbf{next }} k$ + +Fill in the blanks below so that each algorithm segment performs the same job as +the one shown in the exercise statement. + +a. + +$\text{sum } := 0\\ \text{\textbf{for }} i := 0 \text{\textbf{ to \_\_\_\_}}\\ \ \ \text{sum } := \text{\_\_\_\_}\\ \text{\textbf{next }} i$ + +b. + +$\text{sum } := 0\\ \text{\textbf{for }} j := 2 \text{\textbf{ to \_\_\_\_}}\\ \ \ \text{sum } := \text{\_\_\_\_}\\ \text{\textbf{next }} j$ + +Use repeated division by $2$ to convert (by hand) the integers in 81-83 from +base 10 to base 2. + +81. $90$ + +82. $98$ + +83. $205$ + +Make a trace table to trace the action of Algorithm 5.1.1 on the input in 84-86. + +84. $23$ + +85. $28$ + +86. $44$ + +87. Write an informal description of an algorithm (using repeated division + by 16) to convert a nonnegative integer from decimal notation to hexadecimal + notation (base 16). + +Use the algorithm you developed for exercise 87 to convert the integers in 88-90 +to hexadecimal notation. + +88. $287$ + +89. $693$ + +90. $2,301$ + +91. Write a formal version of the algorithm you developed for exercise 87. diff --git a/chapter_5/notes.md b/chapter_5/notes.md index e69de29..a9a1aa1 100644 --- a/chapter_5/notes.md +++ b/chapter_5/notes.md @@ -0,0 +1,120 @@ +Page 284 + +**Definition** + +If $m$ and $n$ are integers and $m \leq n$, the symbol $\sum_{k=m}^{n}{a_k}$, +read the **summation from $k$ equals $m$ to $n$ of $a$-sub-$k$**, is the sum of +all the terms $a_m, a_{m + 1}, a_{m + 2}, \dots, a_n$. We say that +$a_m + a_{m + 1} + a_{m + 2} + \dots + a_n$ is the **expanded form** of the sum, +and we write + +$$ \sum_{k=m}^{n}{a_k} = a_m + a_{m + 1} + a_{m + 2} + \dots + a_n $$ + +We call $k$ the **index** of the summation, $m$ the **lower limit** of the +summation, and $n$ the **upper limit** of the summation. + +--- + +Page 287 + +**Definition** + +If $m$ and $n$ are integers and $m \leq n$, the symbol $\prod_{k = m}^{n}{a_k}$ +read the **product from $k$ equals $m$ to $n$ of $a$-sub-$k$**, is the product +of all the terms $a_m, a_{m + 1}, a_{m + 2}, \dots, a_n$. + +We write + +$$ \prod_{k = m}^{n}{a_k} = a_m \cdot a_{m + 1} \cdot a_{m + 1} \dots a_n $$ + +--- + +Page 288 + +**Theorem 5.1.1** + +If $a_m, a_{m + 1}, a_{m + 1}, \dots$ and $b_m, b_{m + 1}, b_{m + 1}, \dots$ are +sequences of real numbers and $c$ is any real number, then the following +equations hold for any integer $n \geq m$: + +1. $\sum_{k = m}^{n}{a_k} + \sum_{k = m}^{n}{b_k} = \sum_{k = m}^{n}{(a_k + b_k)}$ + +2. $c \cdot \sum_{k = m}^{n}{a_k} = \sum_{k = m}^{n}{c \cdot a_k} \quad \text{generalized distributive law}$ + +3. $\left(\prod_{k = m}^{n}{a_k}\right) \cdot \left(\prod_{k = m}^{n}{b_k}\right) = \prod_{k = m}^{n}{(a_k \cdot b_k)}$ + +--- + +Page 291 + +**Definition** + +For each positive integer $n$, the quantity **$n$ factorial** denoted $n!$, is +defined to be the product of all the integers from $1$ to $n$: + +$$ n! = n \cdot (n - 1) \dots 3 \cdot 2 \cdot 1 $$ + +**Zero factorial**, denoted $0!$, is defined to be $1$: + +$$ 0! = 1 $$ + +--- + +Page 292 + +**Definition** + +Let $n$ and $r$ be integers with $0 \leq r \leq n$. The symbol + +$$ \binom{n}{r} $$ + +is read "**$n$ choose $r$**" and represents the number of subsets of size $r$ +that can be chosen from a set with $n$ elements. + +--- + +Page 292 + +**Formula for Computing $\dbinom{n}{r}$** + +For all integers $n$ and $r$ with $0 \leq r \leq n$, + +$$ \binom{n}{r} = \frac{n!}{r!(n - r)!} $$ + +--- + +Page 295 + +**Algorithm 5.1.1 Decimal to Binary Conversion Using Repeated Division by $2$** + +_[In Algorithm 5.1.1 the input is a nonnegative integer $a$. The aim of the +algorithm is to produce a sequence of binary digits $r[0], r[1], r[2], \dots +r[k] so that the binary representation of $n$ is_ + +$$ \left(r[k]r[k - 1] \dots r[2]r[1]r[0]\right)_2 $$ + +_That is,_ + +$$ a = 2^k \cdot r[k] + 2^{k - 1} \cdot r[k - 1] + \dots + 2^3 \cdot r[2] + 2^1 \cdot r[1] + 2^0 \cdot r[0] $$ + +_.]_ + +**Input:** $a$ _[a nonegative integer]_ + +**Algorithm Body:** + +$q := a, i := 0$ + +_[Repeatedly perform the integer division of $q$ by $2$ until $q$ becomes $0$. +Store successive remainders in a one-dimensional array +$r[0], r[1], r[2], \dots r[k]$. Even if the initial-value of $q$ equals $0$, the +loop should execute one time (so that $r[0]$ is computed). Thus the guard +condition for the **while** loop is $i = 0$ or $q \neq 0$.]_ + +$\text{\textbf{while }}(i = 0 \text{ or } q \new 0)\\ \ \ r[i] := q \mod 2\\ \ \ q := q \text{ div } 2\\ \ \ \text{[r[i] and q can be obtained by calling the division algorithm.]}\\ \ \ i := i + 1\\ \text{\textbf{end while}}$ + +_[After execution of this step, the values of $r[0], r[1], \dots, r[i - 1]$ are +all $0$'s and $1$'s, and +$a = \left(r[i - 1]r[i - 2] \dots r[2]r[1]r[0]\right)_2$.]_ + +**Output:** $r[0], r[1], r[2], \dots, r[i - 1]$ _[a sequence of integers]_ diff --git a/chapter_5/test_yourself.md b/chapter_5/test_yourself.md index e69de29..68d23a0 100644 --- a/chapter_5/test_yourself.md +++ b/chapter_5/test_yourself.md @@ -0,0 +1,18 @@ +**Test Yourself** + +Page 296 + +1. The notation $\sum_{k = m}^{n}{a_k}$ is read "_____." + +2. The expanded form of $\sum_{k = m}^{n}{a_k}$ is _____. + +3. The value of $a_1 + a_2 + a_3 + \dots + a_n$ when $n = 2$ is "_____." + +4. The notation $\prod_{k = m}^{n}{a_k}$ is read "_____." + +5. If $n$ is a positive integer, then $n! =$ _____. + +6. $\sum_{k = m}^{n}{a_k} + c\sum_{k = m}^{n}{b_k} =$ _____. + +7. $\left(\prod_{k = m}^{n}{a_k}\right)\left(\prod_{k = m}^{n}{b_k}\right) =$ + _____.