Docsity

Midterm 1 Exam with Solutions - Discrete Structures | CS 173, Exams of Discrete Structures and Graph Theory

Toggle sidebar
bg1
CS 173, Spring 2011, Midterm 1 Solutions
Notice that there were several versions of the exam, involving 2-3 versions of each problem.
Problem 1: Multiple choice (12 points)
Check the appropriate box for each statement. (One box per statement.) If you change your
answer, make it very clear when you’ve meant to uncheck a box.
For any sets Aand B,
|A∪B|=|A|+|B|.True False √
For any sets Aand B,
|A×B|=|A||B|.True √False
−15 ≡7 (mod 8) True False √
−15 ≡7 (mod 11) True √False
For any set A,∅ ∈ A.True False √
For any set A,∅ ⊆ A.True √False
For any sets Aand B,
if x∈A∩B, then x∈A.True √False
{5,6,7} ∩ {1,2,8}={∅} True False √
“Linear order”
means the same thing as
“partial order.”
True False √
pf3
pf4
pf5

Partial preview of the text

Download Midterm 1 Exam with Solutions - Discrete Structures | CS 173 and more Exams Discrete Structures and Graph Theory in PDF only on Docsity!

CS 173, Spring 2011, Midterm 1 Solutions

Notice that there were several versions of the exam, involving 2-3 versions of each problem.

Problem 1: Multiple choice (12 points)

Check the appropriate box for each statement. (One box per statement.) If you change your answer, make it very clear when you’ve meant to uncheck a box.

For any sets A and B, |A ∪ B| = |A| + |B|.

True False

For any sets A and B, |A × B| = |A||B|.

True

False

− 15 ≡ 7 (mod 8) True^ False^

− 15 ≡ 7 (mod 11) True^

False

For any set A, ∅ ∈ A. True^ False^

For any set A, ∅ ⊆ A. True^

False

For any sets A and B, if x ∈ A ∩ B, then x ∈ A.

True

False

{ 5 , 6 , 7 } ∩ { 1 , 2 , 8 } = {∅} True^ False^

“Linear order” means the same thing as “partial order.”

True False

If a relation is not symmetric, it is antisymmetric.

True False

For any real number x, ⌊x⌋ ≤ x ≤ ⌈x⌉.

True

False

7 | 0 True^

False

Problem 2: Calculation (10 points)

Calculate the values of the following expressions, showing your work. When the value is a non- empty set, explicitly list its contents. For calculations in Zk, express your final answer as [x], where 0 ≤ x < k.

(a) In Z 12 , ([7] + [11])^2 = [18]^2 = [6]^2 = [36] = [0]

(b) In Z 10 , ([7] + [11])^2 = [18]^2 = [8]^2 = [64] = [4]

(c) In Z 13 , ([7] + [11])^2 = [18]^2 = [5]^2 = [25] = [12]

(d) {a, b} × { 5 , 6 , 7 } = {(a, 5), (a, 6), (a, 7), (b, 5), (b, 6), (b, 7)}

(e) {a, b} × {(5, 6), 7 } = {(a, (5, 6)), (a, 7), (b, (5, 6)), (b, 7)}

(f) { 5 , 6 , 7 } ∩ {(5, 6), 8 } = ∅

(g) gcd(221, 1224) = 17

(h) gcd(391, 1150) = 23

(i) gcd(221, 1495) = 13

(j) {p + q^2 | 0 ≤ p ≤ 2 and 0 ≤ q ≤ 2 } = { 0 , 1 , 2 , 3 , 4 , 5 , 6 }

(k) {(p, q) | p ∈ Z and q ∈ Z and 1 ≤ pq ≤ 2 } = {(1, 1), (− 1 , −1), (1, 2), (− 1 , −2), (2, 1), (− 2 , −1)}

(l)

∑^ k+

i=

2 −i^ = 2 −

2 k+

(b) (3 points) Recall that Z^2 is the set of all pairs of integers. Let’s define the equivalence relation ∼ on Z^2 as follows: (x, y) ∼ (p, q) if and only |x| + |y| = |p| + |q|. List three members of [(2, 3)]. Solution: Members of [(2, 3)] include (2, 3), (3, 2), (− 2 , −3), (− 2 , 3), (1, 4), (− 4 , 1), (0, 5), etc. (You only needed to supply three pairs.)

(c) (3 points) Recall that N^2 is the set of all pairs of natural numbers. Let’s define the equivalence relation ∼ on N^2 as follows: (x, y) ∼ (p, q) if and only xy = pq. List three members of [(5, 6)]. Solution: Members of [(5, 6)] include (5, 6), (6, 5), (10, 3), (3, 10), (1, 30), etc. (You only needed to supply three pairs.) Notice that both numbers in the pair must be positive.

(d) (2 points) State the negation of the following claim:

Claim: For all real numbers x and y, if x is irrational and y is irrational, then x + y is irrational.

Solution: There are some real numbers x and y such that x is irrational, y is irrational, but x + y is rational.

Claim: For all real numbers p and q, if p is irrational and q is irrational, then pq + is irrational.

Solution: There are some real numbers p and q such that p is irrational, q is irrational, but pq + 1 is rational.

(e) (2 points) Disprove the claim from part (c) using a concrete counter-example. Briefly explain why your counter-example works. Solution: (First version of the claim:) Let x =

2 and y = −

  1. Then both x and y are irrational. But x + y =
  1. = 0 which is rational. (Second version of the claim:) Let p = q =
  1. Then both p and q are irrational. However pq + 1 = (
    • 1 = 2 + 1 = 3 which is rational.

Problem 4: Writing a proof (8 points)

Recall the following definitions, for any integers x and y and any positive integer k:

x ≡ y (mod k) if and only if k|(x − y).

x|y if and only if there is an integer m such that y = xm.

Working directly from these definitions (e.g. not using facts you may know about congruence or divisibility) and in your best mathematical style, prove the following claim.

Version 1: For all integers a, b, p, and q and all positive integers k, if a ≡ p (mod 2k) and b ≡ q (mod k), then a(b + 1) ≡ p(q + 1) (mod k).

Solution: Let a, b, p, and q be integers and k be a positive integer. Suppose that a ≡ p (mod 2k) and b ≡ q (mod k). Then 2k|a − p and k|b − q (definition of congruence). So a − p = 2kn and b − q = km, where n and m are integer (definition of divides). So a = p + 2kn and b = q + km.

So then

a(b + 1) = (p + 2km)(q + km + 1) = p(q + 1) + p(km) + 2km(q + km + 1) = p(q + 1) + ks

where s = pk + 2m(q + km + 1).

So a(b + 1) − p(q + 1) = ks. Since s must be an integer by closure, this means that k|a(b + 1) − p(q + 1). So a(b + 1) ≡ p(q + 1) (mod k).

Version 2: For all integers a, b, p, and q and all positive integers k, if a ≡ b (mod k) and p ≡ q (mod 5k), then a(p + 2) ≡ b(q + 2) (mod k).

Solution: Let a, b, p, and q be integers and k be a positive integer. Suppose that a ≡ b (mod k) and p ≡ q (mod 5k), Then k|a − b and 5k|p − q (definition of congruence. So a − b = kn and p − q = 5km, where n and m are integer (definition of divides). So a = b + kn and p = q + 5km.

So then

a(p + 2) = (b + kn)(q + 5km + 2) = b(q + 2) + b(5km) + kn(q + 5km + 2) = b(q + 2) + ks

where s = 5bm + n(q + 5km + 2).

So a(p + 2) − b(q + 2) = ks. Since s must be an integer by closure, this means that k|a(p + 2) − b(q + 2). So a(p + 2) ≡ b(q + 2) (mod k).