Learning objectives
- Explain why p → q and ¬q → ¬p are interchangeable.
- Decide when contraposition is easier than a direct proof.
- Write a complete proof by contraposition.
- Prove biconditionals by proving both directions.
Roman Urdu. Kabhi p → q ko seedha sabit karna mushkil hota hai. Lecture 3 se hum jante hain ke p → q aur ¬q → ¬p barabar hain, is liye hum ¬q maan kar ¬p tak pohanchte hain. Isay proof by contraposition kehte hain.
Core concepts
Method. To prove p → q: (1) assume ¬q; (2) show ¬p; (3) conclude ¬q → ¬p, hence p → q, because the two are equivalent.
When to use it. When q is a negative or "not" statement, or when ¬q gives a clean algebraic form (for example "n is even" gives n = 2k) while p is hard to unpack.
Biconditionals. To prove p ↔ q, prove p → q and q → p. To prove several statements are equivalent, prove a cycle of implications.
Misconception. Contraposition is not the converse. Proving ¬p → ¬q is not enough.
Worked examples
Example 1 (basic). Theorem. If 3n + 2 is odd, then n is odd. Contrapositive: if n is even, then 3n + 2 is even. Proof: n = 2k, so 3n + 2 = 6k + 2 = 2(3k + 1), which is even. ∎
Example 2 (intermediate). Theorem. If n² is even, then n is even. Contrapositive: if n is odd, then n² is odd. This was proved in Lecture 7, Example 2. ∎ A direct attempt would need to take a square root, which is awkward. This is the kind of case where contraposition is clearly better.
Example 3 (advanced). Theorem. If n = ab with a and b positive integers, then a ≤ √n or b ≤ √n. Contrapositive: if a > √n and b > √n, then n ≠ ab. Proof: multiplying the two inequalities (all numbers positive), ab > √n · √n = n, so ab ≠ n. ∎ Computing meaning: to find a factor of n it is enough to test divisors up to √n.
Example 4 (computing). A rule says "if the request is authorised, it carries a valid token." The contrapositive "if the token is invalid, deny the request" is the check that is actually coded. The two statements are logically the same rule.
Computer science connection
Security checks written as "deny unless…"; trial division up to √n in primality tests (Module 7); proving program properties by showing that any violation implies a precondition failure.
Key takeaways
- p → q ≡ ¬q → ¬p, so proving either proves both.
- Contraposition beats a direct proof when ¬q is easier to use than p.
- Do not confuse contrapositive with converse.
Roman Urdu. Contraposition mein ¬q maan kar ¬p sabit karte hain. Yeh tab asaan hota hai jab q "not" wala statement ho. Converse (q → p) sabit karna contraposition nahi hai.
Five revision questions
- State the contrapositive of "If n² is odd then n is odd."
- Prove: if 5n + 3 is even, then n is odd.
- Prove: if ab is odd, then a and b are both odd.
- Why does Example 3 imply a primality test only needs to check up to √n?
- Outline how to prove "n is even if and only if n² is even."
Homework. Prove by contraposition: (a) if 7n + 4 is even, then n is even; (b) for real x and y, if x + y ≥ 2 then x ≥ 1 or y ≥ 1. Then prove that n is even if and only if n² is even.
Quiz
p → q ki contrapositive?
Contrapositive ¬q → ¬p, aur ye original ke barabar hai.
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