



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Mathematics 55ā Spring 2005 Lecture 14 (Wednesday 2/23/2005) More on Proof By Induction
Please read §3.4 for this Friday, and §3.5 for next Monday. I plan to devote 4 more lectures, including todayās, to Chapter 3.
Example: Prove by induction that every positive integer ā„ 2 can be represented as a product of powers of prime numbers. (Clarification: A āfactorizationā with a single factor is allowed. Thus 2 = 2 is considered to be a prime factorization of 2.) Attempted Proof : The first small point is that weāre only supposed to prove something about all n ā„ 2, rather than all integers n ā„ 1. Let Q(n) be the statement that n can be represented as a product of (positive integer) powers of prime numbers. Let P (n) be the statement [(n ā„ 2) ā Q(n)]. If we prove P (n) for all n ā„ 1 then we will have proved Q(n) for all n ā„ 2. Basis step: If n = 1 then n ā„ 2 is False, so P (1) is True. First attempt at inductive step: Let n be a positive integer. We want to prove P (n + 1). There are two cases. (i) If n + 1 is prime then the desired factorization is simply to write n + 1 as itself; this is one of those factorizations having only one factors. (ii) If n + 1 is not prime, then by definition of a prime number, there must exist at least one integer factor q > 1 that divides n + 1. Choose one such factor q, and write n + 1 = qr where r is another positive integer. Now both q, r are < n + 1. If the inductive hypothesis applied to both q, r then we could express each as a product of powers of primes. Multiplying together their two factorizations would yield a factorization of n + 1 as a product of powers of primes, completing the inductive step. Thus we see that it could be useful to have a different kind of inductive hypothesis, of the form P (k) for all k ⤠n. The principle of strong induction says that this is a
valid method of inference. More precisely, the principle of strong induction says that
[ P (1) ā§ ān
[P (k) for all k ⤠n] ā P (n + 1)
ā ānP (n)
where the UofD is N.
Example: Prove that the greedy algorithm for the lecture scheduling problem always produces an optimal solution. Definitions of terms: The scheduling problem: UC Mudville opens, and each aca- demic department submits a nonnegotiable list of lectures it wants to hold. Lecture j begins at time bj , and ends at time ej ; j ranges from 1 to n. These times are arbitrary; a lecture might begin at 9:17 and end at 9:32, while another might begin at 9:21 and end at 10:05. Alas, due to construction delays, thereās only one lecture hall. The scheduling office wants to fit in as many lectures as possible, but of course no two at the same time. How to choose which ones?
(Two lectures are not considered to overlap if one begins at exactly the moment when the other ends.) The greedy algorithm: (i) Choose whichever lecture ends earliest. (In case of a tie, choose any one.) (ii) Discard all lectures that overlap with the chosen one. Then go back to step (i), choosing only from among those lectures not discarded. Repeat until no lectures remain. Hereās a series of pictures illustrating a sample set of lectures and the application of the greedy algorithm. Time runs horizontally, from left to right. the time axis is not shown. Each line segment denotes a lecture; the left endpoint indicates its beginning time, and the right endpoint its ending time.
Figure 1: All proposed lectures (above).
Figure 2: The lecture ending earliest has been selected, and all other lectures that overlap with it have been discarded.
then applying the greedy algorithm to A. That is,
greedy(L) = 1 + greedy(A).
Consider any set S of nonoverlapping lectures. Let K ā S be a lecture that ends earliest. Express S as S = T āŖ {K} where K /ā T. Then eK ⤠bi ⤠ei for any i ā T. Since eJ ⤠eK, this means that no lecture in T overlaps with lecture J. Thus T ā A. By the induction hypothesis, |T | ⤠greedy(A). Thus
|S| = 1 + |T | ⤠1 + greedy(A) = greedy(L).
Hereās some material that wasnāt included in the lecture, due to time constraints: Comment. There are many, many greedy algorithms. We saw another earlier in the semester, dealing with making change. Greedy algorithms arise in problems where one makes a sequences of choices among alternatives in attempting to optimize or maximize something. Choosing one alternative narrows the field of possibilities for the next choice, and so on. In a greedy algorithm, roughly speaking, one makes whichever choice appears to yield the greatest immediate progress towards the goal, without considering what will happen down the line. In chess, this means thinking only of the present move, rather than thinking ahead. In making change, it means using the largest denomination of coin available, so that the remaining change to be made is minimized. In the scheduling problem, it means choosing whichever lecture ends earliest, so that the greatest amount of time remains for the scheduling of additional lectures. Weāve already learned (text and problem set discussions of making change with various denominations of coins) that sometimes greedy algorithms produce optimal solutions, but sometimes they do not. Greedy algorithms are generally easy to implement ā just as chess would be easy if one never had to think ahead. Thus itās often useful to prove that a greedy algo- rithm is optimal, for one then has a simple and optimal solution.
There are lots of other examples of proofs by induction in our text. I recommend studying them.
There are two theoretical points you might be wondering about. (1) What justifies the principle of induction? That is, why is it a valid rule of inference? (2) What justifies the principle of strong induction? The well-ordering property of N (or of N = { 0 , 1 , 2 , Ā· Ā· Ā· } = N āŖ { 0 }): Every nonempty subset of N contains a (unique) smallest element. That is: if S ā N is
nonempty then there exists n ā S such that (k ā S) ā (n ⤠k). In this course, we accept the well-ordering property as an axiom about N, that is, as a fundamental assumption that is not proved. In mathematics one must begin with some axioms; one canāt prove something from nothing at all. In more advanced treatments one starts with the theory of sets and with a small list of axioms about sets, and one proves the well-ordering property from those axioms. To do that would take us much of a semester, and although fascinating, would probably not significantly advance our understanding of the subject matter of this course. So I hope that youāre willing to take the well-ordering property for granted.
Proof that induction is a valid method of inference: Suppose given some predicate P (n). Suppose that P (1) is True, and that ān ā N(P (n) ā P (n + 1)) is True. We must prove that P (n) is True for all n ā N. Let S be the set of all n ā N for which P (n) is False; we want to prove that S is empty. If not, then by the well-ordering property, S has some smallest element, k. Let n = k ā 1. Then n /ā S, since k is smallest. Therefore P (n) is True. Then both P (n) and P (n) ā P (n + 1) are True, so P (n + 1) is True by modus ponens. Thus P (k) is True, so k /ā S, a contradiction. Thus S must be empty.