We saw in the previous exercise an example of testing our code to discover faulty cases. We can now properly define the statement we found in Exercise 1: For any positive integer
n, the sum of the first
n odd integers is equal to n2. In other words:
How do we go about proving such a statement is really true for any positive integer
n? We will use the principle of mathematical induction, the formal definition of which will be developed throughout these next couple of exercises.
The first step in any induction proof is to identify the base case (the smallest possible case for which this statement is true). For instance, suppose you wanted to show for all positive integers
x is at most x2, or
Since our cases are all of the positive integers, our base case (the smallest case) for this example is the smallest possible integer. That happens to be 1, and we can show that
1 <= 1**2 quite easily because
1 = 1**2. Therefore, we have proven the base case for this conjecture. The upcoming checkpoint will ask you to find the base case for the statement
which we established earlier in this narrative.
Think about the smallest possible case which proves our statement as described in the narrative. When you think you have the answer, create a variable called
k and set it equal to that number in the code editor.