COMP233 · First Exam & Answers

First Exam: Worked Solutions

Discrete Mathematics (COMP 233) · Section 9 · Second Semester 2025/2026
Back to COMP233

About this paper

This is the First Exam you sat on 12 May 2026, together with my worked solutions to every question and the marking criteria. Work each question on paper first, then click Show solution; for Q1 click any option to check your answer.

Course
Discrete Mathematics (COMP 233)
Section
9
Semester
Second Semester 2025/2026
Exam date
12 May 2026
Solutions released
14 May 2026
Questions
4 (10 marks each)
Total
40 marks · weight 30% of course grade
Q1
Multiple choice
[ 10 marks ]
Select the correct answer for each of the following. Click any option to check it.
Q1.1
2 marks
If n = 5k + 2 for some integer k, what is the value of n² mod 5?
a.0
b.1
c.4
d.2
Q1.2
2 marks
What is the largest power of 6 that divides 30⁵ · 40³?
a.
b.6⁵
c.6⁷
d.6⁹
Q1.3
2 marks
Suppose m and n are integers with m mod 6 = 3 and n mod 6 = 4. What is (m + n) mod 6?
a.7
b.1
c.0
d.5
Q1.4
2 marks
Which of the following is NOT equivalent to the statement: "∀ integers n, if n is divisible by 4, then n is divisible by 2"?
a.Every integer divisible by 4 is also divisible by 2.
b.There is no integer divisible by 4 that is not divisible by 2.
c.Being divisible by 4 is a sufficient condition for an integer to be divisible by 2.
d.Some integer divisible by 4 is divisible by 2.
Q1.5
2 marks
Consider the statement: "∃ a real number x such that x² + 1 = 0". Which of the following best describes this statement?
a.The statement is true; x = 0 satisfies it.
b.The statement is false; for every real number x, x² ≥ 0, so x² + 1 ≥ 1 > 0.
c.The statement is true; x = −1 satisfies it.
d.The statement is undefined since x² + 1 has no real solution.
Q2
Direct proofs
[ 10 marks ]
Q2.A
4 marks
Prove that for every odd integer n, n² + 3 is divisible by 4.
Worked solution

Proof. Suppose n is a particular but arbitrarily chosen odd integer. [We must show 4 | (n² + 3).]

By definition of odd, n = 2k + 1 for some integer k.

n² + 3 = (2k + 1)² + 3
       = 4k² + 4k + 1 + 3
       = 4k² + 4k + 4
       = 4(k² + k + 1).

Let t = k² + k + 1. Then t is an integer (sums and products of integers are integers), and n² + 3 = 4t.

By definition of divisibility, 4 | (n² + 3).

Marking guide (4 marks, 1 per criterion).

  • 1 mark: correct setup, introducing the witness via the definition of odd (n = 2k + 1).
  • 1 mark: correct algebraic expansion to (2k + 1)² + 3 = 4k² + 4k + 4.
  • 1 mark: factoring out 4 to get 4(k² + k + 1).
  • 1 mark: clean conclusion citing the definition of divisibility.
Q2.B
3 marks
Prove that for all integers a, b, and c, if a | b and b | c, then a | c.
Worked solution (transitivity of divisibility, Theorem 4.3.3)

Proof. Suppose a, b, c are particular but arbitrarily chosen integers with a | b and b | c. [We must show a | c.]

By definition of divisibility:

b = a · r   for some integer r   (from a | b)
c = b · s   for some integer s   (from b | c)

Substituting the first into the second:

c = b · s = (a · r) · s = a · (r · s).

Let k = r · s. Then k is an integer (product of integers is an integer), and c = a · k.

By definition of divisibility, a | c.

Marking guide (3 marks, 1 per criterion).

  • 1 mark: correct application of the definition of divisibility to both givens (b = ar and c = bs).
  • 1 mark: correct substitution to express c = a(rs).
  • 1 mark: clean conclusion that rs is an integer, so a | c.
Q2.C
3 marks
Use the quotient-remainder theorem with d = 3 to prove that for every integer n, the integer n² + 2n has the form 3k or 3k + 2 for some integer k.
Worked solution (proof by division into cases)

Proof. Let n be a particular but arbitrarily chosen integer. By the quotient-remainder theorem with d = 3, exactly one of the following holds for some integer q:

n = 3q   or   n = 3q + 1   or   n = 3q + 2.

Case 1: n = 3q.

n² + 2n = (3q)² + 2(3q)
        = 9q² + 6q
        = 3(3q² + 2q).

Let k = 3q² + 2q (an integer). Then n² + 2n = 3k. Has the form 3k. ✓

Case 2: n = 3q + 1.

n² + 2n = (3q + 1)² + 2(3q + 1)
        = 9q² + 6q + 1 + 6q + 2
        = 9q² + 12q + 3
        = 3(3q² + 4q + 1).

Let k = 3q² + 4q + 1 (an integer). Then n² + 2n = 3k. Has the form 3k. ✓

Case 3: n = 3q + 2.

n² + 2n = (3q + 2)² + 2(3q + 2)
        = 9q² + 12q + 4 + 6q + 4
        = 9q² + 18q + 8
        = 9q² + 18q + 6 + 2
        = 3(3q² + 6q + 2) + 2.

Let k = 3q² + 6q + 2 (an integer). Then n² + 2n = 3k + 2. Has the form 3k + 2. ✓

In every case n² + 2n has the form 3k or 3k + 2 for some integer k.

Marking guide (3 marks, 1 per criterion).

  • 1 mark: correct setup applying the quotient-remainder theorem with d = 3 to split n into the three cases.
  • 1 mark: correct algebraic computation of n² + 2n in all three cases.
  • 1 mark: correct identification of the target form (3k or 3k + 2) for each case and a clean overall conclusion.

Observation. The form 3k + 1 never arises. So in fact a stronger statement holds: n² + 2n mod 3 ∈ {0, 2} for every integer n.

Q3
Counterexample & rational closure
[ 10 marks ]
Q3.A
4 marks total
Consider the following statement: "For all integers m and n, if m and n are both odd, then m + n is odd".
  1. Disprove the statement by providing a counterexample.
  2. State the correct conclusion about m + n when m and n are both odd, and prove it.
Worked solution

(1) Counterexample. Take m = 1 and n = 3. Both are odd. Their sum is

m + n = 1 + 3 = 4 = 2 · 2,

which is even by definition (witness k = 2), not odd. The hypothesis is true (both are odd) and the conclusion is false (the sum is not odd). One such pair is enough to disprove the universal claim.

Acceptable variants: any specific pair of odd integers whose sum is even, e.g. (1, 1), (3, 5), (−1, 7).

(2) Correct conclusion. "For all integers m and n, if m and n are both odd, then m + n is even."

Proof. Suppose m and n are particular but arbitrarily chosen odd integers. [We must show m + n is even.]

By definition of odd:

m = 2r + 1   for some integer r,
n = 2s + 1   for some integer s.

Watch. The two witnesses r and s need not be the same. Calling both k is the classic find-the-mistake error.

Then

m + n = (2r + 1) + (2s + 1)
       = 2r + 2s + 2
       = 2(r + s + 1).

Let t = r + s + 1. Then t is an integer (sum of integers is an integer), and m + n = 2t.

By definition of even, m + n is even.

Marking guide (4 marks total, 1 per criterion).

  • 1 mark: valid counterexample, any specific pair of odd integers whose sum is even.
  • 1 mark: correct statement of the corrected conclusion (m + n is even when both are odd).
  • 1 mark: correct setup using the definition of odd, with different witnesses (m = 2j + 1, n = 2k + 1). Reusing the same letter is the classic trap.
  • 1 mark: completing the proof, showing m + n = 2 · (integer) and concluding even.
Q3.B
6 marks
Prove that for all rational numbers r and s, the number r² + s² is a rational number.
Worked solution

Proof. Suppose r and s are particular but arbitrarily chosen rational numbers. [We must show r² + s² is rational.]

By definition of rational,

r = a / b   for some integers a, b with b ≠ 0,
s = c / d   for some integers c, d with d ≠ 0.

Square each:

r² = a² / b²    and    s² = c² / d².

Combine over a common denominator:

r² + s² = a²/b² + c²/d²
       = (a²·d² + b²·c²) / (b² · d²).

Let p = a²d² + b²c² and q = b²d².

  • p is an integer because products and sums of integers are integers.
  • q = b² · d² is an integer for the same reason, and q ≠ 0 because b ≠ 0 and d ≠ 0 imply b² ≠ 0 and d² ≠ 0, hence b²d² ≠ 0 by the zero-product property.

So r² + s² = p / q with p, q integers and q ≠ 0. By definition of rational, r² + s² is rational.

Alternative (cite Theorem 4.2.2). Once and are each shown rational (numerator a square of an integer; denominator a nonzero square), Theorem 4.2.2 (sum of two rationals is rational) finishes the argument in one line.

Marking guide (6 marks, 1 per criterion).

  • 1 mark: setup using the definition of rational, with separate witnesses (r = a/b, s = c/d, b, d ≠ 0).
  • 1 mark: correct squaring (r² = a²/b² and s² = c²/d²).
  • 1 mark: correct combination into a single fraction with common denominator b²d².
  • 1 mark: justifying that the numerator a²d² + b²c² is an integer.
  • 1 mark: justifying that the denominator b²d² is a nonzero integer. This is the point most often missed.
  • 1 mark: clean conclusion citing the definition of rational.
Q4
Quantifiers and truth-table validity
[ 10 marks ]
Q4.A
6 marks total
Let S be the set of students at a university and C the set of courses offered. Let E(s, c) denote "student s is enrolled in course c".
  1. Express the following statement symbolically using , , and the predicate E: "There is a course that every student is enrolled in". [3 marks]
  2. Write the negation of the following statement, in a form where no negation symbol appears before any quantifier: ∀ s ∈ S, ∃ c ∈ C such that E(s, c). [3 marks]
Worked solution

(1) Symbolic form.

∃ c ∈ C such that ∀ s ∈ S, E(s, c).

Read: "there exists a course c such that for every student s, s is enrolled in c."

Why this order counts. The course must be fixed first (∃ first), and then it must work for every student (∀ inside). Swapping the order to ∀ s ∃ c, E(s, c) would only say "every student is enrolled in at least one course", a much weaker claim. The two statements have completely different meanings (see Section 3.3, the loves-table examples).

(2) Negation, with no ∼ before any quantifier.

Walk the negation left-to-right, flipping each quantifier and pushing inside as we go.

start∼(∀ s ∈ S, ∃ c ∈ C, E(s, c))
step 1≡ ∃ s ∈ S such that ∼(∃ c ∈ C, E(s, c))  flip outer ∀ to ∃ (Theorem 3.2.1)
step 2≡ ∃ s ∈ S such that ∀ c ∈ C, ∼E(s, c)  flip ∃ to ∀ (Theorem 3.2.2)

Final form:

∃ s ∈ S such that ∀ c ∈ C, ∼E(s, c).

Read: "there is a student who is not enrolled in any course", equivalently, "some student is enrolled in no course at all".

Marking guide (6 marks total).

Part (1) · 3 marks, 1 per criterion:

  • 1 mark: correct outer quantifier ∃ c ∈ C.
  • 1 mark: correct inner quantifier ∀ s ∈ S, with proper scope.
  • 1 mark: correct predicate E(s, c) with arguments in the right order.

Part (2) · 3 marks, 1 per criterion:

  • 1 mark: correct conversion of the outer to .
  • 1 mark: correct conversion of the inner to .
  • 1 mark: correct negation of the predicate to ∼E(s, c) in the innermost position.
Q4.B
4 marks
Use a truth table to determine whether the following argument form is valid. Clearly indicate which columns represent the premises, which represents the conclusion, whether the argument is valid or invalid, and a short explanation based on the truth table.
p ∨ q
p → r
q → r
∴ r
Worked solution

Three variables p, q, r give 2³ = 8 rows. The premise columns are p ∨ q, p → r, and q → r; the conclusion column is r. A row is critical when all three premises are true. The argument is valid iff the conclusion is true in every critical row.

pqr p ∨ q p → r q → r ∴ r critical?
TTTTTTTyes · conclusion T ✓
TTFTFFFno
TFTTTTTyes · conclusion T ✓
TFFTFTFno
FTTTTTTyes · conclusion T ✓
FTFTTFFno
FFTFTTTno · p ∨ q is F
FFFFTTFno · p ∨ q is F

Premise columns: p ∨ q, p → r, q → r.

Conclusion column: ∴ r.

Critical rows (all three premises T): rows 1, 3, and 5. In each of those rows the conclusion r is also T.

The argument is valid.

Explanation. In every row where all three premises hold simultaneously, the conclusion r is also true. There is no critical row in which the conclusion fails, so no counterexample exists. The argument therefore preserves truth.

Recognise the form. This is the inference rule Division into cases (Chapter 2.3, Rule 8): from p ∨ q together with p → r and q → r, conclude r. Once the rule is proven valid by truth table (as above), it can be cited by name in later proofs without re-deriving.

Marking guide (4 marks, 1 per criterion).

  • 1 mark: complete and correct 8-row truth table with all premise and conclusion columns computed correctly.
  • 1 mark: correct identification of which columns are the premises (p ∨ q, p → r, q → r) and which is the conclusion (r).
  • 1 mark: correct identification of the three critical rows where all premises are true.
  • 1 mark: correct validity verdict with an explanation referencing the critical rows.