Proof Techniques | Computer Science
3.1 Direct Proof
Section titled “3.1 Direct Proof”To prove : assume Derive by a chain of logical deductions.
Example. Prove: if is odd, then is odd.
Proof. Let . Then Which is odd.
Worked Example. Prove: the sum of any two rational numbers is rational.
Solution
Let and where and . Then
Since and The sum is rational.
3.2 Proof by Contrapositive
Section titled “3.2 Proof by Contrapositive”To prove : prove instead.
Example. Prove: if is even, then is even.
Proof. Contrapositive: if is odd, then is odd. This was proved above.
Worked Example. Prove: if is odd, then is odd.
Solution
Contrapositive: if is even, then is even.
Let . Then Which is even.
3.3 Proof by Contradiction
Section titled “3.3 Proof by Contradiction”To prove : assume and derive a contradiction.
Example (Euclid). There are infinitely many primes.
Proof. Suppose there are finitely many primes . Consider . is not divisible by any (it leaves remainder 1). So is either prime itself or has a prime Factor not in the list. Either way, the list was incomplete. Contradiction.
Worked Example. Prove: is irrational.
Solution
Suppose in lowest terms, with and . Then So is even, hence is even. Write . Then So Hence is even. But then both and are even, Contradicting .
3.4 Mathematical Induction
Section titled “3.4 Mathematical Induction”Principle of Mathematical Induction. To prove for all :
- Base case: Prove .
- Inductive step: Prove for all .
Strong Induction. The inductive step assumes to prove .
Example. Prove: for all .
Proof. Base case: : . True.
Inductive step: Assume . Then
Worked Example. Prove by strong induction: every integer can be factored into primes.
Solution
Base case: is prime, so it is a (trivial) product of primes.
Inductive step: Assume every integer in factors into primes, where . Consider .
If is prime, it is already a product of primes (itself).
If is composite, then where . By the strong induction Hypothesis, both and factor into primes. Hence also factors into primes.
Worked Example. Prove: for all .
Solution
Base case: : . ✓
Inductive step: Assume . Then
3.5 Structural Induction
Section titled “3.5 Structural Induction”For recursively defined structures (lists, trees, formulas), prove a property by induction on the Structure:
- Base cases (empty list, leaf node, atomic formula).
- Inductive cases (cons, node with children, compound formula).
3.6 The Well-Ordering Principle
Section titled “3.6 The Well-Ordering Principle”Well-Ordering Principle (WOP). Every nonempty set of nonnegative integers has a least element.
Theorem 3.1. The Well-Ordering Principle is equivalent to the Principle of Mathematical Induction.
Proof (WOP implies induction). Let be a property with true and . Suppose for contradiction that fails for some . Let S = \\{n \geq 0 : P(n)\; \mathrm{is\; false{}\\}. By assumption So by WOP, has a least Element . Since is true, . Then is true (by minimality of ), And by the inductive hypothesis, so is true, contradicting . Therefore and holds for all .
Proof (induction implies WOP). Let be nonempty. We prove by induction that If Then has a least element. For , Contains Which is the least element. Assume the claim for . If Then is the least element. Otherwise And by The induction hypothesis applied to the shifted set, a least element exists.
Worked Example. Use the WOP to prove that every can be written as a sum of distinct Powers of 2.
Solution
Let be the set of positive integers that cannot be written as a sum of distinct powers of 2. Suppose . By WOP, has a least element .
Let be the largest power of 2 not exceeding (so ). Then and . If Then is a single power of 2, Contradicting . If Then So (by minimality Of ). Hence is a sum of distinct powers of 2, all of which are . Adding Gives as a sum of distinct powers of 2, contradicting . Therefore .
flowchart TD A[3_Proof Techniques] --> B[Key Concepts] A --> C[Core Principles] A --> D[Practical Applications] B --> E[Fundamental definitions] C --> F[Design patterns] D --> G[Real-world usage]Intuition
Section titled “Intuition”Proof techniques establish mathematical truth. Direct proof assumes premises and derives conclusions. Proof by contradiction assumes the negation and finds a contradiction. Mathematical induction proves statements for all natural numbers by showing a base case and inductive step. These techniques are essential for verifying algorithm correctness, proving complexity bounds, and establishing security properties.
Common Mistakes
Section titled “Common Mistakes”Circular reasoning in direct proofs. A proof is circular when the conclusion is assumed (even implicitly) in the premises. For example, proving “if is even then is even” by writing so is valid, but assuming is even to prove is even is not. Always verify that your assumptions do not presuppose the result.
Incorrect base case in mathematical induction. Students sometimes start induction at when the statement only holds for , or verify only one base case when the inductive step requires two (as with Fibonacci-type recurrences). Check that the base case matches the domain of the statement and that enough base cases are proven.
Confusing contrapositive with converse. The contrapositive of is , which is logically equivalent to the original. The converse is , which is not equivalent. Proving the converse does not prove the original statement.
Cross-References
Section titled “Cross-References”[[1-discrete-mathematics/1_propositional-and-predicate-logic]] - Logical foundations
[[1-discrete-mathematics/2_sets-relations-and-functions]] - Set-theoretic proofs
[[1-algorithms/algorithm_design]] - Algorithm correctness proofs
[[1-algorithms/complexity-theory]] - Complexity proofs