Proofs and induction
لم يُترجم بعد؛ يُعرض باللغة الإنجليزية
عن هذا الدرس
A proof shows that a claim is true in every case, not just the ones you tried. Follow one claim, 1 + 2 + … + n = n(n+1)/2, from checking examples to a full proof by induction: a base case that starts the chain, and an inductive step that passes the truth from each case to the next, like a row of falling dominoes.
A claim for every n
A proof shows a claim is true in every case. Our claim, called P(n): 1 + 2 + … + n = n(n+1)/2 for every whole number n ≥ 1. The formula row works out the right side for n = 1 to 5.
>>> def f(n): ... return n * (n + 1) // 2 ... >>> [f(n) for n in range(1, 6)] [1, 3, 6, 10, 15]
اقرأ الدرس خطوة بخطوة
A claim for every n
A proof shows a claim is true in every case. Our claim, called P(n): 1 + 2 + … + n = n(n+1)/2 for every whole number n ≥ 1. The formula row works out the right side for n = 1 to 5.
>>> def f(n): ... return n * (n + 1) // 2 ... >>> [f(n) for n in range(1, 6)] [1, 3, 6, 10, 15]Examples are not a proof
Now add up the left side: 1, then 1 + 2 = 3, then 6, 10 and 15. All five match the formula. But the claim is about every n, and there are infinitely many. Checking cases, however many, can never cover them all.
>>> [sum(range(1, n + 1)) for n in range(1, 6)] [1, 3, 6, 10, 15] >>> all(sum(range(1, n + 1)) == n * (n + 1) // 2 for n in range(1, 1001)) TrueThe domino idea
Proof by induction works like a row of dominoes. Show two things. Base case: the first domino falls. Inductive step: whenever one domino falls, it knocks over the next. Then every domino falls, however long the row.
>>> sum(range(1, 101)) # 1 + 2 + ... + 100 5050 >>> 100 * 101 // 2 5050Base case: n = 1
Base case: check P(1). The left side is just 1. The right side is 1 × 2 / 2 = 1. Both sides are equal, so P(1) is true. The first lamp lights: the first domino falls.
>>> n = 1 >>> sum(range(1, n + 1)), n * (n + 1) // 2 (1, 1)Assume P(k)
Inductive step. Pick any whole number k ≥ 1 and assume P(k) is true: 1 + … + k = k(k+1)/2. This assumption is called the inductive hypothesis. Now ask: if P(k) is true, must P(k + 1) be true too?
>>> k = 10 # one example k; the proof works for any k >>> sum(range(1, k + 1)) == k * (k + 1) // 2 TrueAdd the next number
The left side of P(k + 1) is 1 + … + k + (k + 1). Its first k terms are exactly the left side of P(k), so the hypothesis lets us swap them for k(k+1)/2. That leaves k(k+1)/2 + (k + 1).
>>> k = 10 >>> sum(range(1, k + 2)) == k * (k + 1) // 2 + (k + 1) TrueTidy up the algebra
Take out the common factor (k + 1): k(k+1)/2 + (k + 1) = (k + 1)(k/2 + 1) = (k + 1)(k + 2)/2. That is the formula with n = k + 1. So if P(k) is true, P(k + 1) is true.
>>> k = 10 >>> k * (k + 1) // 2 + (k + 1), (k + 1) * (k + 2) // 2 (66, 66)The dominoes fall
Now put the two parts together. P(1) is true. The step with k = 1 gives P(2), with k = 2 it gives P(3), then P(4), P(5) and on forever. Every n is reached, so P(n) is true for all n ≥ 1.
>>> for n in range(1, 6): ... print(n, sum(range(1, n + 1)), n * (n + 1) // 2) ... 1 1 1 2 3 3 3 6 6 4 10 10 5 15 15Both parts are needed
Drop either part and the proof fails. The false claim n = n + 1 has a working step: if n = n + 1, then n + 1 = n + 2. But no case is true, so nothing starts the chain.
>>> n = 1 >>> n == n + 1 # the base case fails False
أسئلة سريعة: 5
اختر إجابة واحدة لكل سؤال. يمكنك تغيير اختياراتك قبل التحقق منها.
01A program checks a formula for n = 1 to 1,000,000 and every case matches. What does that show?
Checks give evidence and catch mistakes, but there are infinitely many n. Only a proof, such as one by induction, covers them all.
02What are the two parts of a proof by induction?
The base case shows the first case is true (the first domino falls). The inductive step shows that each true case makes the next one true (each domino knocks over the next).
03In the inductive step for 1 + 2 + … + n = n(n+1)/2, what do you assume?
You assume P(k), the inductive hypothesis, and then show P(k + 1) must follow. Assuming P(k + 1) itself would be circular.
04Using the inductive hypothesis, 1 + 2 + … + k + (k + 1) equals k(k+1)/2 + (k + 1). What does that simplify to?
Take out the common factor (k + 1): (k + 1)(k/2 + 1) = (k + 1)(k + 2)/2. For k = 10 both sides are 66.
05The claim n = n + 1 has a working inductive step: if n = n + 1, then n + 1 = n + 2. Why is it still false?
The inductive step only passes truth along. With no true starting case, there is nothing to pass on. That is why every proof by induction needs its base case.
المسرد
- Proof
- An argument that shows a claim is true in every case it talks about, step by step from facts already known.
- Claim P(n)
- A statement about a whole number n, such as 1 + 2 + … + n = n(n+1)/2. P(3) is the same statement with n = 3.
- Proof by induction
- A way to prove P(n) for every n from a starting value: prove the base case, then prove the inductive step.
- Base case
- The first case, usually P(1), checked directly. It starts the chain.
- Inductive step
- A proof that if P(k) is true for some k, then P(k + 1) is also true. It passes truth from each case to the next.
- Inductive hypothesis
- The assumption made inside the inductive step: P(k) is true for one unknown whole number k.
- Counterexample
- One case where a claim is false. A single counterexample is enough to show a claim about every n is false.
الملاحظات والمصادر
- The dots in 1 + 2 + … + n mean "keep adding every whole number up to n". The inductive hypothesis is not circular: we assume P(k) and show P(k + 1), but we never assume P(k + 1) itself.
- The base case can start anywhere: to prove a claim for every n ≥ 4, check P(4) first and the chain runs from there.
- A second proof: write the sum forwards and backwards and add the two rows. Each of the n columns adds up to n + 1, which gives twice the sum, so the sum is n(n+1)/2. For n = 100 that is 5050.
- Strong induction assumes every case from P(1) up to P(k), not just P(k). It suits recursion that steps back more than one place, such as Fibonacci numbers.
- Programmers use the same reasoning to show that loops and recursive functions are correct: if a fact holds before the first pass and each pass keeps it true, it holds after every pass.
- Lehman, Leighton & Meyer, Mathematics for Computer Science (MIT 6.042J), chapter 5 Induction
- MIT OpenCourseWare 6.1200J Mathematics for Computer Science (2024)
- Rosen, Discrete Mathematics and Its Applications, 8th ed., section 5.1 Mathematical Induction
- Hammack, Book of Proof, 3rd ed., chapter 10 Mathematical Induction
- Levin, Discrete Mathematics: An Open Introduction, Induction
- Python library: Built-in functions (sum, range)
اختبار يتاح بعد الخطوة الأخيرة.