Well done! We now have written out our induction hypothesis both in writing and in Python code. Our final task is to prove that our induction hypothesis is true for the integer
k is the value we supposed in the induction hypothesis. For our example, we want to prove that:
We first will take a look at our sum and say that:
In other words, we are saying that the sum of the odd integers from 1 to
k+1 equals the sum of the odd integers from 1 to
k plus the
k+1th odd integer. These two sums are both adding
k+1 odd integers together, and so we can confidently say that they mean the same thing.
Does the summation on the right look familiar? That’s because that is exactly the summation defined in our induction hypothesis! We can substitute k2 for that sum and obtain:
The rest is left to basic algebra:
(k+1)**2 is, in fact, what we sought in the beginning, and so our proof is now complete. Sadly, Python cannot mathematically prove these types of arguments for you. The best we can do using Python is to test if the
k+1th case is true.
Recall that in the previous exercise we set
k equal to nine. Now, set
k equal to
10 in the code editor.