Lesson 10 of 15
Mathematical Induction
Proof by Induction
Mathematical induction proves statements of the form for all :
- Base case: Prove .
- Inductive step: Assume (inductive hypothesis), prove .
Classic Example: Sum Formula
Theorem:
Proof: Base case : ✓. Inductive step: assume it holds for . Then:
Sum of Squares
Strong Induction
In strong induction, the hypothesis is , not just . This is equivalent in power but more convenient for some proofs (e.g., unique prime factorization).
def verify_sum_of_squares(n):
actual = sum(i**2 for i in range(1, n+1))
formula = n * (n + 1) * (2 * n + 1) // 6
return actual == formula
print(verify_sum_of_squares(100)) # True
Your Task
Implement the three verification functions below.
Pyodide loading...
Loading...
Click "Run" to execute your code.