Skip to main content

Engineering Mathematics

Mathematical Logic

Learn truth tables, implications, and quantifier negations so you can decide validity and equivalences in under a minute — then lock it with GATE-style MCQs and flashcards.

~6 hrs Scoring Discrete unit 10 samples · 10 practice · 10 cards

GATE CSE mathematical logic — propositional logic, normal forms, predicates, quantifiers, sample GATE questions, flashcards, and practice drills.

Learning outcomes

  • Build and read truth tables for compound propositions
  • Convert formulas to CNF/DNF at GATE depth
  • Negate quantified statements correctly
  • Solve GATE-style logic MCQs with a clear explanation trail

Propositional connectives

  • Atomic propositions combine with ¬, ∧, ∨, →, ↔. Precedence usually ¬ > ∧ > ∨ > → > ↔ (confirm convention in the stem).
  • Implication p → q is false only when p is true and q is false. Memorise the truth table.
  • p → q ≡ ¬p ∨ q ≡ ¬q → ¬p (contrapositive). Converse q → p is not equivalent.
  • Biconditional p ↔ q is true when p and q have the same truth value.
  • Exclusive OR p ⊕ q is true when exactly one of p, q is true; p ⊕ q ≡ (p ∨ q) ∧ ¬(p ∧ q) ≡ ¬(p ↔ q).
pqp→qp↔qp⊕q
TTTTF
TFFFT
FTTFT
FFTTF

Worked example

Problem. Which is logically equivalent to ¬(p → q)?

Solution. ¬(¬p ∨ q) ≡ p ∧ ¬q. So implication fails exactly when the premise is true and the conclusion is false.

Normal forms & classification

  • A tautology is always true; a contradiction always false; otherwise contingency.
  • DNF is OR of ANDs of literals; CNF is AND of ORs of literals. GATE may ask which form a formula is in.
  • You can obtain DNF from the truth table by OR-ing minterms where the formula is true.
  • Logical equivalence means identical truth tables — use identities (idempotent, absorption, De Morgan) to simplify.
  • A formula is satisfiable if some assignment makes it true; valid formulas are a special case of satisfiable ones.

Formulas to remember

  • ¬(p ∧ q) ≡ ¬p ∨ ¬q
  • ¬(p ∨ q) ≡ ¬p ∧ ¬q
  • p → q ≡ ¬p ∨ q
  • (p → q) ∧ (q → p) ≡ p ↔ q

Worked example

Problem. Is (p → q) ∧ (q → p) a tautology?

Solution. No — it is equivalent to p ↔ q, which is false when p and q differ. It is a contingency (satisfiable, not valid).

Inference patterns used in GATE

  • Modus Ponens: from p and p → q infer q. Modus Tollens: from ¬q and p → q infer ¬p.
  • Hypothetical syllogism: from p → q and q → r infer p → r.
  • Disjunctive syllogism: from p ∨ q and ¬p infer q.
  • Resolution on CNF clauses is the engine behind many “which conclusion follows” stems — eliminate complementary literals.
RulePremisesConclusion
Modus Ponensp , p → qq
Modus Tollens¬q , p → q¬p
HSp → q , q → rp → r
DSp ∨ q , ¬pq

Predicates & quantifiers

  • ∀x P(x) means P holds for every x in the domain; ∃x P(x) means it holds for at least one x.
  • Negation: ¬∀x P(x) ≡ ∃x ¬P(x) and ¬∃x P(x) ≡ ∀x ¬P(x). Flip quantifier and negate the matrix.
  • Order of mixed quantifiers matters: ∀x ∃y R(x,y) is not the same as ∃y ∀x R(x,y).
  • Restrict domains carefully — “for all positive integers” changes truth values versus “all integers”.
  • Nested reading tip: ∀x ∃y means “for each x you may pick a (possibly different) y”; ∃y ∀x means “one y works for every x”.

Worked example

Problem. Negate: ∀x ∃y (x < y).

Solution. ∃x ∀y ¬(x < y) ≡ ∃x ∀y (x ≥ y) — “there is a maximum element”.

English → logic translation checklist

  • “If P then Q” / “P only if Q” → P → Q. “P if Q” → Q → P. “P if and only if Q” → P ↔ Q.
  • “Unless” often rewrites as: “P unless Q” ≈ ¬Q → P (equivalently P ∨ Q).
  • “Necessary condition for P is Q” means P → Q. “Sufficient condition for P is Q” means Q → P.
  • Unique existence “exactly one” uses ∃x (P(x) ∧ ∀y (P(y) → y = x)).

Exam tips

  • When stuck on implication chains, rewrite every → as ¬p ∨ q and simplify.
  • For quantifier MCQs, try a tiny domain {1,2} to test candidate answers.
  • Remember: converse ≠ contrapositive; only contrapositive preserves equivalence.
  • Mark “valid”, “satisfiable”, and “unsatisfiable” on scrap paper before eliminating options.
  • In “which follows” questions, check whether the conclusion is true in every model of the premises — not merely sometimes.
Exam pattern · 10 questions

GATE sample questions & answers

10 GATE-style MCQs for Mathematical Logic with full explanations. Attempt each question before revealing the answer.

Q1 GATE-style quantifier + equivalence (inspired by GATE CS pattern)

Which one of the following is NOT logically equivalent to ¬∃x ∀y (¬P(y) ∨ Q(x))?

  • A) ∀x ∃y (P(y) ∧ ¬Q(x))
  • B) ∀x ∃y (¬(¬P(y) ∨ Q(x)))
  • C) ∀x ∃y (P(y) → Q(x))
  • D) ¬∃x ∀y (P(y) → Q(x))
Show answer & explanation

Answer: C

Start from ¬∃x ∀y (¬P(y) ∨ Q(x)). Push negation: ∀x ∃y ¬(¬P ∨ Q) ≡ ∀x ∃y (P ∧ ¬Q). Also ¬P∨Q ≡ P→Q, so the original is ¬∃x ∀y (P→Q), matching D. Option C replaces ∧ ¬Q by → and flips the meaning — it is not equivalent.

Q2 GATE-style Modus Tollens word problem

Consider the following logical inferences. I. If it rains, then the cricket match will not be played. II. The cricket match was played. From I and II, which conclusion follows?

  • A) It rained
  • B) It did not rain
  • C) The match may or may not have been played under rain
  • D) None of the above
Show answer & explanation

Answer: B

Let R = rains, M = match played. I is R → ¬M. II is M. From M we get ¬(¬M), so Modus Tollens on R → ¬M yields ¬R. So it did not rain.

Q3 Classic validity MCQ

Which of the following is a tautology?

  • A) (p ∨ q) → (p ∧ q)
  • B) (p ∧ q) → (p ∨ q)
  • C) p → ¬p
  • D) (p → q) → (q → p)
Show answer & explanation

Answer: B

(p ∧ q) → (p ∨ q) fails never: if both true, consequent true; if the antecedent is false, implication is true. A fails when exactly one of p,q is true. C fails when p is true. D is converse of implication and fails when p true, q false.

Q4 GATE-style satisfiability / contradiction check

The propositional formula (p ∧ (p → q) ∧ ¬q) is:

  • A) Satisfiable but not valid
  • B) Valid
  • C) A contradiction (unsatisfiable)
  • D) Equivalent to q
Show answer & explanation

Answer: C

From p and p → q infer q (Modus Ponens), which contradicts ¬q. Equivalently: p ∧ (¬p ∨ q) ∧ ¬q has no satisfying assignment. So the formula is a contradiction.

Q5 High-frequency GATE trap: converse vs contrapositive

Let p, q, r be propositions. Which of the following is TRUE?

  • A) (p → q) ≡ (¬p → ¬q)
  • B) (p → q) ≡ (¬q → ¬p)
  • C) (p → q) ≡ (q → p)
  • D) (p → q) ≡ (p ∧ ¬q)
Show answer & explanation

Answer: B

Contrapositive: p → q ≡ ¬q → ¬p. A is inverse (not equivalent). C is converse. D is the negation of the implication, not the implication itself.

Q6 Quantifier-order classic

Which one is the correct translation of: “Every person has a mother” over people domain with M(x,y) = “y is mother of x”?

  • A) ∃y ∀x M(x,y)
  • B) ∀x ∃y M(x,y)
  • C) ∀x ∀y M(x,y)
  • D) ∃x ∃y M(x,y)
Show answer & explanation

Answer: B

For each person x there exists some y who is mother of x: ∀x ∃y M(x,y). Option A says one fixed mother for everyone.

Q7 GATE-style tautology recognition

Which of the following propositional formulas is a tautology?

  • A) p → (q → p)
  • B) (p → q) → p
  • C) (p ∧ ¬p) → ¬(q ∨ ¬q)
  • D) Both A and C
Show answer & explanation

Answer: D

A is a standard tautology (if p is true, the implication holds; if p is false, p→anything is true after inner analysis — truth table confirms). C has antecedent p∧¬p always false, so the implication is always true regardless of consequent. B fails when p is false and q is true. So A and C are tautologies.

Q8 Counting satisfying assignments

The number of different truth assignments that make (p ∨ ¬q) ∧ (¬p ∨ q) true is:

  • A) 0
  • B) 1
  • C) 2
  • D) 4
Show answer & explanation

Answer: C

(p∨¬q)∧(¬p∨q) ≡ p↔q, true for (p,q)=(T,T) and (F,F) — exactly 2 assignments.

Q9 Quantifier negation drill

¬∀x (P(x) → Q(x)) is equivalent to:

  • A) ∀x (P(x) ∧ ¬Q(x))
  • B) ∃x (P(x) ∧ ¬Q(x))
  • C) ∃x (P(x) → ¬Q(x))
  • D) ∀x (¬P(x) ∨ ¬Q(x))
Show answer & explanation

Answer: B

¬∀x (P→Q) ≡ ∃x ¬(¬P∨Q) ≡ ∃x (P∧¬Q). Option A wrongly keeps ∀. Option C is weaker/wrong shape.

Q10 Resolution / chain of inferences

Which conclusion follows from the premises? 1. ¬p ∨ q 2. ¬q ∨ r 3. p

  • A) ¬r
  • B) r
  • C) ¬p
  • D) q ∧ ¬r
Show answer & explanation

Answer: B

From p and ¬p∨q get q (resolution / DS). From q and ¬q∨r get r. So r follows. ¬r contradicts; ¬p contradicts premise 3.

Topic drill · 10 questions

10 practice questions — Mathematical Logic

Extra page-specific practice beyond the GATE samples. Attempt all 10, then reveal answers to check your reasoning.

P1

How many rows of the truth table of (p ⊕ q) → (p ∨ q) evaluate to TRUE?

  • A) 1
  • B) 2
  • C) 3
  • D) 4
Show answer & explanation

Answer: D) 4

p⊕q is T only for (T,F) and (F,T); in both cases p∨q is T, so implication T. When p⊕q is F, implication is automatically T. All 4 rows true — a tautology.

P2

Simplify (¬p ∨ q) ∧ (p ∨ ¬q) to a single connective form.

  • A) p → q
  • B) p ↔ q
  • C) p ⊕ q
  • D) p ∨ q
Show answer & explanation

Answer: B) p ↔ q

(¬p∨q) is p→q and (p∨¬q) is q→p. Their AND is p↔q.

P3

Which formula is in CNF?

  • A) (p ∧ q) ∨ r
  • B) (p ∨ q) ∧ (¬p ∨ r)
  • C) ¬(p ∨ q) ∧ r
  • D) p → (q ∧ r)
Show answer & explanation

Answer: B) (p ∨ q) ∧ (¬p ∨ r)

CNF is a conjunction of disjunctions of literals. B matches. A is DNF-shaped; C has a negated clause; D still has →.

P4

The negation of ∃x (P(x) → Q(x)) is equivalent to:

  • A) ∀x (P(x) → ¬Q(x))
  • B) ∀x (P(x) ∧ ¬Q(x))
  • C) ∃x (P(x) ∧ ¬Q(x))
  • D) ∀x (¬P(x) ∨ Q(x))
Show answer & explanation

Answer: B) ∀x (P(x) ∧ ¬Q(x))

¬∃x (P→Q) ≡ ∀x ¬(¬P∨Q) ≡ ∀x (P∧¬Q).

P5

Domain = {1,2}. Which is TRUE?

  • A) ∀x ∃y (x < y)
  • B) ∃y ∀x (x ≤ y)
  • C) ∀x ∀y (x ≠ y)
  • D) ∃x ∀y (x > y)
Show answer & explanation

Answer: B) ∃y ∀x (x ≤ y)

Take y=2: both 1≤2 and 2≤2. A fails for x=2 (no larger element). C is false because equals exist. D would need an x greater than every y, impossible.

P6

From premises (p ∨ q) and (¬p ∨ r), which conclusion is valid?

  • A) q ∧ r
  • B) q ∨ r
  • C) p ∧ r
  • D) ¬q ∨ ¬r
Show answer & explanation

Answer: B) q ∨ r

Resolution/case split: if p then from ¬p∨r get r; if ¬p then from p∨q get q. Either way q∨r. q∧r need not hold.

P7

“A sufficient condition for failure is overheating” with F=failure, H=overheating means:

  • A) F → H
  • B) H → F
  • C) F ↔ H
  • D) ¬H → F
Show answer & explanation

Answer: B) H → F

Sufficient condition for F is H means H is enough to guarantee F: H → F.

P8

Which identity is correct?

  • A) p NOR q ≡ ¬p ∧ ¬q
  • B) p NAND q ≡ ¬p ∧ ¬q
  • C) p NOR q ≡ ¬p ∨ ¬q
  • D) p NAND q ≡ p ∨ q
Show answer & explanation

Answer: A) p NOR q ≡ ¬p ∧ ¬q

NOR is ¬(p ∨ q) ≡ ¬p ∧ ¬q by De Morgan. NAND is ¬(p ∧ q) ≡ ¬p ∨ ¬q, so B/C/D are wrong.

P9

Is ((p → q) ∧ (q → r) ∧ p ∧ ¬r) satisfiable?

  • A) Yes
  • B) No
Show answer & explanation

Answer: B) No

From p and p→q get q; from q and q→r get r; contradicts ¬r. Unsatisfiable (contradiction).

P10

Translate and negate: “Someone in the class can solve every GATE logic question.” Let C(x)=in class, S(x,y)=x solves y, Q(y)=logic question.

  • A) Negation: ∀x (C(x) → ∃y (Q(y) ∧ ¬S(x,y)))
  • B) Negation: ∃x (C(x) ∧ ∀y (Q(y) → ¬S(x,y)))
  • C) Negation: ∀x ¬C(x)
  • D) Negation: ∃y ∀x (Q(y) ∧ S(x,y))
Show answer & explanation

Answer: A) Negation: ∀x (C(x) → ∃y (Q(y) ∧ ¬S(x,y)))

Original: ∃x (C(x) ∧ ∀y (Q(y) → S(x,y))). Negate: ∀x (¬C(x) ∨ ∃y (Q(y) ∧ ¬S(x,y))) ≡ ∀x (C(x) → ∃y (Q(y) ∧ ¬S(x,y))).

Topic FAQs

Do I need formal proof systems (natural deduction) for GATE?

No. Focus on truth tables, equivalences, normal forms, and quantifier negation — not Gentzen-style proofs.

What is the difference between satisfiable and valid?

Valid = tautology (true in every interpretation). Satisfiable = true in at least one interpretation. Contingencies are satisfiable but not valid.

How many logic questions appear in GATE CSE?

Usually a small but scoring cluster inside Discrete Mathematics — often 1–2 marks via MCQ/MSQ on equivalence, validity, or quantifiers. Accuracy matters more than volume.

Quick revision · 10 cards

10 flashcards — Mathematical Logic

Hover a card to reveal the answer with a 3D flip. On touch devices, tap the card or use Show answer.

Q1 For propositions p and q, when is the implication p → q FALSE?
Q2 How do you rewrite the implication p → q without using the → connective?
Q3 What is the difference between the converse and the contrapositive of p → q?
Q4 State De Morgan’s laws for conjunction and disjunction.
Q5 How do you negate the quantified statements ∀x P(x) and ∃x P(x)?
Q6 What is the difference between CNF and DNF?
Q7 Define valid, satisfiable, and unsatisfiable propositional formulas.
Q8 State Modus Ponens and Modus Tollens.
Q9 What is the difference between ∀x ∃y R(x,y) and ∃y ∀x R(x,y)?
Q10 In English-to-logic translation, what does “P only if Q” mean?