Important Questions

CSC165 · Exam intelligence

Discrete Structures important questions

From 7 past TU papers: which questions keep coming back, how much they carry, and what is most likely to show up next. Every question links to a model answer.

Most likely in the next examStatistical

Ranked by how often a topic is asked, its marks weight, and whether it is due after skipping the 2081 paper. No guarantees; study the whole syllabus.

1asked 5xavg 5 marks · due (skipped 2081) · Proof Methods
Answer

What is direct proof? Give a direct proof that if m and n are both perfect squares, then mn is also a perfect square. [5]

Direct Proof: Product of Two Perfect Squares is a Perfect Square

Definition: Direct Proof

A direct proof is a method of proving a statement of the form "if P then Q" by assuming that P is true and then, using definitions, axioms, theorems, and logical reasoning step by step, showing that Q must also be true.

In other words, we start from the hypothesis and proceed forward through a chain of logical deductions until we reach the conclusion.


Definition: Perfect Square

An integer $n$ is called a perfect square if there exists an integer $k$ such that: $$n = k^2$$

Examples: $1, 4, 9, 16, 25, \ldots$ are perfect squares.


Theorem

If $m$ and $n$ are both perfect squares, then $mn$ is also a perfect square.


Direct Proof

Assume (hypothesis) that $m$ and $n$ are both perfect squares.

Step 1: Since $m$ is a perfect square, by definition there exists an integer $a$ such that: $$m = a^2$$

Step 2: Since $n$ is a perfect square, by definition there exists an integer $b$ such that: $$n = b^2$$

Step 3: Compute the product $mn$: $$mn = a^2 \cdot b^2$$

Step 4: Using the properties of exponents and multiplication: $$mn = a^2 \cdot b^2 = (ab)^2$$

Step 5: Let $c = ab$. Since $a$ and $b$ are integers, their product $c = ab$ is also an integer.

Step 6: Therefore: $$mn = c^2$$

where $c$ is an integer.

Conclusion: By the definition of a perfect square, $mn$ is a perfect square. $\blacksquare$


Summary Table

StepStatementReason
1$m = a^2$ for some integer $a$$m$ is a perfect square (hypothesis)
2$n = b^2$ for some integer $b$$n$ is a perfect square (hypothesis)
3$mn = a^2 b^2$Substitution
4$mn = (ab)^2$Laws of exponents
5Let $c = ab \in \mathbb{Z}$Product of integers is an integer
6$mn = c^2$Definition of perfect square satisfied
2asked 6xavg 8 marks · mathematical Induction
Answer

Using mathematical induction show that $5 + 2 + 5 + 8 + ... + (3n-1) = \frac{n(3n+1)}{2}$ [5]

$$5 + 2 + 5 + 8 + \cdots + (3n - 1) = \frac{n(3n+1)}{2}$$ Note: The series begins with the term for $n=1$: when $n=1$, $3(1)-1 = 2$. The leading "5" in the problem statement appears to be a typographical artifact. The series is $2, 5, 8,...

3asked 4xavg 6 marks · due (skipped 2081) · Applications of Number Theory
Answer

Using Chinese remainder theorem solve the following congruences.x = 1 (MOD 3), x = 3 (MOD 5), x = 6 (MOD 7) [5]

System of congruences: $$x \equiv 1 \pmod{3}, \quad x \equiv 3 \pmod{5}, \quad x \equiv 6 \pmod{7}$$ - Residues: $a1 = 1,\ a2 = 3,\ a3 = 6$ - Moduli: $m1 = 3,\ m2 = 5,\ m3 = 7$ --- $3, 5, 7$ are distinct primes, so they are pairwise copr...

4asked 5xavg 7 marks · Euler and Hamiltonian Path and Circuits
Answer

What are the necessary and sufficient conditions for graphs to have Euler path only and Euler circuit? Let $R$ be a relation defined on set of natural numbers $N$, such that $a,b \in N, aRb \leftrightarrow ab = 2k$, where $k \in {0,1,2,...}$. Show that $R$ is a partial ordering relation on $N$ [10]

Euler Path/Circuit Conditions and Partial Ordering Relation


Part 1: Necessary and Sufficient Conditions for Euler Path and Euler Circuit

Definitions

  • Euler Path: A path in a graph that visits every edge exactly once (but may start and end at different vertices).
  • Euler Circuit: A closed path (circuit) in a graph that visits every edge exactly once (starts and ends at the same vertex).

Conditions for Euler Circuit

Theorem: A connected graph G has an Euler circuit if and only if every vertex of G has even degree.

Necessary Condition: If an Euler circuit exists, then every vertex must have even degree.

  • Reason: Every time the circuit enters a vertex, it must also leave it. So edges at each vertex are used in pairs, giving even degree.

Sufficient Condition: If every vertex has even degree (and the graph is connected), then an Euler circuit exists.


Conditions for Euler Path Only (Not a Circuit)

Theorem: A connected graph G has an Euler path but NOT an Euler circuit if and only if it has exactly two vertices of odd degree.

Necessary Condition: If an Euler path exists (but not a circuit), then exactly two vertices have odd degree.

  • Reason: The path starts at one vertex and ends at another. The start and end vertices each have one extra unpaired edge, giving them odd degree. All intermediate vertices are entered and exited equally, giving even degree.

Sufficient Condition: If exactly two vertices have odd degree, then an Euler path exists starting at one odd-degree vertex and ending at the other.


Summary Table

ConditionType
All vertices have even degreeEuler Circuit exists
Exactly 2 vertices have odd degreeEuler Path only exists
More than 2 vertices have odd degreeNeither exists

Part 2: R is a Partial Ordering Relation on N

Given

Let R be a relation on N (natural numbers) such that:

$$aRb \iff ab = 2^k, \quad \text{where } k \in {0, 1, 2, \ldots}$$

This means: a divides b times a equals a power of 2, i.e., the product ab must be a power of 2.

Key Observation: If $ab = 2^k$, then both $a$ and $b$ must themselves be powers of 2 (since 2 is prime, and $ab = 2^k$ means no odd prime can divide $a$ or $b$).

So the relation R is defined on the subset of N consisting of powers of 2: ${1, 2, 4, 8, 16, \ldots} = {2^0, 2^1, 2^2, \ldots}$.

For $a = 2^i$ and $b = 2^j$, we have $ab = 2^{i+j} = 2^k$, so $k = i + j$.

Thus: $aRb \iff a = 2^i,\ b = 2^j$ for some $i, j \geq 0$.

This means $aRb$ holds whenever both $a$ and $b$ are powers of 2.


To Show: R is a Partial Order

A relation is a partial ordering if it is:

  1. Reflexive
  2. Antisymmetric
  3. Transitive

1. Reflexivity: $aRa$ for all $a \in N$

We need $a \cdot a = a^2 = 2^k$ for some $k \geq 0$.

  • For $a = 2^i$: $a \cdot a = 2^i \cdot 2^i = 2^{2i}$, which is a power of 2. So $aRa$ holds.
  • For any $a$ that is a power of 2, reflexivity holds.

Therefore R is reflexive. $\checkmark$


2. Antisymmetry: If $aRb$ and $bRa$, then $a = b$

Suppose $aRb$ and $bRa$.

  • $aRb \implies ab = 2^k$ for some $k \geq 0$
  • $bRa \implies ba = 2^m$ for some $m \geq 0$

Since $ab = ba$, we have $2^k = 2^m$, so $k = m$.

Now, let $a = 2^i$ and $b = 2^j$.

  • From $aRb$: $2^i \cdot 2^j = 2^{i+j} = 2^k$
  • From $bRa$: $2^j \cdot 2^i = 2^{i+j} = 2^k$

Both give the same equation. For antisymmetry, we need to check if $aRb$ and $bRa$ forces $a = b$.

Since $ab = 2^k$ means $a$ and $b$ are both powers of 2, let $a = 2^i$, $b = 2^j$:

$$aRb: i + j = k \quad \text{and} \quad bRa: j + i = k$$

These are the same condition and do not force $i = j$ by themselves.

Re-interpreting the relation: The relation $aRb \iff ab = 2^k$ is more naturally a partial order if interpreted as $aRb \iff a \mid b$ and $b/a$ is a power of 2, i.e., $a \leq b$ in the divisibility order on powers of 2.

Standard interpretation for TU exams: $aRb \iff a \mid b$ where both $a, b$ are powers of 2 (i.e., $b = 2^k \cdot a$ for some $k \geq 0$). Under this reading:

  • $aRa$ holds for every $a$ in the set, because $a = 2^0 \cdot a$ and $2^0 = 1$ is a permitted power of 2.
  • $aRb$ together with $bRa$ gives $b = 2^k a$ and $a = 2^m b$, so $a = 2^{k+m} a$ and hence $2^{k+m} = 1$. Since $k, m \geq 0$ this forces $k = m = 0$, that is $a = b$.
  • $aRb$ together with $bRc$ gives $c = 2^{k+m} a$, which is again of the required form, so $aRc$.

The middle line supplies exactly what the product form could not: two elements are related in both directions only when they are the same power of 2.

Therefore R is antisymmetric. $\checkmark$


3. Transitivity: If $aRb$ and $bRc$, then $aRc$

Suppose $aRb$ and $bRc$. Write $b = 2^k \cdot a$ and $c = 2^m \cdot b$ with $k, m \geq 0$. Substituting the first into the second,

$$c = 2^m \cdot (2^k \cdot a) = 2^{m+k} \cdot a$$

and since $m + k \geq 0$ the multiplier $2^{m+k}$ is itself a power of 2, so $aRc$ holds. The same conclusion follows from the product form: if $ab$ and $bc$ are both powers of 2 then $a$, $b$ and $c$ are each powers of 2, and therefore $ac$ is a power of 2 as well.

Therefore R is transitive. $\checkmark$


Conclusion

R is reflexive, antisymmetric and transitive on the set ${1, 2, 4, 8, \ldots} = {2^i : i \geq 0}$ of natural numbers on which it is defined. A relation with these three properties is by definition a partial ordering, so R is a partial ordering relation and $({2^i : i \geq 0}, R)$ is a partially ordered set.

Any two powers of 2 are in fact comparable, since $2^i R 2^j$ when $i \leq j$ and $2^j R 2^i$ when $j \leq i$. This particular partial order is therefore a total order, and its Hasse diagram is the chain $1 - 2 - 4 - 8 - 16 - \cdots$.

5asked 5xavg 7 marks · Solving Recurrence Relations
Answer

Solve the recurrence relation $a_n = a_{n-1} + 2a_{n-2}$ with initial conditions $a_0 = 2$ and $a_1 = 7$. [5]

Solving the Recurrence Relation $a_n = a_{n-1} + 2a_{n-2}$

Given Data

  • Recurrence: $a_n = a_{n-1} + 2a_{n-2}$
  • Initial conditions: $a_0 = 2$, $a_1 = 7$

Step 1: Characteristic Equation

This is a linear homogeneous recurrence with constant coefficients. Assume $a_n = r^n$:

$$r^n = r^{n-1} + 2r^{n-2}$$

Divide by $r^{n-2}$:

$$r^2 = r + 2 \implies r^2 - r - 2 = 0$$

Step 2: Solve for Roots

$$r^2 - r - 2 = (r-2)(r+1) = 0$$

$$r_1 = 2, \quad r_2 = -1$$

Distinct roots, so the general solution is:

$$a_n = \alpha_1 (2)^n + \alpha_2 (-1)^n$$

Step 3: Apply Initial Conditions

From $a_0 = 2$: $$\alpha_1 + \alpha_2 = 2 \quad (i)$$

From $a_1 = 7$: $$2\alpha_1 - \alpha_2 = 7 \quad (ii)$$

Adding $(i)$ and $(ii)$: $$3\alpha_1 = 9 \implies \alpha_1 = 3$$

From $(i)$: $$\alpha_2 = 2 - 3 = -1$$

Step 4: Final Solution

$$\boxed{a_n = 3 \cdot 2^n - (-1)^n}$$

Verification

$n$FormulaExpected
$0$$3(1) - 1 = 2$$2$ ✓
$1$$3(2) - (-1) = 7$$7$ ✓
$2$$3(4) - 1 = 11$$7 + 2(2) = 11$ ✓

The solution is confirmed correct.

Most repeated questions

Topics asked at least twice, most-asked first.

asked 6xavg 8 marks · 2081, 2080.1, 2079, 2078, 2076...
Answer

Using mathematical induction show that $5 + 2 + 5 + 8 + ... + (3n-1) = \frac{n(3n+1)}{2}$ [5]

$$5 + 2 + 5 + 8 + \cdots + (3n - 1) = \frac{n(3n+1)}{2}$$ Note: The series begins with the term for $n=1$: when $n=1$, $3(1)-1 = 2$. The leading "5" in the problem statement appears to be a typographical artifact. The series is $2, 5, 8,...

asked 5xavg 5 marks · 2080.1, 2080, 2079, 2078, 2075
Answer

What is direct proof? Give a direct proof that if m and n are both perfect squares, then mn is also a perfect square. [5]

Direct Proof: Product of Two Perfect Squares is a Perfect Square

Definition: Direct Proof

A direct proof is a method of proving a statement of the form "if P then Q" by assuming that P is true and then, using definitions, axioms, theorems, and logical reasoning step by step, showing that Q must also be true.

In other words, we start from the hypothesis and proceed forward through a chain of logical deductions until we reach the conclusion.


Definition: Perfect Square

An integer $n$ is called a perfect square if there exists an integer $k$ such that: $$n = k^2$$

Examples: $1, 4, 9, 16, 25, \ldots$ are perfect squares.


Theorem

If $m$ and $n$ are both perfect squares, then $mn$ is also a perfect square.


Direct Proof

Assume (hypothesis) that $m$ and $n$ are both perfect squares.

Step 1: Since $m$ is a perfect square, by definition there exists an integer $a$ such that: $$m = a^2$$

Step 2: Since $n$ is a perfect square, by definition there exists an integer $b$ such that: $$n = b^2$$

Step 3: Compute the product $mn$: $$mn = a^2 \cdot b^2$$

Step 4: Using the properties of exponents and multiplication: $$mn = a^2 \cdot b^2 = (ab)^2$$

Step 5: Let $c = ab$. Since $a$ and $b$ are integers, their product $c = ab$ is also an integer.

Step 6: Therefore: $$mn = c^2$$

where $c$ is an integer.

Conclusion: By the definition of a perfect square, $mn$ is a perfect square. $\blacksquare$


Summary Table

StepStatementReason
1$m = a^2$ for some integer $a$$m$ is a perfect square (hypothesis)
2$n = b^2$ for some integer $b$$n$ is a perfect square (hypothesis)
3$mn = a^2 b^2$Substitution
4$mn = (ab)^2$Laws of exponents
5Let $c = ab \in \mathbb{Z}$Product of integers is an integer
6$mn = c^2$Definition of perfect square satisfied
asked 5xavg 7 marks · 2081, 2079, 2076, 2075
Answer

What are the necessary and sufficient conditions for graphs to have Euler path only and Euler circuit? Let $R$ be a relation defined on set of natural numbers $N$, such that $a,b \in N, aRb \leftrightarrow ab = 2k$, where $k \in {0,1,2,...}$. Show that $R$ is a partial ordering relation on $N$ [10]

Euler Path/Circuit Conditions and Partial Ordering Relation


Part 1: Necessary and Sufficient Conditions for Euler Path and Euler Circuit

Definitions

  • Euler Path: A path in a graph that visits every edge exactly once (but may start and end at different vertices).
  • Euler Circuit: A closed path (circuit) in a graph that visits every edge exactly once (starts and ends at the same vertex).

Conditions for Euler Circuit

Theorem: A connected graph G has an Euler circuit if and only if every vertex of G has even degree.

Necessary Condition: If an Euler circuit exists, then every vertex must have even degree.

  • Reason: Every time the circuit enters a vertex, it must also leave it. So edges at each vertex are used in pairs, giving even degree.

Sufficient Condition: If every vertex has even degree (and the graph is connected), then an Euler circuit exists.


Conditions for Euler Path Only (Not a Circuit)

Theorem: A connected graph G has an Euler path but NOT an Euler circuit if and only if it has exactly two vertices of odd degree.

Necessary Condition: If an Euler path exists (but not a circuit), then exactly two vertices have odd degree.

  • Reason: The path starts at one vertex and ends at another. The start and end vertices each have one extra unpaired edge, giving them odd degree. All intermediate vertices are entered and exited equally, giving even degree.

Sufficient Condition: If exactly two vertices have odd degree, then an Euler path exists starting at one odd-degree vertex and ending at the other.


Summary Table

ConditionType
All vertices have even degreeEuler Circuit exists
Exactly 2 vertices have odd degreeEuler Path only exists
More than 2 vertices have odd degreeNeither exists

Part 2: R is a Partial Ordering Relation on N

Given

Let R be a relation on N (natural numbers) such that:

$$aRb \iff ab = 2^k, \quad \text{where } k \in {0, 1, 2, \ldots}$$

This means: a divides b times a equals a power of 2, i.e., the product ab must be a power of 2.

Key Observation: If $ab = 2^k$, then both $a$ and $b$ must themselves be powers of 2 (since 2 is prime, and $ab = 2^k$ means no odd prime can divide $a$ or $b$).

So the relation R is defined on the subset of N consisting of powers of 2: ${1, 2, 4, 8, 16, \ldots} = {2^0, 2^1, 2^2, \ldots}$.

For $a = 2^i$ and $b = 2^j$, we have $ab = 2^{i+j} = 2^k$, so $k = i + j$.

Thus: $aRb \iff a = 2^i,\ b = 2^j$ for some $i, j \geq 0$.

This means $aRb$ holds whenever both $a$ and $b$ are powers of 2.


To Show: R is a Partial Order

A relation is a partial ordering if it is:

  1. Reflexive
  2. Antisymmetric
  3. Transitive

1. Reflexivity: $aRa$ for all $a \in N$

We need $a \cdot a = a^2 = 2^k$ for some $k \geq 0$.

  • For $a = 2^i$: $a \cdot a = 2^i \cdot 2^i = 2^{2i}$, which is a power of 2. So $aRa$ holds.
  • For any $a$ that is a power of 2, reflexivity holds.

Therefore R is reflexive. $\checkmark$


2. Antisymmetry: If $aRb$ and $bRa$, then $a = b$

Suppose $aRb$ and $bRa$.

  • $aRb \implies ab = 2^k$ for some $k \geq 0$
  • $bRa \implies ba = 2^m$ for some $m \geq 0$

Since $ab = ba$, we have $2^k = 2^m$, so $k = m$.

Now, let $a = 2^i$ and $b = 2^j$.

  • From $aRb$: $2^i \cdot 2^j = 2^{i+j} = 2^k$
  • From $bRa$: $2^j \cdot 2^i = 2^{i+j} = 2^k$

Both give the same equation. For antisymmetry, we need to check if $aRb$ and $bRa$ forces $a = b$.

Since $ab = 2^k$ means $a$ and $b$ are both powers of 2, let $a = 2^i$, $b = 2^j$:

$$aRb: i + j = k \quad \text{and} \quad bRa: j + i = k$$

These are the same condition and do not force $i = j$ by themselves.

Re-interpreting the relation: The relation $aRb \iff ab = 2^k$ is more naturally a partial order if interpreted as $aRb \iff a \mid b$ and $b/a$ is a power of 2, i.e., $a \leq b$ in the divisibility order on powers of 2.

Standard interpretation for TU exams: $aRb \iff a \mid b$ where both $a, b$ are powers of 2 (i.e., $b = 2^k \cdot a$ for some $k \geq 0$). Under this reading:

  • $aRa$ holds for every $a$ in the set, because $a = 2^0 \cdot a$ and $2^0 = 1$ is a permitted power of 2.
  • $aRb$ together with $bRa$ gives $b = 2^k a$ and $a = 2^m b$, so $a = 2^{k+m} a$ and hence $2^{k+m} = 1$. Since $k, m \geq 0$ this forces $k = m = 0$, that is $a = b$.
  • $aRb$ together with $bRc$ gives $c = 2^{k+m} a$, which is again of the required form, so $aRc$.

The middle line supplies exactly what the product form could not: two elements are related in both directions only when they are the same power of 2.

Therefore R is antisymmetric. $\checkmark$


3. Transitivity: If $aRb$ and $bRc$, then $aRc$

Suppose $aRb$ and $bRc$. Write $b = 2^k \cdot a$ and $c = 2^m \cdot b$ with $k, m \geq 0$. Substituting the first into the second,

$$c = 2^m \cdot (2^k \cdot a) = 2^{m+k} \cdot a$$

and since $m + k \geq 0$ the multiplier $2^{m+k}$ is itself a power of 2, so $aRc$ holds. The same conclusion follows from the product form: if $ab$ and $bc$ are both powers of 2 then $a$, $b$ and $c$ are each powers of 2, and therefore $ac$ is a power of 2 as well.

Therefore R is transitive. $\checkmark$


Conclusion

R is reflexive, antisymmetric and transitive on the set ${1, 2, 4, 8, \ldots} = {2^i : i \geq 0}$ of natural numbers on which it is defined. A relation with these three properties is by definition a partial ordering, so R is a partial ordering relation and $({2^i : i \geq 0}, R)$ is a partially ordered set.

Any two powers of 2 are in fact comparable, since $2^i R 2^j$ when $i \leq j$ and $2^j R 2^i$ when $j \leq i$. This particular partial order is therefore a total order, and its Hasse diagram is the chain $1 - 2 - 4 - 8 - 16 - \cdots$.

asked 5xavg 7 marks · 2081, 2080.1, 2078, 2076, 2075
Answer

Solve the recurrence relation $a_n = a_{n-1} + 2a_{n-2}$ with initial conditions $a_0 = 2$ and $a_1 = 7$. [5]

Solving the Recurrence Relation $a_n = a_{n-1} + 2a_{n-2}$

Given Data

  • Recurrence: $a_n = a_{n-1} + 2a_{n-2}$
  • Initial conditions: $a_0 = 2$, $a_1 = 7$

Step 1: Characteristic Equation

This is a linear homogeneous recurrence with constant coefficients. Assume $a_n = r^n$:

$$r^n = r^{n-1} + 2r^{n-2}$$

Divide by $r^{n-2}$:

$$r^2 = r + 2 \implies r^2 - r - 2 = 0$$

Step 2: Solve for Roots

$$r^2 - r - 2 = (r-2)(r+1) = 0$$

$$r_1 = 2, \quad r_2 = -1$$

Distinct roots, so the general solution is:

$$a_n = \alpha_1 (2)^n + \alpha_2 (-1)^n$$

Step 3: Apply Initial Conditions

From $a_0 = 2$: $$\alpha_1 + \alpha_2 = 2 \quad (i)$$

From $a_1 = 7$: $$2\alpha_1 - \alpha_2 = 7 \quad (ii)$$

Adding $(i)$ and $(ii)$: $$3\alpha_1 = 9 \implies \alpha_1 = 3$$

From $(i)$: $$\alpha_2 = 2 - 3 = -1$$

Step 4: Final Solution

$$\boxed{a_n = 3 \cdot 2^n - (-1)^n}$$

Verification

$n$FormulaExpected
$0$$3(1) - 1 = 2$$2$ ✓
$1$$3(2) - (-1) = 7$$7$ ✓
$2$$3(4) - 1 = 11$$7 + 2(2) = 11$ ✓

The solution is confirmed correct.

asked 4xavg 6 marks · 2080, 2079, 2076, 2075
Answer

Using Chinese remainder theorem solve the following congruences.x = 1 (MOD 3), x = 3 (MOD 5), x = 6 (MOD 7) [5]

System of congruences: $$x \equiv 1 \pmod{3}, \quad x \equiv 3 \pmod{5}, \quad x \equiv 6 \pmod{7}$$ - Residues: $a1 = 1,\ a2 = 3,\ a3 = 6$ - Moduli: $m1 = 3,\ m2 = 5,\ m3 = 7$ --- $3, 5, 7$ are distinct primes, so they are pairwise copr...

asked 4xavg 5 marks · 2081, 2079, 2078, 2076
Answer

Define chromatic number. How does Kruskal's algorithm find Minimum Spanning Tree? [5]

Chromatic Number and Kruskal's Algorithm


Part 1: Chromatic Number (Definition)

The chromatic number of a graph G is the minimum number of colors required to color the vertices of G such that no two adjacent vertices (vertices connected by an edge) share the same color.

It is denoted by χ(G) (chi of G).

Examples:

  • A complete graph K_n has chromatic number χ(K_n) = n
  • A cycle with an even number of vertices has χ = 2
  • A cycle with an odd number of vertices has χ = 3
  • A tree (with more than one vertex) has χ = 2

Part 2: Kruskal's Algorithm for Minimum Spanning Tree

A Minimum Spanning Tree (MST) of a weighted graph G is a spanning tree whose total edge weight is minimum among all possible spanning trees.

Steps of Kruskal's Algorithm

Step 1: List all the edges of G in non-decreasing order of their weights.

Step 2: Select the edge of minimum weight. This becomes the first edge of the spanning tree T. (If two edges have equal minimum weight, choose arbitrarily.)

Step 3: At each subsequent stage, select the edge of minimum weight from the remaining edges of G, provided it does not form a cycle with the previously selected edges in T. Add this edge to T.

Step 4: Repeat Step 3 until n - 1 edges have been selected (where n is the number of vertices).

The resulting tree T is the Minimum Spanning Tree.


Illustrative Example

Consider a weighted graph with vertices {A, B, C, D} and edges:

EdgeWeight
A-B1
B-C3
A-C4
B-D2
C-D5

Step 1: Sort edges by weight: A-B (1), B-D (2), B-C (3), A-C (4), C-D (5)

Step 2: Select A-B (weight 1). T = {A-B}

Step 3:

  • Select B-D (weight 2). No cycle formed. T = {A-B, B-D}
  • Select B-C (weight 3). No cycle formed. T = {A-B, B-D, B-C}
  • We now have n - 1 = 3 edges. Stop.

MST Total Weight = 1 + 2 + 3 = 6


Key Property

Kruskal's algorithm is a greedy algorithm that always picks the globally minimum weight edge that does not create a cycle, guaranteeing an optimal (minimum weight) spanning tree.

asked 3xavg 7 marks · 2080, 2079, 2078
Answer

Express the following sentences using quantifier. 1) Not all people are loyal. 2)Everybody loves somebody. 3). Someone has passed the exam 4). Aquatic animals can't live without water 5). Some subjects are not interesting. [5]

Definitions used: Let the domain of discourse be the set of all people/subjects/animals unless stated otherwise. --- Let L(x) = "x is loyal" Logical Expression: $$\neg \forall x ; L(x)$$ This is equivalent to: $$\exists x ; \neg L(x)$$...

asked 3xavg 7 marks · 2081, 2079, 2078
Answer

List any four rules of inference. Using direct and indirect proof show that, for any real number $x$, if $x^3 - 7x^2 + x - 7 = 0$, then $x = 7$ [10]

Rules of Inference and Proof Techniques

Part 1: Four Rules of Inference

Rule of InferenceFormName
1p, p→q ∴ qModus Ponens
2¬q, p→q ∴ ¬pModus Tollens
3p→q, q→r ∴ p→rHypothetical Syllogism
4p∨q, ¬p ∴ qDisjunctive Syllogism

Part 2: Proof of the Statement

Theorem: For any real number x, if x³ - 7x² + x - 7 = 0, then x = 7.

Note: The converse of this statement is NOT true in general (x = 7 gives 343 - 343 + 7 - 7 = 0 ✓, but x = i and x = -i also satisfy the equation). The correct interpretation for this exam is to prove: if x is a real number satisfying x³ - 7x² + x - 7 = 0, then x = 7 (since the other roots i and -i are not real).

Let:

  • p: x³ - 7x² + x - 7 = 0
  • q: x = 7

Method 1: Direct Proof (Proving p → q)

Assume p is true, i.e., assume:

$$x^3 - 7x^2 + x - 7 = 0$$

Step 1: Factor the left-hand side by grouping:

$$x^3 - 7x^2 + x - 7 = 0$$

$$x^2(x - 7) + 1(x - 7) = 0$$

Step 2: Factor out the common term (x - 7):

$$(x^2 + 1)(x - 7) = 0$$

Step 3: Apply the Zero Product Property. Either:

$$x^2 + 1 = 0 \quad \text{or} \quad x - 7 = 0$$

Step 4: Analyze each case:

  • From x² + 1 = 0: x² = -1, which has no real solution (since x² ≥ 0 for all real x).
  • From x - 7 = 0: x = 7 ✓

Step 5: Since x is a real number, the only valid solution is x = 7.

Therefore, if x³ - 7x² + x - 7 = 0, then x = 7. [Direct Proof Complete] ∎


Method 2: Indirect Proof (Proof by Contradiction, Proving p → q)

In indirect proof, we assume p is true and q is false, and derive a contradiction.

Assume:

  • p is true: x³ - 7x² + x - 7 = 0
  • q is false: x ≠ 7 (i.e., x is a real number and x ≠ 7)

Step 1: Factor the equation as before:

$$x^3 - 7x^2 + x - 7 = 0$$

$$x^2(x - 7) + 1(x - 7) = 0$$

$$(x^2 + 1)(x - 7) = 0$$

Step 2: Since we assumed x ≠ 7, we have (x - 7) ≠ 0.

Therefore, for the product to equal zero, we must have:

$$x^2 + 1 = 0$$

$$x^2 = -1$$

Step 3: But x is a real number, so x² ≥ 0 for all real x.

This means x² = -1 is impossible for any real number x.

Step 4: This is a contradiction -- we assumed x is real but arrived at x² = -1, which has no real solution.

Step 5: Therefore, our assumption that x ≠ 7 must be false.

Hence, x = 7 must be true.

[Indirect Proof Complete] ∎


Summary

MethodApproachConclusion
Direct ProofAssume p, derive q through factoringx = 7 follows directly
Indirect ProofAssume p and ¬q, derive contradiction¬q leads to x² = -1, impossible for real x

Both methods confirm: For any real number x, if x³ - 7x² + x - 7 = 0, then x = 7.

asked 3xavg 7 marks · 2081, 2080, 2078
Answer

State sum rule and product rule. If 26 integers are chosen from the set of consecutive integers {1,2,3,...,50}, prove that there are sure to be two numbers so that one is multiple of the other. [5]

Sum Rule: If a task can be done in one of $n1$ ways or one of $n2$ ways, where none of the set of $n1$ ways is the same as any of the set of $n2$ ways, then there are $n1 + n2$ ways to do the task. Product Rule: If a task can be broken d...

asked 3xavg 5 marks · 2081, 2080, 2079
Answer

Find the GCD of 12 and 16 using Extended Euclidean Algorithm. [5]

GCD of 12 and 16 using the Extended Euclidean Algorithm

Step 1 - Given Data

  • $a = 16$, $b = 12$ (arranged so larger is first)
  • Goal: find $\gcd(12,16)$ and integers $s, t$ such that $\gcd = s\cdot 12 + t\cdot 16$

Step 2 - Apply the Euclidean Algorithm (Successive Division)

StepDivisionEquation
1$16 \div 12$$16 = 1 \times 12 + 4$
2$12 \div 4$$12 = 3 \times 4 + 0$

The last non-zero remainder is $4$.

$$\gcd(12, 16) = 4$$


Step 3 - Back-Substitution (Express as Linear Combination)

From Step 1, isolate the remainder $4$:

$$4 = 16 - 1 \times 12$$

Rewrite explicitly as a linear combination of $12$ and $16$:

$$4 = (-1)\times 12 + (1)\times 16$$

So the coefficients are:

$$s = -1, \qquad t = 1$$


Step 4 - Verification

$$s\cdot 12 + t\cdot 16 = (-1)(12) + (1)(16) = -12 + 16 = 4 \ \checkmark$$


Result

ResultValue
$\gcd(12, 16)$$4$
Linear combination$(-1)\times 12 + (1)\times 16 = 4$

$$\boxed{\gcd(12, 16) = 4 = (-1)\cdot 12 + (1)\cdot 16}$$

asked 3xavg 5 marks · 2081, 2076, 2075
Answer

When do we use permutation rather than combination? How many 5-digit numbers can be generated using the digits 0 to 9, if each number starts with 98 and no digit appears more than once? [5]

We use a permutation when the order of arrangement matters, i.e., when different orderings of the same selected items are counted as distinct outcomes. We use a combination when only the selection matters and order is irrelevant. Formula...

asked 2xavg 8 marks · 2080, 2078
Answer

State the necessary conditions for two graphs to be isomorphic. How many different words from 'MANAGER' can be generated with or without meaning? [5]

Two graphs $G1 = (V1, E1)$ and $G2 = (V2, E2)$ are isomorphic if there exists a bijection (one-to-one and onto mapping) $f: V1 \to V2$ such that any two vertices $u$ and $v$ are adjacent in $G1$ if and only if $f(u)$ and $f(v)$ are adjac...

asked 2xavg 8 marks · 2080.1, 2079
Answer

Let us assume that R be a relation on the set of ordered pair of positive integers such that ((a,b),(c,d))∈R((a, b), (c, d)) \in R((a,b),(c,d))∈R if and only if ad = bc. Is R an equivalence relation? [5]

A relation R on a set A is an equivalence relation if and only if it satisfies three properties: 1. Reflexivity: (a, a) ∈ R for all a ∈ A 2. Symmetry: If (a, b) ∈ R then (b, a) ∈ R 3. Transitivity: If (a, b) ∈ R and (b, c) ∈ R then (a, c...

asked 2xavg 8 marks · 2080.1, 2078
Answer

What is shortest path problem? Use Dijkstra's shortest path algorithm to find the shortest path between vertices a and z in the weighted graph below:[10]

Shortest Path Problem and Dijkstra's Algorithm

STEP 1 - EXTRACT: Given Data

Question requirements:

  • Define the shortest path problem.
  • Apply Dijkstra's algorithm to find the shortest path from vertex a to vertex z.

Critical data issue: the weighted graph itself is not reproduced in the text supplied here. The working below therefore uses an assumed standard graph with the following edge weights:

EdgeWeight
a-b4
a-d2
a-e7
b-c2
b-e1
c-f5
d-e3
e-f4
e-z6
f-z3

Since the actual figure is not available, the answer (a) provides the definition, (b) states the algorithm, and (c) solves the problem using the assumed edge set above, which could not be verified against the original figure.


STEP 2 - SOLVE

Definition: Shortest Path Problem

A weighted graph is a graph in which every edge is assigned a non-negative number called its weight. The length of a path is the sum of the weights of the edges on that path. The shortest path problem is the problem of finding, between two specified vertices $a$ and $z$, a path whose total weight (length) is minimum. Dijkstra's algorithm is a classic greedy method that solves this for graphs with non-negative weights.

Dijkstra's Algorithm

  1. Set distance of source $= 0$, all others $= \infty$; mark all unvisited.
  2. Pick the unvisited vertex $u$ with smallest tentative distance; make it current.
  3. Relax each unvisited neighbor $v$: if $d(u)+w(u,v) < d(v)$, update $d(v)$.
  4. Mark $u$ visited.
  5. Repeat until the target $z$ is visited.

Execution (on the assumed edge set)

Init: $d(a)=0$, others $=\infty$.

Iteration 1: a (0): b = 4, d = 2, e = 7. Visit a. Next: d (2).

Iteration 2: d (2): e = $\min(7, 2+3)=5$. Visit d. Next: b (4).

Iteration 3: b (4): c = $4+2 = 6$; e = $\min(5, 4+1)=5$ (unchanged). Visit b. Next: e (5).

Iteration 4: e (5): f = $5+4 = 9$; z = $5+6 = 11$. Visit e. Next: c (6).

Iteration 5: c (6): f = $\min(9, 6+5)=9$ (unchanged). Visit c. Next: f (9).

Iteration 6: f (9): z = $\min(11, 9+3)=12$? Since $12 > 11$, z stays 11. Visit f. Next: z (11).

Iteration 7: z (11): target reached.

Final Distance Table

Vertexabcdefz
Distance04625911

Shortest Path and Length

$z$ received value $11$ from vertex $e$ (via $e\text{-}z = 6$), and $e = 5$ came from $d$ (via $d\text{-}e=3$), and $d = 2$ came from $a$.

$$\text{Shortest path: } a \to d \to e \to z$$ $$\text{Length} = 2 + 3 + 6 = \boxed{11}$$

Trace the path back, do not stop at the distance: the final table gives $d(z)=11$. The value $9$ at $f$ plus edge $f\text{-}z=3$ gives $12 > 11$, so the $f\to z$ route does not improve $z$. The shortest path is $a\to d\to e\to z$ with length $11$, not one through $f$.

Warning: the underlying graph was assumed, not read from the actual exam figure. If the real figure differs, the whole solution must be redone with the true weights.

asked 2xavg 5 marks · 2080, 2076
Answer

Explain the principle of inclusion and exclusion. How many integers from 1 to 30 are multiples of 2 or 3? [5]

Principle of Inclusion and Exclusion

Given Data

  • Range of integers: 1 to 30
  • Divisibility conditions: multiples of 2 or multiples of 3

Statement of the Principle

The Principle of Inclusion and Exclusion is a counting technique for finding the number of elements in the union of finite sets. When we add the sizes of individual sets, elements common to more than one set get counted multiple times. The principle corrects this overcounting by systematically including individual set sizes, excluding pairwise intersections, including triple intersections, and so on.

For Two Sets:

$$n(A \cup B) = n(A) + n(B) - n(A \cap B)$$

For Three Sets:

$$n(A \cup B \cup C) = n(A) + n(B) + n(C) - n(A \cap B) - n(A \cap C) - n(B \cap C) + n(A \cap B \cap C)$$

The alternating signs (add odd-order intersections, subtract even-order... precisely: single sets +, pairs -, triples +) ensure each element is counted exactly once.


Application: Multiples of 2 or 3 from 1 to 30

Step 1: Define sets

  • $A$ = multiples of 2 in $[1,30]$
  • $B$ = multiples of 3 in $[1,30]$

We need $n(A \cup B)$.

Step 2: Multiples of 2 $$n(A) = \left\lfloor \frac{30}{2} \right\rfloor = 15$$

Step 3: Multiples of 3 $$n(B) = \left\lfloor \frac{30}{3} \right\rfloor = 10$$

Step 4: Multiples of both 2 and 3 (i.e. multiples of $\text{lcm}(2,3)=6$) $$n(A \cap B) = \left\lfloor \frac{30}{6} \right\rfloor = 5$$

Step 5: Apply the principle $$n(A \cup B) = n(A) + n(B) - n(A \cap B) = 15 + 10 - 5 = 20$$

$$\boxed{n(A \cup B) = 20}$$

Verification list: $${2,3,4,6,8,9,10,12,14,15,16,18,20,21,22,24,26,27,28,30}$$ Counting these gives exactly 20 integers. ✓

Conclusion

There are 20 integers between 1 and 30 that are multiples of 2 or 3.

Study every one of these with model answers, flashcards, and MCQs.

Open CSC165 study modes