Learning objectives
- Build a truth table for any compound proposition.
- Know that n variables give 2ⁿ rows.
- Classify a proposition as tautology, contradiction or contingency.
- 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
- How many rows are in a truth table with 5 variables?
- Classify p → (p ∨ q).
- Build a table for (p → q) ∧ (q → p).
- Is (p ∧ q) → p a tautology? Justify.
- 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?
2 ki power 3 = 8 rows.
All lectures
- Lecture 0: Discrete vs Continuous
- Lecture 1: Propositions and Connectives
- Lecture 2: Truth Tables, Tautologies and Contradictions
- Lecture 3: Logical Equivalence and the Laws of Logic
- Lecture 4: Predicate Logic and Quantifiers
- Lecture 5: Rules of Inference
- Lecture 6: Logical Arguments and Puzzle Solving
- Lecture 7: Direct Proof and Proof by Implication
- Lecture 8: Proof by Contraposition
- Lecture 9: Proof by Contradiction
- Lecture 10: Mathematical Induction
- Lecture 11: Strong Induction
- Lecture 12: Applications of Proofs and Proof Strategy
START WELL TO END WELL