START WELL TO END WELL
+92 340 1501700 startwelleducationbhimber@gmail.com Mon – Sat: 8:00 AM – 2:00 PM
Startwell Education logo
StartwellEducation
Discrete Structures · Lecture 2

Truth Tables, Tautologies and Contradictions

Week 1, slot 2 · CLO-1, CLO-2 · Bloom C3 · Prerequisite: Lecture 1 · Reference: Rosen 7th, Logic and Proofs

Learning objectives

  1. Build a truth table for any compound proposition.
  2. Know that n variables give 2ⁿ rows.
  3. Classify a proposition as tautology, contradiction or contingency.
  4. Use truth tables to decide when two statements agree.

Roman Urdu. Is lecture mein hum compound proposition ka truth table banana seekhte hain. n variables ke liye 2ⁿ rows hoti hain. Phir dekhte hain ke koi statement hamesha sahih (tautology), hamesha ghalat (contradiction) ya kabhi sahih kabhi ghalat (contingency) hai.

Core concepts

Definition. A tautology is always true. A contradiction is always false. A contingency is sometimes true and sometimes false.

Method for building a table: (1) list variables; (2) write all 2ⁿ combinations in a fixed order, starting TT…T and ending FF…F; (3) add one column per sub-expression, working from the innermost brackets outwards; (4) the last column is the answer.

Theorem. A table with n variables has 2ⁿ rows. Reason: each variable independently takes 2 values, so by the product rule there are 2 · 2 · … · 2 = 2ⁿ combinations.

Try it: truth table maker

Type a statement using p, q, r, s. Use the buttons or type ! (not), & (and), | (or), ^ (xor), -> (implies), <-> (iff).

Worked examples

Example 1 (basic). Show p ∨ ¬p is a tautology and p ∧ ¬p a contradiction.

p ¬p p ∨ ¬p p ∧ ¬p
T F T F
F T T F

The third column is all T and the fourth is all F, as claimed.

Example 2 (intermediate). Show (p ∨ q) ∧ ¬(p ∧ q) has the same truth values as p ⊕ q.

p q p∨q p∧q ¬(p∧q) (p∨q) ∧ ¬(p∧q) p⊕q
T T T T F F F
T F T F T T T
F T T F T T T
F F F F T F F

The last two columns match in all four rows, so "at least one but not both" is exactly XOR.

Example 3 (advanced). Show [(p → q) ∧ p] → q is a tautology.

p q p→q (p → q) ∧ p whole statement
T T T T T
T F F F T
F T T F T
F F T F T

The last column is all T. This tautology is the rule modus ponens, used again in Lecture 5.

Example 4 (computing). For if (a && (b || !a)), a table over a and b shows the result equals a ∧ b. Check: when a = T, b ∨ ¬a = b; when a = F the whole thing is F. So the test !a inside is redundant and can be removed.

Computer science connection

Testing all input combinations of a condition; circuit verification. Checking every row costs 2ⁿ steps. Deciding satisfiability of a Boolean formula (SAT) is the classic NP-complete problem, which is why large circuits need smarter methods than tables.

Key takeaways

  • n variables → 2ⁿ rows.
  • Tautology: all T. Contradiction: all F. Contingency: mixed.
  • Build tables column by column from the inside out.

Roman Urdu. n variables ka truth table 2ⁿ rows ka hota hai. Agar aakhri column mein sab T ho to tautology, sab F ho to contradiction. Table banate waqt andar wale brackets se shuru karein.

Five revision questions

  1. How many rows are in a truth table with 5 variables?
  2. Classify p → (p ∨ q).
  3. Build a table for (p → q) ∧ (q → p).
  4. Is (p ∧ q) → p a tautology? Justify.
  5. Simplify the condition a || (a && b) using a table.

Homework. Build the 8-row table for (p ∧ q) → r and state its type. Write a short program that prints the truth table of any two-variable expression.

Quiz

3 variables ki truth table mein kitni rows?

All lectures

  1. Lecture 0: Discrete vs Continuous
  2. Lecture 1: Propositions and Connectives
  3. Lecture 2: Truth Tables, Tautologies and Contradictions
  4. Lecture 3: Logical Equivalence and the Laws of Logic
  5. Lecture 4: Predicate Logic and Quantifiers
  6. Lecture 5: Rules of Inference
  7. Lecture 6: Logical Arguments and Puzzle Solving
  8. Lecture 7: Direct Proof and Proof by Implication
  9. Lecture 8: Proof by Contraposition
  10. Lecture 9: Proof by Contradiction
  11. Lecture 10: Mathematical Induction
  12. Lecture 11: Strong Induction
  13. Lecture 12: Applications of Proofs and Proof Strategy
Admissions Open

Give your child the right start.

Seats are limited. Visit our campus, meet our teachers and see why families trust Startwell Education.