Discrete Mathematics Midterm 2 Q&A
Discrete Mathematics Midterm 2 Q&A
𝒑 ¬𝒑 ¬𝒑 ∨ 𝒑
T F T
F T T
is a tautology
𝑝 𝑞 𝑟 (𝑝 ∨ 𝑞) ¬(𝑝 ∨ 𝑞) ¬(𝑝 ∨ 𝑞) ↔ 𝑟 (𝑝 → 𝑟) 𝑞 ∧ (𝑝 → 𝑟)
T T T T F F T T
T T F T F T F F
T F T T F F T F
T F F T F T F F
F T T T F F T T
F T F T F T T T
F F T F T T T F
F F F F T F T F
Not Logically Equivalent
𝑆 = ∅, or 2𝑆 = {∅, {{∅}}}
2. Use set builder notation and logical equivalences to prove the second distributive law,
(2 Marks)
which states that 𝑨 ∩ (𝑩 ∪ 𝑪) = (𝑨 ∩ 𝑩) ∪ (𝑨 ∩ 𝑪) for all sets 𝑨, 𝑩, and 𝑪.
----------------------------------------------------------------------------------------------------------------------------
𝑨 ∩ (𝑩 ∪ 𝑪) = {𝒙| 𝒙 ∈ 𝑨 ∧ 𝒙 ∈ (𝑩 ∪ 𝑪)}
𝑨 ∩ (𝑩 ∪ 𝑪) = {𝒙| 𝒙 ∈ 𝑨 ∧ (𝒙 ∈ 𝑩 ∨ 𝒙 ∈ 𝑪)}
𝑨 ∩ (𝑩 ∪ 𝑪) = {𝒙| (𝒙 ∈ 𝑨 ∧ 𝒙 ∈ 𝑩) ∨ (𝒙 ∈ 𝑨 ∧ 𝒙 ∈ 𝑪)}
----------------------------------------------------------------------------------------------------------------------------
1 2 2 1 2 9 2
[0 0 3 ] × [3 −1] = [ 3 1]
1 3 −1 1 1 9 −2
1 0 2
𝐀 = [2 0 5]
2 5 −1
NO, because 𝐀 ≠ 𝐀𝑡
3. List all the steps used to search for 9 in the sequence 4, 3, 5, 9, 6, 11, 8, using a linear (3 Marks)
search algorithm. (Note: start from the left)
----------------------------------------------------------------------------------------------------------------------------
2- Compare 9 with the value in the location 𝑖 = 1, because the numbers are not equal (9 ≠ 4), then
4- Compare 9 with the value in the location 𝑖 = 2, because the numbers are not equal (9 ≠ 3), then
6- Compare 9 with the value in the location 𝑖 = 3, because the numbers are not equal (9 ≠ 5), then
8- Compare 9 with the value in the location 𝑖 = 4, because the numbers are equal (9 = 9), then
9- Stop, we found the number in this location (i.e., 𝑖 = 4) and then return 4.
----------------------------------------------------------------------------------------------------------------------------
GOOD LUCK,
Dr. Ahmed Hagag