Discrete Math Speedrun
⚑ TOPIC 2 · PROOFS

Proofs

Proofs are the heart of mathematics β€” the part the examiner reads most carefully. Direct, contrapositive, contradiction, cases, induction, and the rules of inference that connect each line.

πŸ“ Syllabus 2.1–2.4⏱ ~30 min readπŸ“ 20 problems
Progress 0 / 0
Topic complete β€” every problem revealed.

2.1 What is a Proof?

A proof is a finite sequence of statements, each of which is either an axiom, a previously proved theorem, a hypothesis, or follows from earlier statements by a rule of inference. The last statement is the conclusion.

Definition Axiomatic system. A collection of axioms (statements taken to be true without proof) together with rules of inference. From these you derive theorems. Two requirements:
  • Consistent: you cannot derive both a proposition and its negation.
  • (Ideally) Complete: every true statement can be derived. (GΓΆdel showed this is impossible for systems strong enough to do arithmetic.)

Why proofs?

  • Certainty. A computer experiment showing 10⁹ cases works gives evidence, not certainty. Goldbach has been checked to absurd bounds but is unproven.
  • Insight. A good proof tells you why something is true, not just that it is.
  • Communication. Proofs are the universal language: a peer in Tokyo can verify your work line-by-line.

An argument is "valid" iff

… it is impossible for all the premises to be true while the conclusion is false. Equivalently, $(P_1 \land P_2 \land \cdots \land P_n) \to Q$ is a tautology.

2.2 Rules of Inference

For propositional logic

RuleFormTautology
Modus Ponens$p,\;\; p\to q \;\;\therefore q$$(p\land(p\to q))\to q$
Modus Tollens$\lnot q,\;\; p\to q \;\;\therefore \lnot p$$(\lnot q\land(p\to q))\to \lnot p$
Hypothetical syllogism$p\to q,\;\; q\to r \;\;\therefore p\to r$$((p\to q)\land(q\to r))\to(p\to r)$
Disjunctive syllogism$p\lor q,\;\; \lnot p \;\;\therefore q$$((p\lor q)\land\lnot p)\to q$
Addition$p \;\;\therefore p\lor q$$p\to(p\lor q)$
Simplification$p\land q \;\;\therefore p$$(p\land q)\to p$
Conjunction$p,\;\; q \;\;\therefore p\land q$$(p\land q)\to(p\land q)$
Resolution$p\lor q,\;\; \lnot p\lor r \;\;\therefore q\lor r$$((p\lor q)\land(\lnot p\lor r))\to(q\lor r)$

Modus Ponens vs Modus Tollens (the two you'll use most)

MP "fires forward": if we have $p$ and $p \to q$, we get $q$.
MT "fires backward via contrapositive": if we have $\lnot q$ and $p \to q$, we get $\lnot p$.

For quantified statements

RuleForm
Universal Instantiation$\forall x\, P(x) \;\;\therefore P(c)$ for any element $c$
Universal Generalization$P(c)$ for an arbitrary $c$ $\;\;\therefore \forall x\, P(x)$
Existential Instantiation$\exists x\, P(x) \;\;\therefore P(c)$ for some specific (new!) name $c$
Existential Generalization$P(c)$ for some particular $c$ $\;\;\therefore \exists x\, P(x)$

Existential instantiation gotcha

When you do EI from $\exists x\,P(x)$ you must introduce a new constant not used before. You can't claim it's some specific value β€” you only know some $x$ satisfies $P$.

Common fallacies (the marks-eating mistakes)

FallacyWrong formWhy wrong
Affirming the consequent$p\to q,\;\; q \;\;\therefore p$$q$ might be true for many reasons besides $p$.
Denying the antecedent$p\to q,\;\; \lnot p \;\;\therefore \lnot q$$q$ can be true even if $p$ is false.
Affirming a disjunct$p \lor q,\;\; p \;\;\therefore \lnot q$Inclusive OR allows both.
Begging the questionAssuming what you're trying to proveCircular reasoning.

Worked example: build a formal proof

Premises.

  1. If it does not rain or it is not foggy, then the sailing race is held and the lifesaving demonstration goes on.
  2. If the sailing race is held, then the trophy is awarded.
  3. The trophy was not awarded.

Conclusion. It rained.

Variables. $R$ = "it rains," $F$ = "it is foggy," $S$ = "sailing race held," $L$ = "lifesaving demo on," $T$ = "trophy awarded."

Formalised premises.

  1. $(\lnot R \lor \lnot F) \to (S \land L)$
  2. $S \to T$
  3. $\lnot T$

Goal. Derive $R$.

  1. $\lnot T$   [Premise 3]
  2. $S \to T$   [Premise 2]
  3. $\lnot S$   [Modus Tollens, 1 & 2]
  4. $\lnot S \lor \lnot L$   [Addition, 3]
  5. $\lnot (S \land L)$   [De Morgan, 4]
  6. $(\lnot R \lor \lnot F) \to (S \land L)$   [Premise 1]
  7. $\lnot(\lnot R \lor \lnot F)$   [Modus Tollens, 5 & 6]
  8. $R \land F$   [De Morgan + double negation, 7]
  9. $R$   [Simplification, 8] ∎

2.3 Types of Proofs

Every proof of $p \to q$ (or of a statement that can be cast that way) uses one of a small number of strategies. Pick the one whose shape fits your premises.

Direct Proof

Goal. Prove $p \to q$.
Method. Assume $p$. Through a chain of logical steps, deduce $q$. Done.

Example. If $n$ is odd, then $n^2$ is odd.

Proof. Assume $n$ is odd. Then $n = 2k+1$ for some integer $k$. Then $$n^2 = (2k+1)^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1.$$ Since $2k^2 + 2k$ is an integer, $n^2$ has the form $2m+1$, i.e., $n^2$ is odd. ∎

Example. Show that the square of an even integer is even.

Proof. Let $n = 2k$. Then $n^2 = 4k^2 = 2(2k^2)$. Hence $n^2$ is even. ∎

Proof by Contraposition

Goal. Prove $p \to q$.
Method. Prove $\lnot q \to \lnot p$ directly. Logically equivalent.

When to use it

Use contrapositive when the negation of $q$ gives you something concrete to manipulate (like "$n$ is odd" instead of "$n$ is not even"), but $p$ itself doesn't.

Example. If $n^2$ is even, then $n$ is even. (Contrapositive of "$n$ odd ⟹ $n^2$ odd.")

Proof (contrapositive). Assume $n$ is odd. Write $n = 2k+1$. Then $n^2 = 4k^2 + 4k + 1 = 2(2k^2+2k) + 1$ is odd. Hence $\lnot(n \text{ even}) \to \lnot(n^2 \text{ even})$. By contraposition, $n^2$ even ⟹ $n$ even. ∎

Example. If $3n+2$ is even, then $n$ is even.

Proof (contrapositive). Suppose $n$ is odd. Then $n = 2k+1$, so $3n+2 = 6k+3+2 = 6k+5 = 2(3k+2)+1$, which is odd. Contrapositive proven; original follows. ∎

Proof by Contradiction

Goal. Prove $q$.
Method. Assume $\lnot q$. Derive a contradiction (some $r \land \lnot r$). Hence $\lnot q$ is false, so $q$ holds.

Example. $\sqrt{2}$ is irrational.

Proof. Suppose, for contradiction, that $\sqrt{2} = a/b$ in lowest terms (so $\gcd(a,b)=1$). Squaring: $2b^2 = a^2$, so $a^2$ is even, so $a$ is even (by the previous example). Write $a = 2c$. Then $2b^2 = 4c^2$, so $b^2 = 2c^2$, so $b^2$ is even, so $b$ is even. But $a, b$ both even contradicts $\gcd(a,b)=1$. ∎

Example. $\log_2 3$ is irrational.

Proof. Suppose $\log_2 3 = p/q$ with $p,q \in \mathbb{Z}$, $q \neq 0$. Then $2^{p/q} = 3$, so $2^p = 3^q$. LHS is even (assuming $p \geq 1$), RHS is odd β€” contradiction. If $p = 0$, $2^0 = 1 \neq 3^q$ for any $q$. ∎

Example. If $3n+2$ is even, then $n$ is even (by contradiction).

Proof. Suppose $3n+2$ is even but $n$ is odd. Then $n = 2k+1$, so $3n+2 = 6k+5 = 2(3k+2)+1$ is odd. Contradicts "$3n+2$ even." ∎

Proof by Cases (Exhaustion)

Goal. Prove $p$ where the universe splits into cases $C_1, C_2, \ldots, C_n$ that exhaust all possibilities.
Method. Prove $p$ in each case.

Example. For every integer $n$, $n \leq n^2$.

Proof (by cases).

  • Case 1: $n \geq 1$. Multiply $n \geq 1$ by the positive number $n$ to get $n^2 \geq n$.
  • Case 2: $n = 0$. Then $0 = 0^2$ βœ“.
  • Case 3: $n \leq -1$. Then $n < 0$ but $n^2 \geq 1 > 0$, so $n < n^2$. βœ“

All integers covered. ∎

Example. The square of any integer leaves remainder 0 or 1 modulo 4.

Proof. Every integer is $4k, 4k+1, 4k+2,$ or $4k+3$.

  • $(4k)^2 = 16k^2 \equiv 0\pmod 4$.
  • $(4k+1)^2 = 16k^2 + 8k + 1 \equiv 1 \pmod 4$.
  • $(4k+2)^2 = 16k^2 + 16k + 4 \equiv 0 \pmod 4$.
  • $(4k+3)^2 = 16k^2 + 24k + 9 \equiv 1 \pmod 4$.

Hence the only remainders are 0 and 1. ∎

Mathematical Induction

Goal. Prove $\forall n \in \mathbb{N},\, P(n)$.
Method.

  1. Base case: show $P(0)$ (or $P(1)$, whatever the smallest case is).
  2. Inductive step: assume $P(k)$ for an arbitrary $k$ (the inductive hypothesis); prove $P(k+1)$.
  3. By the principle of induction, $P(n)$ holds for all $n$.

Example. $1 + 2 + 3 + \cdots + n = \dfrac{n(n+1)}{2}$ for all $n \geq 1$.

Base. $n=1$: LHS $=1$, RHS $= 1 \cdot 2 / 2 = 1$ βœ“.

Step. Assume $1 + \cdots + k = k(k+1)/2$. Then $$1+\cdots+k+(k+1) = \frac{k(k+1)}{2} + (k+1) = (k+1)\cdot\frac{k+2}{2} = \frac{(k+1)(k+2)}{2}.$$ So $P(k+1)$ holds. ∎

Strong induction. Sometimes you assume $P(0), P(1), \ldots, P(k)$ to derive $P(k+1)$. Equivalent in power to ordinary induction but often easier to apply.

Example. Every integer $n \geq 2$ is a product of primes. Base: $2$ is prime. Step: assume the claim for all $2 \leq m \leq k$. If $k+1$ is prime, done. Else $k+1 = ab$ with $2\leq a, b \leq k$; by IH, $a$ and $b$ each factor into primes, so $k+1$ does too. ∎

Existence proofs and counterexamples

  • Constructive existence: show how to build an example. ("There exist irrationals $a,b$ with $a^b$ rational" β€” e.g., $\sqrt{2}^{\log_2 9} = 3$.)
  • Non-constructive existence: prove existence without exhibiting one. Often by contradiction.
  • Disproving a universal: just exhibit one counterexample. ("The product of two irrationals is irrational" is false: $\sqrt{2}\cdot\sqrt{2}=2$, rational.)

Proving equivalences of multiple statements

To show $p_1, p_2, p_3, p_4$ are all equivalent, it suffices to show a cycle: $p_1 \to p_2 \to p_3 \to p_4 \to p_1$. That's 4 implications instead of $\binom{4}{2}\cdot 2 = 12$. You can also use any other set of implications whose transitive closure covers all pairs.

2.4 Program Correctness & Loop Invariants

A program is correct with respect to a specification (precondition $P$, postcondition $Q$) if whenever the precondition holds before execution, the postcondition holds after. We write this as a Hoare triple: $$\{P\}\; \text{Program}\; \{Q\}.$$

Two flavours

  • Partial correctness: if the program terminates, $Q$ holds.
  • Total correctness: the program terminates AND $Q$ holds.

Verifying simple sequences

For straight-line code, trace the state.

Swap.

temp := x
x := y
y := temp
Precondition: $x = a \land y = b$ for some specific values $a, b$.
After line 1: $\text{temp} = a, x = a, y = b$.
After line 2: $\text{temp} = a, x = b, y = b$.
After line 3: $\text{temp} = a, x = b, y = a$.
Postcondition $x = b \land y = a$ achieved. βœ“

Loop invariants

A loop invariant is a predicate that:

  1. Holds before the loop starts (initialization).
  2. If it holds before an iteration, holds after (maintenance).
  3. When the loop terminates, it (combined with the negation of the loop condition) implies the postcondition (termination).

Example. Prove that the following code computes $n!$:

i := 1
fact := 1
while i <= n:
    fact := fact * i
    i := i + 1
// claim: fact == n!

Invariant: $\text{fact} = (i-1)!$ and $1 \leq i \leq n+1$.

  • Init. Before loop: $i=1$, $\text{fact}=1=0!=(i-1)!$. βœ“
  • Maintenance. Suppose $\text{fact}=(i-1)!$. Body sets $\text{fact} \gets \text{fact}\cdot i = (i-1)!\cdot i = i!$ and then $i \gets i+1$. After: $\text{fact} = (i_{\text{new}}-1)!$. βœ“
  • Termination. Loop exits when $i > n$, i.e., $i = n+1$. Then $\text{fact} = (i-1)! = n!$. βœ“

Done. ∎

Example. Linear search returns the smallest index of $\text{target}$ in $A[1..n]$ (or $-1$).

i := 1
while i <= n:
    if A[i] == target: return i
    i := i + 1
return -1

Invariant: $\text{target} \notin A[1..i-1]$.

  • Init. $i=1$, $A[1..0]$ is empty, so vacuously target not in it.
  • Maintenance. Before iteration: target not in $A[1..i-1]$. If $A[i]=\text{target}$, we return correctly. Else, target not in $A[1..i]$; we increment $i$.
  • Termination. If loop exits without finding, $i = n+1$, so target $\notin A[1..n]$. Return $-1$ is correct.

Writing invariants β€” a checklist

  1. What's true before the loop? After every iteration?
  2. How does the loop progress toward the goal?
  3. What does the invariant + loop-exit condition imply about the final state?

If you can answer these three, you have your invariant.


Interactive β€” Inference rule trainer

Quick reps for the most-tested skill: looking at premises and naming the rule that gets you the conclusion. Each round is one inference; click the rule you think applies. The site shuffles automatically.

Name the rule

Problem Bank β€” Proofs

Drawn from DPP 5–6, proofs worksheets, and the midsem paper. Try each on paper first; reveal the solution to check your reasoning.

ConceptMediumQ1DPP 5 Β· Inference

Premises: P1: Research will not be completed on time. P2: If the project is funded, we will buy new equipment. P3: If we buy new equipment, the research will be completed on time. P4: The grant is not renewed or the project is funded. What conclusion follows?

Goal: Formulate the premises in propositional logic and derive a valid conclusion step-by-step using standard rules of inference.

Step-by-Step Derivation:

  1. Define Propositional Variables:
    • $C$: "The research will be completed on time."
    • $F$: "The project is funded."
    • $E$: "We will buy new equipment."
    • $R$: "The grant is renewed."
  2. Translate Premises:
    • P1: $\lnot C$
    • P2: $F \to E$
    • P3: $E \to C$
    • P4: $\lnot R \lor F$
  3. Apply Rules of Inference:
    StepExpressionJustification
    1$F \to E$Premise P2
    2$E \to C$Premise P3
    3$F \to C$Hypothetical Syllogism (from Steps 1 & 2)
    4$\lnot C$Premise P1
    5$\lnot F$Modus Tollens (from Steps 3 & 4)
    6$\lnot R \lor F$Premise P4
    7$\lnot R$Disjunctive Syllogism (from Steps 5 & 6)

Conclusion: The grant was not renewed ($\lnot R$). ∎

ConceptEasyQ2DPP 5 Β· Validity

P1: If $1+1 = 11$, then 7 is odd. P2: 7 is even. Conclusion: $1+1 \neq 11$. Comment on validity.

Goal: Formulate the argument using propositional logic and evaluate its validity and soundness.

Step-by-Step Analysis:

  1. Define Variables: Let $p$ be the proposition "$1+1=11$" and $q$ be the proposition "7 is odd."
  2. Translate the Argument:
    • Premise 1: $p \to q$
    • Premise 2: $\lnot q$ (since "7 is even" is equivalent to "7 is not odd")
    • Conclusion: $\lnot p$ (since "$1+1 \neq 11$")
  3. Evaluate Validity (Form): By the rule of Modus Tollens, from $p \to q$ and $\lnot q$, we can validly deduce $\lnot p$. Thus, the argument is logically valid.
  4. Evaluate Soundness (Truth of Premises):
    • $p$ is false, so the conditional $p \to q$ is vacuously true.
    • $q$ is false, so the premise $\lnot q$ is true.
    • Since all premises are true in reality, the argument is also sound, and the conclusion ($\lnot p$) must be true (which it is, since $1+1 \neq 11$). ∎
ConceptHardQ3DPP 5 Β· Identify rule

(a) The university is not closed today. If it snows, the university will close. Therefore, it did not snow today.
(b) If I stay in the sun too long, I sunburn. If I go swimming, I stay too long. Therefore, if I swim, I sunburn.

Goal: For each statement, formulate the premise-conclusion structure and identify the rule of inference used.

Step-by-Step Analysis:

  • (a) The university is not closed today. If it snows, the university will close. Therefore, it did not snow today.
    • Let $C$ = "university is closed", $S$ = "it snows".
    • Premises: $\lnot C$, $S \to C$. Conclusion: $\lnot S$.
    • Structure: $\lnot C, S \to C \therefore \lnot S$.
    • Rule of Inference: Modus Tollens (MT).
  • (b) If I stay in the sun too long, I sunburn. If I go swimming, I stay too long. Therefore, if I swim, I sunburn.
    • Let $W$ = "swim", $S$ = "stay in sun too long", $B$ = "sunburn".
    • Premises: $S \to B$, $W \to S$. Conclusion: $W \to B$.
    • Structure: $W \to S, S \to B \therefore W \to B$.
    • Rule of Inference: Hypothetical Syllogism (HS). ∎
ConceptEasyQ4DPP 5 Β· Whirlpool

"If I play hockey, I am sore." "If I am sore, I use the whirlpool." "I did not use the whirlpool." Conclusion?

Goal: Translate the English statements into propositional logic and deduce a valid conclusion.

Step-by-Step Derivation:

  1. Define Variables: Let $H$ = "I play hockey", $S$ = "I am sore", and $W$ = "I use the whirlpool".
  2. Formulate Premises:
    • P1: $H \to S$
    • P2: $S \to W$
    • P3: $\lnot W$
  3. Apply Rules of Inference:
    • From P1 ($H \to S$) and P2 ($S \to W$), by Hypothetical Syllogism, we derive $H \to W$.
    • From $H \to W$ and P3 ($\lnot W$), by Modus Tollens, we derive $\lnot H$.

Conclusion: I did not play hockey ($\lnot H$). ∎

ConceptEasyQ5DPP 5 Β· Lottery

"I did not win the lottery." "I am clever or lucky." "If I am lucky, I will win the lottery." Conclusion?

Goal: Formulate the statements and apply inference rules to obtain the final conclusion.

Step-by-Step Derivation:

  1. Define Variables: Let $W$ = "I win the lottery", $C$ = "I am clever", and $L$ = "I am lucky".
  2. Formulate Premises:
    • P1: $\lnot W$
    • P2: $C \lor L$
    • P3: $L \to W$
  3. Apply Rules of Inference:
    • From P3 ($L \to W$) and P1 ($\lnot W$), by Modus Tollens, we derive $\lnot L$.
    • From P2 ($C \lor L$) and $\lnot L$, by Disjunctive Syllogism, we derive $C$.

Conclusion: I am clever ($C$). ∎

ConceptEasyQ6DPP 5 Β· Tony Stark

"Tony will train or use a gadget." "If Tony trains, he is stronger." "Tony did not defeat villains." "If Tony is stronger, he can defeat villains." What follows?

Goal: Formulate the arguments and apply rules of inference step-by-step to find the conclusion.

Step-by-Step Derivation:

  1. Define Variables: Let $T$ = "Tony trains", $G$ = "Tony uses a gadget", $S$ = "Tony is stronger", and $D$ = "Tony defeats villains".
  2. Formulate Premises:
    • P1: $T \lor G$
    • P2: $T \to S$
    • P3: $\lnot D$
    • P4: $S \to D$
  3. Apply Rules of Inference:
    • From P4 ($S \to D$) and P3 ($\lnot D$), by Modus Tollens, we derive $\lnot S$.
    • From P2 ($T \to S$) and $\lnot S$, by Modus Tollens, we derive $\lnot T$.
    • From P1 ($T \lor G$) and $\lnot T$, by Disjunctive Syllogism, we derive $G$.

Conclusion: Tony used a gadget ($G$). ∎

ConceptHardQ7DPP 5 Β· Valid/Fallacy

(a) If $n > 1$ then $n^2 > 1$. Suppose $n^2 > 1$. Then $n > 1$. Valid?
(b) If $n > 3$ then $n^2 > 9$. Suppose $n^2 \leq 9$. Then $n \leq 3$.

Goal: Analyze each argument structure and determine whether it represents a valid rule of inference or a logical fallacy.

Analysis:

  • (a) If $n > 1$ then $n^2 > 1$. Suppose $n^2 > 1$. Then $n > 1$.
    • Let $p$ = "$n > 1$" and $q$ = "$n^2 > 1$".
    • Structure: $p \to q$, $q \therefore p$.
    • This is the fallacy of affirming the consequent.
    • Counterexample: Set $n = -2$. The premise $p \to q$ is true, and the assumption $q$ ($(-2)^2 = 4 > 1$) is true, but the conclusion $p$ ($-2 > 1$) is false. Hence, the argument is invalid.
  • (b) If $n > 3$ then $n^2 > 9$. Suppose $n^2 \leq 9$. Then $n \leq 3$.
    • Let $p$ = "$n > 3$" and $q$ = "$n^2 > 9$". Note that $\lnot q$ is "$n^2 \leq 9$" and $\lnot p$ is "$n \leq 3$".
    • Structure: $p \to q$, $\lnot q \therefore \lnot p$.
    • This follows the rule of Modus Tollens. Hence, the argument is valid. ∎
ConceptEasyQ8DPP 5 Β· Programming languages

"Every PL with garbage collection is slow. C does not use garbage collection. Therefore C is slow." Valid?

Goal: Formulate the categorical syllogism and evaluate its logical validity.

Step-by-Step Analysis:

  1. Define Predicates: Let $G(x)$ be "$x$ has garbage collection" and $S(x)$ be "$x$ is slow." Let the constant $\text{C}$ represent the programming language C.
  2. Translate Premises and Conclusion:
    • Premise 1: $\forall x \, (G(x) \to S(x))$
    • Premise 2: $\lnot G(\text{C})$
    • Conclusion: $S(\text{C})$
  3. Evaluate the Argument Form:
    • Instantiating Premise 1 for C yields $G(\text{C}) \to S(\text{C})$.
    • Combined with Premise 2 ($\lnot G(\text{C})$), the argument structure is: $$G(\text{C}) \to S(\text{C}), \quad \lnot G(\text{C}) \quad \therefore S(\text{C})$$
    • This is the fallacy of denying the antecedent. The fact that C does not use garbage collection does not imply it cannot be slow for other reasons.

Conclusion: The argument is invalid (a logical fallacy). ∎

ComputeEasyQ9DPP 5 Β· NASA

If hacked, then user error OR design flaw. Computer was hacked. The computer did not have a design flaw. Conclude: user error. Valid?

Goal: Formulate the compound argument in propositional logic and check its validity using rules of inference.

Step-by-Step Derivation:

  1. Define Variables: Let $H$ = "hacked", $U$ = "user error", and $D$ = "design flaw".
  2. Translate Premises:
    • P1: $H \to (U \lor D)$
    • P2: $H$
    • P3: $\lnot D$
  3. Apply Rules of Inference:
    StepExpressionJustification
    1$H \to (U \lor D)$Premise P1
    2$H$Premise P2
    3$U \lor D$Modus Ponens (from Steps 1 & 2)
    4$\lnot D$Premise P3
    5$U$Disjunctive Syllogism (from Steps 3 & 4)

Conclusion: The argument is valid. ∎

ProofEasyQ10DPP 5 Β· Quantified inference

Given: $\forall x\, (P(x) \to (Q(x) \land S(x)))$ and $\forall x\, (P(x) \land R(x))$. Show $\forall x\, (R(x) \land S(x))$ is true.

Goal: Construct a formal derivation for the quantified conclusion $\forall x\, (R(x) \land S(x))$ from the given premises.

Formal Proof:

  1. Let $c$ be an arbitrary element in the domain of discourse.
  2. StepExpressionJustification
    1$\forall x\, (P(x) \land R(x))$Premise 2
    2$P(c) \land R(c)$Universal Instantiation from Step 1
    3$P(c)$Simplification from Step 2
    4$R(c)$Simplification from Step 2
    5$\forall x\, (P(x) \to (Q(x) \land S(x)))$Premise 1
    6$P(c) \to (Q(c) \land S(c))$Universal Instantiation from Step 5
    7$Q(c) \land S(c)$Modus Ponens from Steps 3 & 6
    8$S(c)$Simplification from Step 7
    9$R(c) \land S(c)$Conjunction from Steps 4 & 8
    10$\forall x\, (R(x) \land S(x))$Universal Generalization from Step 9 (since $c$ was arbitrary)

Hence, the claim is proved. ∎

ProofMediumQ11DPP 6 Β· Direct proof

Let $m, n, p$ be integers. Suppose $m+n$ and $n+p$ are even. Prove $m+p$ is even.

Goal: Prove directly that $m+p$ is even given that $m+n$ and $n+p$ are even integers.

Proof (Direct):

  1. Use definition of even integers: Since $m+n$ and $n+p$ are even, there exist integers $a$ and $b$ such that: $$m + n = 2a$$ $$n + p = 2b$$
  2. Express $m+p$ algebraically: Add the two equations together: $$(m+n) + (n+p) = 2a + 2b$$ $$m + p + 2n = 2(a+b)$$ Isolate $m+p$ by subtracting $2n$ from both sides: $$m + p = 2a + 2b - 2n$$ $$m + p = 2(a + b - n)$$
  3. Show $m+p$ is even: Since $a, b,$ and $n$ are integers, their algebraic combination $k = a+b-n$ is also an integer. Thus, we can write $m+p = 2k$ for some integer $k$. By definition of even numbers, $m+p$ is even. ∎
ProofMediumQ12DPP 6 Β· Disprove

Prove or disprove: "The product of two irrational numbers is always irrational."

Goal: Evaluate the truth of the universal statement and write a formal proof or disproof.

Disproof (by Counterexample):

  1. To disprove the universal statement "for all irrational $a, b$, the product $ab$ is irrational," it suffices to show a single pair of irrational numbers whose product is rational.
  2. Let $a = \sqrt{2}$ and $b = \sqrt{2}$.
  3. We know that $\sqrt{2}$ is irrational (by classic contradiction proof).
  4. Compute their product: $$ab = \sqrt{2} \cdot \sqrt{2} = (\sqrt{2})^2 = 2$$
  5. The number 2 is a rational number since it can be expressed as $2/1$, where $2, 1 \in \mathbb{Z}$.

Since we found a counterexample, the statement is false. ∎

ConceptEasyQ13DPP 6 Β· OR proof

If $mn$ is even, then $m$ is even or $n$ is even.

Goal: Prove that if the product of two integers $mn$ is even, then at least one of the integers must be even.

Proof (by Contraposition):

  1. State the Contrapositive: The contrapositive of $P \to (Q \lor R)$ is $\lnot(Q \lor R) \to \lnot P$, which by De Morgan's Law is: $$\lnot Q \land \lnot R \to \lnot P$$ "If $m$ is odd and $n$ is odd, then the product $mn$ is odd."
  2. Assume the antecedent of the contrapositive: Assume $m$ and $n$ are both odd integers. By definition, there exist integers $a$ and $b$ such that: $$m = 2a + 1$$ $$n = 2b + 1$$
  3. Compute the product $mn$: $$mn = (2a+1)(2b+1) = 4ab + 2a + 2b + 1$$ Factor out a 2 from the first three terms: $$mn = 2(2ab + a + b) + 1$$
  4. Conclude: Since $a, b$ are integers, $k = 2ab + a + b$ is an integer. Thus, $mn = 2k + 1$, which is the definition of an odd number. Since the contrapositive statement is true, the original statement holds. ∎
ProofEasyQ14DPP 6 Β· Three sock pigeonhole

Drawer contains only blue and black socks. Show: pulling three socks guarantees a matching pair.

Goal: Prove that picking any 3 socks from a drawer containing only blue and black socks guarantees a matching pair of the same color.

Proof (by Pigeonhole Principle):

  1. Identify Pigeons and Pigeonholes:
    • Let the "pigeons" ($N$) be the pulled socks: $N = 3$.
    • Let the "pigeonholes" ($k$) be the colors of the socks (blue and black): $k = 2$.
  2. Apply the Principle: Since $N = 3 > 2 = k$, the Pigeonhole Principle states that at least one pigeonhole must contain at least: $$\lceil N/k \rceil = \lceil 3/2 \rceil = 2 \text{ pigeons.}$$
  3. Conclude: This means at least 2 of the pulled socks must share the same color. Therefore, a matching pair is guaranteed. ∎
ProofEasyQ15DPP 6 Β· 25 days, same month

Show that among any 25 days, at least 3 fall in the same month.

Goal: Prove that in any selection of 25 days, at least 3 days must belong to the same month.

Proof (by Pigeonhole Principle):

  1. Identify Pigeons and Pigeonholes:
    • Let the "pigeons" ($N$) be the days: $N = 25$.
    • Let the "pigeonholes" ($k$) be the months of the year: $k = 12$.
  2. Apply the Generalized Pigeonhole Principle: The principle states that if $N$ items are distributed into $k$ bins, then at least one bin must contain at least: $$\lceil N/k \rceil \text{ items.}$$ Calculate: $$\lceil 25/12 \rceil = \lceil 2.0833 \rceil = 3 \text{ items.}$$
  3. Conclude: At least 3 days must fall in the same month. ∎
ProofEasyQ16DPP 6 Β· Equivalence chain

For real $a, b$, show these are equivalent: (i) $a < b$, (ii) $\tfrac{a+b}{2} > a$, (iii) $\tfrac{a+b}{2} < b$.

Goal: Show that statements (i), (ii), and (iii) are logically equivalent by proving the cycle of implications: (i) $\implies$ (ii) $\implies$ (iii) $\implies$ (i).

Proof:

  • Part 1: Prove (i) $\implies$ (ii).
    • Assume $a < b$. Add $a$ to both sides of the inequality: $$a + a < a + b \implies 2a < a + b$$
    • Divide by 2: $$a < \frac{a+b}{2} \quad \text{which is equivalent to} \quad \frac{a+b}{2} > a.$$
  • Part 2: Prove (ii) $\implies$ (iii).
    • Assume $\frac{a+b}{2} > a$. Multiply by 2: $$a + b > 2a \implies b > a \quad \text{(or } a < b).$$
    • Now, we show $\frac{a+b}{2} < b$. Start from $a < b$ and add $b$ to both sides: $$a + b < b + b \implies a + b < 2b$$
    • Divide by 2: $$\frac{a+b}{2} < b.$$
  • Part 3: Prove (iii) $\implies$ (i).
    • Assume $\frac{a+b}{2} < b$. Multiply by 2: $$a + b < 2b$$
    • Subtract $b$ from both sides: $$a < b.$$

Since the cycle of implications is complete, the three statements are equivalent. ∎

ProofHardQ17Midsem Β· Contraposition

(a) Explain proof by contraposition. (b) Prove: if $n^2 - 6n + 5$ is even, then $n$ is odd.

Goal: Define the methodology of proof by contraposition, and apply it to prove the given statement.

Solution:

  1. (a) Explanation: To prove an implication $P \to Q$ by contraposition, we instead prove the logically equivalent statement $\lnot Q \to \lnot P$. We assume the negation of the conclusion ($\lnot Q$) and show that the negation of the hypothesis ($\lnot P$) must follow.
  2. (b) Proof:
    • State the Contrapositive: "If $n$ is even (not odd), then $n^2 - 6n + 5$ is odd (not even)."
    • Assume the antecedent of the contrapositive: Let $n$ be an even integer. Therefore, $n = 2k$ for some integer $k$.
    • Evaluate the expression $n^2 - 6n + 5$: Substitute $n = 2k$ into the expression: $$n^2 - 6n + 5 = (2k)^2 - 6(2k) + 5 = 4k^2 - 12k + 5$$ Separate the constant 5 as $4 + 1$: $$= 4k^2 - 12k + 4 + 1 = 2(2k^2 - 6k + 2) + 1$$
    • Conclude: Since $2k^2 - 6k + 2$ is an integer, $n^2 - 6n + 5$ is of the form $2m+1$ for some integer $m$. By definition, the expression is odd. By the principle of contraposition, the original statement is proven. ∎
ProofMediumQ18Induction Β· Sum of cubes

Prove by induction: $1^3 + 2^3 + \cdots + n^3 = \left(\dfrac{n(n+1)}{2}\right)^2$.

Goal: Prove the closed-form summation formula using mathematical induction for all $n \geq 1$.

Proof (by Induction):

  1. Define the Proposition: Let $P(n)$ be the statement: $$1^3 + 2^3 + \cdots + n^3 = \left(\frac{n(n+1)}{2}\right)^2$$
  2. Base Case ($n=1$):
    • LHS $= 1^3 = 1$.
    • RHS $= \left(\frac{1(1+1)}{2}\right)^2 = (1)^2 = 1$.
    • Since LHS $=$ RHS, $P(1)$ is true.
  3. Inductive Hypothesis (IH): Assume that $P(k)$ is true for some arbitrary integer $k \geq 1$: $$1^3 + 2^3 + \cdots + k^3 = \left(\frac{k(k+1)}{2}\right)^2$$
  4. Inductive Step: We must show that $P(k+1)$ is true, i.e.: $$\sum_{i=1}^{k+1} i^3 = \left(\frac{(k+1)(k+2)}{2}\right)^2$$ Expand the summation for $k+1$: $$\sum_{i=1}^{k+1} i^3 = \left( \sum_{i=1}^{k} i^3 \right) + (k+1)^3$$ Substitute the inductive hypothesis (IH) into the sum: $$= \left(\frac{k(k+1)}{2}\right)^2 + (k+1)^3 = \frac{k^2(k+1)^2}{4} + (k+1)^3$$ Factor out the common term $(k+1)^2$: $$= (k+1)^2 \left[ \frac{k^2}{4} + (k+1) \right] = (k+1)^2 \left[ \frac{k^2 + 4k + 4}{4} \right]$$ Recognize the numerator as a perfect square: $k^2 + 4k + 4 = (k+2)^2$: $$= (k+1)^2 \frac{(k+2)^2}{4} = \left(\frac{(k+1)(k+2)}{2}\right)^2$$ This matches the expression for $P(k+1)$.
  5. Conclusion: Since both the base case and the inductive step hold, by the Principle of Mathematical Induction, $P(n)$ is true for all $n \geq 1$. ∎
ProofEasyQ19Induction Β· Inequality

Prove $2^n > n^2$ for all $n \geq 5$.

Goal: Prove the inequality $2^n > n^2$ for all integers $n \geq 5$ using mathematical induction.

Proof (by Induction):

  1. Base Case ($n=5$):
    • LHS $= 2^5 = 32$.
    • RHS $= 5^2 = 25$.
    • Since $32 > 25$, the base case holds.
  2. Inductive Hypothesis (IH): Assume that $2^k > k^2$ holds for some arbitrary integer $k \geq 5$.
  3. Inductive Step: We must show that $2^{k+1} > (k+1)^2$. LHS of the statement at $k+1$: $$2^{k+1} = 2 \cdot 2^k$$ Substitute the inductive hypothesis ($2^k > k^2$): $$2^{k+1} > 2k^2$$ We now need to show that $2k^2 \geq (k+1)^2$ for $k \geq 5$: $$2k^2 \geq k^2 + 2k + 1 \iff k^2 - 2k - 1 \geq 0$$ Rewrite as: $$(k-1)^2 - 2 \geq 0$$ Since $k \geq 5$, the minimum value of $(k-1)^2 - 2$ is $(4)^2 - 2 = 14 > 0$. Therefore, $2k^2 \geq (k+1)^2$ is always true for $k \geq 5$. Thus: $$2^{k+1} > 2k^2 \geq (k+1)^2 \implies 2^{k+1} > (k+1)^2$$
  4. Conclusion: By the Principle of Mathematical Induction, the inequality holds for all $n \geq 5$. ∎
ProofMediumQ20Loop invariant

Prove the following program computes the sum $1 + 2 + \cdots + n$ for $n \geq 1$:

i := 1; s := 0
while i <= n:
    s := s + i
    i := i + 1
return s

Goal: Formally prove program correctness using loop invariants.

Proof:

  1. Define the Loop Invariant: Let the invariant $I$ be: $$s = \sum_{j=1}^{i-1} j = \frac{(i-1)i}{2} \quad \text{and} \quad 1 \leq i \leq n+1$$
  2. Verify Initialization (Base Case): Before the loop starts, $i=1$ and $s=0$. Substitute $i=1$ into the invariant formula: $$s = \frac{(1-1)\cdot 1}{2} = 0$$ The invariant holds.
  3. Verify Maintenance (Inductive Step): Assume $I$ is true before an iteration of the loop, and the loop guard $i \leq n$ holds. Let the state values at the start of the iteration be $s$ and $i$. The loop body performs the updates: $$s' = s + i$$ $$i' = i + 1$$ We must show the new state satisfies the invariant $s' = \frac{(i'-1)i'}{2}$. $$s' = s + i = \frac{(i-1)i}{2} + i \quad \text{[by inductive assumption]}$$ $$= \frac{i^2 - i + 2i}{2} = \frac{i^2 + i}{2} = \frac{i(i+1)}{2}$$ Since $i' = i + 1$, we have $i = i' - 1$. Substituting this in: $$s' = \frac{(i'-1)i'}{2}$$ Also, since $1 \leq i \leq n$, we have $2 \leq i' \leq n+1$. Thus, the loop invariant is maintained.
  4. Verify Termination: The loop terminates when the guard $i \leq n$ becomes false. Since $i$ starts at 1 and increases by 1 each step, the loop must terminate exactly when $i = n+1$. Substituting $i = n+1$ into the loop invariant: $$s = \frac{(n+1-1)(n+1)}{2} = \frac{n(n+1)}{2} = 1 + 2 + \cdots + n$$ Thus, when the program terminates, it returns the correct sum. ∎
Key takeaways Β· Proofs
  • Choose the right strategy first. Direct if the hypothesis is concrete; contrapositive if "$\lnot$ goal" is concrete; contradiction if "$\lnot$ goal" leads to something impossible.
  • Cite the rule. When asked to construct a formal proof, label each line with the rule name (MP, MT, HS, DS, Addition, Simplification, etc.).
  • End with ∎ or QED. Examiners love a clean ending.
  • Induction has three parts β€” never skip the base case, never skip stating the inductive hypothesis.
  • Loop invariants need initialisation, maintenance, termination β€” exactly three things to show.