INDUCTION AND RECURSION

Similar documents
Proofs: A General How To II. Rules of Inference. Rules of Inference Modus Ponens. Rules of Inference Addition. Rules of Inference Conjunction

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

0.Axioms for the Integers 1

Manual of Logical Style

Proof Techniques (Review of Math 271)

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination I (Spring 2008)

Logic, Sets, and Proofs

Proofs. Introduction II. Notes. Notes. Notes. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

A Guide to Proof-Writing

Proof Terminology. Technique #1: Direct Proof. Learning objectives. Proof Techniques (Rosen, Sections ) Direct Proof:

Supplementary Logic Notes CSE 321 Winter 2009

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

First order Logic ( Predicate Logic) and Methods of Proof

Mat 243 Exam 1 Review

Steinhardt School of Culture, Education, and Human Development Department of Teaching and Learning. Mathematical Proof and Proving (MPP)

1.1 Statements and Compound Statements

Climbing an Infinite Ladder

Gödel s Incompleteness Theorems by Sally Cockburn (2016)

Propositional Logic. Spring Propositional Logic Spring / 32

Chapter 1 Elementary Logic

HANDOUT AND SET THEORY. Ariyadi Wijaya

Introduction to Metalogic

Math 300 Introduction to Mathematical Reasoning Autumn 2017 Proof Templates 1

Lecture Notes on Heyting Arithmetic

MCS-236: Graph Theory Handout #A4 San Skulrattanakulchai Gustavus Adolphus College Sep 15, Methods of Proof

Packet #1: Logic & Proofs. Applied Discrete Mathematics

Propositional natural deduction

MAC-CPTM Situations Project

Learning Goals of CS245 Logic and Computation

Review. Propositions, propositional operators, truth tables. Logical Equivalences. Tautologies & contradictions

1 The Foundation: Logic and Proofs

Informal Statement Calculus

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

Prompt. Commentary. Mathematical Foci

Propositional Logic: Syntax

Gödel s Incompleteness Theorems

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models

1 The Foundation: Logic and Proofs

a. (6.25 points) where we let b. (6.25 points) c. (6.25 points) d. (6.25 points) B 3 =(x)[ H(x) F (x)], and (11)

Section 1.2: Propositional Logic

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics. Introductory Notes in Discrete Mathematics Solution Guide

Logic and Proofs. (A brief summary)

MAT 243 Test 1 SOLUTIONS, FORM A

Climbing an Infinite Ladder

CSE 20 DISCRETE MATH. Winter

Lecture 2: Proof Techniques Lecturer: Lale Özkahya

At the start of the term, we saw the following formula for computing the sum of the first n integers:

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Chapter 2: The Logic of Quantified Statements

CSE 20. Final Review. CSE 20: Final Review

Your quiz in recitation on Tuesday will cover 3.1: Arguments and inference. Your also have an online quiz, covering 3.1, due by 11:59 p.m., Tuesday.

A Multiplicative Operation on Matrices with Entries in an Arbitrary Abelian Group

Review CHAPTER. 2.1 Definitions in Chapter Sample Exam Questions. 2.1 Set; Element; Member; Universal Set Partition. 2.

Every formula evaluates to either \true" or \false." To say that the value of (x = y) is true is to say that the value of the term x is the same as th

Math 4606, Summer 2004: Inductive sets, N, the Peano Axioms, Recursive Sequences Page 1 of 10

n n P} is a bounded subset Proof. Let A be a nonempty subset of Z, bounded above. Define the set

Natural Deduction. Formal Methods in Verification of Computer Systems Jeremy Johnson

Advanced Topics in LP and FP

Uniform Schemata for Proof Rules

Proofs. Example of an axiom in this system: Given two distinct points, there is exactly one line that contains them.

Mathematical Induction

CHAPTER 0: BACKGROUND (SPRING 2009 DRAFT)

Introducing Proof 1. hsn.uk.net. Contents

Predicate Logic. Andreas Klappenecker

Proofs. Chapter 2 P P Q Q

Intro to Logic and Proofs

185.A09 Advanced Mathematical Logic

CSE 20 DISCRETE MATH. Fall

Tools for reasoning: Logic. Ch. 1: Introduction to Propositional Logic Truth values, truth tables Boolean logic: Implications:

Metainduction in Operational Set Theory

Chapter 1: The Logic of Compound Statements. January 7, 2008

Foundations of Discrete Mathematics

Readings: Conjecture. Theorem. Rosen Section 1.5

Chapter One. The Real Number System

Basic properties of the Integers

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

MAI0203 Lecture 7: Inference and Predicate Calculus

3 Propositional Logic

Natural Deduction is a method for deriving the conclusion of valid arguments expressed in the symbolism of propositional logic.

Logic and Inferences

Lecture 11: Measuring the Complexity of Proofs

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

Math 10850, fall 2017, University of Notre Dame

The Integers. Peter J. Kahn

02 Propositional Logic

Lecture 4: Probability, Proof Techniques, Method of Induction Lecturer: Lale Özkahya

7.5.2 Proof by Resolution

Chapter 1. Logic and Proof

EECS 1028 M: Discrete Mathematics for Engineers

PRINCIPLE OF MATHEMATICAL INDUCTION

Logic for Computer Science - Week 5 Natural Deduction

Discrete Structures for Computer Science

Definition 2.3. We define addition and multiplication of matrices as follows.

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

Chapter 9. Proofs. In this chapter we will demonstrate how this system works. The precise definition of 9-1

What are the recursion theoretic properties of a set of axioms? Understanding a paper by William Craig Armando B. Matos

means is a subset of. So we say A B for sets A and B if x A we have x B holds. BY CONTRAST, a S means that a is a member of S.

FACTORIZATION AND THE PRIMES

Transcription:

INDUCTION AND RECURSION Jorma K. Mattila LUT, Department of Mathematics and Physics 1 Induction on Basic and Natural Numbers 1.1 Introduction In its most common form, mathematical induction or, as it is also called, complete induction is used in the domain of basic numbers or natural numbers. Specifically, in induction, it is assumed that a certain property holds for the lowest basic number, which is zero, and that if this property is true for n then it is true for n + 1. If these two conditions are met, then the property in question is true for all basic numbers. To gain a better understanding of induction, it is necessary to learn more about basic numbers. For this reason, we will define addition and multiplication in a recursive way. This allows the derivation of certain important properties of these operations. Later in this section, certain variants of induction will be introduced. 1.2 Basic and Natural Numbers The set of natural numbers is denoted by N {1, 2,...}. This set contains all positive integers, that is, the set N is the same as Z +. Adding zero to the set, we have the set of basic numbers N 0 {0, 1, 2,...}. The set of basic numbers is the same as the set of non-negative numbers (i.e., the complement of the set of negative integers, where the set of negative integers is denoted by Z {..., 3, 2, 1}). In daily life, we use the symbols from 0 to 9 to represent the first 10 basic numbers. All numbers above 9 are constructed according o certain formation rules. In number theory, there is only one special symbol, the symbol 0. All other 1

numbers are written by means of the successor mechanism. The successor of a number n, denoted by s(n), is merely the number following n in the sequence of natural numbers. For example, the number 1 is written as s(0), the number 2 as s(s(0)), the number 3 as s(s(s(0))), and so on. Of course, s(n) n + 1, but we prefer not to use the addition symbol at this time. This allows us to keep the theory general and to define successor functions outside the area of natural numbers. For instance, the days of the week have successors, as do elements in linked lists. There are a number of axioms that describe how to work with basic numbers. These axioms were introduced by Giuseppe Peano in 1889, and they are therefore called Peano axioms. We will now introduce these axioms for basic numbers and provide some motivation for each of them. Peano Axioms: 1. 0 is a basic number. 2. If n is a basic number, then so is s(n). Note that s(n) is defined to be a basic number if n is a basic number. This makes the definition of the basic numbers recursive. The third and fourth Peano axioms indicate that all basic numbers are distinct. This means that the s(n) must never be 0 and that s(n) s(m) unless n m. This gives rise to axioms 3 and 4: 3. For all n, s(n) 0. 4. If s(n) s(m), then n m. Axiom 4 is the counterpositive of (n m) (s(n) s(m)), which says that distinct numbers have distinct successors. There are four axioms that deal with addition and multiplication. We define 0 to be the right identity of addition; that is m (m + 0 m). (1.1) The successor function is used for the remaining n. This gives rise to the following recursive definition: m n (m + s(n) s(m + n)). (1.2) 2

To see that this definition is compatible with the standard definition for addition, simply replace s(n) in (1.2) by n + 1, which yields m n (m + (n + 1) (m + n) + 1). More imortantly, (1.2) can be used to perform the addition of any two basic numbers. Simply apply (1.2) until n is reduced to 0, at which time (1.1) becomes applicable. Example 1.1. Find 3 + 2 s(s(s(0))) + s(s(0)). Solution: s(s(s(0))) + s(s(0)) s(s(s(s(0))) + s(0)) By (1.2) s(s(s(s(s(0))) + 0)) By (1.2) s(s(s(s(s(0))))) By (1.1) Multiplication can be defined in a very similar fashion. One has n (n 0 0) (1.3) m n (m s(n) m n + m) (1.4) The reader may verify that multiplication satisfies this definition. Moreover, it may be shown that this defines multiplication between arbitrary natural numbers. Equations (1.1) to (1.4) constitute the Peano axioms 5 to 8. Definitions of this type are used frequently in logical and functional programming languages. They also play an important role in the theory of computability. The last Peano axiom indicates that for each predicate P the following expression is valid. P (0) n (P (n) P (s(n))) n P (s(n)). (1.5) This last axiom formulates, in a rather compact form, the principle of mathematical induction. This principle is very important, and the next section gives many examples for its use. 1.3 Mathematical Induction The previous section showed how to use the successor mechanism to define predicates and functions on basic numbers. If P is any property regarding a basic 3

number, then it is often straighforward to make a statement about s(n), given that a similar statemenmt holds for n. Hence, if P (n) is any predicate regarding the basic number n, it should be relatively easy to prove or disprove the proposition P (n) P (s(n)). Suppose now that P (n) P (s(n)) has been proved for all n. In addition to this, suppose that P (0) is true. Then the following deduction is possible. In this deduction, we use the numbers 1, 2, 3,... instead of s(0), s(s(0)), and so on. 1. n (P (n) P (s(n))) Premise 2. P (0) Premise 3. P (0) P (1) Instantiate 1 with n : 0 4. P (1) modus ponens, 2, 3 5. P (1) P (2) Instantiate 1 with n : 1 6. P (2) modus ponens, 4, 5 7. P (2) P (3) Instantiate 1 with n : 2 8. P (3) modus ponens, 6, 7. It should be noted that this proof can be continued forever. In this way, one first derives P (1) from P (0) and P (0) P (1), and so on. Since this can be continued, the proof essentially shows that, for all n, P (n) is true. This leads to the principle of masthematical induction. We now formulate this rules as a rule of inference. This rule of inference can also be derived from (1.5). Induction: Assume that the universe of discourse is given by the set of basic numbers, and let P (n) be any property of basic numbers. In this case, one can make use of the following rule of inference: P (0) n (P (n) P (s(n))) n P (n) P (0) is called the inductive base or the basis of induction. The expression n (P (n) P (s(n))) is called the inductive step. Hence, the inductive base and the inductive step together imply that P (n) is true for all n. Note that both the basis of induction and the inductive step are needed to arrive at the conclusion that P (n) is true for all n. 4

Example 1.2. Let s assume that if a tulip is red in year n it will be red in the next year s(n). This means that the inductive step n (P (n) P (s(n))) holds. If, in addition to this, P (0) is true, that is, if the tulip is red in year zero, it is possible to conclude that the tulip is red in all years from zero onward. If either P (0) is not true, that is, if the tulip is not red in year zero, or if n (P (n) P (s(n))) is not true, that is, if the flower can change its color, then one is not allowed to conclude that the tulip will be red in all future years. Since s(n) n + 1, the inductive step can also be written as n (P (n) P (n + 1)). The term inductive step is chosen appropriately, because it indicates that, once P (n) is true, one can make the step to the next number s(n) n + 1. It is, in this sense, the step from n to n + 1. In propositional logic, the following approach can be used to prove the implication A B. First, A is assumed, and, using A as an assumption, B is derived. If this is possible, we conclude that A B. Note that as soon as A B has been derived A must be discharged; that is, A is no longer assumed to be true. Moreover, as shown in the chapter of predicate logic, any free variables in A are fixed while deriving B. On the other hand, once A is discharged, A is no longer a premise, and universal generalization over any true variable in A is possible. This idea is frequently used to perform the inductive step. One assumes P (n) and derives P (n + 1) in order to conclude that P (n) P (n + 1). Since P (n) is now discharged, n is no longer fixed (unless, of course, it appears in some other premise), and one is allowed to conclude that n (P (n) P (n + 1)). If P (n) is used as an assumption in this fashion, then P (n) is called the inductive hypothesis. In summary, one can prove n P (n) by conducting the following steps: Inductive base. Prove P (0). Inductive hypothesis. Assume P (n). Proof under hypothesis. Fix n, and derive P (n + 1). Discharge hypothesis. Conclude that P (n) P (n + 1), and discharge P (n). Hence, P (n) is no longer necessarily true. 5

Generalize. By discharging P (n), n becomes a true variable, and one can use universal generalization to conclude from P (n) P (n + 1) that From the base of induction and the inductive step, one con- Conclusion. cludes that n (P (n) P (n + 1)). n P (n). The three steps "proof under hypothesis", "discharge hypothesis", and "generalize" together form the inductive step. Example 1.3. Let H n be zero for n 0, and H n+1 1 + 2H n otherwise. Prove that H n 2 n 1. Solution: For each n, H n is either true or false. Consequently, H n 2 n 1 is a property of n, and we can identify this expression with P (n) in mathematical induction. Inductive base: P (0) must be established; that is, for n 0, H n 2 n 1 2 0 1 0 H 0. Hence, P (0) is true. Inductive hypothesis: Assume P (n); that is, assume that H n 2 n 1 is true. This assumption fixes n until P (n) is discharged. Proof under hypothesis: We must now derive P (n + 1), that is, show that H n+1 2 n+1 1. The use of the inductive hypothesis H n 2 n 1 is allowed in the construction of this derivation. This yields H n+1 1 + 2H n By definition 1 + 2(2 n 1) Inductive hypothesis:h n 2 n 1 2 n+1 1 Simple algebra Discharge hypothesis: If P (n) is assumed, it follows that P (n + 1) is also true. Hence, (H n 2 n 1) (H n+1 2 n+1 1). The inductive hypothesis H n 2 n 1 is discharged now; that is, it is no longer assumed to be necessarily true. 6

Generalization: Since n does not appear in any hypothesis, a generalization over n yields n ((H n 2 n 1) (H n+1 2 n+1 1)). Conclusion: According to the principle of induction, the base and the inductive step together prove that n (H n 2 n 1). Since the discharge of the inductive hypothesis and the generalization step are basically always the same, they are omitted. This means, in effect, that the inductive step has been established as soon as the proof that P (n + 1) is true has been completed, using P (n) as an assumption in the proof. It is for this reason that we will omit the steps "discharge hypothesis" and "generalize". However, to indicate that these two steps are tacitly implied, from now on we call the step "proof under hypothesis" the "inductive step". Example 1.4. Show that, for all n, 2(n + 2) (n + 2) 2. Solution: In this example, P (n) stands for 2(n + 2) (n + 2) 2. Inductive base: We must establish P (0); that is, we must establish that, for n 0, 2(n + 2) (n + 2) 2. Since for n 0 both sides of the inequality are equal to 4, P (0) is true. Inductive hypothesis: P (n): 2(n + 2) (n + 2) 2 is assumed. Inductive step: One must derive P (n + 1), that is, show that 2((n + 1) + 2) ((n + 1) + 2) 2. 7

This is done as follows: 2((n + 1) + 2) 2((n + 2) + 1) Algebra 2(n + 2) + 2 Algebra (n + 2) 2 + 2 n 2 + 4n + 6 Inductive hypothesis Algebra n 2 + 6n + 9 Add the term 2n + 3 ((n + 1) + 2) 2 Algebra Conclusion: Since the inductive base and the inductive step are established, one is allowed to conclude that n (2(n + 2) (n + 2) 2 ). The next proof is somewhat more informal, but closer to a proof by induction as it may appear in a mathematics textbook. Example 1.5. Show that n 3 + 2n is divisible by 3. Solution: Let P (n): n 3 + 2n be divisible by 3. Now P (0): 0 is divisible by 3, so P (0) is true. The inductive hypothesis is that n 3 + 2n is divisible by 3. The inductive step is now as follows: (n + 1) 3 + 2(n + 1) n 3 + 3n 2 + 3n + 1 + 2n + 2 n 3 + 3n 2 + 5n + 3 (n 3 + 2n) + 3(n 2 + n + 1). This means that (n+1) 3 +2(n+1) can be written as a sum of two terms. The first term is divisible by 3 if the inductive hypothesis holds, and the second term is a multiple of 3 and therefore divisible by 3. Hence, if P (n) is true, so is P (n + 1), which completes the inductive step. Since P (0) is true, one concludes that P (n) is true for all n. 1.4 Induction for Proving Properties of Addition From definitions (1.1) and (1.2), all properties of addition can be derived, including the fact that 0 is the left identity element of addition and that addition is 8

commutative and associative. These results are, of course, well known, and one feels that no proofs are needed. However, the proofs are excellent examples for practicing induction. In the proofs, s(n) is used rather than n + 1. We first prove that 0 is the left identity element of addition; that is, we prove that n (0 + n n). (1.6) We identify P (n) with the property of n that 0 + n n. n. Inductive base. P (0), which is 0 + 0 0, is true by (1.1). Inductive hypothesis. Assume that P (n) is true; that is, show that 0 + n Inductive step. It must be shown that P (s(n)) is true; that is, show that, given the inductive hypothesis, 0 + s(n) s(n). This is done as follows: 0 + s(n) s(0 + n) (1.2) with m : 0, n : n s(n) Inductive hypothesis: 0 + n : n Conclusion. (1.6). The inductive base and the inductive step together imply Next, we show that addition is commutative. In other words, we prove that, for all m and n, m + n n + m. There are now two variables, m and n, but induction can only be done on one variable. Fortunately, it does not matter in this particular case which variable is picked. We arbitrarily choose to do induction on m. The steps involved are as follows: Inductive base. (1.1) and (1.1). Inductive hypothesis. m fixed m + n n + m. P (0) is true, because n + 0 0 + n. This follows from Assume that P (m) is true; that is, assume that for Inductive step. One must now prove P (s(m)), which means that s(m) + n n + s(m) must be shown. This proof is lengthy, and it will be done later. Conclusion. The inductive base, together with the inductive step imply 9

that m (m + n n + m). Since n does not occur in any premise, one can generalize over n, and one concludes that m n (m + n n + m). We still have omitted the hard part of the proof, the inductive step. In this step, one must show that if m + n n + m then s(m) + n n + s(m). Observe that n + s(m) unifies with n + s(m) appearing in (1.2), which allows us to write n + s(m) s(n + m) By (1.2) s(m + n) By inductive hypothesis At this stage, we are stuck because no law seems to be applicable. To overcome this difficulty, we make a leap of faith, conjecturing that s(m + n) s(m) + n, which allows us to continue s(m + n) s(m) + n. This implies that n + s(m) s(m) + n, as required. At this point, however, the conjecture is just wishful thinking, and meeds to be proved before it can be used in the proof. Hence, we must show that, for all m and n, s(m + n) s(m) + n. This equation will also be proved by using mathematical induction. However, this time the induction is on n, because this makes it simpler to prove the inductive base, as shown next. Inductive base. P (0) is s(m + 0) s(m) + 0, which is true, as one can show by applying (1.1) twice. s(m + 0) s(m) s(m) + 0. Inductive hypothesis. Assume that s(m + n) s(m) + n. Inductive step. Prove that s(m + s(n)) s(m) + s(n). This is done as follows: s(m + s(n)) s(s(m + n)) (1.2) with m : m, n : n s(s(m) + n) Inductive hypothesis s(m) + s(n) (1.2) with m : s(m), n : n 10

Conclusion. The inductive step and the inductive base imply that n (s(m + n) s(m) + n). To show that this is true for all m, one only needs to generalize over m. This proves the conjecture used in the proof, completing thus the proof that addition is commutative. Other proofs, including the fact that addition is associative, can be done in a similar fashion. 1.5 Changing the Induction Base So far, the basis for induction has always been 0, but this is not really a requirement. Indeed, one can start induction with any element n 0 by choosing P (n 0 ) as the base of induction. This leads to the following rule of inference: Induction from n 0 : P (n 0 ) n ((n n 0 ) (P (n) P (s(n)))) n ((n n 0 ) P (n)) The justification of this rule is the same as before. If P (n 0 ) is true and if, for all n n 0, P (n) implies that P (n + 1), then P must also be true for all values following n 0. Specifically, if P (n 0 ) holds and if P (n 0 ) P (n 0 + 1), then P (n 0 + 1) must be true. P (n 0 + 1), in conjunction with P (n 0 + 1) P (n 0 + 2), implies that P (n 0 + 2). Continuing in this fashion leads one to conclude that, if the inductive step is established and in P (n 0 ) is true, then P (n) must be true for all n n 0. This rule of inference leads to the following setup: Inductive base. Establish P (n 0 ). Inductive hypothesis. Assume P (n) for n n 0. Inductive step. Prove P (n + 1) for n n 0. Conclusion. Use the inductive base and the inductive step to conclude that n ((n n 0 ) P (n)). Example 1.6. Show that 2 n < n! for n 4. 11

Solution: Let P (n): 2 n < n!. P (0), P (1), P (2), and P (3) are not true, and we do not need them to be true. Now P (4): 2 4 16 < 4! 1 2 3 4 24, so P (4) holds. Inductive base: P(4) is true; that is, 2 4 < 4!. Inductive hypothesis: Assume that P (n) 2 n < n!. Inductive step: Prove that P (n + 1): 2 n+1 < (n + 1)!. To do this, multiply both sides of the inductive hypothesis by 2 to get, for n 4, 2 2 n 2 n+1 < 2(n!) < (n + 1) n! (n + 1)! Conclusion: The inductive step, together with the fact that P (4) is true, allows one to conclude that, for all n 4, 2 n < n!. The starting value n 0 need not even be positive. This allows one to use induction in the domain of integers, which contains negative numbers. 1.6 Strong Induction If one has P (0), and n (P (n) P (n + 1)), then one can successively prove P (1), P (2), P (3), and so on. This means that, once P (n) is proved, one can use P (0), P (1),..., P (n) as the inductive hypotheses to prove that P (n + 1). This leads to the following method, which is called strong induction: Inductive base. Establish P (0). Inductive hypothesis. Assume P (0), P (1),..., P (n). Inductive step. Prove P (n + 1). Conclusion. The basis of induction and the inductive step allow one to conclude that n P (n). Note that the method remains applicable if the base of induction is P (n 0 ) rather than P (0), in the manner indicated in Section 1.5. strong induction can be derived from normal induction. We present some examples. The first example deals with the zero of an operator. Generally, d is zero of the operator if x (x d d) and x (d x d) 12

are both satisfied for all x. Examples of zeros are the number 0 in multiplication, truth value T in the case of disjunction, and F in the case of conjunction. In the case of multiplication, x 0 0 and 0 x 0 for all x, and in the case of disjunction, P T T and T P T for all P. The demonstration that F is a zero for conjunction is similar. Example 1.7. Consider expressions using, and no other operator. Define d as the zero of, that is, x d d x d for all x. Show that any such expression containing one more instances of d must be equal to d. Solution: Let P (n) be the proposition that an expression with n occurrences of is d, provided that the expression contains a single d. Inductive base: P (0) is true because, among the expressions without operators, only d itself contains d. Inductive hypothesis: Assume P (m), m n; that is, assume that any expression with n or fewer operators that contains a d yields d. Inductive step: If x is an expression with n+1 operators and if x is of the form x 1 x 2, then x contains d only if either x 1 or x 2 contains d. Both x 1 and x 2 have n or fewer operators, and according to the inductive hypothesis, all expressions x i with n or fewer operators yield d if they contain a single d. It follows that either x 1 or x 2 yields d. If x 1 yields d, so does x 1 x 2 d x 2, and same is true if x 2 d. Either way, x d, which completes the inductive step. Conclusion: The basis of induction and the inductive step together imply that P (n) is true for all n. This means that for any n every expression with n operators containing d yields d. Example 1.8. Prove that every nonprime natural number greater than 1 can be written as a product of primes. Solution: Let P (n) be the statement that n is either prime or can be written as the product of primes. The basis for induction is P (2), which states that 2 is either a prime or can be written as a product of primes. This is correct sinse 2 is a prime number. The inductive hypothesis is that any number less than or equal to n is either prime or can be written as a product of primes. Based on this 13

inductive hypothesis, we prove that n + 1 is either prime or can be written as the product of primes. The only case we have to consider is when n + 1 is not prime, because P (n + 1) is cetainly true otherwise. If n + 1 is not prime, then n + 1 n 1 n 2 for some numbers n 1 n and n 2 n. If n 1 and n 2 are both either primes or products of primes, so is n 1 n 2. This completes the inductive step. Since the basis for induction holds, this proves that P (n) is true for all n. 2 Sums and Related Constructs 2.1 Introduction There is a special notation for writing sums involving many terms, the sigma notation, Σ. A recursive definition of the sigma notation will be given, and this definition will be applied to prove a number of important results involving sums by mathematical induction. Notations similar to the Σ notation will be introduced to express products, conjunctions, and disjunctions. All these notations make use of indexes, which correspond, in some sense, to the bound variables of quantifiers. 2.2 Recursive Definitions of Sums and Products The sigma notation is a compact notation to express sums involving many terms. In particular, if a m, a m+1,..., a n are terms, their sum is written as n a i. Hence, one has a i a m + a m+1 +... + a n. (2.1) Here, i is the index of the summation, m is its lower bound, and n is its upper bound. The lower bound together with the upper bound constitutes the range of the index. If the upper bound is less than the lower cound, the sum in question contains no terms; it is empty. Empty sums are assigned the value zero. For instance, 3 i4 a i 0. The terms a i constitute a function with the argumnent i. Example 2.1. Express the sum of the integers from 3 to 20 by using the sigma notation. 14

Solution: By replacing the a i in (2.1), one obtains 20 i3 This solves the problem as required. Example 2.2. Find the value of 9 4 1. i 3 + 4 + 5 +... + 20 Solution: Since the sum in question has the six terms a 4, a 5,..., a 9, all of which are equal to 1, the sum in question is 1 + 1 + 1 + 1 + 1 + 1 6. The following recursive definition makes it easier to apply induction. a i 0, if m > n n+1 a i a i + a n+1, if m n + 1 (2.2) Example 2.3. Consider the expression 3 2i. One has, according to (2.2), 3 2 2 i 2 i + 2 3 1 2 i + 2 2 + 2 3 0 2 i + 2 1 + 2 2 + 2 3 0 + 2 1 + 2 2 + 2 3 14 Also note that (2.2) implies that n 1 a i a i + a n 0 + a n. in in 15

The definition given in (2.2) can obviously be extended by replacing the + by other operators, such as,, and. In the case when the upper limit is below the lower limit, one replaces the 0 by the identity of the operator. To express a product in this fashion, one uses the symbol. The product of the factors a m, a m+1, a m+2,..., a n is thus written as n a i a m a m+1... a n. If m > n, the product is assigned 1, which is the identity element of multiplication. The recursive definition of is therefore n a i 1, if m > n n+1 ( n ) a i a i a n+1, if m n For other operations, one uses a large version of the operator symbol to play the role of Σ. n P i P m P m+1... P n. If the upper bound is below the lower bound, the disjunction is assigned the identity of, which is F. The conjunction of P i, i m, m + 1,..., n, is similarly expressed as n P i P m P m+1... P n. If the upper bound is below the lower bound, the conjunction is assigned the identity of, which is T. More generally, if is any operator with identity e, then one has the following recursive definition of : n a i e, if m > n n+1 ( n ) a i a i a n+1, if m n + 1 16

The notation introduced is closely related to quantifiers. Specifically. if a universe consists of a 1, a 2,..., a n, then one has x P (x) x P (x) n P (a i ) n P (a i ) If the domain is the set of natural numbers, this yields x P (x) x P (x) P (x) x1 P (x) This shows that the index of a sum is closely related to the bound variable x. Indeed, most of the rules formulated for bound variables also apply to indexes, whether the indexes are in sums, conjunctions, or disjunctions. All the constructs deal with terms a i, which can be any functions of the index i. These functions form the scope of the summation, product, and so on. the index i is strictly local to the scope. In particular, if i appears outside the scope, it must be considered as a distinct variable. 2.3 Identities Involving Sums x1 A number of important relations involving sums are (a i + b i ) a i + b i (2.3) ( ) (a i + b) a i + (n m + 1)b, n m 1 (2.4) (a i b) b a i (2.5) 17

a i n+k +k a i k (2.6) Equations (2.3) - (2.6) can easily be proved by induction. We prove (2.3) and (2.6). For the proof of (2.3), P (n) is the proposition that (2.3) is true for n. One has the following: Base for induction: For n m 1, m 1 a i 0, that is, (2.3) is true, and the same holds for m 1 b i. Hence, for n m 1, (2.3) instantiates to 0 0 + 0, which is true. Inductive hypothesis: The inductive hypothesis is given by (2.3), except that n is fixed. Inductive step: One has n+1 (a i + b i ) (a i + b i ) + (a n+1 + b n+1 ) By (2.2) a i + b i + a n+1 + b n+1 a i + a n+1 + n+1 b i + b n+1 n+1 a i + b i By (2.2) Inductive hypothesis Addition commutes Conclusion: The inductive base and the inductive step imply that (2.3) is valid for all n. Equation (2.6) can be proved as follows. For n 0, both sides of (2.6) are equal to zero, which settles the base case. We now prove that, for some fixed value of n greater than or equal to 0, (2.6) is true, with n replaced by n + 1. One has 18

n+1 a i a i + a n+1 By (2.2) n+k +k n+k +k n+k+1 +k a i k + a n+1 a i k + a n+k+1 k a i k By (2.2) Inductive hypothesis n + 1 n + k + 1 k This completes the inductive step, and since the basis is true, (2.6) must be true for all n. The same result can be obtained by expanding both sides of (2.6). This yields a 1 + a 2 +... + a n a (1+k) k + a (2+k) k +... + a (n+k) k. It is now immediately evident why both sides of (2.6) are equal. Indexes are in a sense like bound variables. They, too, are merely placeholders, which means that the name of the index can be changed as long as new name does not clash with a variable already used. In a sum, for instance, one can use either i, j, or k as the index. Hence, a i a j jm a k. as in the case of quantifiers, it is often convenient to standardize variables apart. The following example illustrates this point. At the same time, it demonstrates the use of (2.5). km Example 2.4. Prove that ( a i ) 2 ( ) a i a j. ij 19

After the formal proof, verify your result with n 3, a 1 3, a 2 2, and a 3 5. Solution: One has ( ) 2 ( ) ( ) a i a i a i ( ) ( ) a i a j ij ( ) a j a i ij ( ) a i a j ij Expand square Standardize variables apart (2.5) with b : a j (2.5) with b : a i To check this result with given values of n and a i, we have ( 3 3 ) 2 a i 3 + 2 + 5 10 a i 100. On the other hand, Hence, 3 a 1 a j 3 3 + 3 2 + 3 5 30 j1 3 a 2 a j 2 3 + 2 2 + 2 5 20 j1 3 a 3 a j 5 3 + 5 2 + 5 5 50 j1 3 3 a i a j 100. j1 20

The derivation given in Example 2.4 resembles some of the derivations, which dealt with equivalences involving quantifiers. This shows again the close relation between indexes and bound variables. A final note concerns instantiations of sums. Instantiations do not affect the index of a sum, because this index is local to the sum. The same rule applies, of course, to quantifiers, as was shown. We prove a number of important formulas involving specific functions of i in place of the a i. Example 2.5. Use mathematical induction to show that for n 0, n(n + 1) i. (2.7) 2 i0 Solution: Let P (n) be the property of n that (2.7) holds. We prove by mathematical induction that P (n) is true for all n N 0. Inductive base: P (0) is true because (2.7) holds for n 0. 1 i 0, and 0 2 0. 0 i0 In this case Inductive hypothesis: The inductive hypothesis is given by (2.7) with n fixed. Inductive step: One has n+1 i i0 i + n + 1 By (2.7) i0 n(n + 1) + n + 1 2 By inductive hypothesis n(n + 1) + 2(n + 1) 2 Add fractions (n + 1)(n + 2) 2 Right side of (2.7) with n : n + 1 Conclusion: The inductive base and the inductive step imply that (2.7) is valid for all n N 0. Example 2.6. Prove that for all n N 0, a i an+1 1, a 1 a 1, n 0. (2.8) i0 21

Solution: P (n) is given by (2.8). One has the following: Inductive base: For n 0, both sides of (2.8) evaluate to 1, which proves the basis of induction. Inductive hypothesis: Assume that (2.8) is true for n fixed. Inductive step: One has n+1 a i i0 a i + a n+1 By (2.8) i0 an+1 1 a 1 + an+1 By inductive hypothesis an+1 1 + a n+2 a n+1 a 1 an+2 1 a 1 Add fractions Right side of (2.8) with n : n + 1 Conclusion: The inductive base and the inductive step together imply that (2.8) is valid for all n N 0. 2.4 Double Sums and Matrices In Example 2.4, an expression with nested sums appeared. Such expressions will now be discussed. To deal with double sums, one uses terms of the form a ij. If i is in the range i 1, 2,..., m and j is in the range j 1, 2,..., n then one can arrange the a ij in rows and columns as follows: In the first row, one writes all a 1,j, j 1,..., n, in the second row, one writes all a 2j, j 1,..., n and so on, and in the mth row, one writes all a mj. This yields a 11 a 12 a 13... a 1n a 21 a 22 a 23... a 2n (2.9).... a m1 a m2 a m3... a mn A table such as this is called a matrix. If the matrix has the elements a ij, one denotes this matrix by [a ij ]. In other words. (2.9) represents the matrix [a ij ]. 22

Matrices can be given names, such as A, B, and so on. If A [a ij ], then a uv is the element in row u, column v of A. In other words, the first subscript always denotes the row, and the second always denotes the column. Although we frequently denote the row by i and the column by j, this is incidental. For instance, a ji denotes the element one finds in row j, column i. Given the terms a ij, i 1, 2,..., m and j 1, 2,..., n, the form m n j1 a ij is merely the sum of the following sums: m a ij j1 a 1j + j1 a 2j +... + j1 a mj. Since the sum n j1 a ij is the total of row i, the double sum m n j1 a ij is the sum of the row totals. It is intuitively clear that the sum of the row totals is the overall total and that this overall total can also be obtained by taking the sums of the column totals, which is n j1 m a ij. Hence, it is intuitively clear that m a ij j1 j1 j1 m a ij. (2.10) We prove by induction that this is indeed the case. Induction is done on n. If n 0, both sides of (2.10) are zero. We now assume that (2.10) is true for n fixed and prove that this equation also holds for n + 1. ( m n+1 m ) a ij a ij + a i,n+1 By (2.2) j1 m j1 a ij + j1 j1 n+1 j1 m a ij + m a i,n+1 By (2.3) m a i,n+1 m a ij By (2.2) By inductive hypothesis Two matrices A and B can be multiplied, and this operation is denoted as 23

A B. If C A B, with C [c ij ], then c ij is given as c ij r a ik b kj, i 1, 2,..., m, j 1, 2,..., n. (2.11) k1 Here m is the number of rows of A, and r is the number of columns of A. The number of rows of B must match the number of columns of A; that is, B must have r rows. If this is not the case, then matrix multiplication is not defined. The number of columns of B is denoted by n. Note that, to find c ij for given i and j, only row i of matrix A and column j of matrix B are involved. Specifically, one multiplies the elements of row i of matrix A with the corresponding elements of column j on matrix B and adds the products. Example 2.7. Multiply A with B, where ( ) 1 2 3 5 2 A and B 1 1 4 3 1 2 3 Solution: The result of the matrix multiplication is ( ) 1 2 3 5 2 A B 4 3 1 1 1 2 3 ( ) 2 17 C. 3 14 In the resulting matrix, the entries c ij are found by using (2.11). To find c 1 2, for example, one has to use row 1 of matrix A and column 2 of matrix B. The result is c 1 2 3 2 + 5 1 + 2 3 17. The other c ij can be found in a similar fashion. References [1] Stanley N. Burris, Logic for Mathematics and Computer Science, Prentice Hall, 1998. 24

[2] Winfried.K. Grassmann, Jean-Paul Tremblay Logic and Discrete Mathematics. A Computer Science Perspective, Addison-Wesley, Pearson Education Limited, 2002. [3] R. Johnsonbaugh, Discrete Mathematics, Prentice Hall, 4. painos, 2001. 25