diff --git a/Spring-2023/CS-2233/Assignment-3/Assignment.pdf b/Spring-2023/CS-2233/Assignment-3/Assignment.pdf new file mode 100644 index 0000000..994b484 Binary files /dev/null and b/Spring-2023/CS-2233/Assignment-3/Assignment.pdf differ diff --git a/Spring-2023/CS-2233/Assignment-3/Solution.typ b/Spring-2023/CS-2233/Assignment-3/Solution.typ new file mode 100644 index 0000000..251a75b --- /dev/null +++ b/Spring-2023/CS-2233/Assignment-3/Solution.typ @@ -0,0 +1,161 @@ +#let m(math) = align(center)[$#math$] +#let pgbreakmsg = align(center, text(blue, weight: "black", size: 1.5em)[See Next Page\ ↓]) + +#let solve(work, solution) = align( + center, +)[ + #let solution = align(center, block( + inset: 5pt, + stroke: blue + .3pt, + fill: rgb(0, 149, 255, 15%), + radius: 4pt, + )[#align(left)[#solution]]) + + #if work == [] [ + #solution + ] else [ + #block(inset: 6pt, radius: 4pt, stroke: luma(50%) + .5pt, fill: luma(90%))[ + #align(left, text(font: "Liberation Sans", size: .85em, work)) + #solution + ] + ] +] + +#let problem-header(number, points) = [== Problem #number. #text(weight: "regular")[[#points + points]]] + +#let problem(number, points, body) = [ + == Problem #number. #text(weight: "regular")[[#points points]] + #body +] + +#set page(margin: (x: .4in, y: .4in)) +#set table(align: center) + +_*Price Hiller*_ +#v(-.8em) +_*zfp106*_ +#v(-.8em) +Homework Assignment 3 +#v(-.8em) +CS 2233 +#v(-.8em) +Section 001 + +#align( + center, + block( + inset: 6pt, + radius: 4pt, + stroke: luma(50%) + .5pt, + fill: luma(90%), + )[If you are interested in viewing the source code of this document, you can do so + by clicking + #text( + blue, + link( + "https://git.orion-technologies.io/Price/college/src/branch/Development/Spring-2023/CS-2233/Assignment-3/Solution.typ", + "here", + ), + ).], +) += Problems + +#problem( + 1, + 10, +)[ + - Complete all participation activities in zyBook sections $2.1$, $2.2$, and $2.4$-$2.6$. + #solve[][Done] +] + +#problem( + 2, + 10, +)[ + Prove that if $a$, $b$, and $c$ are odd integers, then $a + b + c$ is an odd + integer. + + #solve[ + An odd integer is expressed as $2k + 1$ where $k$ is some integer. + ][ + 1. Suppose that $a$, $b$, and $c$ are odd integers. I shall prove that $a + b + c$ is an odd + integer. + 2. Since $a$, $b$, and $c$ are integers, $a + b + c$ is also an integer + 3. Since $a$ is odd, there is an integer $q$ such that $a = 2q + 1$ + 4. Since $b$ is odd, there is an integer $w$ such that $b = 2w + 1$ + 5. Since $c$ is odd, there is an integer $e$ such that $c = 2e + 1$ + 6. $a + b + c = (2q + 1) + (2w + 1) + (2e + 1) = 2(q + w + e + 1) + 1$ + 7. Let $m = q + w + e + 1$ + 8. Since $q$, $w$, $e$, and $1$ are integers, $m$ must be an integer + 9. Since $a + b + c = 2m + 1$, therefore $a + b + c$ is + an odd integer + ] +] +#problem( + 3, + 30, +)[ + Recall that a rational number can be put in the form $p/q$ where $p$ and $q$ are + integers and $q ≠ + 0$. Prove the following for any rational number, $x$: + + a.) If $x$ is rational, then $x - 5$ is rational + #solve[][ + 1. Let $x$ be a rational number. I will show that $x - 5$ is also a rational + number. + 2. Since $x$ is rational, there exists integers $p$ and $q$ such that $x = p/q$ and $q ≠ 0$. + 3. Thus $x - 5 = p/q - 5$ + 4. Since $5$ is an integer, $5$ is also a rational number written as $5/1$ + 5. Therefore $p/q - 5 = p/q - 5/1$ + 6. Working $p/q - 5/1$ we get $(p - 5q)/(q × 1)$ which is $(p - 5q)/q$ + 7. Since $x - 5$ is equal to the ratio of two integers where the deonominator $≠ 0$, then $x - 5$ is a rational number + ] + b.) If $x - 5$ is rational, then $x/3$ is rational + + #solve[][ + 1. Let $x - 5$ be rational. I will show that $x/3$ is also rational + 2. $x - 5 = p/q$ for some integers $p$, $q$, where $q ≠ 0$ + 3. Add $5$ to both sides giving $x = p/q + 5$ + 4. Divide both sides by $3$ giving $x/3 = (p/q + 5)/3$ + 5. $(p/q + 5)/3$ is also rational + 6. Therefore $x/3$ is rational + ] +\ + c.) If $x/3$ is rational, then $x$ is rational + #solve[][ + 1. Let $x/3$ be rational. I will show that $x$ is rational + 2. $x/3 = p/q$ for some integers $p$ and $q$ where $q ≠ 0$ + 3. Multiply both sides of the equation by $q$ to get $x = 3p/q$ + 4. Since $p$, $q$, and $3$ are integers, $x$ is rational + ] +] + +#problem( + 4, + 20, +)[ + Consider the following statement: For all integers $m$ and $n$, if $m - n$ is + odd, then $m$ is odd or $n$ is odd. + + a.) Prove the statement using a proof by contrapositive + #solve[][ + 1. Let $m$ and $n$ be integers. I will show that if $m$ is even and $n$ is even + then $m - n$ is even + 2. Since $m$ is even, there exists an integer $k$ such that $m = 2k$ + 3. Since $n$ is even, there exists an integer $j$ such that $n = 2j$ + 4. Thus, $m - n = 2k - 2j = 2(k - j )$ + 5. Since $k - j$ is an integer, $2(k - j)$ is even + 6. Therefore, if $m$ is even and $n$ is even, $m - n$ is even + ] + b.) Prove the statement by using a proof by contradiction + #solve[][ + 1. Let $m$ and $n$ be integers. Assume then that $m - n$ is odd, but both $m$ and $n$ are + even + 2. If $m$ is even, then $m = 2k$ for some integer $k$ + 3. If $n$ is even, then $n = 2j$ for some integer $j$ + 4. Then $m - n = 2k - 2j = 2(k - j)$ + 5. But $2(k - j)$ is even, which contradicts that $m - n$ is odd + 6. Thus, if $m - n$ is odd, then $m$ must be odd or $n$ must be odd + ] +] diff --git a/Spring-2023/CS-2233/TODO.org b/Spring-2023/CS-2233/TODO.org index 9b00fbe..f11db8f 100644 --- a/Spring-2023/CS-2233/TODO.org +++ b/Spring-2023/CS-2233/TODO.org @@ -1,4 +1,10 @@ -* DONE Assignment 1 +* DONE Assignment 1 :college:cs2233: DEADLINE: <2024-01-26 Fri> SCHEDULED: <2024-01-25 Thu> Complete Zybooks section ~1~ and the first homework assignment + +* TODO Assignment 3 :college:cs2233: +DEADLINE: <2024-02-11 Sun> SCHEDULED: <2024-02-11 Sun> + +Complete Zybooks section ~2~ and the third homework assignment +