Discrete Mathematics: Mathematical Logic and Methods of Proof

Propositions and Logical Connectives

Definition of Proposition

  • A proposition is a declarative sentence (an assertion) which is either true or false, but not both.

Example 1.1 – Propositions
  • (a) "3 is a prime number." (true)

  • (b) "Warangal is the capital of India." (false)

  • (c) "1+5=61 + 5 = 6." (true)

  • (d) "6 divides 13." (false)

Key Point / Common Mistake
  • Not every sentence is a proposition! The following sentences are not propositions:

    • (a) "Read this carefully." – an order, not true/false.

    • (b) "Are you attending this class?" – a question.

    • (c) "x+y=7x + y = 7." – an open sentence; truth depends on unknown x,yx, y.

    • (d) "a−b>3a - b > 3." – an open sentence; truth depends on a,ba, b.

  • A sentence only qualifies as a proposition once it has a fixed, well-defined truth value.

Truth Value and Propositional Variables

Definition: Truth Value
  • If a proposition is true, its truth value is denoted TT or 11. If false, its truth value is denoted FF or 00.

  • Notation:

    • (i) Throughout, 11 and 00 stand for true and false.

    • (ii) T\mathbf{T} denotes a proposition that is always true; F\mathbf{F} denotes one that is always false.

Definition: Propositional Variables
  • Variables that represent propositions (with unspecified truth value) are called propositional variables, usually written p,q,r,s,…p, q, r, s, \dots (some references use P,Q,R,S,…P, Q, R, S, \dots).

  • Example:

    • pp : "3 is a prime number."

    • qq : "1+9=101 + 9 = 10."

    • rr : "6 divides 11."

Exercises 1
  1. Which of the following are propositions? For each proposition, give its truth value.

    • (a) "Every prime number is odd."

    • (b) "Please close the door."

    • (c) "23=82^3 = 8."

    • (d) "What time is it?"

    • (e) "x2−4=0x^2 - 4 = 0."

    • (f) "Hyderabad is the capital of Telangana."

  2. Write two propositions of your own – one true and one false.

  3. Explain, in one line, why "nn is an even number" is not a proposition, while "4 is an even number" is.

Logical Connectives

  • Propositions built from existing propositions using logical connectives are called compound propositions:

    • Negation: ¬\neg (NOT)

    • Conjunction: ∧\wedge (AND)

    • Disjunction: ∨\vee (OR)

    • Implication: →\rightarrow (if)

    • Biconditional: ↔\leftrightarrow (if and only if)

    • Exclusive OR: ⊕\oplus (XOR)

Definition: Negation, ¬\neg
  • Negation is a unary operator (it acts on a single proposition). If pp is a proposition, its negation is denoted ¬p\neg p (also written ∼p\sim p or pˉ\bar{p}), read "not pp".

pp

¬p\neg p

1

0

0

1

Example 1.2 – Negation
  • pp : "4 is a prime number." (0)

  • ¬p\neg p : "4 is not a prime number." (1)

Definition: Conjunction, ∧\wedge
  • Conjunction is a binary operator. If p,qp, q are propositions, their conjunction p∧qp \wedge q is read "pp and qq", and is true Leicester/exactly when both pp and qq are true.

pp

qq

p∧qp \wedge q

0

0

0

0

1

0

1

0

0

1

1

1

Example 1.3 – Conjunction
  • pp : "4 is a prime number."

  • qq : "3+2=53 + 2 = 5."

  • p∧qp \wedge q : "4 is a prime number and 3+2=53 + 2 = 5." – false (since pp is false).

Definition: Disjunction, ∨\vee
  • Disjunction is a binary operator. If p,qp, q are propositions, their disjunction p∨qp \vee q is read "pp or qq", and is true whenever at least one of p,qp, q is true.

pp

qq

p∨qp \vee q

0

0

0

0

1

1

1

0

1

1

1

1

Example 1.4 – Disjunction
  • pp : "4 is a prime number."

  • qq : "3+2=53 + 2 = 5."

  • p∨qp \vee q : "4 is a prime number or 3+2=53 + 2 = 5." – true (since qq is true).

Key Point / Common Mistake
  • ∧\wedge needs both sides true (only row 1,1 gives 1).

  • ∨\vee needs at least one side true (only row 0,0 gives 0).

  • They agree everywhere except when exactly one of p,qp, q is true and one is false – ∧\wedge then says false, ∨\vee says true.

Exercises

Let pp : "It is raining," qq : "It is cold."

  1. Write ¬p\neg p, p∧qp \wedge q, and p∨qp \vee q in words.

  2. Construct the truth table for ¬p∨q\neg p \vee q

  3. Construct the truth table for p∧¬qp \wedge \neg q

  4. If pp is true and qq is false, find the truth values of ¬p\neg p, p∧qp \wedge q, and p \vee q$.\n5. Translate into symbols: "It is not raining, but it is cold."\n\n# Implication and Equivalence\n\n## Implication (Conditional Statement)\n\n### Definition: Implication, \rightarrow\n\n- If p, qarepropositions,are propositions,p \rightarrow qisa∗∗conditionalstatement∗∗(orimplication),read"ifis a **conditional statement** (or implication), read "ifp,then, thenq".\n- In p \rightarrow q,,pisthe∗∗hypothesis∗∗(antecedent/premise)andis the **hypothesis** (antecedent/premise) andq is the **conclusion** (consequence).\n\n| p∣|q∣|p \rightarrow q |\n| :---: | :---: | :---: |\n| 0 | 0 | 1 |\n| 0 | 1 | 1 |\n| 1 | 0 | 0 |\n| 1 | 1 | 1 |\n\n- p \rightarrow qis∗∗onlyfalse∗∗whenis **only false** whenpistrueandis true andq is false – a true hypothesis leading to a false conclusion.\n\n### Example 2.1 – Implication\n\n- "If Warangal is the capital of Telangana, then New Delhi is not the capital of India." – **true** (1), because the hypothesis "Warangal is the capital of Telangana" is false, and 0 \rightarrow q is always true.\n\n### Key Point / Common Mistake\n\n- p \rightarrow q can be read in many equivalent ways – all mean exactly the same thing:\n - if p,then, thenq\n - pimpliesimpliesq\n - ponlyifonly ifq\n - pis∗sufficient∗foris *sufficient* forq\n - qfollowsfromfollows fromp\n - qwheneverwheneverp\n - qififp\n - qis∗necessary∗foris *necessary* forp\n- **Common mistake:** "psufficientforsufficient forq"and"" and "qnecessaryfornecessary forp" say the *same* thing – students often confuse which variable is "necessary" and which is "sufficient".\n\n### Definition: Converse, Contrapositive, Inverse\n\n- From p \rightarrow q we can form three new conditionals:\n - **Converse:** q \rightarrow p\n - **Contrapositive:** eg q \rightarrow eg p\n - **Inverse:** eg p \rightarrow eg q\n- **Note:** p \rightarrow qanditscontrapositiveand its contrapositive eg q \rightarrow eg p∗always∗havethesametruthvalue.Likewise,theconverse*always* have the same truth value. Likewise, the converseq \rightarrow pandtheinverseand the inverse eg p \rightarrow eg q *always* have the same truth value.\n\n### Example 2.2 – Converse, Contrapositive, Inverse\n\nLet p:"Istudywell,": "I study well,"q:"Iexcelinlife."For: "I excel in life." Forp \rightarrow q:\n- **Converse** (q \rightarrow p): "If I excel in life, then I study well."\n- **Contrapositive** ( eg q \rightarrow eg p): "If I do not excel in life, then I do not study well."\n- **Inverse** ( eg p \rightarrow eg q): "If I do not study well, then I do not excel in life."\n\n## Biconditional (Equivalence)\n\n### Definition: Biconditional, \leftrightarrow\n\n- If p, qarepropositions,thebiconditionalare propositions, the biconditionalp \leftrightarrow qisread"is read "pifandonlyifif and only ifq"("" ("piffiffq").\n\n| p∣|q∣|p \leftrightarrow q |\n| :---: | :---: | :---: |\n| 0 | 0 | 1 |\n| 0 | 1 | 0 |\n| 1 | 0 | 0 |\n| 1 | 1 | 1 |\n\n- p \leftrightarrow qistrueexactlywhenis true exactly whenpandandq have the **same** truth value.\n- Equivalent readings: "pisequivalenttois equivalent toq","", "piffiffq","", "pisnecessaryandsufficientforis necessary and sufficient forq","if", "ifpthenthenq,andif, and ifqthenthenp".\n\n### Key Point / Common Mistake\n\n- **Fact:** p \leftrightarrow qandand(p \rightarrow q) \wedge (q \rightarrow p) always have the same truth value – "iff" really does mean "implies both ways".\n\n### Exercises\n\nLet p:"yougetanAonthefinalexam,": "you get an A on the final exam,"q:"youdoeveryexerciseinthebook,": "you do every exercise in the book,"r : "you get an A in this class."\n\n1. Translate into symbols: "You get an A in this class, but you do not do every exercise in the book."\n2. Translate into symbols: "To get an A in this class, it is necessary for you to get an A on the final."\n3. Translate into symbols: "Getting an A on the final and doing every exercise in the book is sufficient for getting an A in this class."\n4. Translate into symbols: "You will get an A in this class if and only if you either do every exercise in the book or get an A on the final."\n5. Now let p:"Xisplayingcricket,": "X is playing cricket,"q:"Xisreadinghisbook,": "X is reading his book,"r : "X is inside the room." Write an English sentence for each:\n - (a) p \rightarrow eg q\n - (b) r \rightarrow q\n - (c) (r \wedge q) \rightarrow eg p\n - (d) eg(r \wedge q)\n6. Write the converse, contrapositive, and inverse of: "If nisdivisibleby6,thenis divisible by 6, thenn is divisible by 3."\n\n# Truth Tables and Logical Equivalences\n\n## Precedence of Logical Operators\n\n- When a compound proposition uses several connectives without brackets, the order of operations decides how to evaluate it:\n\n| Operator | Precedence |\n| :---: | :---: |\n| eg | 1 (highest) |\n| \wedge | 2 |\n| \vee | 3 |\n| \rightarrow | 4 |\n| \leftrightarrow | 5 (lowest) |\n\n### Key Point / Common Mistake\n\n- p \rightarrow (q \rightarrow r)andand(p \rightarrow q) \rightarrow rare∗∗different∗∗propositions–are **different** propositions –\rightarrow is **not** associative. Always keep brackets around nested implications; never drop them "for short".\n\n## Constructing Truth Tables for Compound Propositions\n\n- To build a truth table for a compound proposition: list all combinations of truth values for the variables (2^nrowsforrows forn variables), then fill in intermediate columns from the inside out.\n\n### Example 3.1 – Truth Table of (p \rightarrow q) \wedge ( eg p \rightarrow q)\n\n| p∣|q∣|p \rightarrow q∣| eg p∣| eg p \rightarrow q∣|(p \rightarrow q) \wedge ( eg p \rightarrow q) |\n| :---: | :---: | :---: | :---: | :---: | :---: |\n| 0 | 0 | 1 | 1 | 0 | 0 |\n| 0 | 1 | 1 | 1 | 1 | 1 |\n| 1 | 0 | 0 | 0 | 1 | 0 |\n| 1 | 1 | 1 | 0 | 1 | 1 |\n\n- Notice the final column equals the column for q–sothisstatementislogicallyequivalenttojust– so this statement is logically equivalent to justq.\n\n### Example 3.2 – Truth Table of (p \leftrightarrow q) \vee ( eg q \leftrightarrow r)\n\n| p∣|q∣|r∣|p \leftrightarrow q∣| eg q∣| eg q \leftrightarrow r∣|(p \leftrightarrow q) \vee ( eg q \leftrightarrow r) |\n| :---: | :---: | :---: | :---: | :---: | :---: | :---: |\n| 0 | 0 | 0 | 1 | 1 | 0 | 1 |\n| 0 | 0 | 1 | 1 | 1 | 1 | 1 |\n| 0 | 1 | 0 | 0 | 0 | 1 | 1 |\n| 0 | 1 | 1 | 0 | 0 | 0 | 0 |\n| 1 | 0 | 0 | 0 | 1 | 0 | 0 |\n| 1 | 0 | 1 | 0 | 1 | 1 | 1 |\n| 1 | 1 | 0 | 1 | 0 | 1 | 1 |\n| 1 | 1 | 1 | 1 | 0 | 0 | 1 |\n\n### Exercises – Building Truth Tables\n\nConstruct the truth table for each compound proposition:\n- (i) p \rightarrow ( eg q \vee r)\n- (ii) eg p \rightarrow (q \rightarrow r)\n- (iii) (p \rightarrow q) \vee ( eg p \rightarrow r)\n- (iv) (p \rightarrow q) \wedge ( eg p \rightarrow r)\n- (v) ( eg p \leftrightarrow eg q) \leftrightarrow (q \leftrightarrow r)\n- (vi) ((p \wedge q) \vee eg r) \leftrightarrow p\n\n## Tautology, Contradiction, Contingency\n\n### Definition: Tautology, Contradiction, Contingency\n\n- A compound proposition that is **true in every row** of its truth table is a **tautology**.\n- One that is **false in every row** is a **contradiction**.\n- One that is neither – true in some rows, false in others – is a **contingency**.\n\n### Example 3.3 – Classifying Compound Propositions\n\n- **Tautologies:** p \vee eg p;;(p \wedge q) \rightarrow (p \vee q).\n- **Contradictions:** p \wedge eg p;;(p \leftrightarrow q) \wedge ( eg p \wedge q).\n- **Contingency:** (p \vee q) \rightarrow eg r – true for some assignments, false for others.\n\n## Logical Equivalence\n\n### Definition: Logical Equivalence, \equiv\n\n- Two compound propositions are **logically equivalent** if they have the *same truth table* (same truth value in every row). We write P \equiv Q.\n\n### Example 3.4 – Proving eg(p \wedge q) \equiv eg p \vee eg q – De Morgan's Law\n\n| p∣|q∣|p \wedge q∣| eg(p \wedge q)∣| eg p∣| eg q∣| eg p \vee eg q |\n| :---: | :---: | :---: | :---: | :---: | :---: | :---: |\n| 0 | 0 | 0 | 1 | 1 | 1 | 1 |\n| 0 | 1 | 0 | 1 | 1 | 0 | 1 |\n| 1 | 0 | 0 | 1 | 0 | 1 | 1 |\n| 1 | 1 | 1 | 0 | 0 | 0 | 0 |\n\n- Columns 4 and 7 match in every row, so eg(p \wedge q) \equiv eg p \vee eg q..\blacksquare\n\n## Table of Important Logical Equivalences\n\n| Name | Equivalence |\n| :--- | :--- |\n| **Idempotent Laws** | p \wedge p \equiv p<br><br>p \vee p \equiv p |\n| **Double Negation Law** | eg( eg p) \equiv p |\n| **Commutative Laws** | p \wedge q \equiv q \wedge p<br><br>p \vee q \equiv q \vee p |\n| **Associative Laws** | (p \vee q) \vee r \equiv p \vee (q \vee r)<br><br>(p \wedge q) \wedge r \equiv p \wedge (q \wedge r) |\n| **Distributive Laws** | p \vee (q \wedge r) \equiv (p \vee q) \wedge (p \vee r)<br><br>p \wedge (q \vee r) \equiv (p \wedge q) \vee (p \wedge r) |\n| **De Morgan's Laws** | eg(p \wedge q) \equiv eg p \vee eg q<br><br> eg(p \vee q) \equiv eg p \wedge eg q |\n| **Absorption Laws** | p \vee (p \wedge q) \equiv p<br><br>p \wedge (p \vee q) \equiv p |\n| **Identity Laws** | p \wedge 1 \equiv p<br><br>p \vee 0 \equiv p |\n| **Domination Laws** | p \wedge 0 \equiv 0<br><br>p \vee 1 \equiv 1 |\n| **Negation Laws** | p \wedge eg p \equiv 0<br><br>p \vee eg p \equiv 1 |\n| **Law of Implication** | p \rightarrow q \equiv eg p \vee q |\n| **Law of Contrapositive** | p \rightarrow q \equiv eg q \rightarrow eg p |\n| **Law of Exportation** | (p \wedge q) \rightarrow r \equiv p \rightarrow (q \rightarrow r) |\n| **Law of Biconditional** | p \leftrightarrow q \equiv (p \wedge q) \vee ( eg p \wedge eg q)<br><br>p \leftrightarrow q \equiv (p \rightarrow q) \wedge (q \rightarrow p) |\n\n### Example 3.5 – Proving Equivalence Without a Truth Table\n\nShow that eg(p \vee ( eg p \wedge q)) \equiv eg p \wedge eg q.\n\n\begin{aligned}

eg(p \vee ( eg p \wedge q)) &\equiv eg p \wedge eg( eg p \wedge q) && \text{(De Morgan)} \ &\equiv eg p \wedge ( eg( eg p) \vee eg q) && \text{(De Morgan)} \ &\equiv eg p \wedge (p \vee eg q) && \text{(Double negation)} \ &\equiv ( eg p \wedge p) \vee ( eg p \wedge eg q) && \text{(Distributive)} \ &\equiv F \vee ( eg p \wedge eg q) && \text{(Negation law)} \ &\equiv eg p \wedge eg q && \text{(Identity law)} \end{aligned}\n\n### Example 3.6 – Simplifying a Circuit Expression\n\nSimplify (p \wedge q) \vee (p \wedge eg q) \vee ( eg p \wedge q).\n\n\begin{aligned} (p \wedge q) \vee (p \wedge eg q) \vee ( eg p \wedge q) &\equiv [p \wedge (q \vee eg q)] \vee ( eg p \wedge q) && \text{(Distributive, on first two terms)} \ &\equiv (p \wedge T) \vee ( eg p \wedge q) && \text{(Negation law)} \ &\equiv p \vee ( eg p \wedge q) && \text{(Identity law)} \ &\equiv (p \vee eg p) \wedge (p \vee q) && \text{(Distributive)} \ &\equiv T \wedge (p \vee q) && \text{(Negation law)} \ &\equiv p \vee q && \text{(Identity law)} \end{aligned}\n\n### Example 3.7 – Simplifying Using the Conditional Identity\n\nSimplify eg(p \rightarrow q) \vee (p \wedge q).\n\n\begin{aligned}

eg(p \rightarrow q) \vee (p \wedge q) &\equiv eg( eg p \vee q) \vee (p \wedge q) && \text{(Conditional identity)} \ &\equiv (p \wedge eg q) \vee (p \wedge q) && \text{(De Morgan, double negation)} \ &\equiv p \wedge ( eg q \vee q) && \text{(Distributive)} \ &\equiv p \wedge T && \text{(Negation law)} \ &\equiv p && \text{(Identity law)} \end{aligned}\n\n### Example 3.8 – Proving a Biconditional Equivalence Step by Step\n\nShow that p \leftrightarrow q \equiv (p \wedge q) \vee ( eg p \wedge eg q).\n\n\begin{aligned} p \leftrightarrow q &\equiv (p \rightarrow q) \wedge (q \rightarrow p) && \text{(Biconditional identity)} \ &\equiv ( eg p \vee q) \wedge ( eg q \vee p) && \text{(Conditional identity, twice)} \ &\equiv [( eg p \vee q) \wedge eg q] \vee [( eg p \vee q) \wedge p] && \text{(Distributive)} \ &\equiv [( eg p \wedge eg q) \vee (q \wedge eg q)] \vee [( eg p \wedge p) \vee (q \wedge p)] && \text{(Distributive, twice more)} \ &\equiv [( eg p \wedge eg q) \vee F] \vee [F \vee (p \wedge q)] && \text{(Negation laws)} \ &\equiv ( eg p \wedge eg q) \vee (p \wedge q) && \text{(Identity laws)} \end{aligned}\n\n### Exercises – Logical Equivalences\n\n1. Use De Morgan's laws to find the negation of: "Priya has a laptop and an internet connection."\n2. Show, using a truth table, that (p \rightarrow q) \wedge (p \rightarrow r) \equiv p \rightarrow (q \wedge r).\n3. Simplify eg(p \leftrightarrow q)usinglogicalidentitiesandexpressitintermsofusing logical identities and express it in terms of\oplus.\n4. Show that (p \wedge q) \rightarrow p is a tautology, without a truth table.\n5. Determine whether p \rightarrow (q \rightarrow p) is a tautology, contradiction, or contingency.\n6. Simplify (p \vee q) \wedge ( eg p \vee q) \wedge (p \vee eg q) step by step, citing a law at each stage.\n7. Prove, using only the laws of the table above (no truth table), that p \rightarrow (q \rightarrow r) \equiv (p \wedge q) \rightarrow r.\n8. Show that eg p \vee (p \wedge q) \equiv eg p \vee q using the distributive and absorption laws.\n9. Simplify the following digital-logic expression to a minimum number of gates: (A \wedge B \wedge C) \vee (A \wedge B \wedge eg C) \vee ( eg A \wedge B \wedge C).\n\n## Tautological Implication\n\n### Definition: Tautological Implication\n\n- Let P, Qbecompoundpropositions.Ifbe compound propositions. IfP \rightarrow Qisa∗∗tautology∗∗,wesayis a **tautology**, we sayP∗∗tautologicallyimplies∗∗**tautologically implies**Q,written, writtenP \implies Q(meaning:whenever(meaning: wheneverPistrue,is true,Q is true).\n\n### Example 3.9 – Standard Tautological Implications\n\n- p \wedge q \implies pandandp \wedge q \implies q\n- p \implies p \vee qandandq \implies p \vee q\n- q \implies p \rightarrow q(i.e.,(i.e.,q \rightarrow (p \rightarrow q) is a tautology)\n- eg p \implies p \rightarrow q(i.e.,(i.e., eg p \rightarrow (p \rightarrow q) is a tautology)\n\n### Exercises – Tautological Implication\n\n1. Show that eg(p \rightarrow q) \equiv p \wedge eg q$.

  1. Show that p⊕q≡(¬p∧q)∨(p∧¬q)p \oplus q \equiv (\neg p \wedge q) \vee (p \wedge \neg q).

  2. Simplify ¬(p∨¬(p∧q))\neg(p \vee \neg(p \wedge q)) using the laws above.

  3. Simplify (p∧q)→(p∨q)(p \wedge q) \rightarrow (p \vee q) – what kind of proposition is it?

  4. Show that \neg(p \vee (\neg p \wedge q)) \equiv \neg p \wedge \neg q$.\n6. Verify q \implies p \vee qandand eg p \implies p \rightarrow q using truth tables.\n\n# Predicate Logic: Predicates and Quantifiers\n\n## Predicate\n\n### Definition: Predicate\n\n- A **predicate** (propositional function) is a statement P(x)whosetruthvaluedependsonthevariablewhose truth value depends on the variablex.Itbecomesapropositiononlyonce. It becomes a proposition only oncex is assigned a value, or bound by a quantifier.\n\n### Example 4.1\n\n- Let P(x):": "x > 3".Find". FindP(4)andandP(2).\n- **Solution:** P(4):": "4 > 3"isTrue." is True.P(2):": "2 > 3" is False.\n\n## Quantifiers\n\n### Definition: Universal Quantifier\n\n- The **universal quantification** of P(x)is"is "P(x)forallvaluesoffor all values ofxinthedomain,"writtenin the domain," written\forall x \, P(x).Itistrueiff. It is true iffP(x)istruefor∗every∗is true for *every*x in the domain.\n\n### Definition: Existential Quantifier\n\n- The **existential quantification** of P(x)is"thereexistsanis "there exists anxinthedomainsuchthatin the domain such thatP(x),"written," written\exists x \, P(x).Itistrueiff. It is true iffP(x)istruefor∗atleastone∗is true for *at least one*x in the domain.\n\n## Negating Quantifiers (De Morgan's Laws for Quantifiers)\n\n| Negation | Equivalent Statement |\n| :--- | :--- |\n| eg \forall x \, P(x)∣|\exists x \, eg P(x) |\n| eg \exists x \, P(x)∣|\forall x \, eg P(x) |\n\n### Example 4.2\n\n- Negate: "Every student in this class has taken a course in calculus."\n- **Solution:** Let C(x):": "xhastakencalculus,"domain:studentsintheclass.Statement:has taken calculus," domain: students in the class. Statement:\forall x \, C(x).Negation:. Negation:\exists x \, eg C(x) – "There is a student in this class who has not taken calculus."\n\n### Example 4.3\n\n- Negate: \exists x \, (x^2 = 2) over the integers.\n- **Solution:** eg \exists x \, (x^2 = 2) \equiv \forall x \, (x^2 eq 2)–"Foreveryinteger– "For every integerx,,x^2 eq 2" (true, since 2 is not a perfect square).\n\n## Translating Statements Involving Quantifiers\n\n### Example 4.4\n\n- Translate: "Some students have visited Mexico but not Canada" using M(x)::xhasvisitedMexico,has visited Mexico,C(x)::x has visited Canada, domain: students.\n- **Solution:** \exists x \, (M(x) \wedge eg C(x))$.

Exercises
  1. Let P(x)P(x) : "xx spends more than 5 hours studying daily," domain = students of your class. Express in words: (a) ∀x P(x)\forall x \, P(x), (b) ∃x ¬P(x)\exists x \, \neg P(x).

  2. Write the negation of "All Amrita students are hardworking" using quantifiers, then in plain English.

  3. Express "No student failed the exam" symbolically, using F(x)F(x) : xx failed.

  4. Determine the truth value of ∀x∈Z (x2≥x)\forall x \in \mathbb{Z} \, (x^2 \geq x) and ∃x∈Z (x2<x)\exists x \in \mathbb{Z} \, (x^2 < x).

Nested Quantifiers

Definition: Nested Quantifiers
  • Nested quantifiers occur when one quantifier lies within the scope of another, e.g. ∀x∃y P(x,y)\forall x \exists y \, P(x, y). The order of quantifiers matters when they are of different types.

Example 4.5 – Order Matters!

Let P(x,y)P(x, y) : "x+y=0x + y = 0" over the real numbers.

  • ∀x∃y P(x,y)\forall x \exists y \, P(x, y) : "For every xx there is a yy with x+y=0x + y = 0" – True (take y=−xy = -x).

  • ∃y∀x P(x,y)\exists y \forall x \, P(x, y) : "There is a single yy that works for every xx" – False (no fixed yy satisfies x+y=0x + y = 0 for all xx).

Negating Nested Quantifiers
  • Apply De Morgan's rule for quantifiers repeatedly, flipping each quantifier and negating the innermost predicate.

Example 4.6
  • Negate ∀x∃y (x+y=1)\forall x \exists y \, (x + y = 1).

\begin{aligned}\n\neg(\forall x \exists y \, (x + y = 1)) &\equiv \exists x \, \neg(\exists y \, (x + y = 1)) \\\n&\equiv \exists x \forall y \, \neg(x + y = 1) \\\n&\equiv \exists x \forall y \, (x + y \neq 1)\n\end{aligned}

Example 4.7
  • Translate: "The sum of two positive integers is always positive" and negate it.

  • Solution: ∀x∀y ((x>0∧y>0)→x+y>0)\forall x \forall y \, ((x > 0 \wedge y > 0) \rightarrow x + y > 0).

  • Negation: ∃x∃y ((x>0∧y>0)∧x+y≤0)\exists x \exists y \, ((x > 0 \wedge y > 0) \wedge x + y \leq 0) – "There exist positive integers whose sum is not positive" (a false statement, but the correctly-formed negation).

Exercises – Nested Quantifiers
  1. Let Q(x,y)Q(x, y) : "xx is the mother of yy". Express in words: ∃x∀y Q(x,y)\exists x \forall y \, Q(x, y); then state its truth value.

  2. Translate "Every real number except zero has a multiplicative inverse" using nested quantifiers.

  3. Negate ∃x∀y (P(x,y)∨Q(y))\exists x \forall y \, (P(x, y) \vee Q(y)) fully, moving all negations inward.

  4. Determine whether ∀x∃y (y=x+1)\forall x \exists y \, (y = x + 1) and ∃y∀x (y=x+1)\exists y \forall x \, (y = x + 1) are equivalent over the integers. Justify.

  5. Express symbolically: "For every positive integer nn there exists a prime number greater than nn".

  6. Translate into nested quantifiers: "Every student has emailed at least one professor, but no professor has been emailed by every student." (Domain: students SS, professors PP; predicate E(s,p)E(s, p) : ss has emailed pp.)

  7. Negate the statement ∀x∃y∀z (P(x,y,z)→Q(x,z))\forall x \exists y \forall z \, (P(x, y, z) \rightarrow Q(x, z)) fully.

Rules of Inference and Natural Deduction

Inference and Inference Rules

  • When we reason logically, we start from things we already know (or accept) to be true, and we derive new true statements from them. This process of generating conclusions from evidence and known facts is called inference.

Definition: Inference and Inference Rules
  • Inference is the process of deriving new (true) conclusions from existing facts or statements.

  • Inference rules are templates for generating valid arguments. They are applied step by step to build a proof – a sequence of statements that leads from given premises to a desired conclusion.

Example 5.1 – Checking Equivalence by Truth Table
  • Recall that an implication P→QP \rightarrow Q has a converse Q→PQ \rightarrow P, a contrapositive ¬Q→¬P\neg Q \rightarrow \neg P, and an inverse ¬P→¬Q\neg P \rightarrow \neg Q. Which of these four are logically equivalent to one another?

  • Solution: We build the truth table for all four statements:

PP

QQ

P→QP \rightarrow Q

Q→PQ \rightarrow P

¬Q→¬P\neg Q \rightarrow \neg P

¬P→¬Q\neg P \rightarrow \neg Q

T

T

T

T

T

T

T

F

F

T

F

T

F

T

T

F

T

F

F

F

T

T

T

T

  • Comparing columns: the P→QP \rightarrow Q column is identical to the ¬Q→¬P\neg Q \rightarrow \neg P column, and the Q→PQ \rightarrow P column is identical to the ¬P→¬Q\neg P \rightarrow \neg Q column.

  • Conclusion: An implication is always logically equivalent to its contrapositive: P→Q≡¬Q→¬PP \rightarrow Q \equiv \neg Q \rightarrow \neg P. (Similarly, the converse is equivalent to the inverse.) The implication is not, in general, equivalent to its converse or its inverse.

Key Point / Common Mistake
  • This is one of the most useful facts in all of mathematics: to prove P→QP \rightarrow Q, it is sometimes easier to prove the contrapositive ¬Q→¬P\neg Q \rightarrow \neg P instead – they say exactly the same thing. (This becomes Proof by Contraposition).

Standard Rules of Inference

  • Each rule below has the same shape: some statements are given as true (above the line), and a new statement is guaranteed to be true as a result (below the line, marked ∴\therefore, read "therefore").

  • Every rule can be checked by writing out a truth table and confirming that whenever every statement above the line is true, the statement below the line is also true.

Rule: Modus Ponens
  • If P→QP \rightarrow Q is true, and PP is true, then QQ must be true.

P→Q,P∴Q\frac{P \rightarrow Q, \quad P}{\therefore Q}

Example 5.2 – Modus Ponens
  • Statement 1: "If I am sleepy, then I go to bed." (P→QP \rightarrow Q)

  • Statement 2: "I am sleepy." (PP)

  • Conclusion: "I go to bed." (QQ)

  • This is valid because if P→QP \rightarrow Q is true and PP is true, the only row of the truth table of P→QP \rightarrow Q where PP is true and P→QP \rightarrow Q is true has QQ true as well.

Rule: Modus Tollens
  • If P→QP \rightarrow Q is true, and QQ is false (¬Q\neg Q), then PP must be false (¬P\neg P).

P→Q,¬Q∴¬P\frac{P \rightarrow Q, \quad \neg Q}{\therefore \neg P}

Example 5.3 – Modus Tollens
  • Statement 1: "If I am sleepy, then I go to bed." (P→QP \rightarrow Q)

  • Statement 2: "I do not go to bed." (¬Q\neg Q)

  • Conclusion: "I am not sleepy." (¬P\neg P)

  • Why it works: If PP were true, then by Modus Ponens QQ would have to be true – but we are told QQ is false. So PP cannot be true; it must be false.

Rule: Hypothetical Syllogism
  • If P→QP \rightarrow Q is true, and Q→RQ \rightarrow R is true, then P→RP \rightarrow R must be true. (Implications "chain together".)

P→Q,Q→R∴P→R\frac{P \rightarrow Q, \quad Q \rightarrow R}{\therefore P \rightarrow R}

Example 5.4 – Hypothetical Syllogism
  • Statement 1: "If you have my home key, then you can unlock my home." (P→QP \rightarrow Q)

  • Statement 2: "If you can unlock my home, then you can take my money." (Q→RQ \rightarrow R)

  • Conclusion: "If you have my home key, then you can take my money." (P→RP \rightarrow R)

Rule: Disjunctive Syllogism
  • If P∨QP \vee Q is true, and PP is false (¬P\neg P), then QQ must be true.

P∨Q,¬P∴Q\frac{P \vee Q, \quad \neg P}{\therefore Q}

Example 5.5 – Disjunctive Syllogism
  • Statement 1: "Today is Sunday or Monday." (P∨QP \vee Q)

  • Statement 2: "Today is not Sunday." (¬P\neg P)

  • Conclusion: "Today is Monday." (QQ)

Rule: Addition
  • If PP is true, then P∨QP \vee Q is true, no matter what QQ is.

P∴P∨Q\frac{P}{\therefore P \vee Q}

Example 5.6 – Addition
  • Statement: "I have a vanilla ice-cream." (PP)

  • Conclusion: "I have a vanilla or a chocolate ice-cream." (P∨QP \vee Q)

  • This looks strange at first – we never said anything about chocolate! – but it is valid: if PP is true, then P∨QP \vee Q is automatically true, whatever QQ happens to be.

Rule: Simplification
  • If P∧QP \wedge Q is true, then PP is true (and separately, QQ is true).

P∧Q∴P\frac{P \wedge Q}{\therefore P}

Example 5.7 – Simplification
  • Statement: "It is raining and it is cold." (P∧QP \wedge Q)

  • Conclusion: "It is raining." (PP) (or equally, "It is cold.")

Rule: Resolution
  • If P∨QP \vee Q is true, and ¬P∨R\neg P \vee R is true, then Q∨RQ \vee R must be true.

P∨Q,¬P∨R∴Q∨R\frac{P \vee Q, \quad \neg P \vee R}{\therefore Q \vee R}

Example 5.8 – Resolution
  • Statement 1: "I will study or I will fail." (P∨QP \vee Q)

  • Statement 2: "I will not study, or I will sleep early." (¬P∨R\neg P \vee R)

  • Conclusion: "I will fail, or I will sleep early." (Q∨RQ \vee R)

Natural Deduction

  • Normal human reasoning moves in a line: from premises, step by step, to a conclusion. Natural Deduction is the formal method in Propositional Logic that mimics exactly this natural process – and it is what mathematicians actually use when they write proofs.

Definition: Natural Deduction
  • A Natural Deduction proof is a sequence of well-formed formulas (statements) that:

    • begins with one or more given premises (fresh premises may also be added later in the proof), and

    • generates every new statement by applying an inference rule or a replacement rule to statements that already appear earlier in the sequence, continuing until the desired conclusion is reached.

Key Point / Common Mistake
  • A Natural Deduction system has just two ingredients: a set of rules, and a method for applying them. This is exactly how theorems are proved in mathematics – so every mathematical proof is an instance of Natural Deduction.

Replacement Rules

  • Besides inference rules, a Natural Deduction proof is also allowed to replace any statement (or part of a statement) by something logically equivalent to it. These logical equivalences are called replacement rules.

Key Point / Common Mistake
  • Do not confuse inference rules with replacement rules. An inference rule only works "forward", in one direction, on a whole statement. A replacement rule works in either direction, and can be applied to just a part of a longer statement, because the two sides are fully equivalent.

A Worked Natural Deduction Proof

Example 5.9 – Combining Several Rules

Given the premises P→QP \rightarrow Q, Q→RQ \rightarrow R, ¬R\neg R, prove ¬P\neg P using Natural Deduction.

Solution: We build a sequence of statements, justifying each new line by a rule applied to earlier lines.

Step

Statement

Justification

1

P→QP \rightarrow Q

Premise

2

Q→RQ \rightarrow R

Premise

3

¬R\neg R

Premise

4

P→RP \rightarrow R

Hypothetical Syllogism (1, 2)

5

¬P\neg P

Modus Tollens (4, 3)

Conclusion: ¬P\neg P follows from the three premises. ■\blacksquare

Practice Questions
  1. Name the inference rule used, and state the conclusion: "If it rains, the match is cancelled." "It rains."

  2. Name the inference rule used, and state the conclusion: "If the alarm rings, I wake up." "I did not wake up."

  3. Name the inference rule used, and state the conclusion: "If you study, you pass." "If you pass, you graduate."

  4. Name the inference rule used, and state the conclusion: "I will take the bus or the train." "I will not take the bus."

  5. Write the converse, inverse, and contrapositive of: "If a number is divisible by 4, then it is divisible by 2."

  6. Using a truth table, verify the Disjunctive Syllogism rule.

  7. Give the replacement rule that justifies rewriting ¬(P∧Q)\neg(P \wedge Q) as ¬P∨¬Q\neg P \vee \neg Q

  8. Using Natural Deduction, prove ¬P\neg P from the premises P→QP \rightarrow Q, Q→RQ \rightarrow R, R→SR \rightarrow S, and ¬S\neg S. (Hint: first find ¬R\neg R, then ¬Q\neg Q, then ¬P\neg P – a chain of Modus Tollens steps.)

Methods of Proof: Direct Proof, Contraposition, Contradiction

Core Definitions

  • Theorem: A statement proved true.

  • Proof: A valid chain of reasoning (using axioms, definitions, and previously proved theorems) establishing the truth of a theorem.

  • Axiom (Postulate): A statement assumed true without proof.

  • Even and Odd Integers: An integer nn is even if n=2kn = 2k for some integer kk. It is odd if n=2k+1n = 2k + 1 for some integer k$.\n\n## Direct Proof\n\n- To prove p \rightarrow qdirectly:assumedirectly: assumepistrue,andshowis true, and showq must also be true, using definitions, axioms, and known results.\n\n### Example 6.1 – Direct Proof\n\n- **Prove:** If nisodd,thenis odd, thenn^2 is odd.\n- **Proof:** Assume nisodd.Thenis odd. Thenn = 2k + 1forsomeintegerfor some integerk. So:\n  n^2 = (2k + 1)^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1\n  Since 2k^2 + 2kisaninteger,is an integer,n^2hastheformhas the form2m + 1,so, son^2isodd.is odd.\blacksquare\n\n## Proof by Contraposition\n\n- To prove p \rightarrow q,itsufficestoprovethe(logicallyequivalent)contrapositive, it suffices to prove the (logically equivalent) contrapositive eg q \rightarrow eg p – justified by the Law of Contrapositive.\n\n### Example 6.2 – Proof by Contraposition\n\n- **Prove:** If n^2iseven,thenis even, thenn is even.\n- **Proof:** We prove the contrapositive: if nisodd,thenis odd, thenn^2isodd(provedabove).Hence,bycontraposition,ifis odd (proved above). Hence, by contraposition, ifn^2iseven,is even,niseven.is even.\blacksquare\n\n### Example 6.3 – Contraposition with Quadratics\n\n- **Prove:** If n^2isodd,thenis odd, thenn is odd.\n- **Proof (by contraposition):** We prove: if niseven,thenis even, thenn^2iseven.Assumeis even. Assumen = 2k.Then. Thenn^2 = 4k^2 = 2(2k^2),so, son^2iseven.Bycontraposition,is even. By contraposition,n^2 \text{ odd} \implies n \text{ odd}..\blacksquare\n\n## Proof by Contradiction\n\n- Assume the negation of what you want to prove, and derive a contradiction (a statement of the form r \wedge eg r).\n\n### Example 6.4 – Proof by Contradiction\n\n- **Prove:** \sqrt{2} is irrational.\n- **Proof:** Suppose, for contradiction, that \sqrt{2}isrational.Thenis rational. Then\sqrt{2} = \frac{a}{b}forintegersfor integersa, bwithwith\gcd(a, b) = 1.\n  Squaring both sides:\n  2 = \frac{a^2}{b^2} \implies a^2 = 2b^2\n  Thus a^2iseven,sois even, soaiseven;writeis even; writea = 2c. Then:\n  4c^2 = 2b^2 \implies b^2 = 2c^2\n  so b^2iseven,whichimpliesis even, which impliesbiseven.Butthen2dividesbothis even. But then 2 divides bothaandandb,contradicting, contradicting\gcd(a, b) = 1.Thiscontradictionshows. This contradiction shows\sqrt{2}isirrational.is irrational.\blacksquare\n\n### Example 6.5 – Contradiction with a Sum\n\n- **Prove:** The sum of a rational number and an irrational number is irrational.\n- **Proof:** Suppose, for contradiction, that risrational,is rational,xisirrational,butis irrational, butr + xisrational.Writeis rational. Writer = \frac{a}{b}andandr + x = \frac{c}{d}withwitha, b, c, dintegers,integers,b, d eq 0. Then:\n  x = (r + x) - r = \frac{c}{d} - \frac{a}{b} = \frac{cb - ad}{db}\n  which is a ratio of integers, so xisrational–contradictingthatis rational – contradicting thatxisirrational.Henceis irrational. Hencer + xmustbeirrational.must be irrational.\blacksquare\n\n## Proof by Cases\n\n- Split the hypothesis into an exhaustive set of cases, and prove the conclusion in each case separately.\n\n### Example 6.6 – Proof by Cases\n\n- **Prove:** For every integer n,,n^2 \geq n$.

  • Proof:

    • Case 1 (n≤0n \leq 0): then n^2 \geq 0 \geq n$.\n - Case 2 (n = 1):):n^2 = 1 = n$.

    • Case 3 (n≥2n \geq 2): n^2 = n \cdot n \geq n \cdot 2 > n$.\n  All cases give n^2 \geq n..\blacksquare\n\n## Additional Solved Proofs\n\n### Example 6.7 – Direct Proof Involving Divisibility\n\n- **Prove:** If a \mid bandanda \mid c,then, thena \mid (b + c).\n- **Proof:** Assume a \mid bandanda \mid c.Bydefinition,. By definition,b = akandandc = amforsomeintegersfor some integersk, m. Then:\n  b + c = ak + am = a(k + m)\n  Since k + misaninteger,is an integer,a \mid (b + c)..\blacksquare\n\n### Exercises\n\n1. Give a direct proof that if nandandmarebothperfectsquares,thenare both perfect squares, thennm is a perfect square.\n2. Prove by contraposition: If 3n + 2isodd,thenis odd, thenn is odd.\n3. Prove by contradiction that there is no smallest positive rational number.\n4. Give a constructive proof that there exists a positive integer that can be written as the sum of cubes of positive integers in two different ways.\n5. Prove by contradiction that there are infinitely many prime numbers. (Euclid's classical proof.)\n6. Prove: if xandandyarebothoddintegers,thenare both odd integers, thenx^2 + y^2 is even but not divisible by 4.\n\n# Mathematical Induction and Recursive Definitions\n\n## The Principle of Mathematical Induction\n\n- Mathematical induction is a method of proof used to establish that a statement P(n)istrueforeverynaturalnumberis true for every natural numbern (or every natural number from some starting point onward).\n\n### Definition: Principle of Mathematical Induction (P.M.I.)\n\n- Let P(n)beastatementinvolvinganaturalnumberbe a statement involving a natural numbern. Suppose:\n 1. P(1) is true (or true for some fixed starting natural number), and\n 2. whenever P(k)istrue,is true,P(k + 1)isalsotrue,foreverynaturalnumberis also true, for every natural numberk$.   Then P(n)P(n) is true for all natural numbers nn (from the starting point onward).

  • Steps to prove a statement by induction:

    1. Basis of Induction: Show that P(1)P(1) is true (check the statement for the starting value).

    2. Inductive Hypothesis: Assume that P(k)P(k) is true, for some natural number k$.\n 3. **Inductive Step:** Using the assumption that P(k)istrue,showthatis true, show thatP(k + 1) is also true.\n  If all three steps succeed, then by P.M.I., P(n)istrueforeverynaturalnumberis true for every natural numbern$.

Key Point / Common Mistake
  • The Inductive Hypothesis is not the same as assuming what we want to prove. We are only assuming the statement holds for one particular (but arbitrary) value kk – we are not assuming it is true for all nn. The whole point of the Inductive Step is to use this single assumption to honestly derive the next case, P(k+1)P(k + 1).

Worked Examples of Induction

Example 7.1 – Sum of the First nn Odd Numbers
  • Use induction to prove that the sum of the first nn odd natural numbers is n2n^2:   1+3+5+⋯+(2n−1)=n21 + 3 + 5 + \dots + (2n - 1) = n^2

  • Solution: Let P(n)P(n) be the statement 1 + 3 + 5 + \dots + (2n - 1) = n^2$.\n - **Basis of Induction:** For n = 1:L.H.S.=1,R.H.S.=: L.H.S. = 1, R.H.S. =1^2 = 1.SinceL.H.S.=R.H.S.,. Since L.H.S. = R.H.S.,P(1) is true.\n - **Inductive Hypothesis:** Assume P(k)istrueforsomeis true for somek \in \mathbb{N},i.e., i.e.1 + 3 + 5 + \dots + (2k - 1) = k^2$.

    • Inductive Step: We must show P(k+1)P(k + 1) is true, i.e. 1 + 3 + 5 + \dots + (2k - 1) + (2k + 1) = (k + 1)^2$.\n    \text{L.H.S.} = [1 + 3 + 5 + \dots + (2k - 1)] + (2k + 1) = k^2 + (2k + 1) = (k + 1)^2 = \text{R.H.S.} \n    So P(k + 1) is true.\n - **Conclusion:** By P.M.I., P(n)istrueforallis true for alln \in \mathbb{N}..\blacksquare\n\n### Example 7.2 – Sum of the First n Natural Numbers\n\n- Use induction to prove that for all n \in \mathbb{N},\n  1 + 2 + 3 + \dots + n = \frac{n(n + 1)}{2}\n- **Solution:** Let P(n)bethestatementbe the statement1 + 2 + \dots + n = \frac{n(n + 1)}{2}$.

    • Basis of Induction: For n=1n = 1: L.H.S. = 1, R.H.S. = 1(2)2=1\frac{1(2)}{2} = 1. So P(1)P(1) is true.

    • Inductive Hypothesis: Assume P(k)P(k) is true: 1 + 2 + \dots + k = \frac{k(k + 1)}{2}$.\n - **Inductive Step:** We show P(k + 1)holds,i.e.holds, i.e.1 + 2 + \dots + k + (k + 1) = \frac{(k + 1)(k + 2)}{2}$.     L.H.S.=[1+2+⋯+k]+(k+1)=k(k+1)2+(k+1)=(k+1)(k2+1)=(k+1)(k+2)2=R.H.S.\text{L.H.S.} = [1 + 2 + \dots + k] + (k + 1) = \frac{k(k + 1)}{2} + (k + 1) = (k + 1)\left(\frac{k}{2} + 1\right) = \frac{(k + 1)(k + 2)}{2} = \text{R.H.S.}

    • Conclusion: By P.M.I., 1+2+⋯+n=n(n+1)21 + 2 + \dots + n = \frac{n(n + 1)}{2} for all n∈Nn \in \mathbb{N}. ■\blacksquare

Example 7.3 – A Divisibility Statement
  • Use induction to prove that for all n∈Nn \in \mathbb{N}, 22n−12^{2n} - 1 is divisible by 3.

  • Solution: Let P(n)P(n) be the statement: 22n−12^{2n} - 1 is divisible by 3.

    • Basis of Induction: For n=1n = 1: 22−1=4−1=32^2 - 1 = 4 - 1 = 3, which is divisible by 3. So P(1)P(1) is true.

    • Inductive Hypothesis: Assume P(k)P(k) is true, i.e. 22k−1=3m2^{2k} - 1 = 3m for some integer m$.\n - **Inductive Step:** We show P(k + 1)istrue,i.e.is true, i.e.2^{2(k+1)} - 1 is divisible by 3.\n    2^{2(k+1)} - 1 = 2^{2k+2} - 1 = 4 \cdot 2^{2k} - 1 = 4(2^{2k} - 1) + 4 - 1 = 4(3m) + 3 = 3(4m + 1)\n    which is divisible by 3. So P(k + 1) is true.\n - **Conclusion:** By P.M.I., 2^{2n} - 1isdivisibleby3forallis divisible by 3 for alln \in \mathbb{N}..\blacksquare\n\n### Example 7.4 – Another Divisibility Statement\n\n- Prove that n^3 - nisdivisibleby3forallpositiveintegersis divisible by 3 for all positive integersn$.

  • Solution: Let P(n)P(n) be the statement: n3−nn^3 - n is divisible by 3.

    • Basis of Induction: For n=1n = 1: 13−1=01^3 - 1 = 0, which is divisible by 3. So P(1)P(1) is true.

    • Inductive Hypothesis: Assume P(k)P(k) is true, i.e. k3−k=3mk^3 - k = 3m for some integer m$.\n - **Inductive Step:** We show P(k + 1)istrue,i.e.is true, i.e.(k + 1)^3 - (k + 1) is divisible by 3.\n    (k + 1)^3 - (k + 1) = k^3 + 3k^2 + 3k + 1 - k - 1 = (k^3 - k) + 3(k^2 + k) = 3m + 3(k^2 + k) = 3(m + k^2 + k)\n    So (k + 1)^3 - (k + 1)isdivisibleby3.Sois divisible by 3. SoP(k + 1) is true.\n - **Conclusion:** By P.M.I., n^3 - nisdivisibleby3forallis divisible by 3 for alln \geq 1..\blacksquare\n\n### Example 7.5 – Divisibility with a Different Base\n\n- Prove that 5^n - 1isdivisibleby4forallpositiveintegersis divisible by 4 for all positive integersn$.

  • Solution: Let P(n)P(n) be the statement: 5n−15^n - 1 is divisible by 4.

    • Basis of Induction: For n=1n = 1: 5−1=45 - 1 = 4, which is divisible by 4. So P(1)P(1) is true.

    • Inductive Hypothesis: Assume P(k)P(k) is true, i.e. 5k−1=4m5^k - 1 = 4m for some integer m$.\n - **Inductive Step:** We show P(k + 1)istrue,i.e.is true, i.e.5^{k+1} - 1 is divisible by 4.\n    5^{k+1} - 1 = 5 \cdot 5^k - 1 = 5(4m + 1) - 1 = 20m + 5 - 1 = 20m + 4 = 4(5m + 1)\n    So 5^{k+1} - 1isdivisibleby4.Sois divisible by 4. SoP(k + 1) is true.\n - **Conclusion:** By P.M.I., 5^n - 1isdivisibleby4forallis divisible by 4 for alln \geq 1..\blacksquare\n\n### Key Point / Common Mistake\n\n- For a divisibility statement, the trick in the Inductive Step is always the same: rewrite the (k + 1)−thexpressionsothatitcontainsthe-th expression so that it contains thek-th expression as a piece, plus something extra. Then replace that piece using the Inductive Hypothesis, and check the whole sum is still a multiple of the required number.\n\n### Example 7.6 – An Inequality Proof\n\n- Prove that 2^n > n^2forallintegersfor all integersn \geq 5$.

  • Solution: Let P(n)P(n) be the statement: 2^n > n^2$.\n - **Basis of Induction:** For n = 5::2^5 = 32 > 25 = 5^2.So. SoP(5) is true.\n - **Inductive Hypothesis:** Assume P(k)istrueforsomeis true for somek \geq 5,i.e., i.e.2^k > k^2$.

    • Inductive Step: We want to show P(k+1)P(k + 1) is true, i.e. 2^{k+1} > (k + 1)^2$.\n    2^{k+1} = 2 \cdot 2^k > 2k^2 \quad \text{(by hypothesis)}\n    So it is enough to show 2k^2 \geq (k + 1)^2 = k^2 + 2k + 1 \iff k^2 - 2k - 1 \geq 0$.     For k≥5k \geq 5: k^2 - 2k - 1 = k(k - 2) - 1 \geq 5(3) - 1 = 14 > 0$. Hence 2k^2 > (k + 1)^2,so, so2^{k+1} > (k + 1)^2.\n - **Conclusion:** By P.M.I., 2^n > n^2forallintegersfor all integersn \geq 5..\blacksquare\n\n### Example 7.7 – A Recursive Sequence\n\n- A sequence is defined recursively by a_1 = 1andanda_n = a_{n-1} + 2n - 1forforn \geq 2.Provethat. Prove thata_n = n^2forallfor alln \geq 1$.

  • Solution: Let P(n)P(n) be the statement: a_n = n^2$.\n - **Basis of Induction:** For n = 1::a_1 = 1 = 1^2.So. SoP(1) is true.\n - **Inductive Hypothesis:** Assume P(k)istrue,i.e.is true, i.e.a_k = k^2$.

    • Inductive Step: We show P(k+1)P(k + 1) is true, i.e. a_{k+1} = (k + 1)^2$.\n    a_{k+1} = a_k + 2(k + 1) - 1 = k^2 + 2k + 1 = (k + 1)^2\n - **Conclusion:** By P.M.I., a_n = n^2forallfor alln \geq 1..\blacksquare\n\n## Strong Induction\n\n- Ordinary induction lets us assume only P(k)toproveto proveP(k + 1).Somestatements–especiallythoseaboutrecursivesequencesthatdependonmorethanonepreviousterm–needastrongerassumption:thatthestatementistrueforeveryvalueupto. Some statements – especially those about recursive sequences that depend on more than one previous term – need a stronger assumption: that the statement is true for every value up tok,notjustfor, not just fork itself.\n\n### Definition: Strong Induction\n\n- To prove P(n)forallfor alln \geq b:\n - **Basis:** Prove P(b) (and possibly a few more base cases).\n - **Inductive Step:** Assume P(b), P(b + 1), \dots, P(k)arealltrue,andproveare all true, and proveP(k + 1).\n\n### Example 7.8 – Fibonacci Inequality – Strong Induction\n\n- Let F_1 = 1, F_2 = 1, F_n = F_{n-1} + F_{n-2}forforn \geq 3(theFibonaccisequence).Provethat(the Fibonacci sequence). Prove thatF_n < 2^nforallfor alln \geq 1$.

  • Solution: Let P(n)P(n) be the statement: F_n < 2^n$.\n - **Basis:** F_1 = 1 < 2^1 = 2,and, andF_2 = 1 < 2^2 = 4.So. SoP(1)andandP(2) are true.\n - **Inductive Step:** Assume P(j)istrueforeveryis true for everyjwithwith1 \leq j \leq k(some(somek \geq 2),i.e.), i.e.F_j < 2^jforallsuchfor all suchj.Weshow. We showP(k + 1)istrue,i.e.is true, i.e.F_{k+1} < 2^{k+1}$.     Since k+1≥3k + 1 \geq 3, the recursive definition gives Fk+1=Fk+Fk−1F_{k+1} = F_k + F_{k-1}, and both Fk,Fk−1F_k, F_{k-1} are covered by the inductive assumption:     Fk+1=Fk+Fk−1<2k+2k−1<2k+2k=2k+1F_{k+1} = F_k + F_{k-1} < 2^k + 2^{k-1} < 2^k + 2^k = 2^{k+1}

    • Conclusion: By strong induction, Fn<2nF_n < 2^n for all n≥1n \geq 1. ■\blacksquare

Practice Questions – Prove by P.M.I.

For all natural numbers nn, show using the Principle of Mathematical Induction:

  1. 1+2+3+⋯+n=n(n+1)21 + 2 + 3 + \dots + n = \frac{n(n + 1)}{2}

  2. 12+22+32+⋯+n2=n(n+1)(2n+1)61^2 + 2^2 + 3^2 + \dots + n^2 = \frac{n(n + 1)(2n + 1)}{6}

  3. 13+23+33+⋯+n3=[n(n+1)2]21^3 + 2^3 + 3^3 + \dots + n^3 = \left[\frac{n(n + 1)}{2}\right]^2

  4. 2+4+6+⋯+2n=n2+n2 + 4 + 6 + \dots + 2n = n^2 + n

  5. 1+3+5+⋯+(2n−1)=n21 + 3 + 5 + \dots + (2n - 1) = n^2

  6. For any natural number nn, xn−ynx^n - y^n is divisible by x−yx - y, where xx and yy are any integers with x \neq y$.\n7. For all natural numbers n \geq 5,,n^2 < 2^n$.

  7. For all natural numbers n≥4n \geq 4, n^3 < 3^n$.\n9. For all natural numbers n \geq 3,,2n + 1 < 2^n$.

  8. For all n∈Nn \in \mathbb{N}, 22n−12^{2n} - 1 is divisible by 3.

Recursive Definitions

Definition: Recursive Definition
  • A recursive definition defines a mathematical object in terms of simpler or smaller instances of the same object. A recursive definition consists of two essential parts:

    1. a base case, which specifies the initial value or values; and

    2. a recursive rule, which defines new values in terms of previously defined values.

Recursively Defined Functions

Definition: Recursively Defined Function
  • A function is said to be defined recursively if its value is defined for one or more initial values and a rule is given for determining the value at subsequent inputs from previously defined values.

Example 7.9 – Factorial Function
  • The factorial function can be defined recursively by:   0!=1andn!=n(n−1)!,n≥10! = 1 \quad \text{and} \quad n! = n(n - 1)!, \quad n \geq 1

  • For example, 4! = 4(3!) = 4(3)(2!) = 4(3)(2)(1!) = 4(3)(2)(1)(0!) = 4(3)(2)(1)(1) = 24$.\n- Here, 0! = 1isthebasecase,andis the base case, andn! = n(n - 1)! is the recursive rule.\n\n### Example 7.10 – Power Function\n\n- For a nonzero real number a,thefunction, the functiona^ncanbedefinedrecursivelyfornonnegativeintegerscan be defined recursively for nonnegative integersn by:\n  a^0 = 1 \quad \text{and} \quad a^n = a \cdot a^{n-1}, \quad n \geq 1\n- For example, a^4 = a \cdot a^3 = a \cdot a \cdot a^2 = a \cdot a \cdot a \cdot a = a^4$.

Recursively Defined Sequences

Definition: Recursively Defined Sequence
  • A sequence is said to be defined recursively if one or more initial terms are specified and each subsequent term is defined in terms of one or more preceding terms.

Example 7.11 – Fibonacci Sequence
  • The Fibonacci sequence is defined recursively by:   F0=0,F1=1,andFn=Fn−1+Fn−2,n≥2F_0 = 0, \quad F_1 = 1, \quad \text{and} \quad F_n = F_{n-1} + F_{n-2}, \quad n \geq 2

  • Thus, F2=F1+F0=1F_2 = F_1 + F_0 = 1, F3=F2+F1=2F_3 = F_2 + F_1 = 2, F4=F3+F2=3F_4 = F_3 + F_2 = 3, F_5 = F_4 + F_3 = 5$.\n- Hence the sequence begins as 0, 1, 1, 2, 3, 5, 8, 13, \dots\n\n### Example 7.12 – Sum of the First n Positive Integers\n\n- Define the sequence recursively by:\n  S_0 = 0 \quad \text{and} \quad S_n = S_{n-1} + n, \quad n \geq 1\n- Therefore, S_1 = 1,,S_2 = 3,,S_3 = 6,,S_4 = 10.Thus,. Thus,S_n = 1 + 2 + \dots + n$.

Recursively Defined Sets

Definition: Recursively Defined Set
  • A set can be defined recursively by specifying:

    1. a basis, which specifies the initial elements of the set; and

    2. a recursive rule, which specifies how new elements are generated from elements that are already in the set.

Example 7.13 – Positive Integers Divisible by 3
  • Define the set SS of positive integers divisible by 3 recursively:

    • Basis: 3 \in S$.\n - **Recursive rule:** If x \in S,then, thenx + 3 \in S$.

  • Therefore, S = \{3, 6, 9, 12, 15, \dots\}$.\n\n### Example 7.14 – Powers of 2\n\n- Define the set S = {1, 2, 4, 8, 16, \dots} recursively:\n - **Basis:** 1 \in S$.

    • Recursive rule: If x∈Sx \in S, then 2x \in S$.\n- Hence, S = {1, 2, 4, 8, 16, \dots}$.

Recursive Algorithms

Definition: Recursive Algorithm
  • A recursive algorithm is an algorithm that solves a problem by calling itself on a smaller instance of the same problem. A recursive algorithm has two essential parts:

    1. a base case, which can be solved directly; and

    2. a recursive case, in which the algorithm calls itself with a smaller input.

Example 7.15 – Recursive Factorial Algorithm
procedure factorial(n)
    if n = 0 then return 1
    else return n * factorial(n - 1)
  • The base case is n=0n = 0, for which the algorithm returns 1. The recursive case is n⋅factorial(n−1)n \cdot \text{factorial}(n - 1).

Example 7.16 – Tracing the Factorial Algorithm
  • Consider factorial(4)\text{factorial}(4). The recursive calls are:

\begin{aligned}\n\text{factorial}(4) &= 4 \cdot \text{factorial}(3) \\\n&= 4 \cdot 3 \cdot \text{factorial}(2) \\\n&= 4 \cdot 3 \cdot 2 \cdot \text{factorial}(1) \\\n&= 4 \cdot 3 \cdot 2 \cdot 1 \cdot \text{factorial}(0) \\\n&= 4 \cdot 3 \cdot 2 \cdot 1 \cdot 1 = 24\n\end{aligned}

Example 7.17 – Recursive Power Algorithm
procedure power(a, n)
    if n = 0 then return 1
    else return a * power(a, n - 1)
  • For example, power(2,4)\text{power}(2, 4) produces:

\begin{aligned}\n\text{power}(2, 4) &= 2 \cdot \text{power}(2, 3) \\\n&= 2 \cdot 2 \cdot \text{power}(2, 2) \\\n&= 2 \cdot 2 \cdot 2 \cdot \text{power}(2, 1) \\\n&= 2 \cdot 2 \cdot 2 \cdot 2 \cdot \text{power}(2, 0) = 16\n\end{aligned}

Example 7.18 – Euclidean Algorithm for GCD
  • The greatest common divisor can be computed recursively using:   gcd⁡(a,b)=gcd⁡(b,a mod b),b≠0\gcd(a, b) = \gcd(b, a \bmod b), \quad b \neq 0

  • The recursive algorithm is:

procedure gcd(a, b)
    if b = 0 then return a
    else return gcd(b, a mod b)
  • The base case is b = 0$.\n\n### Example 7.19 – Finding \gcd(48, 18)\n\n- Using the recursive Euclidean algorithm:\n\n\begin{aligned} \gcd(48, 18) &= \gcd(18, 48 \bmod 18) = \gcd(18, 12) \ &= \gcd(12, 18 \bmod 12) = \gcd(12, 6) \ &= \gcd(6, 12 \bmod 6) = \gcd(6, 0) = 6 \end{aligned}\n\n- Therefore, \gcd(48, 18) = 6$.

Exercises
  1. Define the factorial function recursively and use it to compute 5!$.\n2. Give a recursive definition of a^nforanonzerorealnumberfor a nonzero real numberaandanonnegativeintegerand a nonnegative integern$.

  2. Give a recursive definition of the Fibonacci sequence.

  3. Find F6F_6 using the recursive definition F_0 = 0, F_1 = 1, F_n = F_{n-1} + F_{n-2}$.\n5. Define the sequence 1, 3, 5, 7, 9, \dots recursively.\n6. Define the set of positive integers divisible by 5 recursively.\n7. Define the set {1, 2, 4, 8, 16, \dots} recursively.\n8. Write a recursive algorithm for computing n!$.

  4. Trace the recursive algorithm for factorial(5)\text{factorial}(5).

  5. Write a recursive algorithm for computing a^n$.\n11. Trace the recursive algorithm for \text{power}(2, 5).\n12. Use the recursive Euclidean algorithm to find \gcd(48, 18).\n13. Write a recursive algorithm for computing the n$$-th Fibonacci number.

  6. Explain the base case and recursive case in a recursive algorithm.

  7. Explain why a recursive algorithm must eventually reach its base case.