Lesson 3 of 15
Proof Techniques
The Art of Mathematical Proof
Mathematics is built on proofs — rigorous arguments that a statement is true. The main proof strategies are:
Direct proof: Assume , deduce step by step.
Proof by contrapositive: To prove , prove instead (logically equivalent).
Proof by contradiction: Assume the negation of what you want to prove, derive a contradiction.
Proof by induction: Prove a base case , then prove .
Example: Direct Proof
Claim:
We verify this computationally and use it:
def sum_formula(n):
return n * (n + 1) // 2
print(sum_formula(100)) # 5050
Example: Proof by Contradiction — Infinitely Many Primes
Euclid's proof: if only finitely many primes exist, then is not divisible by any of them — a contradiction, since every integer has a prime factor.
def euclid_contradiction(primes):
product = 1
for p in primes:
product *= p
candidate = product + 1
return all(candidate % p != 0 for p in primes)
print(euclid_contradiction([2, 3, 5])) # True — 31 is not divisible by 2, 3, or 5
Your Task
Implement sum_formula(n) and euclid_contradiction(primes) as shown above.
Pyodide loading...
Loading...
Click "Run" to execute your code.