COMP233 · Quiz #1 & Answers

Quiz #1: Worked Solutions

Chapters 1, 2, 3 · Section 9 · Second Semester 2025/2026
Back to COMP233

About this Quiz

This is Quiz #1 from the start of the term, covering material from Chapters 1, 2, and 3. Below you will find every question reproduced exactly as it appeared on the paper, with my worked solutions and the marking criteria for each part. Work each question on paper first, then click Show solution.

Course
Discrete Mathematics (COMP 233)
Section
9
Semester
Second Semester 2025/2026
Covers
Chapters 1, 2, 3
Questions
2 (Q1: 45 pts, Q2: 55 pts)
Total
100 pts · weight 10% of course grade
Q1
Logical equivalence, tautology, and an inference rule
[ 45 marks ]
Q1.a
15 pts
Simplify the following logical expression to an equivalent expression:
¬(p ∧ ¬q) ∧ (p ∨ q)
Worked solution

Apply equivalence laws step by step:

¬(p ∧ ¬q) ∧ (p ∨ q)given
≡ (¬p ∨ ¬(¬q)) ∧ (p ∨ q)De Morgan's law
≡ (¬p ∨ q) ∧ (p ∨ q)double negation
≡ q ∨ (¬p ∧ p)distributive law (factor out q)
≡ q ∨ cnegation law (¬p ∧ p ≡ c)
≡ qidentity law (q ∨ c ≡ q)

Final simplification: ¬(p ∧ ¬q) ∧ (p ∨ q) ≡ q.

Marking guide (15 pts, 3 pts per correct step over 5 steps).

  • 3 pts: De Morgan applied to ¬(p ∧ ¬q).
  • 3 pts: double negation applied to ¬(¬q).
  • 3 pts: distributive law to factor out q.
  • 3 pts: negation law identifying ¬p ∧ p ≡ c.
  • 3 pts: identity law to reach q.

Accept equivalent orderings. Equivalent if students use NOT, ~, or instead of ¬.

Q1.b
25 pts
Show that the following expression is a tautology by proving the logical equivalence using a truth table:
(p ∧ (p → q)) → q ≡ T
Worked solution

Build the truth table column by column. Four rows for two variables p, q:

pq p → q p ∧ (p → q) (p ∧ (p → q)) → q
TTTTT
TFFFT
FTTFT
FFTFT

The final column is T in every row, so the expression evaluates to true for every assignment of truth values to p and q.

(p ∧ (p → q)) → q ≡ T. The expression is a tautology.

Marking guide (25 pts).

  • 3 pts: correct column headers (the five columns above).
  • 3 pts: correctly computed intermediate columns (p → q and p ∧ (p → q)).
  • 16 pts: 4 pts per correct row (4 rows). Lose 1 pt per wrong cell.
  • 3 pts: correct conclusion stating the expression is a tautology and equivalent to T.

If the table is missing entirely: 0 pts.

Q1.c
5 pts
Which Rule of Inference is represented by the tautology in part (b)? Write its formal argument form.
Worked solution

The tautology (p ∧ (p → q)) → q says: if both p and p → q are true, then q is true. That is exactly Modus Ponens.

p p → q ∴ q

Marking guide (5 pts).

  • 2 pts: correctly naming Modus Ponens.
  • 3 pts: correct formal argument form (two premises p and p → q, conclusion q).

Accept equivalent notations for the conclusion (∴ q, ⊢ q, "therefore q"). 0 pts if the rule name is wrong (any other rule).

Q2
Conditional variations, predicates & quantifiers, short answers
[ 55 marks ]
Q2.a
20 pts
Write the contrapositive, converse, inverse, and negation of the following statement:
If Sara passes Discrete Math, then she will register for Data Structures and she will take Algorithms.
Worked solution

Let p = "Sara passes Discrete Math", q = "Sara registers for Data Structures", r = "Sara takes Algorithms". The original statement is p → (q ∧ r).

Contrapositive
¬(q ∧ r) → ¬p  ≡  (¬q ∨ ¬r) → ¬p
"If Sara does not register for Data Structures or does not take Algorithms, then she does not pass Discrete Math."
Converse
(q ∧ r) → p
"If Sara registers for Data Structures and takes Algorithms, then she passes Discrete Math."
Inverse
¬p → ¬(q ∧ r)  ≡  ¬p → (¬q ∨ ¬r)
"If Sara does not pass Discrete Math, then she does not register for Data Structures or does not take Algorithms."
Negation
¬(p → (q ∧ r))  ≡  p ∧ (¬q ∨ ¬r)
"Sara passes Discrete Math, and she does not register for Data Structures or does not take Algorithms."

Important. The negation is not a conditional (no "if…then"). It is a conjunction: the hypothesis holds and the conclusion fails.

Marking guide (20 pts, 5 pts per variation).

  • 3 pts: correct symbolic form for that variation.
  • 2 pts: correct verbal sentence in English.

Must apply De Morgan to ¬(q ∧ r) when writing the contrapositive, inverse, and negation. Deduct 2 pts if missing. Accept ¬q ∨ ¬r or equivalently ¬r ∨ ¬q. The negation must not be a conditional.

Q2.b
20 pts
Consider the following predicates defined on the domain D = {2, 3, 5, 6, 8}:
  • E(x): "x is even"
  • P(x): "x is prime"
For each of the following, write the statement formally using quantifiers and predicates, then determine its truth value. Justify your answer.
  1. Every element in D is even.  [5 pts]
  2. There exists an element in D that is both even and prime.  [5 pts]

Rewrite the following formal statement as a complete English sentence, then determine its truth value with justification:  [10 pts]

∀x ∈ D, (E(x) → P(x))
Worked solution

(i) Every element in D is even.

Formal: ∀x ∈ D, E(x).

Truth value: False. Counterexample: x = 3 is in D but is not even. (Also 5 works.)

(ii) There exists an element in D that is both even and prime.

Formal: ∃x ∈ D, (E(x) ∧ P(x)).

Truth value: True. Witness: x = 2 is both even (2 = 2·1) and prime.

Rewrite: ∀x ∈ D, (E(x) → P(x))

English: "For every element x in D, if x is even then x is prime."

Truth value: False. Counterexample: x = 6 is even (6 = 2·3) but is not prime (6 = 2·3). The hypothesis holds and the conclusion fails. (x = 8 is another counterexample.)

Marking guide (20 pts).

Part (i) · 5 pts:

  • 2 pts: correct formal statement ∀x ∈ D, E(x).
  • 1 pt: correct truth value (False).
  • 2 pts: justification with a specific counterexample.

Part (ii) · 5 pts:

  • 2 pts: correct formal statement ∃x ∈ D, (E(x) ∧ P(x)).
  • 1 pt: correct truth value (True).
  • 2 pts: justification with a specific witness (x = 2).

Rewrite · 10 pts:

  • 4 pts: correct English sentence (universal conditional read aloud).
  • 2 pts: correct truth value (False).
  • 4 pts: justification with a specific counterexample where the hypothesis holds but the conclusion fails (x = 6 or x = 8).
Q2.c
15 pts
Provide the direct logical equivalent or operation for each of the following (write the formal expression). [3 pts each]
  1. Write the negation of the conditional statement: p → q.
  2. Which variation of the conditional p → q is logically equivalent to its Converse?
  3. Given p ↔ q, write it as a conjunction of two conditional statements.
  4. Write the formal argument form of Modus Tollens (using p and q).
  5. Let D = {1, 2, 3, 4} and let P(x) be "x is a factor of 8." Write the truth set of P(x).
Worked solution

1) Negation of p → q:

¬(p → q) ≡ p ∧ ¬q

Reading: "p is true and q is false." The negation of a conditional is not itself a conditional.

2) The variation equivalent to the converse (q → p) is the Inverse:

Inverse: ¬p → ¬q  ≡  Converse: q → p

The converse and inverse are contrapositives of each other, so they are logically equivalent.

3) The biconditional as a conjunction of two conditionals:

p ↔ q ≡ (p → q) ∧ (q → p)

(p implies q) and (q implies p) read together as "p if and only if q".

4) Formal argument form of Modus Tollens:

p → q ¬q ∴ ¬p

Reading: "If p then q. Not q. Therefore not p."

5) Truth set of P(x) on D = {1, 2, 3, 4}:

Check each element. The factors of 8 are 1, 2, 4, 8. Of these, the ones in D are:

Truth set = {1, 2, 4}

Note: 8 is a factor of 8, but 8 ∉ D, so 8 is excluded.

Marking guide (15 pts, 3 pts each).

  • 1) 3 pts for p ∧ ¬q. Accept ¬(p → q) directly but only 1 pt if no simplification.
  • 2) 3 pts for naming the Inverse. 1 pt if only the symbolic form ¬p → ¬q is given without naming it.
  • 3) 3 pts for (p → q) ∧ (q → p). Accept equivalent ordering. 0 pts if disjunction or wrong connective.
  • 4) 3 pts: 1 pt per premise (p → q, ¬q), 1 pt for conclusion ∴ ¬p. All three must be present for full marks.
  • 5) 3 pts for {1, 2, 4}. Deduct 1 pt if 8 is included (forgetting the domain restriction). Deduct 1 pt per wrong or missing element.
Summary of marks. Q1.a Simplification (15) · Q1.b Truth-table tautology (25) · Q1.c Rule of inference (5) · Q2.a Conditional variations (20) · Q2.b Predicates and truth values (20) · Q2.c Five short answers (15). Total: 100 pts. Weight: 10% of the final grade.