MTH401Semester 2 • 4 CreditsCore Subjects

Discrete Mathematics

This course on Discrete Mathematics focuses on employability and skill development, covering topics such as logic and proofs, combinatorics, recurrence relations, graph theory, and number theory.

6 Units • Notes • Model Answers • MCQs
Select Course Unit (6 Units)
Active: Unit 1
Unit 1:Unit 1: Logic and Proofs
7 min read•High-Yield Unit Guide

Unit 1: Logic and Proofs

Unit 1 Exam Focus & Core Takeaways

Review the core definitions, standard architectures, and syntax patterns below. Pay special attention to sections highlighted with bullet points for your mid-term and end-term subjective questions.

Unit 1: Logic and Proofs

1. Propositional Logic

Logic is the foundational framework for rigorous mathematical reasoning, formal verification in computer science, and algorithmic design.

1.1 Propositions and Truth Values

A proposition is a declarative statement (a sentence that declares a fact) that is either strictly true (TT or 11) or strictly false (FF or 00), but not both simultaneously.

  • Examples of Propositions:
    • "π>3\pi > 3" (True)
    • "2+2=52 + 2 = 5" (False)
    • "LPU is a university in Punjab" (True)
  • Non-Propositions:
    • "x+2=7x + 2 = 7" (Contains a free variable; neither true nor false until xx is specified)
    • "Read this textbook carefully." (Imperative command)
    • "Is discrete mathematics difficult?" (Interrogative question)

1.2 Fundamental Logical Connectives and Truth Tables

Complex statements are constructed from atomic propositions using logical operators (connectives).

ConnectiveSymbolNotationNatural Language EquivalentTruth Condition
Negation¬\neg or ∼\sim¬p\neg p"Not pp"Inverts truth value: T→F,F→TT \to F, F \to T
Conjunction∧\landp∧qp \land q"pp and qq"True if and only if both pp and qq are true
Disjunction∨\lorp∨qp \lor q"pp or qq" (inclusive or)True if at least one of pp or qq is true
Exclusive Or⊕\oplus or ∨‾\underline{\lor}p⊕qp \oplus q"pp or qq, but not both"True if exactly one operand is true
Conditional→\top→qp \to q"If pp, then qq"False only when hypothesis pp is true and conclusion qq is false
Biconditional↔\leftrightarrowp↔qp \leftrightarrow q"pp if and only if qq"True when pp and qq share the identical truth value

Master Truth Table

ppqq¬p\neg pp∧qp \land qp∨qp \lor qp⊕qp \oplus qp→qp \to qp↔qp \leftrightarrow q
TTTTFFTTTTFFTTTT
TTFFFFFFTTTTFFFF
FFTTTTFFTTTTTTFF
FFFFTTFFFFFFTTTT

1.3 Conditional Statement Variants: Converse, Contrapositive, and Inverse

Given an implication p→qp \to q (where pp is the hypothesis/antecedent and qq is the conclusion/consequent):

Implication VariantFormal StatementTruth Relation to Original p→qp \to q
Original Implicationp→qp \to qBaseline statement
Contrapositive¬q→¬p\neg q \to \neg pLogically equivalent to p→qp \to q ((p→q)≡(¬q→¬p)(p \to q) \equiv (\neg q \to \neg p))
Converseq→pq \to pNOT equivalent to p→qp \to q; equivalent to Inverse
Inverse¬p→¬q\neg p \to \neg qNOT equivalent to p→qp \to q; equivalent to Converse

[!IMPORTANT]
A conditional statement is always logically equivalent to its contrapositive, but is never guaranteed to be equivalent to its converse or inverse. Confusing an implication with its converse is a common logical fallacy.


2. Propositional Equivalences

2.1 Classification of Compound Propositions

  • Tautology: A compound proposition that is always true for every possible truth assignment of its propositional variables (e.g., p∨¬pp \lor \neg p, p→pp \to p).
  • Contradiction: A compound proposition that is always false for every possible truth assignment (e.g., p∧¬pp \land \neg p).
  • Contingency: A proposition that is neither a tautology nor a contradiction (its truth value depends on variable assignments).

2.2 Logical Equivalence (≡\equiv or ⟺\Longleftrightarrow)

Two compound propositions AA and BB are logically equivalent, denoted A≡BA \equiv B, if A↔BA \leftrightarrow B is a tautology. That is, AA and BB have identical truth values under every truth assignment.

2.3 Fundamental Laws of Logical Equivalences

Law NameIdentity 1Identity 2
Identity Lawsp∧T≡pp \land T \equiv pp∨F≡pp \lor F \equiv p
Domination Lawsp∨T≡Tp \lor T \equiv Tp∧F≡Fp \land F \equiv F
Idempotent Lawsp∨p≡pp \lor p \equiv pp∧p≡pp \land p \equiv p
Double Negation Law¬(¬p)≡p\neg(\neg p) \equiv p—
Commutative Lawsp∨q≡q∨pp \lor q \equiv q \lor pp∧q≡q∧pp \land q \equiv q \land p
Associative Laws(p∨q)∨r≡p∨(q∨r)(p \lor q) \lor r \equiv p \lor (q \lor r)(p∧q)∧r≡p∧(q∧r)(p \land q) \land r \equiv p \land (q \land r)
Distributive Lawsp∨(q∧r)≡(p∨q)∧(p∨r)p \lor (q \land r) \equiv (p \lor q) \land (p \lor r)p∧(q∨r)≡(p∧q)∨(p∧r)p \land (q \lor r) \equiv (p \land q) \lor (p \land r)
De Morgan's Laws¬(p∧q)≡¬p∨¬q\neg(p \land q) \equiv \neg p \lor \neg q¬(p∨q)≡¬p∧¬q\neg(p \lor q) \equiv \neg p \land \neg q
Absorption Lawsp∨(p∧q)≡pp \lor (p \land q) \equiv pp∧(p∨q)≡pp \land (p \lor q) \equiv p
Negation Lawsp∨¬p≡Tp \lor \neg p \equiv Tp∧¬p≡Fp \land \neg p \equiv F

Essential Conditional Equivalences:

  1. p→q≡¬p∨qp \to q \equiv \neg p \lor q (Material Implication)
  2. p→q≡¬q→¬pp \to q \equiv \neg q \to \neg p (Contrapositive Equivalence)
  3. ¬(p→q)≡p∧¬q\neg(p \to q) \equiv p \land \neg q (Negation of Implication)
  4. p↔q≡(p→q)∧(q→p)≡(¬p∨q)∧(¬q∨p)≡(p∧q)∨(¬p∧¬q)p \leftrightarrow q \equiv (p \to q) \land (q \to p) \equiv (\neg p \lor q) \land (\neg q \lor p) \equiv (p \land q) \lor (\neg p \land \neg q)

3. Predicates and Quantifiers

Propositional logic cannot express assertions about individual objects or categories (e.g., "Every prime number greater than 2 is odd"). First-order predicate logic extends propositional logic by introducing variables, predicates, and quantifiers.

3.1 Predicates and Truth Sets

  • A predicate P(x)P(x) is a statement containing a variable xx. Once a specific value aa from the domain of discourse (universe of discourse UU) is assigned to xx, P(a)P(a) becomes a proposition with a definite truth value.
  • The truth set of P(x)P(x) is the set of all elements a∈Ua \in U for which P(a)P(a) is true:
    {a∈U∣P(a) is true}\{ a \in U \mid P(a) \text{ is true} \}

3.2 Quantifiers

QuantifierNotationMeaningTrue ConditionFalse Condition
Universal Quantifier∀xP(x)\forall x P(x)"For all xx, P(x)P(x)"P(x)P(x) is true for every x∈Ux \in UThere is at least one x∈Ux \in U for which P(x)P(x) is false (counterexample)
Existential Quantifier∃xP(x)\exists x P(x)"There exists an xx such that P(x)P(x)"There is at least one x∈Ux \in U for which P(x)P(x) is trueP(x)P(x) is false for every x∈Ux \in U
Uniqueness Quantifier∃!xP(x)\exists! x P(x)"There exists a unique xx such that P(x)P(x)"Exactly one element x∈Ux \in U satisfies P(x)P(x)No element or more than one element satisfies P(x)P(x)

3.3 Negation of Quantified Statements (Generalized De Morgan's Laws)

To negate a quantified statement, toggle the quantifier and negate the predicate:
¬∀xP(x)≡∃x¬P(x)\neg \forall x P(x) \equiv \exists x \neg P(x)
¬∃xP(x)≡∀x¬P(x)\neg \exists x P(x) \equiv \forall x \neg P(x)


3.4 Nested Quantifiers and Order Dependence

When multiple quantifiers are applied to a multi-variable predicate Q(x,y)Q(x, y):

  • Commutativity of Identical Quantifiers:
    ∀x∀yQ(x,y)≡∀y∀xQ(x,y)\forall x \forall y Q(x, y) \equiv \forall y \forall x Q(x, y)
    ∃x∃yQ(x,y)≡∃y∃xQ(x,y)\exists x \exists y Q(x, y) \equiv \exists y \exists x Q(x, y)
  • Non-Commutativity of Mixed Quantifiers:
    ∀x∃yQ(x,y)≢∃y∀xQ(x,y)\forall x \exists y Q(x, y) \not\equiv \exists y \forall x Q(x, y)
    • ∀x∃yQ(x,y)\forall x \exists y Q(x, y): For every xx, there exists a yy (which may depend on xx) such that Q(x,y)Q(x, y) holds.
    • ∃y∀xQ(x,y)\exists y \forall x Q(x, y): There exists a single universal yy that simultaneously works for all xx.
    • The second statement is strictly stronger: ∃y∀xQ(x,y)  ⟹  ∀x∃yQ(x,y)\exists y \forall x Q(x, y) \implies \forall x \exists y Q(x, y), but the converse does not hold.

4. Rules of Inference

An argument is a sequence of statements ending in a conclusion. An argument is valid if the truth of all its premises guarantees the truth of its conclusion:
(p1∧p2∧⋯∧pk)→q is a tautology(p_1 \land p_2 \land \dots \land p_k) \to q \text{ is a tautology}

Rule of InferencePremise 1Premise 2ConclusionTautology Form
Modus Ponens (Law of Detachment)ppp→qp \to q∴q\therefore q[p∧(p→q)]→q[p \land (p \to q)] \to q
Modus Tollens¬q\neg qp→qp \to q∴¬p\therefore \neg p[¬q∧(p→q)]→¬p[\neg q \land (p \to q)] \to \neg p
Hypothetical Syllogismp→qp \to qq→rq \to r∴p→r\therefore p \to r[(p→q)∧(q→r)]→(p→r)[(p \to q) \land (q \to r)] \to (p \to r)
Disjunctive Syllogismp∨qp \lor q¬p\neg p∴q\therefore q[(p∨q)∧¬p]→q[(p \lor q) \land \neg p] \to q
Additionpp—∴p∨q\therefore p \lor qp→(p∨q)p \to (p \lor q)
Simplificationp∧qp \land q—∴p\therefore p(p∧q)→p(p \land q) \to p
Conjunctionppqq∴p∧q\therefore p \land q[(p)∧(q)]→(p∧q)[(p) \land (q)] \to (p \land q)
Resolutionp∨qp \lor q¬p∨r\neg p \lor r∴q∨r\therefore q \lor r[(p∨q)∧(¬p∨r)]→(q∨r)[(p \lor q) \land (\neg p \lor r)] \to (q \lor r)

4.1 Common Fallacies (Invalid Reasoning)

  1. Fallacy of Affirming the Conclusion:
    • Premises: p→qp \to q and qq. Conclusion: ∴p\therefore p.
    • Invalid because [(p→q)∧q]→p[(p \to q) \land q] \to p is a contingency, not a tautology.
  2. Fallacy of Denying the Hypothesis:
    • Premises: p→qp \to q and ¬p\neg p. Conclusion: ∴¬q\therefore \neg q.
    • Invalid because [(p→q)∧¬p]→¬q[(p \to q) \land \neg p] \to \neg q is a contingency.

5. Methods of Mathematical Proof

A proof is a valid mathematical argument that establishes the absolute truth of a statement.

5.1 Proof Terminology

  • Axiom (Postulate): A statement assumed to be true without proof.
  • Theorem: A mathematical statement that has been proven true.
  • Proposition: A less significant or standalone mathematical statement.
  • Lemma: A stepping-stone theorem proved primarily to assist in proving a broader theorem.
  • Corollary: A theorem that follows directly from another theorem with minimal additional proof.
  • Conjecture: A statement proposed to be true, but not yet verified or disproved.

5.2 Direct Proof

To prove a conditional statement p→qp \to q directly:

  1. Assume the hypothesis pp is true.
  2. Use definitions, axioms, previously established theorems, and valid rules of inference.
  3. Deduce that the conclusion qq must be true.

Example:

Theorem: If nn is an odd integer, then n2n^2 is an odd integer.

  • Proof:
    1. Let nn be an arbitrary odd integer.
    2. By definition of an odd integer, n=2k+1n = 2k + 1 for some integer k∈Zk \in \mathbb{Z}.
    3. Compute n2n^2:
      n2=(2k+1)2=4k2+4k+1=2(2k2+2k)+1n^2 = (2k + 1)^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1
    4. Since kk is an integer, m=2k2+2km = 2k^2 + 2k is also an integer.
    5. Thus n2=2m+1n^2 = 2m + 1, which by definition means n2n^2 is odd. ■\blacksquare

5.3 Proof by Contraposition (Indirect Proof)

Since p→q≡¬q→¬pp \to q \equiv \neg q \to \neg p, proving the contrapositive establishes the original implication:

  1. Assume the negation of the conclusion: ¬q\neg q is true.
  2. Deduce through direct argument that the negation of the hypothesis: ¬p\neg p is true.

Example:

Theorem: If 3n+23n + 2 is odd, then nn is odd (for integer nn).

  • Proof by Contraposition:
    1. The contrapositive statement is: "If nn is even, then 3n+23n + 2 is even."
    2. Assume nn is even. By definition, n=2kn = 2k for some integer kk.
    3. Substitute n=2kn = 2k into 3n+23n + 2:
      3n+2=3(2k)+2=6k+2=2(3k+1)3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1)
    4. Let m=3k+1m = 3k + 1, which is an integer. Then 3n+2=2m3n + 2 = 2m, which is even.
    5. Since the contrapositive is true, the original theorem is true. ■\blacksquare

5.4 Proof by Contradiction (Reductio ad Absurdum)

To prove a proposition pp:

  1. Assume the negation ¬p\neg p is true.
  2. Deduce an impossible logical absurdity or contradiction: r∧¬rr \land \neg r (a statement that is both true and false simultaneously).
  3. Conclude that ¬p\neg p must be false, which proves pp is true.

Classic Example: Irrationality of 2\sqrt{2}

Theorem: 2\sqrt{2} is an irrational number.

  • Proof:
    1. Assume for contradiction that 2\sqrt{2} is rational.
    2. Then 2=ab\sqrt{2} = \frac{a}{b}, where a,b∈Z+a, b \in \mathbb{Z}^+ have no common positive factors other than 1 (gcd⁡(a,b)=1\gcd(a, b) = 1, i.e., the fraction is in lowest terms).
    3. Squaring both sides: 2=a2b2  ⟹  a2=2b22 = \frac{a^2}{b^2} \implies a^2 = 2b^2.
    4. This implies a2a^2 is even, which guarantees aa is even (as proved in Section 5.3).
    5. Since aa is even, write a=2ka = 2k for some integer kk.
    6. Substitute a=2ka = 2k into a2=2b2a^2 = 2b^2:
      (2k)2=2b2  ⟹  4k2=2b2  ⟹  b2=2k2(2k)^2 = 2b^2 \implies 4k^2 = 2b^2 \implies b^2 = 2k^2
    7. This implies b2b^2 is even, which guarantees bb is even.
    8. Therefore, both aa and bb are even, meaning 2 divides both aa and bb.
    9. This contradicts the initial premise that gcd⁡(a,b)=1\gcd(a, b) = 1.
    10. Hence, the assumption that 2\sqrt{2} is rational is false; 2\sqrt{2} must be irrational. ■\blacksquare

5.5 Vacuous and Trivial Proofs

  • Vacuous Proof: If hypothesis pp in p→qp \to q is demonstrably false, the conditional statement p→qp \to q is automatically true regardless of qq.
    • Example: "If 0>10 > 1, then discrete mathematics is trivial." True because 0>10 > 1 is false.
  • Trivial Proof: If conclusion qq in p→qp \to q is demonstrably true on its own, then p→qp \to q is automatically true regardless of pp.
    • Example: "If nn is an integer, then n2+1≥0n^2 + 1 \geq 0." True because n2+1≥1>0n^2 + 1 \geq 1 > 0 for all real nn.

5.6 Proof of Equivalence (Biconditional Proofs)

To prove a biconditional statement p↔qp \leftrightarrow q:
Prove both directions separately:

  1. p  ⟹  qp \implies q (forward direction).
  2. q  ⟹  pq \implies p (backward direction).

For a circular chain of equivalences p1↔p2↔⋯↔pnp_1 \leftrightarrow p_2 \leftrightarrow \dots \leftrightarrow p_n:
Prove the cyclic chain of implications:
p1  ⟹  p2  ⟹  p3  ⟹  ⋯  ⟹  pn  ⟹  p1p_1 \implies p_2 \implies p_3 \implies \dots \implies p_n \implies p_1


5.7 Counterexamples

To disprove a universally quantified assertion ∀xP(x)\forall x P(x), it suffices to find a single instance cc in the domain of discourse UU such that P(c)P(c) is false. Such an instance is called a counterexample.

  • Assertion: "Every odd number is a prime number."
    • Counterexample: Let n=9n = 9. nn is odd, but 9=3×39 = 3 \times 3, so 99 is composite. Hence the universal assertion is disproved.
  • Assertion: "n2+n+41n^2 + n + 41 is prime for all positive integers nn."
    • Counterexample: At n=41n = 41, 412+41+41=41(41+1+1)=41×4341^2 + 41 + 41 = 41(41 + 1 + 1) = 41 \times 43, which is composite.

5.8 Mistakes and Pitfalls in Proofs

  1. Begging the Question (Circular Reasoning): Using the statement to be proved (or an equivalent assumption) as a premise in the proof.
  2. Division by Zero: Hiding an algebraic division by (a−b)(a - b) where a=ba = b.
  3. Misuse of Quantifiers: Assuming an existential witness ∃x\exists x holds universally for all xx.
  4. Generalizing from Specific Examples: Showing a statement holds for n=1,2,3n = 1, 2, 3 does not constitute a valid proof for all n∈Nn \in \mathbb{N}.

6. Summary Comparison of Proof Techniques

Proof TechniqueStrategyWhen to Choose
Direct ProofAssume pp, derive qq algebraicallyStraightforward algebraic or definition-driven implications
ContrapositionAssume ¬q\neg q, derive ¬p\neg pWhen ¬q\neg q provides more concrete algebraic structure than pp
ContradictionAssume p∧¬qp \land \neg q, find absurdityWhen dealing with negative assertions (e.g., irrationality, infinitude of primes)
CounterexampleFind single instance cc where P(c)P(c) is falseDisproving a universal statement ∀xP(x)\forall x P(x)
BiconditionalProve p  ⟹  qp \implies q and q  ⟹  pq \implies pEstablishing "if and only if" characterizations