Ch 3. Logic and Proofs
3.6 Mathematical Induction
Imagine stacking blocks to build a tower. You place the first block, then the second on top, then the third, and so on. If you can show that:
- You can place the first block (base case), and
- If you can place one block, you can place the next (inductive step),
then you can build a tower of any height. This is the essence of mathematical induction, which is a method of proof that allows us to establish that a statement holds for all positive integers.
Example 3.45
Claim
The sum of the first [latex]n[/latex] positive integers is given by
[latex]1 + 2 + 3 + \cdots + n = \frac{n(n + 1)}{2}[/latex]
Proof:> Let’s try to understand the pattern by looking at a few small cases.
When [latex]n = 1: \quad 1 = \frac{1(1 + 1)}{2} = 1[/latex]
When [latex]n = 2: \quad 1 + 2 = 3 = \frac{2(2 + 1)}{2} = 3[/latex]
When [latex]n = 3: \quad 1 + 2 + 3 = 6 = \frac{3(3 + 1)}{2} = 6[/latex]
The formula seems to work. Imagine writing the numbers from [latex]1[/latex] to [latex]n[/latex] in a row
[latex]1 + 2 + 3 + \dots + (n - 2) + (n - 1) + n[/latex]
Now write them again in reverse order underneath.
[latex]n + (n - 1) + (n - 2) + \dots + 3 + 2 + 1[/latex]
If you add each column, you get
[latex](1 + n), (2 + n - 1), (3 + n - 2), ..., (n + 1)[/latex]
Each of these adds up to [latex]n + 1[/latex], and there are [latex]n[/latex] such pairs. So, the total of both rows is [latex]n(n + 1)[/latex]. But we only want the sum of one row, so divide by [latex]2[/latex] to obtain [latex]\frac{n(n + 1)}{2}[/latex].
[latex]\square[/latex]
While this proof was done using intuitive reasoning (understanding the pattern and then pairing numbers), it is limited. A more useful and formal proof technique is to use mathematical induction.
The Principle of Mathematical Induction
To prove that a statement [latex]P(n)[/latex] is true for all integers [latex]n \geq k[/latex], a basis step and an inductive step must be proven to be true. These steps are as follows:
- Basis Step: Show that [latex]P(k)[/latex] is true.
- Inductive Step: Assume [latex]P(n)[/latex] is true for some arbitrary [latex]n \geq k[/latex] and then show that [latex]P(n+1)[/latex] is also true.
The assumption in the inductive step is called the inductive hypothesis.
Example 3.45 (revisited)
Claim
The sum of the first [latex]n[/latex] positive integers is given by
[latex]1 + 2 + 3 + \cdots + n = \frac{n(n + 1)}{2}[/latex]
Proof
Let [latex]P(n)[/latex] be the proposition that:
[latex]1 + 2 + 3 + \cdots + n = \frac{n(n + 1)}{2}[/latex]
We will prove [latex]P(n)[/latex] is true for all integers [latex]n \geq 1[/latex] using induction.
Basis Step: Let [latex]n = 1[/latex]. Then [latex]1 = \frac{1(1 + 1)}{2} = 1[/latex], so the base case holds.
Inductive Step: Assume [latex]P(k)[/latex] is true for some arbitrary [latex]k \geq 1[/latex]. That is,
[latex]1 + 2 + 3 + \cdots + k = \frac{k(k + 1)}{2}[/latex]
We must show that [latex]P(k+1)[/latex] is also true, that is,
[latex]1 + 2 + 3 + \cdots + k + (k+1) = \frac{(k + 1)(k + 2)}{2}[/latex]
By the inductive hypothesis,
[latex]1 + 2 + 3 + \cdots + k + (k+1) = \frac{k(k + 1)}{2} + (k + 1) = \frac{(k + 1)(k + 2)}{2}[/latex]
So, the inductive hypothesis holds.
[latex]\square[/latex]
The next example uses factorials, which are widely used in IT and business for calculating permutations and combinations. For a nonnegative integer [latex]n[/latex], the factorial, denoted [latex][/latex], is defined as
[latex]0! = 1[/latex]
[latex]n! = n \cdot (n - 1)![/latex] for [latex]n > 0[/latex]
Example 3.46
Claim
For all integers [latex]n \geq 1[/latex]
[latex]1 \cdot 1! + 2 \cdot 2! + 3 \cdot 3! + \dots + n \cdot n! = (n + 1)! - 1[/latex]
Proof
Basis Step: Let [latex]n = 1[/latex]. Then [latex]1 \cdot 1! = 1 = 2! - 1[/latex], so the base case holds.
Inductive Step: Assume true for [latex]n[/latex] and prove for [latex]n + 1[/latex]. By the inductive hypothesis,
[latex](1 \cdot 1! + 2 \cdot 2! + 3 \cdot 3! + \dots + n \cdot n!) + (n + 1)(n + 1)![/latex]
[latex]= (n + 1)! - 1 + (n + 1)(n + 1)![/latex]
[latex]= (n+1)![1 + (n+1)) - 1[/latex]
[latex]= (n + 2)! - 1[/latex]
The inductive hypothesis holds.
[latex]\square[/latex]
Geometric sums are commonly used in IT and business to model exponential growth or decay, such as in computing compound interest, analyzing amortized costs in algorithms, and forecasting user growth or depreciation over time.
Theorem 3.3: Geometric Sum Formula
Claim
For all integers [latex]n > 0[/latex], and [latex]r \neq 1[/latex], the sum of the first [latex]n + 1[/latex] terms of a geometric sequence with initial term [latex]a[/latex] and common ratio [latex]r[/latex] is
[latex]a + ar + ar^{2} + \cdots + ar^{n} = a \frac{r^{n+1}-1}{r - 1}[/latex]
Proof
Basis Step: Let [latex]n = 0[/latex]. Then
[latex]a = a \frac{r^{1}-1}{r - 1} = a \frac{r - 1}{r - 1} = a[/latex]
Inductive Step: Assume true for [latex]n[/latex] and prove for [latex]n + 1[/latex]. By the inductive hypothesis,
[latex]a + ar + ar^{2} + \cdots + ar^{n} + ar^{n+1}[/latex]
[latex]= a \frac{r^{n+1}-1}{r - 1} + ar^{n+1}[/latex]
[latex]= a \left( \frac{r^{n+1} - 1 + r^{n+2} - r^{n+1}}{r-1} \right)[/latex]
[latex]= a \left( \frac{r^{n+2} - 1}{r - 1} \right)[/latex]
The inductive hypothesis holds.
[latex]\square[/latex]
In IT and business (e.g. finance and retail), many systems use barcodes, credit card numbers, and user IDs where data integrity is critical. Errors often occur when these codes are entered, and they can be detected by using the divisibility by 9 problem. The following check digit example illustrates this.
Example 3.47
Claim: For all integers [latex]n \geq 1[/latex], the number formed by [latex]10^{n} - 1[/latex] is divisible by [latex]9[/latex].
Proof
Basis Step: Let [latex]n = 1[/latex]. Then [latex]10^{1} - 1 = 9[/latex], and [latex]9[/latex] is divisible by [latex]9[/latex].
Inductive Step: Assume that for some [latex]k \geq 1, 10^{k} - 1[/latex] is divisible by [latex]9[/latex]. That is,
[latex]10^{k} - 1 = 9m[/latex] for some integer [latex]m[/latex]
We must show that [latex]10^{k+1} - 1[/latex] is also divisible by [latex]9[/latex]. Consider
[latex]10^{k+1} - 1 = 10 \cdot 10^{k} - 1 = 10(10^{k} - 1) + 9[/latex]
By the inductive hypothesis, [latex]10^{k} - 1 = 9m[/latex], so
[latex]10^{k+1} - 1 = 10 \cdot 9m + 9 = 9(10m + 1)[/latex]
Hence, [latex]10^{k+1}[/latex] is divisible by [latex]9[/latex].
[latex]\square[/latex]
This check digit example provides a natural lead-in to the concept of a loop invariant, especially when we consider how the program processes each digit of a number. In computer programming, a condition that is true before and after every iteration of a loop is called a loop invariant.
Programming Example 3.8 (Pseudocode)
In the check digit system, we compute the sum of digits of a number, often using a loop.
SET digit_sum TO 0
FOR EACH digit IN number_string:
CONVERT digit TO INTEGER
ADD digit TO digit_sum
DISPLAY digit_sum
Here, we can define a loop invariant as:
“At the start of each iteration, digit_sum equals the sum of all digits processed so far.”
This invariant helps us reason about the loop's correctness. It ensures that the loop accumulates the correct total, and that, when the loop finishes, digit_sum holds the sum of all digits in the number.
Claim
The loop correctly computes the sum of all digits in number_string.
Proof
Let number_string be the string of digits of length [latex]n[/latex], indexed from [latex]0[/latex] to [latex]n - 1[/latex]. Let the digits be d_0, d_1, … d_{n-1}.
Basis Step: No digits have been processed, so digit_sum = 0. This is correct because the sum of zero digits is 0.
Inductive Step: Assume that after processing the first [latex]k[/latex] digits, the invariant holds. That is,
digit_sum = d_0 + d_1 + … + d_{k-1}
Now, in the [latex](k+1)[/latex]th iteration, the digit d_k is converted to an integer and then added to digit_sum;. So now
digit_sum = d_0 + d_1 + … + d_k.
The invariant holds for [latex]k + 1[/latex].
[latex]\square[/latex]
Strong Induction Principle
Strong induction is used when proving a statement for [latex]n + 1[/latex] requires assuming the truth of multiple previous cases, not just the case for [latex]n[/latex].
To prove [latex]P(n)[/latex] for all [latex]n \geq k[/latex], we follow two steps:
- Basis Step: Prove [latex]P(k), P(k+1), \dots, P(m)[/latex].
- Inductive Step: Assume [latex]P(k), \dots, P(n)[/latex] are true and prove [latex]P(n+1)[/latex].
Example 3.48
Claim
Any amount of 12 cents or more can be made using only 4-cent and 5-cent coins.
Proof
Basis Step: The amount of 12 cents is made up of three 4-cent coins.
The amount of 13 cents is made up of two 4-cent coins and one 5-cent coin.
The amount of 14 cents is made up of one 4-cent coin and two 5-cent coins.
The amount of 15 cents is made up of three 5-cent coins.
These base cases are chosen because they are the smallest amounts for which we can explicitly show combinations of 4-cent and 5-cent coins that work. These base cases ensure that the inductive step (which builds the solution for [latex]n+1[/latex] using a solution for [latex]n-3[/latex]) has a solid foundation, since [latex]n-3[/latex] must be at least 12 for the step to work.
Inductive Step: Assume true for all values up to [latex]n \geq 15[/latex] and show for [latex]n+1[/latex]. Then by the inductive assumption,
[latex]n+1 = (n - 3) + 4[/latex], and [latex]n - 3 \geq 12[/latex]
>The inductive step works by assuming that we can make change for some amount [latex]n \geq 15[/latex], and then showing that we can also make change for [latex]n + 1[/latex] by simply adding a 4-cent coin. Since [latex]n + 1 - 4 = n - 3[/latex], and we’ve already proven we can make change for all amounts down to 12, this step ensures we can build up to any larger amount using previously verified combinations.
[latex]\square[/latex]
Note: The next two examples aren't directly related to strong induction, but are necessary to attempt the practice questions at the end of this chapter.
Floor and ceiling functions are commonly used in IT and business for rounding, allocation, and discrete decision-making. For example, if 53 customer-service tickets are distributed evenly among 8 agents, then the system uses the ceiling function to ensure all tickets are covered.
The floor of a real number [latex]x[/latex], denoted [latex]\lfloor x \rfloor[/latex], is the greatest integer less than or equal to [latex]x[/latex].
The ceiling of a real number [latex]x[/latex], denoted [latex]\lceil x \rceil[/latex], is the smallest integer greater than or equal to [latex]x[/latex].
Example 3.49
Claim
For any integer [latex]m[/latex], the following identity holds:
[latex]\lfloor \frac{n}{2} \rfloor + \lceil \frac{n}{2} \rceil = n[/latex]
Proof
A proof by cases is needed here, since the integer [latex]n[/latex] can be even or odd.
Case 1: Let [latex]n = 2k[/latex] for some integer [latex]k[/latex]. Then
[latex]\lfloor \frac{n}{2} \rfloor + \lceil \frac{n}{2} \rceil = k + k = 2k = n[/latex]
Case 2: Let [latex]n = 2k + 1[/latex] for some integer [latex]k[/latex]. Then
[latex]\lfloor \frac{n}{2} \rfloor + \lceil \frac{n}{2} \rceil = k + (k + 1) = 2k + 1 = n[/latex]
The identity is proven for all integers [latex]n[/latex].
[latex]\square[/latex]
A binary string of length [latex]n[/latex] has [latex]2^{n}[/latex] possible combinations, which is fundamental in IT and business for understanding how data is encoded, stored, and secured in digital systems.
The binary strings of length 1 are 0 and 1; the binary strings of length 2 are 00, 01, 10, and 11; and the binary strings of length 3 are 000, 001, 010, 011, 100, 101, 110, and 111. Each string is made up of only the digits 0 and 1.
Example 3.50
Claim
Every binary string of length [latex]n[/latex] has [latex]2^{n}[/latex] possible combinations.
Proof
Basis Step: Let [latex]n = 0[/latex]. A binary string of length [latex]0[/latex] is the empty string, and there is exactly one such string. Thus, the number of binary strings of length [latex]0[/latex] is [latex]1 = 2^{0}[/latex].
Inductive Step: Assume that for some [latex]k \geq 0[/latex], the number of binary strings of length [latex]k[/latex] is [latex]2^{k}[/latex]. That is, there are [latex]2^{k}[/latex] binary strings of length [latex]k[/latex].
We must show that the number of binary strings of length [latex]k + 1[/latex] is [latex]2^{k+1}[/latex].
Each binary string of length [latex]k + 1[/latex] can be formed by appending either a 0 or a 1 to a binary string of length [latex]k[/latex]. For each of the [latex]2^{k}[/latex] strings of length [latex]k[/latex], we can create one new string by appending 0 and one new string by appending 1.
So, the total number of strings of length [latex]k + 1[/latex] is [latex]2 \cdot 2^{k} = 2^{k+1}[/latex]. The inductive step holds.
[latex]\square[/latex]
Well-Ordering Principle
The well-ordering principle is used in IT and business to ensure termination and correctness in algorithms and processes. For example, in project scheduling or resource allocation, it helps ensure that tasks are prioritized and completed in a well-defined order, avoiding infinite loops or deadlocks.
This principle underlies induction and is equivalent to it (can be proven).
A direct application of the well-ordering principle in IT and business is the quotient-remainder theorem, which is used in encryption, data integrity, inventory management, and scheduling systems. For example, an inventory management system may have bins that can hold 12 units each. If a warehouse receives 137 units of a product, the system needs to determine how many full bins are needed and how many units remain in the partially filled bin.
The quotient-remainder theorem ensures that the process of finding the smallest non-negative remainder (e.g., the units remaining for a partially filled bin) terminates and that such a remainder exists (137 divided by 12 must have a remainder).
Theorem 3.4: Quotient-Remainder Theorem
Let [latex]a[/latex] be any integer and [latex]d[/latex] a positive integer. Then there exist unique integers [latex]q[/latex] (the quotient) and [latex]r[/latex] (the remainder) such that.
[latex]a = dq + r[/latex] where [latex]0 \leq r < d[/latex]
Proof
We prove this theorem in two steps: existence and uniqueness.
Existence: We want to find integers [latex]q[/latex] and [latex]r[/latex] such that
[latex]a = dq + r[/latex] where [latex]0 \leq r < d[/latex]
We proceed by constructing such a [latex]q[/latex] and [latex]r[/latex]. Let’s divide [latex]a[/latex] by [latex]d[/latex] using integer division, which has two cases.
Case 1: If [latex]a \geq 0[/latex], divide [latex]a[/latex] by [latex]d[/latex] to get a quotient [latex]q[/latex] and remainder [latex]r[/latex] such that
[latex]a = dq + r[/latex] where [latex]0 \leq r < d[/latex]
This is the same as how long division works in elementary arithmetic.
Case 2: If [latex]a < 0[/latex], we choose [latex]q[/latex] to be the largest integer such that [latex]dq \leq a[/latex]. Then define
[latex]r = a - dq[/latex]
Since [latex]dq \leq a < d(q + 1)[/latex], it follows that
[latex]0 \leq r = a - dq < d[/latex]
Thus, in both cases, we have found integers [latex]q[/latex] and [latex]r[/latex] such that
[latex]a = dq + r \text{ where } 0 \leq r < d[/latex]
Existence is proven.
Uniqueness: Suppose there are two pairs of integers [latex](q_{1}, r_{1})[/latex] and [latex](q_{2}, r_{2})[/latex] such that
[latex]a = dq_{1} + r_{1}[/latex] where [latex]0 \leq r_{1} < d[/latex]
[latex]a = dq_{2} + r_{2}[/latex] where [latex]0 \leq r_{2} < d[/latex]
Subtract the two equations to obtain
[latex]dq_{1} + r_{1} = dq_{2} + r_{2}[/latex]
[latex]d(q_{1} - q_{2}) = r_{2} - r_{1}[/latex]
Now, [latex]r_{1}[/latex] and [latex]r_{2}[/latex] are both between [latex]0[/latex] and [latex]d - 1[/latex], so [latex]r_{2} - r_{1}[/latex] is strictly less than [latex]d[/latex] in absolute value, that is,
[latex]|r_{2} - r_{1}| < d[/latex]
But [latex]d(q_{1} - q_{2}) = r_{2} - r_{1}[/latex] implies that [latex]r_{2} - r_{1}[/latex] is divisible by [latex]d[/latex]. The only multiple of [latex]d[/latex] with absolute value less than [latex]d[/latex] is [latex]0[/latex]. So,
[latex]r_{2} - r_{1} = 0[/latex]
[latex]r_{1} = r_{2}[/latex]
Then, from [latex]dq_{1} + r_{1} = dq_{2} + r_{1}[/latex], we obtain [latex]q_{1} = q_{2}[/latex]. Therefore, the pair [latex](q, r)[/latex] is unique.
[latex]\square[/latex]
Real-World Example 3.6: Predicting Software Growth with Induction
A software company tracks the number of users added each month. They notice a pattern:
Month 1: 5 users
Month 2: 10 users
Month 3: 15 users
...
Month [latex]n[/latex]: [latex]5n[/latex] users
They want to prove that the total number of users after [latex]n[/latex] months is
[latex]5 + 10 + 15 + \cdots + 5n = \frac{5n(n+1)}{2}[/latex]
Proof
Basis Step: Let [latex]n = 1[/latex]. Then [latex]5 = \frac{5 \cdot 1 \cdot 2}{2} = 5[/latex].
Inductive Step: Assume true for [latex]k[/latex].
[latex]5 + 10 + 15 + \cdots + 5k = \frac{5k(k+1)}{2}[/latex]
Show true for [latex]k + 1[/latex].
[latex]\frac{5k(k+1)}{2} + 5(k + 1) = \frac{5(k + 1)(k + 2)}{2}[/latex]
The company can now confidently predict user growth using this formula.
[latex]\square[/latex]