CSC165 · TU past paper
Discrete Structures 2078 question paper
The complete TU 2078 exam paper for Discrete Structures (CSC165), all 12 questions with solved model answers written to the mark scheme.
Tap a question to open its answer.
- 110 marksmathematical InductionHideAnswer
Prove that for all integers x and y, if $x^2 + y^2$ is even then x + y is even. Using induction prove that $1^3 + 2^3 + 3^3 + ... + n^3 = n^2(n + 1)^2/4$ [10]
The contrapositive of "if x² + y² is even, then x + y is even" is: If x + y is odd, then x² + y² is odd. We prove the contrapositive. This is a valid approach because a statement and its contrapositive are logically equivalent. --- Assum...
- 210 marksPredicates and QuantifiersHideAnswer
State division and remainder algorithm. Suppose that the domain of the propositional function P(x) consists of the integer 0, 1, 2, 3 and 4. Write out each of the following propositions using disjunctions, conjunctions and negations. a. ∃x P(x)b. ∀x P(x)c. ∃x ¬P(x)d. ∀x ¬P(x)e. ¬∃x P(x)f. ¬∀x P(x)\text{a. } \exists x , P(x) \quad \text{b. } \forall x , P(x) \quad \text{c. } \exists x , \neg P(x) \quad \text{d. } \forall x , \neg P(x) \quad \text{e. } \neg \exists x , P(x) \quad \text{f. } \neg \forall x , P(x)a. ∃xP(x)b. ∀xP(x)c. ∃x¬P(x)d. ∀x¬P(x)e. ¬∃xP(x)f. ¬∀xP(x)[10]
Division and Remainder Algorithm + Quantifier Expansion
Part 1: Division and Remainder Algorithm (The Division Algorithm)
Statement
Division Algorithm: Let a be an integer and d a positive integer. Then there exist unique integers q and r with 0 ≤ r < d such that:
a = d·q + r
Where:
- d is called the divisor
- a is called the dividend
- q is called the quotient → written as
q = a div d - r is called the remainder → written as
r = a mod d
Procedure (div-mod algorithm from notes)
procedure div-mod(a ∈ Z, d ∈ Z⁺) q := 0 r := |a| while r ≥ d begin r := r - d q := q + 1 end if a < 0 and r > 0 then q := -(q + 1) r := d - r return q, rWorking principle: When a is positive, we subtract d from a repeatedly until what remains is less than d. The number of subtractions performed is the quotient q, and what remains is the remainder r.
Example
What is the quotient and remainder when 101 is divided by 11?
101 = 11 × 9 + 2
So:
q = 101 div 11 = 9andr = 101 mod 11 = 2
Part 2: Expanding Quantified Propositions
Given: Domain of P(x) = {0, 1, 2, 3, 4}
The key rules used are:
Quantifier Expansion Rule ∃x P(x) P(0) ∨ P(1) ∨ P(2) ∨ P(3) ∨ P(4) ∀x P(x) P(0) ∧ P(1) ∧ P(2) ∧ P(3) ∧ P(4)
a. ∃x P(x)
"There exists at least one x in the domain such that P(x) is true."
$$\exists x, P(x) \equiv P(0) \lor P(1) \lor P(2) \lor P(3) \lor P(4)$$
b. ∀x P(x)
"P(x) is true for every x in the domain."
$$\forall x, P(x) \equiv P(0) \land P(1) \land P(2) \land P(3) \land P(4)$$
c. ∃x ¬P(x)
"There exists at least one x for which P(x) is false."
$$\exists x, \neg P(x) \equiv \neg P(0) \lor \neg P(1) \lor \neg P(2) \lor \neg P(3) \lor \neg P(4)$$
d. ∀x ¬P(x)
"P(x) is false for every x in the domain."
$$\forall x, \neg P(x) \equiv \neg P(0) \land \neg P(1) \land \neg P(2) \land \neg P(3) \land \neg P(4)$$
e. ¬∃x P(x)
"There is no x for which P(x) is true."
By De Morgan's Law for quantifiers: ¬∃x P(x) ≡ ∀x ¬P(x)
$$\neg \exists x, P(x) \equiv \neg P(0) \land \neg P(1) \land \neg P(2) \land \neg P(3) \land \neg P(4)$$
Note: This is logically equivalent to part (d).
f. ¬∀x P(x)
"It is not the case that P(x) is true for all x."
By De Morgan's Law for quantifiers: ¬∀x P(x) ≡ ∃x ¬P(x)
$$\neg \forall x, P(x) \equiv \neg P(0) \lor \neg P(1) \lor \neg P(2) \lor \neg P(3) \lor \neg P(4)$$
Note: This is logically equivalent to part (c).
Summary Table
Proposition Expanded Form ∃x P(x) P(0) ∨ P(1) ∨ P(2) ∨ P(3) ∨ P(4) ∀x P(x) P(0) ∧ P(1) ∧ P(2) ∧ P(3) ∧ P(4) ∃x ¬P(x) ¬P(0) ∨ ¬P(1) ∨ ¬P(2) ∨ ¬P(3) ∨ ¬P(4) ∀x ¬P(x) ¬P(0) ∧ ¬P(1) ∧ ¬P(2) ∧ ¬P(3) ∧ ¬P(4) ¬∃x P(x) ¬P(0) ∧ ¬P(1) ∧ ¬P(2) ∧ ¬P(3) ∧ ¬P(4) ¬∀x P(x) ¬P(0) ∨ ¬P(1) ∨ ¬P(2) ∨ ¬P(3) ∨ ¬P(4)
Conclusion
Over a finite domain a quantifier is only a compact way of writing a long connective: the existential quantifier unfolds into a disjunction and the universal quantifier unfolds into a conjunction, one term for each element of the domain. The two De Morgan laws for quantifiers, $\neg \exists x, P(x) \equiv \forall x, \neg P(x)$ and $\neg \forall x, P(x) \equiv \exists x, \neg P(x)$, are visible directly in the table above, since (e) matches (d) and (f) matches (c). The division algorithm plays the same role for integers: it guarantees that for any integer $a$ and any positive divisor $d$ the pair $(q, r)$ with $a = dq + r$ and $0 \le r < d$ exists and is unique, which is what makes
divandmodwell defined operations. - 310 marksNumericalGraph IsomorphismHideAnswer
List all the necessary conditions for the graph to be isomorphic with an example. Find the maximal flow from the node SOURCE to SINK in the following network flow.[10]
Part 1: Conceptual question. No numeric data required. Part 2: The network diagram (the actual figure with its specific capacities) is not reproducible from the text provided, and no capacity matrix or edge list was supplied with the que...
- 45 marksNumericalBinomial CoefficientsHideAnswer
What is the coefficient of $x^2$ in $(1+x)^{11}$? Describe how relation can be represented using matrix. [5]
- Expression: $(1+x)^{11}$ - Required: coefficient of $x^2$ - Second task: describe matrix representation of a relation --- By the Binomial Theorem: $$(1+x)^n = \sum{k=0}^{n} \binom{n}{k} x^k$$ The term containing $x^k$ has coefficient
- 55 marksNumericalSolving Recurrence RelationsHideAnswer
Solve the recurrence relation $a_n = 5a_{n-1} - 6a_{n-2}$, with initial conditions $a_0 = 1$, $a_1 = 4$. [5]
Solution of Recurrence Relation
Step 1 - Given Data
$$a_n = 5a_{n-1} - 6a_{n-2}, \quad a_0 = 1,\ a_1 = 4$$
Step 2 - Solve
Characteristic equation. Assume $a_n = r^n$:
$$r^2 = 5r - 6 \implies r^2 - 5r + 6 = 0$$
Roots:
$$(r-2)(r-3) = 0 \implies r_1 = 2,\ r_2 = 3$$
Distinct roots, so the general solution is:
$$a_n = \alpha_1 \cdot 2^n + \alpha_2 \cdot 3^n$$
Apply initial conditions:
$n=0$: $\alpha_1 + \alpha_2 = 1 \quad (i)$
$n=1$: $2\alpha_1 + 3\alpha_2 = 4 \quad (ii)$
From $(i)$: $\alpha_1 = 1 - \alpha_2$. Substitute into $(ii)$:
$$2(1 - \alpha_2) + 3\alpha_2 = 4 \implies 2 + \alpha_2 = 4 \implies \alpha_2 = 2$$
$$\alpha_1 = 1 - 2 = -1$$
Final solution:
$$\boxed{a_n = 2\cdot 3^n - 2^n}$$
Verification:
$n$ $2\cdot3^n - 2^n$ Check 0 $2-1=1$ $a_0=1$ ✓ 1 $6-2=4$ $a_1=4$ ✓ 2 $18-4=14$ $5(4)-6(1)=14$ ✓ - 65 marksProof MethodsHideAnswer
Prove that if n is positive integer, then n is odd if and only if 5n + 6 is odd. [5]
We must prove a biconditional statement: n is odd $\iff$ 5n + 6 is odd A biconditional proof requires proving both directions: 1. (Forward) If n is odd, then 5n + 6 is odd. 2. (Backward) If 5n + 6 is odd, then n is odd. We use the standa...
- 75 marksRules of InferencesHideAnswer
Define proposition. Consider the argument 'John, a student in this class knows how to write program in C. Everyone who knows how to write program in C can get a high paying job. Therefore, someone in this class can get high paying job'. Now, explain which rules of inferences are used for each step. [5]
A proposition is a declarative statement that is either true or false, but not both. It has a definite truth value (T or F). Examples: - "The sky is blue." (True proposition) - "2 + 2 = 5." (False proposition) - "What time is it?" (NOT a...
- 85 marksNumericalPigeonhole PrincipleHideAnswer
Show that if there are 30 students in a class, then at least two have same names that begin with the same letter. Explain the pascal's triangle. [5]
Pigeonhole Principle and Pascal's Triangle
Given Data
- Number of students = 30
- Number of letters in the English alphabet = 26
Part 1: At Least Two Students Have Names Beginning with the Same Letter
Principle Used: Pigeonhole Principle
Statement: If $n$ objects are placed into $k$ boxes and $n > k$, then at least one box contains two or more objects.
More generally, if $n$ objects are placed into $k$ boxes, then at least one box contains at least $\left\lceil \dfrac{n}{k} \right\rceil$ objects.
Proof
Set up the correspondence:
- Pigeonholes (boxes): the 26 letters of the alphabet that a name can begin with. So $k = 26$.
- Pigeons (objects): the 30 students, each classified by the first letter of their name. So $n = 30$.
Since
$$n = 30 > 26 = k,$$
csc165-pascal-triangleby the Pigeonhole Principle at least one letter (box) must be assigned to more than one student.
Using the generalized form, the most crowded letter contains at least
$$\left\lceil \frac{30}{26} \right\rceil = \lceil 1.153\ldots \rceil = 2 \text{ students.}$$
Conclusion: At least two students have names beginning with the same letter. (Proved)
Worst case reasoning: Even if the first 26 students all get distinct starting letters, the remaining $30 - 26 = 4$ students must reuse letters already taken, forcing a repetition.
Part 2: Pascal's Triangle
Definition
Pascal's Triangle is a triangular array of the binomial coefficients $\binom{n}{r}$, where each interior entry equals the sum of the two entries directly above it.
Construction Rule
$$\binom{n}{r} = \binom{n-1}{r-1} + \binom{n-1}{r}$$
with boundary conditions
$$\binom{n}{0} = 1, \qquad \binom{n}{n} = 1 \quad \text{for all } n \ge 0.$$
The Triangle (First 6 rows)
Row 0: 1 Row 1: 1 1 Row 2: 1 2 1 Row 3: 1 3 3 1 Row 4: 1 4 6 4 1 Row 5: 1 5 10 10 5 1Key Properties
Property Description Symmetry $\binom{n}{r} = \binom{n}{n-r}$ Row Sum $\displaystyle\sum_{r=0}^{n}\binom{n}{r} = 2^{n}$ Binomial Theorem Row $n$ gives coefficients of $(x+y)^n$ Borders All edge entries equal $1$ Application: Binomial Theorem
$$(x+y)^n = \sum_{r=0}^{n}\binom{n}{r} x^{n-r} y^{r}$$
Using Row 3:
$$(x+y)^3 = x^3 + 3x^2y + 3xy^2 + y^3$$
Verification of the addition rule
$$\binom{4}{2} = \binom{3}{1} + \binom{3}{2} = 3 + 3 = 6,$$
which matches the middle entry of Row 4.
Summary: With 30 students and only 26 possible initial letters, the Pigeonhole Principle guarantees at least two students share a starting letter. Pascal's Triangle arranges the binomial coefficients so each value is the sum of the two above it, encoding the coefficients of $(x+y)^n$.
- 95 marksShortest Path AlgorithmHideAnswer
Illustrate the Dijkstra's Algorithm to find the shortest path from source node to destination node with an example. [5]
Dijkstra's Algorithm, discovered by E.W. Dijkstra, finds the shortest path between two vertices in a weighted graph. The length of a path is the sum of the weights of its edges, and the shortest path is the minimum length path between tw...
- 105 marksMinimum Spanning TreesHideAnswer
What are the significance of Minimum Spanning Tree? Describe how Kruskal's algorithm can be used to find the MST. [5]
A Minimum Spanning Tree of a weighted connected graph is a spanning tree with the minimum total edge weight. Its significance includes: 1. Network Design: Used in designing minimum-cost communication networks, electrical grids, and road ...
- 115 marksZero-One MatricesHideAnswer
Define zero-one matrix. Explain the types of function. [5]
--- Definition: A zero-one matrix (also called a Boolean matrix) is a matrix whose entries belong only to the Boolean domain {0, 1}. That is, every element of the matrix is either 0 or 1. Boolean matrices are used to represent binary rel...
- 125 marksVenn DiagramHideAnswer
Represent any three set operations using Venn-diagram. Give a recursive defined function to find the factorial of any given positive integer. [5]
--- The union of sets A and B contains all elements that belong to A or B (or both). A ∪ B = { x x ∈ A or x ∈ B } The entire shaded area of both circles represents A ∪ B. --- The intersection of sets A and B contains only the elements co...