Discrete Structures: Midterm

advertisement
Discrete Structures: Final Exam
Due: 1:00pm, Thursday, May 26.
Guidelines: It is an open-book test. No collaboration. Contact me directly or through emails if you
have questions. You can hand in a hard copy of the work and drop it in my mailbox, or send me an
electronic version through email (to my BUBBS account shieu-hong.lin@bubbs.biola.edu
and make sure you keep a copy).
1. Let p, q, r, s be four propositions. Let + denote the disjunction operator (i.e. logical OR), .
denote the conjunction operator (i.e. logical AND), and ~ denote the negation operator (i.e.
logical NOT), (i) Prove that (p.r)+(p.s)+(q.r)+(q.s) is logically equivalent to (p+q).(r+s) by
using a truth table. (ii) Prove it again by applying algebra of propositions in Table 4-1. (iii)
Prove that (p+r).(p+s).(q+r).(q+s) is logically equivalent to (p.q)+(r.s) by applying algebra of
propositions in Table 4-1.
2. John says that a year X is a leap year if and only if ( (X is divisible by 4) and (X is divisible by
400 or X is not divisible by 100) ). Let DivisibleBy4, DivisibleBy100 and DivisibleBy400
denote the atomic propositions that X is divisible by 4, by 100, by 400 respectively. Please
translate John’s definition of what is a leap year into a compound logic proposition involving
the atomic propositions above and the logical operations mentioned in chapter 4.
3. Mary says that a year X is a leap year if and only if it is not that (X is not divisible by 4 or (X is
divisible by 100 but not by 400.)). Let DivisibleBy4, DivisibleBy100 and DivisibleBy400
denote the atomic propositions that X is divisible by 4, by 100, by 400 respectively. Please
translate Mary’s definition of what is a leap years into a compound logic proposition involving
the atomic propositions above and the logical operations mentioned in chapter 4.
4. Prove that John’s compound logic proposition is logically equivalent to Mary’s compound
logic proposition by applying algebra of propositions in Table 4-1.
5. Johnny is responsible of assigning 8 courses to classrooms. There is no overlap of class time
between any of the 8 courses, and Johnny has 3 classrooms, x, y, and z available for the 8
courses. So each course can be assigned to any one of the classrooms. Suppose that Johnny
randomly assign each of the 8 courses to one of the 3 classrooms. (i) How many different ways
could Johnny assign the 8 courses to the 3 classrooms? (ii) Among the possible ways of
classroom assignment, how many of them assign no courses to a specific classroom x? (In
other words, x is not used by any course.) (iii) Among the possible ways of classroom
assignment, how many of them assign no courses to two specific classrooms x and y? (In other
words, x and y are not used by any course.) (iv) Use one of the counting principles mentioned
in chapter 6 to prove that at least one of the rooms will serve at least 3 courses no matter how
Johnny does the classroom assignment.
6. Continue with problem #5. We would like to determine how many possible ways of class
assignment leave at least one of the 3 classrooms unused. Let U be the universe set of all
different ways of class assignment. Let X denote the set of possible ways of class assignment
that assign NO courses to classroom x. Let Y denote the set of possible ways of class
assignment that assign NO courses to classroom y. Let Z denote the set of possible ways of
class assignment that assign NO courses to classroom z. In terms of set notations, our task is to
determine n( X  Y  Z ), i.e. the size of the union of the three sets, X, Y, and Z. (i) Using the
principle of Inclusion-Exclusion, write down the formula to express n( X  Y  Z) in terms of
n( X ), n( Y ), n( Z ), n( X  Y), n( X  Z), n( Y  Z), n( X  Y  Z). (ii) What are the values
of n( X ), n( Y ), n( Z ), n( X  Y), n( X  Z), n( Y  Z), n( X  Y  Z) respectively? (iii)
Apply the formula in (i) and the information in (ii) to determine n( X  Y  Z ) (iv) What is
n( ( X  Y  Z )c ), i.e. the size of the complement of X  Y  Z (v) Assuming that all the
possible ways of class assignment are equally likely, what is the probability that every room is
used by at least one course?
7. Dr. Coin wants to conduct an experiment and tosses a fair coin n times, and each time he will
write down a letter, either H or T depending on whether he gets the head (H) or the tail (T).
After tossing the coin n times, he will get a string of n letters, each of which is either H or T.
There are 2n possible strings Dr. Coin may get in the end since each letter could be either H or
T. Each time Dr. Coin conducts such an experiment he may get any of the2 n possible strings.(i)
Among the 2n possible strings, how many of them have no H at all? How many of them have
exactly 1 H? How many of them have exactly 2 H’s? (ii) In general for any integer i, 0 i n,
how many among the 2n possible strings have exactly i H’s in terms of binomial coefficients?
(iii) For a fair coin, it is reasonable to assume that each of the 2n possible strings are equally
likely to be the result. Based on this assumption of the probability space, what is the
probability of having exactly i H’s in the result, i.e. Probability(Exactly i heads in the result)?
(iv) Now we want to calculate the expected number of H’s Dr. coin will see if he repeated
conduct the same experiment for many times. The expected value of the number of H’s in the
result should be Σ 0in i * Probability(Exactly i heads in the result). Prove that this
expected value is n/2.
8. Solve the following first order linear recurrence relations
(i) a1=3, and for 2n we have an=2*an-1 –1 (ii) b1=4, and for 2n we have bn=3*bn-1 – n
9. Consider the following second order linear recurrence relation about dn
d0=0, d1=3, and for 2n we have dn=3*dn-1 - 2dn-2 - 1
Solve it according to the following hints:
First, you can rewrite the recurrence relation as
d0=0, d1=3, and for 2n , dn-dn-1 = 2*(dn-1 - dn-2 ) -1.
Second, let’s define for 1i si = di-di-1 . Then we get the recurrence relation about sn
s1=3, for 2n sn= 2*sn-1 - 1 .
Note that this is the same recurrence relation as in 8.(i).
Finally, based on your solution to 8.(i), you know the closed form solution for sn as a function of
n. Plug it in and now you get the following first order recurrence relation about dn
d0=0, and for 1n dn-dn-1 = the closed form solution for sn
Solve this recurrence relation to determine the closed form solution for dn as a function of n.
10. Consider the recurrence relation: b1=1, and for 2n bn=2*bn-1 +n
Use mathematical induction to prove bn= 2n+1 – n –2 for 1n is the closed form solution for bn.
11. Consider a complete graph of 15 vertices: a, b, c, d, e, f, g, h, i, j, k, l, m, n, o
The following page gives you the length of edges connecting these 15 vertices and the
shortest distance between vertices after conducting the shortest path calculation.
(i) Explain that how you can find a shortest path between any given pair of vertices, given
the information of the length of edges connecting the vertices and the shortest distance
between vertices (after conducting the shortest-path calculation).
(ii) Apply what you say above to find a shortest path from vertex c to vertex o.
The length of edges between vertices
a b c d e
a:
b:
c:
d:
e:
f:
g:
h:
i:
j:
k:
l:
m:
n:
o:
f g h i
j
k l
m n o
0 51 57 44 50 39 14 28 28 32 54 15 15 11 37
51 0 11 21 65 12 37 46 61 34 12 43 62 32 31
57 11 0 66 48 45 57 16 21 28 19 62 57 29 65
44 21 66 0 64 33 61 12 43 43 54 31 41 63 38
50 65 48 64 0 57 54 32 67 67 29 33 31 59 68
39 12 45 33 57 0 26 45 60 52 58 56 50 12 14
14 37 57 61 54 26 0 38 36 55 60 19 20 60 16
28 46 16 12 32 45 38 0 31 43 18 19 33 34 44
28 61 21 43 67 60 36 31 0 46 30 56 66 21 38
32 34 28 43 67 52 55 43 46 0 34 49 36 53 27
54 12 19 54 29 58 60 18 30 34 0 68 48 52 19
15 43 62 31 33 56 19 19 56 49 68 0 51 43 45
15 62 57 41 31 50 20 33 66 36 48 51 0 29 28
11 32 29 63 59 12 60 34 21 53 52 43 29 0 34
37 31 65 38 68 14 16 44 38 27 19 45 28 34 0
The shortest distance between vertices after calculation
a b c d e
a:
b:
c:
d:
e:
f:
g:
h:
i:
j:
k:
l:
m:
n:
o:
f
g h i
j
k l
m n o
0 35 40 40 46 23 14 28 28 32 46 15 15 11 30
35 0 11 21 41 12 37 27 32 34 12 43 50 24 26
40 11 0 28 48 23 48 16 21 28 19 35 49 29 37
40 21 28 0 44 33 50 12 43 43 30 31 41 45 38
46 41 48 44 0 53 51 32 59 63 29 33 31 57 48
23 12 23 33 53 0 26 39 33 41 24 38 38 12 14
14 37 48 50 51 26 0 38 36 43 35 19 20 25 16
28 27 16 12 32 39 38 0 31 43 18 19 33 34 37
28 32 21 43 59 33 36 31 0 46 30 43 43 21 38
32 34 28 43 63 41 43 43 46 0 34 47 36 43 27
46 12 19 30 29 24 35 18 30 34 0 37 47 36 19
15 43 35 31 33 38 19 19 43 47 37 0 30 26 35
15 50 49 41 31 38 20 33 43 36 47 30 0 26 28
11 24 29 45 57 12 25 34 21 43 36 26 26 0 26
30 26 37 38 48 14 16 37 38 27 19 35 28 26 0
Download