Professional Documents
Culture Documents
DS Revision1
DS Revision1
Chapter 0 Ngoc Le
Revision
Discrete Structures for Computing on May 15, 2020
Logic
Propositional logic
Predicate logic
Proving methods
Set theory
Set
Function
Relation
Counting
Probability
1 Logic
Propositional logic
Predicate logic
Proving methods
Logic
Propositional logic
2 Set theory Predicate logic
Set theory
Function Set
Relation Function
Relation
Counting
Probability
3 Counting
4 Probability
0.2
Revision
Propositional logic
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Counting
g x + y = y + z nếu x = z. Probability
0.3
Revision
Propositional logic
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
b (p → q) ∧ (p → r) và p → (q ∧ r) Proving methods
Set theory
c (p → r) ∧ (q → r) và (p ∨ q) → r Set
Function
d (p → q) ∨ (p → r) và p → (q ∨ r) Relation
e ¬p → (q → r) và q → (p ∨ r) Counting
Probability
f p ↔ q và (p → q) ∧ (q → p)
0.4
Revision
Proving methods
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
(Giả sử đảo nghĩa của học ’giỏi’ là học ’yếu’.) Set theory
Set
a Minh giỏi Toán nhưng yếu Anh văn Function
Relation
b Minh yếu cả Toán lẫn Anh văn Counting
c Minh giỏi Toán hay Minh vừa giỏi Anh văn nhưng vừa yếu Probability
Toán
d Nếu Minh giỏi Toán thì Minh giỏi Anh văn
e Minh giỏi Toán và Anh văn hay Minh yếu Toán nhưng giỏi
Anh
0.5
Revision
Predicate logic
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Set theory
b ∀xN (x) Set
Function
c ¬∃xN (x) Relation
Probability
e ¬∀xN (x)
f ∀x¬N (x)
0.6
Revision
Predicate logic
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
0.7
Revision
Proving methods
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Logic
Propositional logic
Show that if n is an integer and n3 + 2015 is odd, then n is even Predicate logic
Set theory
a a proof by contrapositive. Set
Function
b a proof by contradiction. Relation
Counting
Probability
0.8
Revision
Proving methods
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Set theory
equivalent: (i) n is even, (ii) n + 1 is odd, (iii) 3n + 1 is odd, Set
Probability
d Prove that 32n−1 + 1 is divisible by 4 for all n ≥ 1.
0.9
Revision
Set
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Logic
Let A = {1, 2, 3, 4, 5} and B = {0, 3, 6}. Find Propositional logic
Predicate logic
a A∩B Proving methods
c A−B Function
Relation
d B−A Counting
Probability
0.10
Revision
Set
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Set theory
Set
Show that if A and B are sets, then Function
Relation
b (A ∩ B) ∪ (A ∩ B) = A Probability
0.11
Revision
Set
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
For each of these relations on the set {1, 2, 3, 4}, decide whether it
is reflexive, whether it is symmetric, whether it is antisymmetric, Logic
and whether it is transitive. Propositional logic
Predicate logic
a {(2, 2), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4)} Proving methods
Set theory
b {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)} Set
Function
c {(2, 4), (4, 2)} Relation
Probability
e {(1, 1), (2, 2), (3, 3), (4, 4)}
f {(1, 3), (1, 4), (2, 3), (2, 4), (3, 1), (3, 4)}
0.12
Revision
Function
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Tìm sáu số hạng đầu tiên của dãy được định nghĩa bằng công Logic
thức truy hồi và điều kiện đầu sau. Propositional logic
Predicate logic
a an = −2an−1 , a0 = −1 Proving methods
Set theory
b an = an−1 + an−2 , a0 = 2, a1 = −1 Set
c an = 4a2n−1 , a0 = 1 Function
Relation
Probability
e an = an−1 + an−3 , a0 = 1, a1 = 2, a2 = 0
0.13
Revision
Function
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Tìm f (1), f (2), f (3) và f (4) nếu f (n) được định nghĩa một cách Logic
Propositional logic
đệ quy với f (0) = 1 và n = 0, 1, 2, . . . Predicate logic
Proving methods
a f (n + 1) = f (n) + 2. Set theory
b f (n + 1) = 3f (n). Set
Function
f (n)
c f (n + 1) = 2 . Relation
Counting
2
d f (n + 1) = f (n) + f (n) + 1 Probability
0.14
Revision
Function
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Xác định xem các hàm sau có phải song ánh từ R đến R hay Logic
Propositional logic
không: Predicate logic
Proving methods
a f (x) = 2x + 1 Set theory
b f (x) = x2 + 1 Set
Function
3
c f (x) = x Relation
Counting
2 2
d f (x) = (x + 1)/(x + 2) Probability
0.15
Revision
Function
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Cho mô tả các hàm như sau và hãy trả lời giải thích cho các câu
hỏi sau:
• Thông tin cung cấp có đủ để xác định một hàm số không? Logic
Propositional logic
• Có thể xác định được hàm là đơn ánh? toàn ánh? song ánh? Predicate logic
Proving methods
0.16
Revision
Function
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Logic
Hãy nhận dạng quy luật của dãy số nguyên sau, sau đó tìm ba số Propositional logic
Predicate logic
hạng tiếp theo của dãy. Proving methods
Probability
0.17
Revision
Relation
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Logic
Cho R là quan hệ trên tập {0,1,2,3} có chứa các cặp (0,1), (1,1), Propositional logic
Predicate logic
(1,2), (2,0), (2,2) và (3,0). Tìm Proving methods
Probability
0.18
Revision
Relation
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Xác định xem quan hệ R trên tập tất cả các trang Web là phản
xạ, đối xứng, phản đối xứng, hay bắc cầu, trong đó (a, b) ∈ R khi Logic
a Tất cả những ai đã xem trang Web a cũng xem trang Web b. Proving methods
Set theory
b Tại cả hai trang Web a và b không có liên kết nào giống nhau. Set
Function
c Có ít nhất một liên kết giống nhau trên trang Web a và trang Relation
Web b. Counting
Probability
d Có một trang Web có chứa liên kết đến cả trang Web a lẫn
trang Web b.
0.19
Revision
Relation
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Các quan hệ sau trên {0, 1, 2, 3}, quan hệ nào là tương đương.
Nếu không phải, hãy chỉ ra tính chất còn thiếu để nó trở thành Logic
tương đương. Nếu là tương đương, hãy chỉ ra các lớp đương tương Propositional logic
Predicate logic
của nó. Proving methods
a {(0, 0), (1, 1), (2, 2), (3, 3)} Set theory
Set
b {(0, 0), (0, 2), (2, 0), (2, 2), (2, 3), (3, 2), (3, 3)} Function
Relation
c {(0, 0), (1, 1), (1, 2), (2, 1), (2, 2), (3, 3)} Counting
Probability
d {(0, 0), (1, 1), (1, 3), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)}
e {(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 2), (3, 3)}
0.20
Revision
Relation
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Cho R là quan hệ trên tập gồm các cặp số nguyên dương sao cho Logic
Propositional logic
((a, b), (c, d)) ∈ R nếu và chỉ nếu a + d = b + c. Predicate logic
Proving methods
a Chứng minh rằng R là một quan hệ tương đương. Set theory
b Lớp tương đương của (1,2) với quan hệ tương đương R là gì? Set
Function
Relation
c Hãy biểu diễn bằng lời các lớp tương đương của quan hệ
Counting
tương đương R. Probability
0.21
Revision
Counting
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Logic
Propositional logic
Predicate logic
Proving methods
Set theory
Set
Function
Relation
Counting
Probability
0.22
Revision
Counting
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
|A3 | = 2 × 1 × 1 × 1 × 1 × 1 × 1 × 2 × 2 × 2 = 16.
Tương tự, |A4 | = |A5 | = |A6 | = 16.
Do đó, |A| = 32 + 16 + 16 + 16 + 16 + 16 = 112.
Gọi B là tập chuỗi bit có chiều dài 10 có chứa dãy 5 số 1 liên tiếp. Tương tự như A, ta
có |B| = 32 + 16 + 16 + 16 + 16 + 16 = 112.
Hơn nữa, A ∩ B = {0000011111, 1111100000}.
Theo nguyên lý inclusion-exclusion, số chuỗi bit có chiều dài là 10 có chứa hoặc 5 số 0
liên tiếp hoặc 5 số 1 liên tiếp là
|A ∪ B| = |A| + |B| − |A ∩ B| = 112 + 112 − 2 = 222.
0.22
Revision
Counting
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Set theory
Set
Function
Relation
Counting
Probability
0.23
Revision
Counting
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
a There are 10 ways to choose the first digit, 9 ways to choose Function
Relation
the second, and so on; therefore the answer is
Counting
10 · 9 · 8 · 7 = 5040 Probability
b There are 10 ways to choose the first three digits and 5 ways
to choose the last; therefore the answer is 10.10.10.5 = 5000
c There are 4 ways to choose the position that is to be different
from 9, and 9 ways to choose the digit to go there. Therefore
there are 4.9 = 36 such strings.
0.23
Revision
Counting
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Logic
Propositional logic
A student has three mangos, two papayas, and two kiwi fruits. If Predicate logic
Proving methods
the student eats one piece of fruit each day, and only the type of Set theory
fruit matters, in how many different ways can these fruits be Set
Function
consumed? Relation
Counting
Probability
0.24
Revision
Counting
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Logic
At a wedding, how many ways a photographer can arrange six Propositional logic
Predicate logic
people in a row, including the bride and groom, if Proving methods
Probability
0.25
Revision
Counting
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Probability
c Using your answer to part (a), determine how long it takes a
hacker to try every possible password, assuming that it takes
one nanosecond for a hacker to check each possible password.
0.26
Revision
Counting
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
How many ways are there to distribute five balls into three boxes if
each box must have at least one ball in it if
a) both the balls and boxes are labeled?
Logic
b) the balls are labeled, but the boxes are unlabeled? Propositional logic
Predicate logic
Proving methods
Set theory
Set
Function
Relation
Counting
Probability
0.27
Revision
Counting
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
How many ways are there to distribute five balls into three boxes if
each box must have at least one ball in it if
a) both the balls and boxes are labeled?
Logic
b) the balls are labeled, but the boxes are unlabeled? Propositional logic
Predicate logic
Proving methods
lại chứa 1 ball. TH2 gồm 2 hộp mỗi hộp chứa 2 balls, 1 hộp Counting
0.27
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Set theory
Set
Function
Relation
Counting
Probability
0.28
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
0.28
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
c What is the probability that a fair die never comes up an even Function
Relation
number when it is rolled six times? Counting
0.29
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Logic
Propositional logic
Predicate logic
Suppose that E and F are events such that p(E) = 0.7 and Proving methods
Set theory
p(F ) = 0.5. Show that p(E ∪ F ) ≥ 0.7 and p(E ∩ F ) ≥ 0.2 . Set
Function
Relation
Counting
Probability
0.30
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Assume that the probability a child is a boy is 0.51 and that the
sexes of children born into a family are independent. What is the
probability that a family of five children has
a exactly three boys? Logic
Propositional logic
b at least one boy? Predicate logic
Proving methods
c at least one girl? Set theory
Set
d all children of the same sex? Function
Relation
Counting
Probability
0.31
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Assume that the probability a child is a boy is 0.51 and that the
sexes of children born into a family are independent. What is the
probability that a family of five children has
a exactly three boys? Logic
Propositional logic
b at least one boy? Predicate logic
Proving methods
c at least one girl? Set theory
Set
d all children of the same sex? Function
Relation
Counting
Solution
Probability
0.31
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Set theory
Set
Function
Relation
Counting
Probability
0.32
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Let’s name the bit string beginning with "1" is as event "A", and Set
Function
the bit string with at least 2 consecutive 0s as "B". So we can Relation
write: Counting
0.32
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Set theory
Set
Function
Relation
Counting
Probability
0.33
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Set theory
Solution Set
Function
Let A be the event that exactly four heads appear, and let B be Relation
Counting
the event that the first flip comes up tails. We have
1/25 Probability
p(A|B) = p(A∩B)
p(B) = 1/2 = 16
1
0.33
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Logic
Propositional logic
Predicate logic
Proving methods
Set theory
Set
Function
Relation
Counting
Probability
0.34
Revision
Probability
Huynh Tuong Nguyen,
Tran Tuan Anh, Nguyen
Ngoc Le
Logic
Propositional logic
Predicate logic
Proving methods
Set theory
Set
Function
Relation
Counting
Probability
0.35