# Assignment1 Discrete Maths

```1. There are two webcams, X and Y that can automatically switch On or Off at any given time to
record a live video streaming session. To ensure the smooth recording session, the live feed
input system is programmed with certain criteria. The conditions set are; if webcam X and
webcam Y are switch on, the input system can enable the recording input and the live
session will start. If either webcam X or webcam Y is switched on, the input system cannot
enable the recording and the live session will stop. In all other conditions, the input system
will enable the recording and the live session streaming will commence. a. Based on the
scenario above, generate a simple pseudocode with a function that has x and y as inputs
and livestream and nolivestream as outputs.
a. On a particular day, Prof. Z is intending to have a live session discussion with his
students. He informs his students before the session that “If webcam X works while
the other doesn't or the other way round, I’m afraid that the live discussion session
would not take place”. Represent it in a simple pseudocode the scenario of what was
said by Prof. Z.
b. Translate the pseudocodes in part (a.) and (b.) into propositional logic statements.
c. Using a Truth table, determine if what Prof. Z had stated is consistent with what the
input system was programmed to do.
2. There is an island with two mythical creatures, the Komos and the Dragos. Komos loves
eating visitors to the island while Dragos hates to eat visitors. One fine day, you
mysteriously end up on the island and encounter two creatures, Blue and Red. The Blue
creature smiles and tell you, “Don’t be afraid! We both are not human eaters”. Determine, if
possible, whether the Blue and Red creatures is a Komos or a Dragos.
3. Let A, B and C denotes the sets with the universal set, U. Prove the following equivalence:
π΄∩(π΅∪πΆ)=(π΄∩π΅)∪(π΄∩πΆ).
Let A and B denote the sets with the universal set, U. The symmetric difference of two sets, A
&amp; B is denoted by A Δ B and is defined as such:
A Δ B = (A-B) ∪ (B-A)
4. Prove using Set Builder notation that an equivalent definition of the symmetric difference of
two sets A &amp; B is
A Δ B = (A∪B) − (A∩B)
5. In a set of integers between the numbers 100 and 100,000, how many of these numbers are
divisible by 2, 5, 9 and 13?
6. Find the result for the following double summation.
Question1
1a. Pseudocode
Start
x ο webcam x
y ο webcam y
function checkLivestream(x,y)
if (x=1 and y=1)
return livestream
if (x=1 and y=0)
return nolivestream
if (x=0 and y=1)
return nolivestream
if (x=0 and y=0)
return livestream
end
1b. Live discussion pseudocode
Start
x ο webcam x
y ο webcam y
function check live discussion(x,y)
if x=1 and y=1
return live discussion
if x=1 and y=0
return no live discussion
if x=0 and y=1
return no live discussion
if x=0 and y=0
return live discussion
end
1c.
Let:
X = webcam x is turned on
Y = webcam y is turned on
L = the livestream will occur
D = the live discussion will occur
For part 1a:
π∧π =πΏ
&not;π ∧ π = &not;πΏ
π ∧ &not;π = &not;πΏ
&not;π ∧ &not;π = πΏ
For part 1b:
&not;π ∧ π = &not;π·
π ∧ &not;π = &not;π·
π∧π =π·
&not;π ∧ &not;π = π·
1d.
X
Y
&not;π
&not;π
T
T
F
F
T
F
T
F
F
F
T
T
F
T
F
T
π∧π
T
F
F
T
&not;π ∧ &not;π
T
F
F
T
π ∧ &not;π
F
T
T
F
&not;π ∧ π
F
T
T
F
Based on the truth table above, the truth values of X ∧ Y = &not;X ∧ &not;Y and X ∧ &not;Y=
&not;X ∧ Y, therefore what Prof. Z had stated is consistent with what the input
system was programmed to do.
2.
3.
πππ‘ π₯ ππ π΄ ∩ (π΅ ∪ πΆ),
πβππ π₯ ππ  ππ π΄ πππ (π΅ ∪ πΆ),
πππ‘ π₯ ππ (π΄ ∩ π΅) ∪ (π΅ ∩ πΆ),
πβππ π₯ ππ  ππ π΄ ∩ (π΅ ∪ πΆ),
πΌπ π₯ ππ  ππ π΅, π‘βππ π₯ ππ  ππ (π΄ ∩ π΅)
πΌπ π₯ ππ  ππ πΆ, π‘βππ π₯ ππ  ππ (π΄ ∩ πΆ)
∴ (π΄ ∩ π΅) ∪ (π΄ ∩ πΆ) ⊆ π΄ ∩ (π΅ ∪ πΆ)
∴ π₯ ππ  ππ (π΄ ∩ π΅) ∪ (π΄ ∩ πΆ)
π΄ ∩ (π΅ ∪ πΆ) ⊆ (π΄ ∩ π΅) ∪ (π΄ ∩ πΆ)
Therefore, π΄ ∩ (π΅ ∪ πΆ) ⊆ (π΄ ∩ π΅) ∪ (π΄ ∩ πΆ)
4.
π΄βπ΅ = (π΄ − π΅) ∪ (π΅ − π΄)
πΏππ‘ π₯ ∈ (π΄ − π΅) ∪ (π΅ − π΄)
πβππ π₯ ∈ (π΄ ∪ π΅) − (π΄ ∩ π΅)
π₯ ∈ (π΄ ∩ π΅)πππ π₯ ∉ (π΄ ∩ π΅)
(π₯ ∈ π΄ πππ π₯ ∉ π΅) ππ (π₯ ∈ π΅ πππ π₯ ∉ π΄)
(π₯ ∈ π΄ ππ π₯ ∈ π΅) πππ (π₯ ∉ π΅ ππ π₯ ∉ π΄)
π₯ ∈ (π΄ ∪ π΅) − (π΄ ∩ π΅)
(π₯ ∈ π΄ ππ π₯ ∈ π΅) πππ (π₯ ∉ π΅ ππ π₯ ∉ π΄)
(π₯ ∈ π΄ πππ π₯ ∉ π΅) ππ (π₯ ∈ π΅ πππ π₯ ∉ π΄)
π₯ ∈ (π΄ − π΅) ∪ (π΅ − π΄)
∴ (π΄ − π΅) ∪ (π΅ − π΄) ⊆ (π΄ ∪ π΅) − (π΄ ∩ π΅)
(π΄ ∪ π΅) − (π΄ ∩ π΅) ⊆ (π΄ − π΅) ∪ (π΅ − π΄)
Therefore, (π΄ − π΅) ∪ (π΅ − π΄) = (π΄ ∪ π΅) − (π΄ ∩ π΅)
5.
100ο100,000
a. For numbers divisible by 2 less than 100,000
100,000
⌋
2
= 50,000
=⌊
Numbers divisible by 2 that is less than 100
100
⌋−1
2
= 50 − 1
= 49
=⌊
= 50,000 − 49
= 49,951
Therefore, there are 49,951 numbers that are divisible by 2 whose values
are less than 100,000 and more than or equal to 100.
b. For numbers divisible by 5 that is less than 100,000
100,000
=⌊
⌋
5
= 20,000
Numbers divisible by 5 that is less than 100
100
=⌊
⌋−1
5
= 20 − 1
= 19
= 20,000 − 49
= 19,981
Therefore, there are 19,981 numbers that are divisible by 5 whose values
are less than 100,000 and more than or equal to 100.
c. For numbers divisible by 9 that is less than 100,000
100,000
=⌊
⌋
9
= 11,111
Numbers divisible by 9 that is less than 100
100
=⌊
⌋
9
= 11
= 11,111 − 11
= 11,100
Therefore, there are 11,100 numbers that are divisible by 9 whose values
are less than 100,000 and more than or equal to 100.
d. For numbers divisible by 13 that is less than 100,000
100,000
=⌊
⌋
13
= 7692
Numbers divisible by 13 that is less than 100
100
=⌊
⌋
13
=7
= 7692 − 7
= 7685
Therefore, there are 7625 numbers that are divisible by 13 whose values
are less than 100,000 and more than or equal to 100.
e. For numbers divisible by 2, 5, 9, and 13 that is less than 100,000
Prime factors:
2=2
5=5
9 =3&times;3
13 = 13
LCM of 2, 5, 9, and 13 = 2 &times; 32 &times; 5 &times; 13
=1170
⌊
100,000
⌋ = 85
1170
Therefore, there are 85 numbers that are divisible by 2, 5, 9, and 13 whose
values are less than 100,000 but more than or equal to 100.
6.
π
5
∑ ∑ 3ππ
π=1 π=1
π
= ∑[3π + 3(2)π + 3(3)π + 3(4)π + 3(5)π]
π=1
π
= ∑[3π + 6π + 9π + 12π + 15π]
π=1
π
= ∑[45π]
π=1
π
= 45 ∑ π
π=1
Using Sum Formula
π
1
∑ π = π(π + 1)
2
π=1
1
= 45 ( π(π + 1))
2
45π(π + 1)
=
2
```