$30
CSC2047 – Assessment: Individual Coursework 1
Question Sheet
Total Marks: 100
1.
a. Let π΄, π΅ and πΆ be sets. Show that π΄ × (π΅ ∩ πΆ) = (π΄ × π΅) ∩ (π΄ × πΆ)
(4 marks)
b. Let π: β → β and π: β → β be functions such that
π(π₯) = 5π₯ − 2 and π(π₯) = π₯
2 − 4.
Give a definition for the composite function π β π.
(4 marks)
c. A graph πΊ = (π, πΈ) is said to be isomorphic to a graph π» = (π
′
,πΈ
′
) if there exists a
bijective function, π, from the vertices of πΊ to the vertices of π» such that for two
adjacent vertices in πΊ, π’ and π£, the corresponding vertices in π», π(π’) and π(π£), are
adjacent.
Given the two graphs
πΊ = ({1,2,3},{(1,2), (2,3)}) and π» = ({−2,0,2},{(−2,0), (0,2)},
show that πΊ is isomorphic to π».
(12 marks)
2.
a. Given the graph πΊ, which can be illustrated as
Formally define the graph πΊ′ which is the largest possible subgraph of πΊ where every
vertex in πΊ′ has degree 3.
(5 marks)
4
1
2
3
5
2
3
1
0 -2
2
CSC2047 – Assessment: Individual Coursework 1
b. Using appropriate propositional variables, construct a well-formed formula (WFF) for
the expression:
“If Paul and Jay go to the shops then Alex will not go to the shops.”
Make sure to clearly state how your propositional variables relate to the expression.
(7 marks)
c. Using the same propositional variables defined in (2b), construct a WFF for the
expression:
“Either Alex or Paul go to the shops with Jay, which is the same as saying, Alex and
Jay go to the shops and not Paul, or, Paul and Jay go to the shops and not Alex.”
(8 marks)
3. Let π΄ be an array of 15 integers and π΅ be an array of 10 integers. The arrays π΄ and π΅ are
indexed from 1 to 15 and 1 to 10 respectively. Construct predicates to assert that
a. The third element of π΄ is larger than all elements of π΅.
(3 marks)
b. The elements of π΅ form a consecutive sequence within π΄.
(3 marks)
c. If π₯ is an element of π΄ then – π₯ is an element of π΅.
(7 marks)
d. The value 7 occurs only once in π΄.
(7 marks)
4.
a. Let π₯, π¦ ∈ β€. Prove by construction that the sum of π₯ + π¦ is even when
i. π₯ and π¦ are both even,
(4 marks)
ii. π₯ and π¦ are both odd.
(4 marks)
b. Prove by construction, that for any π ∈ β€ that (π
2 mod 2) = 0 or 1.
(12 marks)
5.
a. Give a recursive definition for the following sequence which is defined over the
natural numbers:
−2, 6, −18, 54, −162, 486, …
(3 marks)
b. Use the pseudo code below to formulate an equivalent recursive definition
Function f(n)
if n = 0:
return 1;
else:
return f(n-1)+3n+2;
end
end
(3 marks)
CSC2047 – Assessment: Individual Coursework 1
c. Using your recursive definition from (5b) compute π(3).
(1 mark)
d. Find a closed-form solution to the function
π(π) = {
0 ππ π = 0
π(π − 1) + 2π ππ‘βπππ€ππ π
(5 marks)
e. Prove, by induction, that your closed-form solution in (5d) is correct.
(8 marks)