Induction
Here is one of the most important ideas in logic (and, obviously, computer science).
Induction is a powerful method for showing a property is true for all nonnegative integers.
The common analogy for inductive method is this: if we climb the first step of the ladder, we can climb the next step, and the next step, and therefore climb the entire ladder.
Let's see how it goes with another example. Say, we have 5 books on our bookshelf:
.--.
.---|__|
.--|===|--|_
| |===| |'\ .---.
| | | |.'\ |===|
| | | |\.'\ | |
| | | | \ \ |===|
| | |__| \.'\ | |
| |===|--| \.'\|===|
^--^---'--^ `-'`---^
0 1 2 3 4
ASCII art from https://www.asciiart.eu/books/books
Looking at the books from left to right, we state two rules for ourselves:
- We are going to read the first book.
- If a book is read, then we are going to read the following book.
We start by reading book 0
. We know that if we read 0
, we are going to read the following one, book 1
.
If we read book 1
, we know that we are going to read the following one, book 2
.
If we read book 2
, we know that we are going to read the following one, book 3
.
...
So, we know that if book
We can conclude that every book on this bookshelf is going to be read. And, that's the idea of induction.
It's similar to the domino effect. The first domino falls, and the others follow.
Putting it in formal logic:
In our example, 0
, is the basis step, or the base case.
The proposition
In a proof, we first need to show that the base case holds. Then, we have to assume
Why do we assume
Remember that in an implication, the only specific case we need to look at is the case where the antecedent, the "if part", is true, because the only case where the whole implication is false is when T
So, if we show that the consequent is true while the antecedent is also true, we show that the implication holds for all cases.
Let's try an example.
We can prove the summation formula with induction.
Remember that the sum of
Or, to put it more precisely:
We're going to show that |
Let |
Base case: Prove |
Inductive step: |
Inductive hypothesis: We assume that |
We have to show that |
Now, let's add |
Let's do the math on the right side: |
If we factor it, we can see that it is the same thing we have wanted: |
What we've seen was ordinary induction. There is another kind of induction called strong induction. The difference is that strong induction just lets you make more assumptions.
In an ordinary induction argument, you assume that
is true and try to prove that is also true. In a strong induction argument, you may assume that and are all true when you go to prove .