CS128 FS2011 Exam 3 Key

Transcription

CS128 FS2011 Exam 3 Key
CS128 FS2011 Exam 3 Key
This is a closed-book, closed-notes exam. The only items you are allowed to use are writing implements.
Mark each sheet of paper you use with your name and the string “cs128fs2011 exam3”. If you are caught
cheating, you will receive a zero grade for this exam. The max number of points per question is indicated in
square brackets after each question. The sum of the max points for all the questions is 56, but note that the
max exam score will be capped at 54 (i.e., there are 2 bonus points but you can’t score more than 100%).
You have exactly 75 minutes to complete this exam. Keep your answers clear and concise while complete.
Good luck!
1. Two new drugs are to be tested using a group of 60 laboratory mice, each tagged with a number for
identification purposes. Drug A is to be given to 22 mice, drug B is to be given to another 22 mice, and
the remaining 16 mice are to be used as controls. A single assignment involves specifying the treatment
for each mouse-whether drug A, drug B, or no drug. How many ways can the assignment of treatments
to mice be made? [3]
38
38!
60!
60!
26
[Exercise 9.5.10] 60
22 22 = 22!38! · 22!16! = 22!22!16! (≈ 3.148 · 10 )
2. An urn contains two blue balls (denoted B1 and B2 ) and three white balls (denoted W1 , W2 , and W3 ).
One ball is drawn, its color is recorded, and it is replaced in the urn. Then another ball is drawn and
its color is recorded.
(a) Let B1 W2 denote the outcome that the first ball drawn is B1 and the second ball drawn is W2 .
Because the first ball is replaced before the second ball is drawn, the outcomes of the experiment
are equally likely. List all possible outcomes of the experiment. [3]
[Exercise 9.1.19a] {B1 B1 , B1 B2 , B1 W1 , B1 W2 , B1 W3 , B2 B1 , B2 B2 , B2 W1 , B2 W2 , B2 W3 , W1 B1 ,
W1 B2 , W1 W1 , W1 W2 , W1 W3 , W2 B1 , W2 B2 , W2 W1 , W2 W2 , W2 W3 , W3 B1 , W3 B2 , W3 W1 , W3 W2 , W3 W3 }
(b) Consider the event that the first ball that is drawn is blue. List all outcomes in the event. What
is the probability of the event? [3]
[Exercise 9.1.19b] {B1 B1 , B1 B2 , B1 W1 , B1 W2 , B1 W3 , B2 B1 , B2 B2 , B2 W1 , B2 W2 , B2 W3 }
10
P(first ball is blue)= 25
= 40%
(c) Consider the event that only white balls are drawn. List all outcomes in the event. What is the
probability of the event? [3]
[Exercise 9.1.19c] {W1 W1 , W1 W2 , W1 W3 , W2 W1 , W2 W2 , W2 W3 , W3 W1 , W3 W2 , W3 W3 }
9
= 36%
P(only white balls)= 25
3. Let S be the set of all strings of a’s and b’s, and define C : S → S by ∀s ∈ S, C(s) = as.
(a) Is C one-to-one? Prove or give a counterexample. [5]
[Exercise 7.2.25a] Yes, C is one-to-one. Proof: Let s1 , s2 ∈ S ∧ C(s1 ) = C(s2 ). We must show
that s1 = s2 . By the definition of C, as1 = as2 . But this can only be true if s1 = s2 (removing a
single a from the left of both sides of the equation.
(b) Is C onto? Prove or give a counterexample. [3]
[Exercise 7.2.25b] No, C is not onto. Counterexample: b ∈ S, but ∀s ∈ S, b 6= as, hence ∀s ∈
S, b 6= C(s).
4. How many solutions are there for the equation y1 + y2 + y3 + y4 = 400 when yi ∈ Z ∧ yi ≥ 5? [3]
383·382·381
383!
[Similar to Exercise 9.6.14] 380+4−1
= 383
= 383 · 191 · 127
6
380
380 = 380!3! =
5. A is the set of all strings of length 2 in 0’s, 1’s, and 2’s. The equivalence relation R is defined on A as
follows:
∀s, t ∈ A, s R t ⇔ the sum of the characters in s equals the sum of the characters in t.
Give the distinct equivalence classes of R. [5]
[Exercise 8.3.14] {00},{01,10},{02,11,20},{12,21},{22}
6. Define a relation I on R as follows: ∀x, y ∈ R, x I y ⇔ x − y is irrational.
(a) Is I reflexive? Justify your answer. [4]
√
[Exercise 8.2.19] No, I is not reflexive. Counterexample: Let x = 2. Then x ∈ R, but x − x = 0
which is rational.
(b) Is I symmetric? Justify your answer. [4]
[Exercise 8.2.19] Yes, I is symmetric. Proof: Let x, y ∈ R such that x I y. We must show that
y I x. By definition of I, x − y is irrational. Now y − x = −(x − y) and the negative of any
irrational number is irrational. Hence y − x is irrational and so y I x by definition of I.
(c) Is I transitive? Justify your answer. [5]
√
[Exercise 8.2.19] No, √I is not transitive. Counterexample: Let
√ x = z = 2 ∧ y = 0. Then
x, y, z ∈ R, x − y = 2 which is irrational, and y − z = − 2 which is also irrational, hence
x I y ∧ y I z. However, x − z = 0 which is rational, thus ∼ (x I z).
(d) Is I an equivalence relation? Justify your answer. [2]
No, because I is not reflexive nor transitive.
7. Let A = {2, 3, 4, 6, 8, 9, 12, 18} and R be the “divides” relation on A.
(a) Draw the Hasse diagram for R. [3]
[Exercise 8.5.16b]
(b) Give the greatest element of R. [1]
[Exercise 8.5.23] None
(c) Give the least element of R. [1]
[Exercise 8.5.23] None
(d) Give the maximal elements of R. [2]
[Exercise 8.5.23] 8,12,18
(e) Give the minimal elements of R. [2]
[Exercise 8.5.23] 2,3
(f) Is R a total order on A? Justify your answer. [2]
[Similar to Exercise 8.5.33] No, because for instance 2 - 3 ∧ 3 - 2.
(g) Give a chain of length 3 for R. [2]
A chain of length 3 has 4 elements, but no such chain exists for R. There are various chains of
length 2 for R, such as {2,4,8}.