CS Discrete Mathematics Dr. D. Manivannan (Mani)

Similar documents
Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60

Chapter 2 - Basics Structures

Chapter 1 : The language of mathematics.

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

586 Index. vertex, 369 disjoint, 236 pairwise, 272, 395 disjoint sets, 236 disjunction, 33, 36 distributive laws

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Chapter Summary. Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability

Propositional Logic, Predicates, and Equivalence

0 Sets and Induction. Sets

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

Chapter Summary. Sets (2.1) Set Operations (2.2) Functions (2.3) Sequences and Summations (2.4) Cardinality of Sets (2.5) Matrices (2.

Notation Index. gcd(a, b) (greatest common divisor) NT-16

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

MATH 363: Discrete Mathematics

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

Equivalence of Propositions

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

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

Section Summary. Definition of a Function.

With Question/Answer Animations. Chapter 2

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

MATH1240 Definitions and Theorems

Section Summary. Relations and Functions Properties of Relations. Combining Relations

Final Exam Review. 2. Let A = {, { }}. What is the cardinality of A? Is

MAT115A-21 COMPLETE LECTURE NOTES

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

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

Mathematics Course 111: Algebra I Part I: Algebraic Structures, Sets and Permutations

Finite and Infinite Sets

Intro to Logic and Proofs

Exercises for Unit VI (Infinite constructions in set theory)

Discrete Mathematical Structures: Theory and Applications

Tutorial Obtain the principal disjunctive normal form and principal conjunction form of the statement

In N we can do addition, but in order to do subtraction we need to extend N to the integers

Section Summary. Sequences. Recurrence Relations. Summations Special Integer Sequences (optional)

Mathematical Reasoning & Proofs

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

Sets McGraw-Hill Education

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions

MATH 220 (all sections) Homework #12 not to be turned in posted Friday, November 24, 2017

Discrete Math Notes. Contents. William Farmer. April 8, Overview 3

Week Some Warm-up Questions

In N we can do addition, but in order to do subtraction we need to extend N to the integers

Logic. Facts (with proofs) CHAPTER 1. Definitions

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION B Sc (MATHEMATICS) I Semester Core Course. FOUNDATIONS OF MATHEMATICS (MODULE I & ii) QUESTION BANK

SETS AND FUNCTIONS JOSHUA BALLEW

MAT 570 REAL ANALYSIS LECTURE NOTES. Contents. 1. Sets Functions Countability Axiom of choice Equivalence relations 9

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Review 1. Andreas Klappenecker

Foundations of Mathematics

7.11 A proof involving composition Variation in terminology... 88

Part IA. Numbers and Sets. Year

Background for Discrete Mathematics

Countable and uncountable sets. Matrices.

Review 3. Andreas Klappenecker

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

Copyright c 2007 Jason Underdown Some rights reserved. statement. sentential connectives. negation. conjunction. disjunction

CSCE 222 Discrete Structures for Computing. Review for Exam 1. Dr. Hyunyoung Lee !!!

MA Discrete Mathematics

Discrete Mathematics

A Semester Course in Basic Abstract Algebra

BASIC MATHEMATICAL TECHNIQUES

MATH FINAL EXAM REVIEW HINTS

1 Basic Combinatorics

SOLUTIONS TO EXERCISES FOR. MATHEMATICS 205A Part 1. I. Foundational material

Math 109 September 1, 2016

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction

5 Set Operations, Functions, and Counting

Chapter 1. Sets and Numbers

Proofs. Chapter 2 P P Q Q

Introduction to Proofs

INFINITY: CARDINAL NUMBERS

Notes on ordinals and cardinals

Analysis 1. Lecture Notes 2013/2014. The original version of these Notes was written by. Vitali Liskevich

Sets and Motivation for Boolean algebra

Theorem. For every positive integer n, the sum of the positive integers from 1 to n is n(n+1)

Mathematics Review for Business PhD Students

Logic, Sets, and Proofs

1. a. Give the converse and the contrapositive of the implication If it is raining then I get wet.

Part II. Logic and Set Theory. Year

Foundations Revision Notes

MATH 324 Summer 2011 Elementary Number Theory. Notes on Mathematical Induction. Recall the following axiom for the set of integers.

CS100: DISCRETE STRUCTURES

CSCE 222 Discrete Structures for Computing. Review for the Final. Hyunyoung Lee

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University

Relations Graphical View

n CS 160 or CS122 n Sets and Functions n Propositions and Predicates n Inference Rules n Proof Techniques n Program Verification n CS 161

CSCE 222 Discrete Structures for Computing

Problem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B.

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

Sets and Functions. (As we will see, in describing a set the order in which elements are listed is irrelevant).

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

3. Abstract Boolean Algebras

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

Automata and Languages

Transcription:

CS 275 - Discrete Mathematics Dr. D. Manivannan (Mani) Department of Computer Science University of Kentucky Lexington, KY 40506 Course Website: www.cs.uky.edu/~manivann/cs275 Notes based on Discrete Mathematics and its applications - by Kenneth H. Rosen (seventh edition) 1

Foundations of Logic and Proof (Chapter 1 Sections 1.1 to 1.6) Definition: A proposition is a declarative statement that is True of False but not both. (Note: true means always true; false means sometimes true or never true.) Example of propositions: Paris is the capital of France. Dr. Eli Capilouto is the president of University of Kentucky. 7 is a prime number (Recall that a positive integer > 1 is a prime number if its only divisors are 1 and itself). If n > 1 is an odd integer, then n is a prime number. The only even prime number is 2. 2+5 = 7. The following are not propositions What is your name? Where are you going? Beware of dogs. What is wrong with you? x+5 = 10. 2

Foundations of Logic and Proof (Chapter 1 Sections 1.1 to 1.6)... Propositional Calculus is an area of logic that deals with propositions. Compound Propositions are formed from existing propositions. Definition: The negation of a proposition p is denoted by p and is defined as p = It is not the case that p. An example: Suppose p = 7 is a prime number. Then p = It is not the case that 7 is a prime number. Definition: If p and q are propositions, then the conjunction of p and q, denoted by p q is the proposition p and q. The conjunction is true if both p and q are true; otherwise, it is false. Truth table for p q: Definition: If p and q are propositions, then the disjunction of p and q, denoted by p q is the proposition p or q. The disjunction is false if both p and q are false; otherwise, it is true. Truth table for p q: 3

Foundations of Logic and Proof (Chapter 1 Sections 1.1 to 1.6)... Definition: Let p and q be propositions. The conditional statement p q is the proposition: If p then q. p q is false when p is true and q is false, and is true otherwise. Truth table for p q: Definition: The proposition q p is called the converse of p q. The Contraposition of p q is the proposition q p. Exercise: The propositions p q and q p are equivalent (i.e., they have same truth values). This is an important result used for proving many propositions. A proof using this method is called proof by contraposition. Example: Let p = Student A graduated with a B.S. degree in CS from UK in the year 2016. Let q = Student A took CS 275 from UK or its equivalent. Definition: Let p and q be propositions. The biconditional statement p q is the proposition: p if and only if q. Truth table: 4

Foundations of Logic and Proof (Chapter 1 Sections 1.1 to 1.6)... Compound propositions that have same truth values are said to be logically equivalent propositions. Logical Equivalences: In the following equivalences T denotes the compound proposition that is always true and F denotes the compound proposition that is always false. Equivalence Name p T p Identity Laws p F p p T T Domination Laws p F F p p p Idempotent Laws p p p ( p) p Double negation Law p q q p Commutative Laws p q q p (p q) r p (q r) Associative Laws (p q) r p (q r) p (q r) (p q) (p r) Distributive Laws p (q r) (p q) (p r) (important laws) (p q) p q De Morgan s Laws (p q) p q (important laws) p (p q) p Absorption Laws p (p q) p p p T Negation Laws p p F 5

Foundations of Logic and Proof (Chapter 1 Sections 1.1 to 1.6)... Logical Equivalences involving Conditional Statements: p q p q p q q p (Important equivalence) p q p q p q (p q) (p q) p q (p q) (p r) p (q r) (p r) (q r) (p q) r (p q) (p r) p (q r) (p r) (q r) (p q) r Logical Equivalences involving Biconditional Statements: p q (p q) (q p) p q p q p q (p q) ( p q) (p q) (p q) Exercise: Prove the above equivalences using truth tables. 6

Foundations of Logic and Proof Predicates and quantifiers Predicates: The statement x is greater than 5 has two parts. The first part, the variable x, is the subject of the statement. The second part the Predicate, is greater than 5 refers to the property that the subject of the statement can have. We can denote the statement x is grater than 5 by P(x), where P is the predicate is greater than 5 and x is the variable. The statement P(x) is also said to be the value of the propositional function P at x. Once a value has been assigned to the variable x, the statement P(x) becomes a proposition and has a truth value. Illustration (For the following examples, the domain is the set of all integers): Let P(x) denote the statement x is less than 100. Then, what are the truth values of (i) P(10); (ii) P(200)? Let Q(x,y) denote the statement x = y 100. What are the truth values of (i) Q(5,10); (ii) Q(5,105)? 7

Foundations of Logic and Proof Predicates and quantifiers Definition: The Universal quantification of P(x) is the statement P(x) for all values of x in the domain. The notation xp(x)) denotes the universal quantification of P(x). We read xp(x) as for all x P(x). Here is called the universal quantifier. An element for which P(x) is false is called a counterexample of xp(x). The meaning of universal and existential quantifiers are summarized in the table below: Statement When it is true? When it is false? xp(x) P(x) is true There is an x for every x. for which P(x) is false. xp(x) There is an x P(x) is false for which P(x) is true. for every x. ( xp(x)) for every x, P(x) is false. For the following examples, assume that the domain is the set of all real numbers(positive and negative): Let (i) P(x) : x > 5; (ii) Q(x) : x 2 > 0; (iii) R(x) : x 2 < 0. Which of the following statements are true? (i) xp(x); (ii) xp(x); (iii) xq(x); (iv) xq(x); (vi) xr(x) ; (vii) xr(x) Read the rules of inference in Table 1 on page 72 and Table 2 on page 76. 8

Section 1.7 - Introduction to Proofs Recall the following about propositions: Associative laws, Distributive laws, De Morgan s laws, and the equivalence p q q p Some terminologies: A Theorem is a statement that can be shown to be true. This term is generally reserved for statements that are important. Less important theorems are called Propositions. A Proof is a valid argument that establishes the truth of a Theorem. Statements used in proofs can include axioms that are assumed to be true, and previously proved theorems. A Lemma is a result that is proved to help in proving a theorem. A Corollary is a theorem that can be established directly from a theorem that has been proved. A Conjecture is a statement that is being proposed to be a true statement, usually based on some partial evidence. Following are some famous conjectures in mathematics: (i) Fermat s last Theorem: The equation X n + Y n = Z n has no nontrivial solution in the set of integers if n > 2. (ii) Four color conjecture: A planar graph is four colorable. 9

Section 1.7 - Introduction to Proofs... Methods for proving Theorems: Direct Method (Forward proofs): The proof of a conditional statement p q is constructed where the first step is the assumption that p is true; subsequent steps are constructed using rules of inference, with the final step showing q must be true. Proof by Contraposition: To prove p q we prove q p. Proof by Contradiction: To prove a statement p is true, we assume p is not true and arrive at a contradiction. Definition: An integer n is even if there exists an integer k such that n = 2k, and n is odd if there exists an integer k such that n = 2k +1, Some examples of direct proof: Prove the following: 1. If n is an even integer then n 2 is an even integer. 2. If n is an odd integer then n 2 is an odd integer. 10

Section 1.7 - Introduction to Proofs... Methods for proving Theorems... Prove the following using proof by contraposition 1. If n is an integer and 5n+2 is odd then n is odd. 2. Let a and b be two integers. If ab is even, then a is even or b is even. 3. If n = ab where a and b are positive integers then a n or b n. 4. If n is an integer and n 2 is odd then n is odd. 5. If n is an integer and n 2 is even then n is even. Definition: A real number r is rational if there exists integers p and q (q 0) such that r = p q. A real number that is not rational is called irrational. 11

Section 1.7 - Introduction to Proofs... Methods for proving Theorems... Prove the following using proof by contradiction: 1. 2 is an irrational number 2. The sum of an irrational number and a rational number is irrational. More examples: 1. Show that the following statements about an integer n are equivalent. (a) n is even. (b) n 1 is odd. (c) n 2 is even 2. Show that if a is irrational and a 0, then 1 a is irrational. 3. Show that at least ten of any 65 days chosen must fall on the same day of the week. Read the following examples in Section 1.7: 14, 15, 16 and 17. 12

Section 1.8 - Proof Methods Following are some additional proof methods. Proof by Cases: To prove (p 1 p 2 p n ) q, we prove [(p 1 q) (p 2 q) (p n q)] Exhaustive Proof: This is done by examining a relatively small number of examples. Existence Proofs: A proof of a proposition of the form xp(x) is called an existence proof. Uniqueness Proofs: This requires proving the following two parts 1. Existence: We show an element x with the desired property exists 2. Uniqueness: We show that if y x, then y does not have the desired property. 13

Section 1.8 - Proof Methods... Prove the following using one of the following proof methods: Proof by Cases, Exhaustive Proof, Existence Proof or Uniqueness Proof 1. Prove that (n + 1) 3 3 n if n is a positive integer with n 4. 2. Prove that if n is an integer, then n 2 n. (Hint: consider the following three cases, n = 0, n 1, n 1) 3. Prove that xy = x y where x and y are any real numbers. 4. Show that there is a positive integer that can be written as the sum of cubes of two positive integers in two different ways. Proof: 1729 = 10 3 + 9 3 = 12 3 + 1 3. (constructive existence proof) 5. Show that there exist irrational numbers x and y such that x y is rational. (non-constructive existence proof) 6. Show that the equation ax+b = c, (a 0) has a unique solution where a,b,c are real numbers. 14

Section 2.1 - Sets Definition 1: A set is an unordered, well defined collection of objects; objects in a set are called elements or members of the set. (Cantor introduced sets) Some Notations: We write a A to denote that a is an element of the set A. We write a A to denote that a is not an element of the set A. {a,b,c,d} represents the set containing the four elements a,b,c,d More Examples and Venn diagrams: Another way to represent set is using the set builder notation as O = {x x is an odd positive integer less than 50} Some sets used often in this course: Z + = {1,2,3, } = the set of all positive integers. N = {0,1,2,3, } = the set of all natural numbers. Z = { 2, 1,0,1,2,3, } = the set of all integers, positive and negative. Q = { p p,q Z and q 0}= the set of all rational numbers. q R = the set of all real numbers. R + = the set of all positive real numbers. Note: Z + N Z Q R; and R + R. 15

Some Definitions: Section 2.1 - Sets Definition 2: Two sets are equal if they have the same elements. Definition: The set with no elements is called the empty set and is denoted by or { }. Definition 3: A set A is said to be a subset of another set B if every element of A is an element of B. We use the notation A B to denote A is a subset of the set B. We use the notation A B to denote A is a proper subset of B. A is a proper subset of B if A B and A B. Theorem 1: is a subset of every set. For any set S, S S. To show two sets are equal, we show each of them is a subset of the other. Definition 4: A set S with exactly n distinct elements, where n is a non-negative integer, is called a finite set and that the cardinality of S is n. The cardinality of S is denoted by S. A set is said to be infinite if it is not finite. Definition 6: Given a set S, the power set of S is the set of all subsets of S, and is denoted by P(S). Some examples: P({ }), P( ), etc. Fact: P(S) = 2 S for any finite set S. i.e., if S has n elements, P(S) has 2 n elements. We will prove this later. 16

Section 2.1 - Sets... Definition 7: An ordered n-tuple (a 1,a 2,,a n ) is the ordered collection that has a 1 as its first element, a 2 as its second element,..., and a n as its n th element. Two ordered n-tuples (a 1,a 2,,a n ) and (b 1,b 2,,b n ) are said to be equal if a i = b i for i = 1,2,,n. 2-tuples are called ordered pairs. Definition 8: Let A and B be sets. The Cartesian product of A and B, denoted by A B, is the set of all ordered pairs (a,b) where a A and b B. i.e., A B = {(a,b) a A,b B} Definition 9: The Cartesian product of the sets A 1,A 2,, A n, denoted by A 1 A 2,, A n, is defined as A 1 A 2,, A n = {(a 1,a 2,,a n ) a i A i,i = 1,2, n} Using set notation with quantifiers. Given a predicate P and a domain D, we define the truth set of P to be the set of elements x D for which P(x) is true. The truth set of P(x) is denoted by P(x) = {x D P(x)} Example: What are the truth sets of the following predicates where the domain is the set Z, the set of all integers? (i)p(x) = x 2 > 5 (ii) Q(x) = x 2 < 0 (iii) R(x) = x+2 is even 17

Section 2.2 - Set Operations Definition 1: Let A and B be sets. The union of two sets A and B, denoted by A B, is the set containing precisely the elements in A and B. i.e., A B = {x (x A) (x B)} Definition 2: The intersection of the sets A and B, denoted by A B, is the set containing those elements that are both in A and B. i.e., A B = {x (x A) (x B)} Definition 3: Two sets are said to be disjoint if their intersection is empty. i.e., they have no common elements. Definition 4: Let A and B be two sets. The difference, denoted by A B, is defined as the set containing all those elements in A that are not in B. i.e., A B = {x (x A) (x B)} Definition 5: Let U be the universal set. The complement of A, denoted by Ā, is the complement of A with respect to U. i.e., Ā = {x (x U) (x A)} 18

Section 2.2 - Set Operations... Some important set identities: Identity A A = A A = A A U = U A = A A = A A A = A Name Identity Laws Domination Laws Idempotent Laws (Ā) = A Complementation Law A B = B A Commutative Laws A B = B A A (B C) = (A B) C Associative Laws A (B C) = (A B) C A (B C) = (A B) (A C) Distributive Laws A (B C) = (A B) (A C) A B = Ā B A B = Ā B A (A B) = A A (A B) = A A Ā = U A Ā = De Morgan s Laws Absorption Laws Complement Laws Exercise: Prove some of the above identities. 19

Section 2.2 - Set Operations... Let A,B,C be sets. Then, prove the following: 1. A (B C) = ( C B) Ā 2. (A B C) = Ā B C 3. A B = A B Definition 6: The union of a collection of sets is the set that contains those elements that are members of at least one set in the collection. We use the notation n A 1 A 2 A n = Definition: The intersection of a collection of sets is the set that contains those elements that are members of all the sets in the collection. We use the notation n A 1 A 2 A n = i=1 i=1 A i A i 20

Section 2.3 Functions Definition 1: Let A and B be two nonempty sets. A function f from A to B is a rule which assigns for each element in A, a unique element in B. We write b = f(a), if b is the unique element assigned by f to a. If f is a function from A to B, then we write, f : A B Definition 2: If f : A B, we say A is the domain of f and B is the codomain of f. If f(a) = b, we say b is the image of a and a is the preimage of b. The range of f is the set of all images of all elements of A. We say f maps A to B. Definition : Two functions f and g are equal if their domain and codomain are same and f(a) = g(a) for all a in their domain. Definition 3: If f and g are functions from a set A to the set of all real numbers R, then f +g and fg are also functions from A to R defined as follows: (f +g)(x) = f(x)+g(x) x A (fg)(x) = f(x)g(x) x A In the above definition, the codomain can be any set in which addition and multiplication are defined.(for example, N,Z +,R +,Z, or any subset of these sets can be codomains). 21

Section 2.3 Functions... Definition 4: Let f : A B be a function and S A, then the image of S under f, denoted as f(s), is the subset of B that contains the images of all elements in S. i.e., f(s) = {f(s) s S} = {t B s S such that t = f(s)} Definition 5: A function f : A B is said to be a oneto-one function or an injection if f(a) = f(b) implies a = b for all a,b A. i.e., ( a, b (f(a) = f(b) a = b)) Definition 6: A function f whose domain and codomain are subsets of real numbers is called an (i) increasing function if f(x) f(y) whenever x < y and (ii) strictly increasing function if f(x) < f(y) whenever x < y. Definition 7: A function f : A B is called on-to or surjective if for every element b B, there is some element a A with f(a) = b Definition 8: A function f : A B is said to be a oneto-one correspondence or a bijection if it is both one-to-one and on-to. 22

Section 2.3 Functions... Definition 9: If f : A B is a one-to-one correspondence from A to B, the inverse function of f, denoted by f 1, is the function that assigns to each element b B, the unique element a A such that f(a) = b. Hence f 1 (b) = a when f(a) = b. Note: Do not confuse f 1 with 1. These two are different. f Definition 10: Let g : A B and f : B C be two functions. The composition of the functions f and g, namely f g : A C, is defined as: f g(a) = f(g(a)) a A Definition 11: The graph of a function f : A B is the set of ordered pairs {(a,b) (a A) (f(a) = b)}. Definition 12: The floor function, namely and the ceiling function, namely, are defined as follows. is defined as is defined as : R R x = the largest integer x. : R R x = the smallest integer x. 23

Section 2.4 - Sequences and summation Definition 1: A sequence is a function from a subset of integers (usually either the set {0,1,2,3, } or {1,2,3, }) to a set S. We use the notation a n to denote the image of integer n. We call a n, a term of the sequence, usually the n th term of the sequence. Definition 2: A geometric progression is a sequence of the form a,ar,ar 2, ar n, where the initial term a and the common ratio r are real numbers. Definition 3: An Arithmetic progression is a sequence of the form a,a+d,a+2d,,a+nd, where the initial term a and the common difference d are real numbers. Finding a formula or a rule for a given sequence is often a difficult problem. You may need to ask many questions such as Are there terms obtained from previous terms by adding, subtracting, multiplying? Are there terms obtained by combining previous terms in a certain way? etc. Find a formula or a rule for the following sequences: (i) 3,6,11,18,27... (ii) 1,2,2,3,3,3,4,4,4,4,... (iii) 2,4,16,256,65536,4294967296,... 24

Section 2.4 - Sequences and summation... We use the notations n j=m a j, n j=m a j, and to represent the sum a m +a m+1 + +a n. a j (m j n) Following are some useful formulas: (We will prove some of them now and some later) 1. 2. 3. 4. 5. n k=0 n k=1 n k=1 ar k (r 0) = arn+1 a r 1 k = n(n+1) 2 k 2 = n(n+1)(2n+1) 6 n k 3 = n2 (n+1) 2 4 k=1 k=0 x k ( x < 1) = 1 1 x (r 1), 6. kx k 1 ( x < 1) = k=1 1 (1 x) 2 25

Section 2.5 - Cardinality of sets Definition 1: The sets A and B have same cardinality if there is a one-to-one correspondence between A and B (A and B can be infinite). Definition 2: If there is a one-to-one function from A to B, the cardinality of A is less than or equal to the cardinality of B. We write A B. If A B and A and B have different cardinality, then we write A < B and say the cardinality of A is less than the cardinality of B. Definition 3: A set that is either finite or has the same cardinality as the set of positive integers is called countable. A set that is not countable is called uncountable. When an infinite set S is countable, we denote its cardinality as ℵ 0 (read as aleph null or aleph not, ℵ is the first Hebrew alphabet). We write S = ℵ 0 and say S has cardinality aleph null. Prove the following: (i) The set of all even integers is countable. (ii) The set of all odd integers is countable (iii) The set of all integers is countable. (iv) The set of all positive rational numbers is countable. (iv) A subset of a countable set is countable. (v) The set of all real numbers is uncountable. Cantor s Continuum hypothesis (1878?): There is no set whose cardinality is strictly between the set Z and the set R. Definition: Hilbert s Grand Hotel has countably infinite number of rooms and each is occupied by a guest. When, a new guest arrives, the new guest can be allocated a room even if the hotel is full!!. (something impossible with finite sets is possible with infinite sets!.) 26

Section 5.1 - Mathematical induction Generally, mathematical induction can be used to prove statements such as P(n) is true for all positive integers n, where P(n) is a propositional function. Principle of Mathematical Induction: To prove P(n) is true for all positive integers n, where P(n) is a propositional function, we complete the following two steps. 1. Basis step: We verify P(1) is true. (i.e., P(n) is true for n = 1). 2. Inductive step: For all positive integers k, we assume P(k) is true and show P(k +1) is true. Principle of induction can be asserted as the following rule of inference: [P(1) k(p(k) P(k +1))] np(n) Why mathematical induction is valid? Proof: Mathematical induction can be used to prove a conjecture if it is true. But it cannot be used to find new theorems. n For example, we can prove k = n(n+1) by induction 2 but... k=1 27

Section 5.1 - Mathematical induction... Prove the following using mathematical induction: 1. If n is positive integer 1+2+ +n = n(n+1) 2 2. If n is positive integer 1+3+5+ +(2n 1) = n 2 3. For any positive integer n, a+ar+ar 2 + +ar n = arn+1 a r 1 when r 1. 4. For any positive integer n, 5. For any positive integer n, n k=1 k 2 = n(n+1)(2n+1) 6 n k 3 = n2 (n+1) 2 4 k=1 6. If n is a positive integer then 2 n < n! if n 4. 7. n 3 n is divisible 3 for all positive integers n. 8. If S is a finite set of n elements, prove that P(S) = 2 n. 9. For any positive integer n > 1 prove the following De n n n n Morgan s Laws. (i) A j = Ā j ; (ii) A j = j=1 j=1 j=1 j=1 Ā j Read Examples 2, 3, 7, 13 and 14 in Section 5.1. 28

Section 5.2 - Strong induction and well ordering Strong Induction: To prove that P(n) is true for all positive integers n, where P(n) is a propositional function, we complete the following two steps: 1. Basis step: We verify that P(1) is true. 2. Inductive step: We show that the conditional statement [P(1) P(2) P(3) P(k)] P(k+1) is true for all positive integers k. ( In fact mathematical induction and strong induction are equivalent. However, sometimes it is easier to use strong induction. Strong induction is also called as the second principle of mathematical induction or Complete induction.) Example: Prove the following statement: If n is a positive integer > 1, then n can be written as a product of primes. (it is not easy to prove this using mathematical induction) A modified version of Strong induction: Let b be a fixed integer and let j be a fixed positive integer. The to prove P(n) is true for all n b, we complete the following two steps. 1. Basis step: Verify that the propositions P(b),P(b + 1),P(b+2),,P(b+j) are true. 2. Inductive step: Show that [P(b) P(b + 1) P(b + 2), P(k)] P(k +1) is true for every integer k b+j. 29

Section 5.2 - Strong induction and well ordering... Prove the following statements: (i) Prove that every amount of money of n dollars can be formed using only $ 2 bills and $ 5 bills if n 4. (ii) Suppose a store offers gift certificates in denominations of 35 dollars and 25 dollars. Prove that using gift certificates in these two denominations only, you can purchase any amount of $ 5n where n 24. Well ordering property: Every nonempty set of nonnegative integers has a least element (It has been proved that the well ordering property, mathematical induction, and strong induction are equivalent). Well ordering property can be directly used in proofs. Example: Use well ordering property to prove division algorithm. (Division Algorithm: If a is an integer and d is a positive integer, then there are unique integers q and r with 0 r < d such that a = qd+r.) 30

Section 5.3 - Recursive definition and structural induction... Recursively defined function: We use the following two steps to define a function with the set of nonnegative integers as its domain: 1. Basis step: Specify the value of the function at zero. 2. Recursive step: Give a rule for finding the value of the function at an integer from its value at smaller integers. Example of recursively defined functions: Recursively defined sets: They have two parts, a basis step and a recursive step. Basis step: An initial collection of elements is specified. Recursive step: In this step, rules for forming new elements in the set from those already known to be in the set are provided. Examples of recursively defined sets: 1. Consider the set S of integers defined by Basis step: 5 S Recursive step: if x S and y S, then x+y S 2. The set Σ, of strings over an alphabet Σ is defined by Basis step: λ Σ, here λ is the empty string. Recursive step: if w Σ and x Σ, then wx Σ Words in a dictionary is a subset of Σ, where Σ = the set {a,b,c,,z,a,b, Z}. 31

Section 5.3 - Recursive definition and structural induction... More examples: 1. The set of rooted trees (where a rooted tree consists of a set of vertices containing a distinct vertex called the root, and edges connecting these vertices), can be defined recursively as follows: Basis step: A single vertex is a rooted tree. Recursive step: suppose T 1,T 2,,T n are rooted trees with roots r 1,r 2,,r n respectively. Then a graph formed by starting with a root r, which is not in any of the rooted trees T 1,T 2,,T n, and adding an edge from each of the vertices r 1,r 2,,r n to r is also a rooted tree. Structural Induction: To prove results about recursively defined sets, we generally use some form of mathematical induction. Example: Show that the set defined by the following rules Basis step: 7 S Recursive step: if x,y S, then x+y S. consists precisely of all positive integers that are multiples of 7. 32

Section 6.1 - The basis of counting Two basic principles of counting: Product rule and Sum rule Product rule: Suppose that a procedure can be broken down in to a sequence of two tasks. If there are n 1 ways to do the first task and for each of these n 1 ways of doing the first task, there are n 2 ways to do the second task, then there are n 1 n 2 ways to do the procedure. This rule generalizes to any number of tasks as well. 1. There are 25 CS majors and 30 math majors in this class. In how many ways can you pick two representatives so that one is a math major and the other is a CS major; Assume that none majors both in CS and math. 2. How many different bit strings of length 5 are there? 3. How many different ternary strings of length 5 are there? 4. How many different licence plate numbers can be formed if each plate contains three digits followed by three letters. 5. By setting up a one-to-one correspondence between the subsets of a finite set S and the bit strings of length S, show that the number of subsets of S is 2 S. 6. Show that there is one-to-one correspondence between the set of all subsets of Z + (the set of all positive integers) and the set of all real numbers in the open interval (0,1) (i.e., the set {x R 0 < x < 1}) Read examples 1 to 10 in the book. 33

Section 6.1 and 6.2 - The basis of counting..., pigeonhole principle The sum Rule: If a task can be done either in one of n 1 ways or in one of n 2 ways, where none of the set of n 1 ways is the same as any of the set of n 2 ways, then there are n 1 +n 2 ways to do the task. Inclusion-Exclusion Principle (sometimes also called as subtraction rule): If a task can be done in either n 1 ways or n 2 ways, then the number of ways to do the task is n 1 +n 2 minus the numbers of ways to do the task in both ways. (i.e., If A and B are two finite sets, then A B = A + B A B ) Theorem 1: Pigeonhole Principle: If k is a positive integer and k +1 or more objects are placed in k boxes, there is at least one box containing two or more objects. Proof: Corollary 1: A function f from a set with k + 1 or more elements to set with k elements is not one-to-one. Theorem 2: Generalized Pigeonhole Principle: If N objects are placed in K boxes, then there is at least one box that contains at least N K objects. Proof: Theorem 3: Every sequence of n 2 +1 real numbers contains a subsequence of length n+1 that is either strictly increasing or strictly decreasing. Proof: 34

Section 6.3 - Permutation and Combination Definition: A permutation of a set of distinct objects is an ordered arrangement of these objects. r-permutation: An ordered arrangement of r elements of a set is called an r-permutation. Definition: The number of r-permutations of a set with n- elements is denoted by P(n,r). Theorem 1: If n is a positive integer and r is an integer with (1 r n), then P(n,r) = n(n 1)(n 2) (n r +1) Proof: Use product rule. Corollary 1: If n and r are positive integers and (1 r n), then P(n,r) = n! (n r)! 35

Section 6.3 - Permutation and.. Definition: An r-combination is an unordered selection of r elements from a set. The number of r-combinations of a set with n elements is denoted by C(n,r) or ( n r). Theorem: The number of r-combinations of a set with n elements where n and r are positive integers such that (0 r n) is given by C(n,r) = n! (n r)!r! Proof: P(n.r) = C(n,r)P(r,r) = C(n,r)r!. Corollary 2: Let n and r be positive integers such that r n. Then C(n,r) = C(n,n r). 36

Section 6.4 - Binomial coefficients and identities Theorem 1: (Binomial Theorem) Let X and Y be variables and n be a positive integer. Then ) ( X n n) ( + X n 1 n) Y + X n 2 Y 2 + ( n ) ( XY n 1 n + (X+Y) n = ( n 0 OR Proof: 1 (X +Y) n = 2 n k=0 ( n ) X n k Y k k Corollary 1: If n > 0 is an integer, then Proof: Take X = Y = 1 in the theorem. Corollary 2: If n > 0 is an integer, then n 1 n k=0 k=0 ( n ) k = 2 n Proof: Take X = 1 and Y = 1 in the theorem. Corollary 3: If n > 0 is an integer, then n n ( n ) ( 1) k = 0 k n ( n ) 2 k = 3 n k k=0 Proof: Take X = 1 and Y = 2 in the theorem. ) Y n Theorem 2: Pascal s identity. Let n and k be positive integers with n k. Then ( ) ( n+1 k = n ( k 1) + n ) k 37

Section 8.1 - Applications of recurrence relations Many counting problems cannot be solved using the techniques described in chapter 6. In this chapter, we explore using recurrence relations for solving some counting problems. Definition 1: A recurrence relation for the sequence {a n } is an equation that expresses a n in terms of one or more of the previous terms in the sequence, namely, a 0,a 1,a 2,...,a n 1, for all integers n with n n 0, where n 0 is a non negative integer. A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence relation. 38

Section 8.2 - Solving linear recurrence relations Definition 1: A linear homogeneous recurrence relation of degree k with constant coefficients is a recurrence relation of the form a n = c 1 a n 1 +c 2 a n 2 +...+c k a n k, where c 1,c 2,...,c k are real numbers and c k 0. Characteristic equation: The equation r k c 1 r k 1 c 2 r k 2 c k = 0 is called the characteristic equation associated with the recurrence relation a n = c 1 a n 1 +c 2 a n 2 +...+c k a n k. Roots of this characteristic equation are called the Characteristic roots of the recurrence relation. As seen in the following Theorems, Characteristic roots help in determining the solution of the recurrence relation. Theorem 1: Let c 1 and c 2 be real numbers. Suppose that r 2 c 1 r c 2 = 0 has two distinct roots r 1 and r 2. Then the sequence {a n } is a solution of the recurrence relation a n = c 1 a n 1 + c 2 a n 2 if and only if a n = α 1 r n 1 + α 2r n 2 for n = 0,1,2,... where α 1 and α 2 are constants. Theorem 2: Let c 1 and c 2 be real numbers with c 2 o. Suppose that r 2 c 1 r c 2 = 0 has only one root r 0. Then the sequence {a n } is a solution of the recurrence relation a n = c 1 a n 1 + c 2 a n 2 if and only if a n = α 1 r n 0 + α 2nr n 0 for n = 0,1,2,... where α 1 and α 2 are constants. 39

Section 8.2... Theorem 3: Let c 1,c 2,...c k be real numbers. Suppose that the characteristic equation r k c 1 r k 1 c 2 r k 2... c k = 0 has k distinct roots r 1,r 2,...r k. Then a sequence {a n } is a solution of the recurrence relation a n = c 1 a n 1 + c 2 a n 2 +... + c k a n k if and only if a n = α 1 r n 1 + α 2r n 2 +... + α kr n k for n = 0,1,2,..., where α 1,α 2,...,α k are constants. Theorem 4: Let c 1,c 2,...,c k be real numbers. Suppose that the characteristic equation r k c 1 r k 1 c 2 r k 2... c k = 0 has t distinct roots r 1,r 2,...r t (t k) with multiplicities m 1,m 2,...,m t, respectively, so that m i 1 for i = 1,2,...,t and m 1 +m 2 +...+m t = k. Then a sequence {a n } is a solution of the recurrence relation a n = c 1 a n 1 +c 2 a n 2 +...+c k a n k if and only if a n = (α 1,0 +α 1,1 n+...+α 1,m1 1n m 1 1 )r n 1 +(α 2,0+α 2,1 n+...+α 2,m2 1n m 2 1 )r n 2 +...+(α t,0 +α t,1 n+...+α t,mt 1n m t 1 )r n t for n = 0,1,2,..., where α i,j are constants for 1 i t and 0 j m i 1. Note: Theorems 1, 2 and 3 are corollaries to Theorem 4 40

Section 8.2... Theorem 5: If {a (p) n } is a particular solution of the nonhomogeneous linear recurrence relation with constant coefficients a n = c 1 a n 1 + c 2 a n 2 +... + c k a n k + F(n), then every solution is of the form {a (p) n + a n (h) }, where {a n (h) } is a solution of the associated linear homogeneous recurrence relation a n = c 1 a n 1 +c 2 a n 2 +...+c k a n k. Theorem 6: If {a n } satisfies the linear non-homogeneous recurrence relation a n = c 1 a n 1 +c 2 a n 2 +...+c k a n k +F(n), where F(n) = (b t n t + b t 1 n t 1 +...+b 1 n + b 0 )s n. When s is not a root of the characteristic equation of the associated linear homogeneous recurrence relation, there is a particular solution of the form (p t n t +p t 1 n t 1 +...+p 1 n+p 0 )s n. When s is a root of this characteristic equation of multiplicity m, there is a particular solution of the form n m (p t n t +p t 1 n t 1 +...+p 1 n+p 0 )s n. 41

Section 8.5 - Inclusion-exclusion principle Theorem 1: (Inclusion-Exclusion principle) Let A 1,A 2,...,A n be finite sets. Then, n A i = A i A i A j + A i A j A k i=1 1 i n 1 i<j n 1 i<j<k n +( 1) n+1 A 1 A 2... A n Recall that we saw the special case of this result earlier for n = 2, namely, A 1 A 2 = A 1 + A 2 A 1 A 2 Proof of the Theorem: 42

Section 9.1 - Relations and their properties Definition 1: Let A and B be two sets. A binary relation from A to B is a subset of the cross product A X B. Note: The concept of relations is a powerful tool in the networked world and has many applications. Definition 2: A relation on a set A is a relation from A to A itself (i.e., a subset of A X A). Notation: Sometimes if (a,b) R, we simply write arb and say a is related to b with respect to R OR a is R-related to b. Definition 3: A relation R on a set A is called reflexive if (a,a) R a A. Definition 4: A relation R on a set A is called symmetric if (b,a) R whenever (a,b) R. i.e., (a,b) R (b,a) R a,b A. R is called antisymmetric if a,b A, ((a,b) R and (b,a) R) implies a = b. i.e., a,b A ((a,b) R) (b,a) R) a = b. Definition 4: A relation R on a set A is called transitive if whenever ((a,b) R and (b,c) R), then (a,c) R, a,b,c A. i.e., a,b,c A ((a,b) R) (b,c) R) (a,c) R. 43

Section 9.1 - Relations... Definition 6: Let R be a relation from a set A to a set B and S be a relation from a set B to set C. The composite of the relations R an S is a relation from A to C, denoted as S R, is defined as S R = {(a,c) (a A) (c C) ( b B such that ((a,b) R) ((b,c) S)} Definition 7: Let R be a relation on the set A. Then, for n = 1,2,, R n is defined recursively as, R 1 = R, and R n+1 = R n R for n = 1,2,. Theorem 1: A relation R is transitive if and only if R n R for all n = 1,2,. Proof: 44

Section 2.6 Matrices Definition 1: A matrix is a rectangular array of numbers. A matrix with m rows and n columns is called an m n matrix (read as m by n matrix). The plural of matrix is matrices. A matrix with same number of rows and columns is called a square matrix. Two matrices are equal if they have the same number of rows, same number of columns and the corresponding entries in every position are equal. Examples of matrices: A short notation for writing a matrix A is A=[a ij ] which indicates that A is a matrix whose (i,j) th entry is a ij. Definition 2: Let m and n be positive integers and let a 11 a 12 a 1n a 21 a 22 a 2n... A =...... a m1 a m2 a mn The i th row of the matrix A is the 1 n matrix [a i1,a i2,,a in ]. The j th column of A is the m 1 matrix a 1j a 2j... a mj 45

Section 2.6 Matrices... Definition 3: Let A= [a ij ] and B= [b ij ] be two m n matrices. The sum of the two matrices A and B, denoted as A + B, is the m n matrix whose (i,j) th entry is a ij + b ij. In other words, A + B = [a ij +b ij ] Definition 4: Let A= [a ij ] be a m k matrix and B= [b ij ] be k n matrix. Then the product of the two matrices A and B, denoted as AB, is the m n matrix whose (i,j) th entry is the sum of the products of the i th row of A and j th column of B. In otherwords, if AB= [c ij ], then c ij = a i1 b 1j +a i2 b 2j + +a ik b kj Definition 5: The identity matrix of order n is the n n matrix I n = [δ ij ] where δ ij = 1 if i = j and δ ij = 0 if i j. In otherwords, I n = 1 0 0 0 1 0......... 0 0 1 Note: Multiplying any matrix with an identity matrix of appropriate size does not change this matrix. i.e., if A is any m n matrix, then AI n = A. Definition 6: Let A = [a ij ] be an m n matrix. The transpose of A, denoted by A t, is the n m matrix obtained by interchanging the rows and columns of A i.e., if A t = [b ij ], then b ij = a ji for i = 1,2,,n and j = 1,2,,m. Definition: 7 A square matrix A is called symmetric if A = A t. i.e., if A = [a ij ], then a ij = a ji i,j (1 i,j n) 46

Section 2.6 Matrices... Zero-one matrix: A zero-one matrix is a matrix whose entries are 0 or 1. Such matrices are often used to represent structures in discrete mathematics. The arithmetic boolean operations on a pair of bits a,b can be defined as follows: a b = { 1 if a = b = 1, 0 otherwise. a b = { 1 if a = 1 or b = 1, 0 otherwise. Definition 8: Let A = [a ij ] and B = [b ij ] be two m n zeroone matrices. Then the join of A and B is the zero-one matrix with (i,j) th entry a ij b ij and is denoted by A B. Let A = [a ij ] and B = [b ij ] be two m n zero-one matrices. Then the meet of A and B is the zero-one matrix with (i,j) th entry a ij b ij and is denoted by A B. Definition 9: Let A= [a ij ] be a m k zero-one matrix and B= [b ij ] be k n zero-one matrix. Then the Boolean product of the two matrices A and B, denoted as A B, is the m n zero-one matrix with (i,j) th entry c ij where c ij = (a i1 b 1j ) (a i2 b 2j ) (a ik b kj ) Definition 10: The r th Boolean power of a zero-one square matrix A, denoted by A [r], is the boolean product of r factors of A. Hence, A [r] = A A A A }{{} r times A [0] is defined as I n. 47

Section 9.3 Representing Relations Suppose R is a relation from A = {a 1,a 2,...a m } to B = {b 1,b 2,...b n }. (Here the elements of A and B are listed in a particular order. If A = B, we use the same ordering in both). The relation R with respect to this ordering of the elements of A and B can be represented as the matrix M R = [m ij ], where m ij = { 1 if (ai,b j ) R. 0 if (a i,b j ) R. Example: Observation: If M R = [m ij ] is the matrix of a relation defined on a set A = {a 1,a 2,,a n } then 1. R is reflexive if and only if m ii = 1 for i = 1,2, n 2. R is symmetric if and only if m ji = m ij 1 i,j n Remark: Suppose R 1 and R 2 are two relations on a set A represented by the matrices M R1 = [m ij ] and M R2 = [m ij ] respectively. Then, the matrices representing R 1 R 2 and R 1 R 2 are respectively M R1 R 2 = [u ij ] and M R1 R 2 = [v ij ] where u ij and v ij are defined by u ij = { 1 if (mij = 1) (m ij = 1). 0 otherwise. v ij = { 1 if (mij = 1) (m ij = 1). 0 otherwise. Thus, M R1 R 2 = M R1 M R2 and M R1 R 2 = M R1 M R2. Example: 48

Section 9.3 Representing Relations... Observations: Let R 1 and R 2 be relations defined on a set A. Let M R1 and M R2 be the matrices representing relations R 1 and R 2 respectively. Then, M R1 R 2 = M R1 M R2. M R1 R 2 = M R1 M R2. Matrix representation of relations also help in determining if a relation is reflexive or symmetric easily. Let R be a relation from A to B and S be a relation from B to C. Suppose A, B and C have m, n, p elements respectively. Let the matrices for S R,R and S be M S R,M R and M S respectively. Then, M S R = M R M S. Definition 1: A directed graph or digraph consists of a set V of vertices together with a set E of ordered pairs of elements of V, called edges or arcs. The vertex a of the edge (a,b) is called initial vertex and b is called the terminal vertex. Thus, directed graphs can be used to represent relations. 49

Section 9.4 - Closure of Relations Definition: Let R be a relation on the set A. The reflexive closure of R is the smallest relation S containing R (i.e., S R) that is reflexive. Note: Let R be a relation on the set A. Then R, where = {(a,a) a A} is the reflexive closure of R. Definition: Let R be a relation on the set A. The symmetric closure of R is the smallest relation S containing R (i.e., R S) that is symmetric. Note: Let R be a relation on the set A. Then the symmetric closure of R is same as R R 1, where R 1 = {(b,a) (a,b) R} Note: We can define the transitive closure of a relation the same way. However, constructing transitive closure of a relation is not easy. We need some graph theory for that. Definition 1: A path from a vertex a to a vertex b in a directed graph G is a sequence of edges (x 0,x 1 ),(x 1,x 2 ),,(x n 1,x n ) in G where n is a nonnegative integer, and x 0 = a, and x n = b; that is, a sequence of edges where the terminal vertex of one edge is the initial vertex of the next edge in the sequence. This path is simply denoted as x 0,x 1,,x n and has length n. A path that begins and ends at the same vertex is called a cycle. 50

Section 9.4 - Closure of Relations... The term path also applies to relations. Let R be a relation on the set A. We say there is a path from a to b in R if there is a sequence of elements a,x 1,x 2,,x n 1,b with (a,x 1 ) R,(x 1,x 2 ) R, (x n 2,x n 1 ) R,(x n 1,b) R. Note: Useful in tracing ancestry, tracking terrorist groups, tracking consumers interest,... Theorem 1: Let R be a relation on the set A. There is a path of length n in R, where n is a positive integer, from a to b if and only if (a,b) R n. Proof: Use induction on n. Definition 2: Let R be a relation on the set A. The connectivity relation R consists of the pairs (a,b) such that there is a path of length at least one from a to b in R. It follows that R = R n n=1 Theorem: The connectivity relation R is the transitive closure of R. Lemma 1: Let A be a set with n elements and R be a relation on A. If there is a path of length at least one in R from a to b, then there is a path with length not exceeding n; moreover, when a b, there is a path of length at most n 1. Theorem 2: If R is a relation on a set A with n elements, then R = R 1 R 2 R n Theorem 3: Let M R be the zero-one matrix representing relation R on a set A with n elements. Then M R = M R M [2] R M[3] R M[n] R. 51

Section 9.5 Equivalence relations Definition 1: A relation on a set A is called an equivalence relation if it is reflexive, symmetric and transitive. Note: An equivalence relation allows to relate objects that are similar in some way. Definition 2: Two elements a and b that are related by an equivalence relation are called equivalent. The notation a b is often used to denote that a and b are equivalent with respect to a particular equivalence relation. Definition 3: Let R be an equivalence relation on a set A. The set of all elements that are related to an element x A is called the equivalence class of x with respect to R. The equivalence class of x with respect to R is denoted by [x] R or simply [x], if the relation under consideration is clear. Theorem 1: Let R be an equivalence relation on a set A. Then, the following three statements are equivalent. 1. arb 2. [a] = [b] 3. [a] [b] 52

Section 9.5 Equivalence relations... Definition: A Partition of a set S is a collection of nonempty disjoint subsets of S whose union is S. In otherwords, the collection of subsets A i, i I} (where I is some indexing set) forms partition of S if and only if S = i IA i and A i A j = i,j I, i j. Theorem 2: Let R be an equivalence relation on a set S. Then the equivalence classes of R form a partition of S. Conversely, given a partition {A i i I} of the set S, there is an equivalence relation R on S that has sets A i, i I as equivalence classes. Proof: 53

Section 9.6 - Partial ordering We use relations to order some or all elements of a set. For example, (i) ordering daily routine (ii) ordering words in a dictionary (iii) ordering of integers (iv) scheduling tasks in a project (v) arrange students in a line according to height (vi) arranging students grades in descending order Note: The ordering can be partial meaning there may be elements not related to each other with respect to the ordering. This leads to the following definition Definition 1: A relation R on a set S is called a partial ordering if R is reflexive, antisymmetric and transitive. A set S, together with a partial ordering R is called a partially ordered set or poset, and is denoted by(s,r). Members of S are called elements of the poset. Note: Customarily, the notation is used to denote (a,b) R (i.e., we say a b and read as a precedes b ) in any arbitrary poset (S,R)). This notation is used because the relation on the set of real numbers is partial order relation. The notation a b denotes that a b but a b. Definition 2: The elements a and b of a poset (S, ) are called comparable if a b or b a. Otherwise, a and b are said to be incomparable. Example: 54

Section 9.6... Definition 3: If (S, ) is a poset and every two elements of S are comparable, the S is called a totally ordered set or a linearly ordered set, and is called a total order. A totally orders set is also called a chain. Definition 4: (S, ) is a well-ordered set if it is a poset such that is a total ordering and every nonempty subset of S has a least element. Theorem 1: (Principle of well ordered induction.) Suppose that S is a well ordered set. Then P(x) is true for all x S, if Inductive step: For every y S, if P(x) is true for all x S such that x y then P(y) is true. Proof: Lexicographic order: let (A 1, 1 ) and (A 2, 2 ) be two posets. The lexicographic ordering on the set (A 1 X A 2 ) is defined as follows: We define (a 1,a 2 ) (b 1,b 2 ) if (a 1 = b 1 and a 2 2 b 2 ) or a 1 1 b 1. Then we obtain a partial ordering by adding equality to the ordering. (Z X Z, ) from (Z, ) and (Z, ) The above definition can be extended to any number of sets as follows: Let (A 1, 1 ),(A 2, 2 ) (A n, n ) be posets, then define on A 1 XA 2 X X A n by (a 1,a 2,,a n ) (b 1,b 2,,b n ) if a 1 1 b 1 or an integer i > 0 such that a 1 = b 1,a 2 = b 2,,a i = b i and a i+1 i+1 b i+1. 55

Section 9.6... Definition: Hasse diagram. We can represent a poset (S, ) as a graph with minimal number of edges. The procedure for reducing the number of edges is as follows: Start with the original graph and remove edges from this graph using the following rules: (i) Since a a a S, we can remove all loops (a,a). (ii) then remove all edges (x,y) for which there is a z such that (x z) and (z y). The resulting graph is called the Hasse diagram of the poset. Example: Definition: An element of a poset is called maximal if it is not less than any other element of the poset. An element is called minimal if it is not greater than any other element. Note: A poset can have more than one maximal element and more than one minimal element. Definition: An element a in a poset (S, ) is said to be the greatest element of the poset if b a b S. An element a in a poset (S, ) is said to be the least element of the poset if a b b S. Note: a poset may not have a greatest element or a least element; however, when they exist, they are unique. An element u in a poset (S, ) is said to be an upper bound of a subset A S, if a u a A. An element l in a poset (S, ) is said to be a lower bound of a subset A S, if l a a A. 56

Section 9.6... An element u in a poset (S, ) is said to be the least upper bound of a subset A S, if u is an upper bound that is less than every other upper bound of A. An element l in a poset (S, ) is said to be the greatest lower bound of a subset A S, if it is greater than every other lower bound. Note: A subset A of a poset (S, ) may not have a lower bound or an upper bound. The greatest lower bound and least upper bound are unique, if they exist. Definition: A poset (S ) in which every pair of elements has both a least upper bound and greatest lower bound is called a lattice. Definition: A total ordering is said to be compatible with the partial ordering R if a b whenever arb. Constructing a compatible total ordering from a partial ordering is called Topological sorting. Lemma 1: Every finite nonempty poset (S, ) has at least one minimal element. Proof: 57

Section 9.6... Algorithm for Topological Sorting Procedure TopologicalSort((S, ): finite poset) Begin integer k := 1; while S { a k := a minimal element of S; S := S {a k }; k := k +1; } return a 1,a 2,,a n ; // a compatible total ordering of S End; Example: 58

Section 10.1 - Graphs and Graph Models Definition 1: A graph G = (V,E) consists of V, a nonempty set of vertices (or nodes) and E, a set of edges. Each edge has either one or two vertices associated with it, called end points. Remark: A graph with infinite vertex set or infinite number of edges is called an infinite graph. A graph with finite vertex set and finite number of edges is called a finite graph. Definition: A graph in which each edge connects two different vertices and where no two edges connect the same pair of vertices is called a Simple graph. Graphs that may have multiple edges connecting the same vertices are called multigraphs. Graphs that may include loops (i.e., edges that connect a vertex to itself) and possibly multiple edges connecting same pair of vertices or a vertex to itself are sometimes called pseudographs. Definition 2: A directed graph (or digraph) (V,E) consists of a nonempty set of vertices V and a set of directed edges (or arcs) E. Each directed edge is associated with an ordered pair of vertices. The directed edge associate with the ordered pair (u,v) is said to start with u and end at v. Definition: A simple directed graph is a directed graph with no loops and no multiple directed edges. A directed multigraph is a directed graph that may have multiple directed edges from a vertex to a second (possibly the same) vertex. 59