Discrete structure and graph theory lecture notes, Study notes of Discrete Structures and Graph Theory

Logic Posets Relation Lattice Sets

Typology: Study notes

2022/2023

Uploaded on 08/14/2023

sumit-gupta-14
sumit-gupta-14 🇮🇳

1 document

1 / 119

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture notes for Math61: Introduction to
Discrete Structures
Last revised March 10, 2020
Allen Gehret
Author address:
Department of Mathematics, University of California, Los Ange-
les, Los Angeles, CA 90095
E-mail address:[email protected]
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Discrete structure and graph theory lecture notes and more Study notes Discrete Structures and Graph Theory in PDF only on Docsity!

Lecture notes for Math61: Introduction to

Discrete Structures

Last revised March 10, 2020

Allen Gehret

Author address:

Department of Mathematics, University of California, Los Ange- les, Los Angeles, CA 90095 E-mail address: [email protected]

  • Chapter 1. Propositional Logic, Sets, and Induction Acknowledgements viii
    • 1.1. Propositional logic
    • 1.2. Sets and set constructions
    • 1.3. Familiar number systems and some basic features
    • 1.4. The well-ordering principle and induction
    • 1.5. Exercises
  • Chapter 2. Relations
    • 2.1. Predicates and quantifiers
    • 2.2. Relations
    • 2.3. Partial and total order relations
    • 2.4. The divides relation
    • 2.5. Equivalence relations and partitions
    • 2.6. The mod n congruence (equivalence) relation
    • 2.7. More abstract nonsense
    • 2.8. Exercises
  • Chapter 3. Functions
    • 3.1. Functions
    • 3.2. Three special types of functions
    • 3.3. The mod n function and the greatest common divisor function
    • 3.4. The Euclidean Algorithm
    • 3.5. Exercises
  • Chapter 4. Counting
    • 4.1. Basic counting principles
    • 4.2. Permutations and combinations
    • 4.3. Exercises
  • Chapter 5. Sequences
    • 5.1. Sequences and recurrence relations
      • recurrence relations 5.2. Solving recurrence relations I: first-order linear (in)homogeneous
      • recurrence relations 5.3. Solving recurrence relations II: second-order linear homogeneous
    • 5.4. Exercises
  • Chapter 6. Graphs and trees iv CONTENTS
    • 6.1. Graphs
    • 6.2. Trees and forests
    • 6.3. Exercises
  • Chapter 7. A glimpse of infinity
    • 7.1. Infinite sets and cardinality
    • 7.2. Cantor’s Theorem on dense linear orders
    • 7.3. Exercises
  • Appendix A. Appendix
    • A.1. The natural numbers and Peano arithmetic
    • A.2. The (ordered) ring of integers
    • A.3. The (ordered) field of rational numbers
    • A.4. The (ordered) field of real numbers
    • A.5. The field of complex numbers
    • A.6. Exercises
  • Bibliography
  • Index

Abstract

The goal of this class is to develop a basic level of mathematical literacy through the study of common structures and theories which often arise in mathematics and computer science. I recommend you refer to these notes for learning the mathematical content of the course, and refer to the textbook for alternative explanations, examples, pictures, and additional exercises. Note: these lecture notes are subject to revision, so the numbering of Lemmas, Theorems, etc. may change throughout the course and I do not recommend you print out too many pages beyond the section where we are in lecture. Any and all questions, comments, and corrections are enthusiastically welcome!

Last revised March 10, 2020. 2010 Mathematics Subject Classification. Primary. The author is supported by the National Science Foundation under Award No. 1703709. v

List of Figures

1.1 Venn diagram of the union A ∪ B of the sets A and B 6

1.2 Venn diagram of the intersection A ∩ B of the sets A and B 7

1.3 Venn diagram of the difference A \ B of the sets A and B 7

1.4 Venn diagram of the complement A of A in the universal set U 8

1.5 Pascal’s Triangle: Table of binomial coefficients

(n k

1.6 Demonstration of Pascal’s Rule 15

1.7 A formal proof that (P → Q) ∧ (Q → R) ∧ P =⇒ R. 22

1.8 The inference rule of Modus Ponens, written in standard form. 22

2.1 Arrow diagram from X to Y illustrating the relation R on X × Y 30

2.2 Digraph representing the relation R 31

2.3 Partial digraph of the ⊆ relation on P

(with self-loops and transitive arrows omitted) 32

2.4 Partial digraph of the ≤ relation on N (with self-loops omitted) 33

2.5 Partial digraph of the divides relation | on N (with self-loops and transitive arrows omitted) 34

2.6 Digraph of the equivalence relation E on X 37

2.7 Partition X/E of X 38

2.8 Partition Z/(mod 5) = {[0], [1], [2], [3], [4]} of Z into equivalence classes 40

3.1 A bijective (i.e., an injective and surjective) function 48

3.2 A surjective function that is not bijective 48

3.3 An injective function that is not surjective 49

3.4 A function that is neither injective nor surjective 49

6.1 A graph with vertex set{ V = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } and edges E = { 1 , 2 }, { 2 , 3 }, { 2 , 5 }, { 4 , 5 }, { 5 , 6 }, { 8 , 9 }

6.2 The complete graph K 4 with vertex set V = { 1 , 2 , 3 , 4 } 82

6.3 An example of a bipartite graph with partition V = V 1 ∪ V 2 83

6.4 The complete bipartite graph K 2 , 3 83

6.5 The K¨onigsberg Graph 85

6.6 An illustration of the Boundary-Crossing Lemma 86

6.7 The proof that V (P ) = V 88

vii

viii LIST OF FIGURES

6.8 The proof that V (P ) = V 89

6.9 A forest with four trees 90

A.1 The natural numbers N and the successor function S : N → N 97

x INTRODUCTION

the theorems themselves. Moreover, the definition of a particular word is the only thing that gives that word meaning, so you must always use the definition.

(IV) Only write true statements.

If you are writing something that is supposed to be a true statement, then it better be a true statement and you better know why it is a true statement. Really the only time you would ever knowingly write down something that is false is if you are doing a proof by contradiction; but even in this case, the introduction of the false statement is still in the service of justifying a true statement.

Conventions and notation

In this class the natural numbers is the set N = { 0 , 1 , 2 , 3 ,.. .} of nonnegative integers. In particular, we will consider 0 to be a natural number. Note: in the textbook the set N is denoted by Znonneg^ , but we will not use this notation.

Unless stated otherwise, the following convention will be in force throughout the entire course:

Global Convention 0.0.1. Throughout, m and n range over N = { 0 , 1 , 2 ,... }.

When we write “X := Y ”, we mean that the object X does not have any meaning or definition yet, and we are defining X to be the same thing as Y. When we write “X = Y ” we typically mean that the objects X and Y both already are defined and are the same. In other words, when writing “X := Y ” we are performing an action (giving meaning to X) and when we write “X = Y ” we are making an assertion of sameness.

In making definitions, we will often use the word “if” in the form “We say that... if.. .” or “If.. ., then we say that.. .”. When the word “if” is used in this way in definitions, it has the meaning of “if and only if” (but only in definitions!). For example:

Definition 0.0.2. Given integer d, n ∈ Z, we say that d divides n if there exists an integer k ∈ Z such that n = dk.

This convention is followed in accordance with mathematical tradition. Also, we shall often write “iff” or “⇔” to abbreviate “if and only if.”

Acknowledgements

I am grateful to Julian Ziegler Hunts for producing many of the figures in these lecture notes and to Ben Spitz for suggesting various exercises.

CHAPTER 1

Propositional Logic, Sets, and Induction

1.1. Propositional logic

Definition 1.1.1. A proposition is a sentence that is either true or false, but not both. In other words, a proposition is a statement for which it makes sense to assign a True/False value (of course, whether a proposition is actually true or false depends on context, definitions, interpretation, etc.).

Example 1.1.2. The following sentences are propositions:

(1) 2 + 2 = 5. (2) Winter is coming. (3) I am the one who knocks. (4) We were on a break.

The following sentences are not propositions:

(5) Should I stay or should I go now? (6) May the force be with you. (7) Is it too late now to say sorry? (8) Everybody clap your hands!

In mathematics, and in language in general, more complicated propositions are built from simpler propositions by (logical) operators (and, or, not and implies).

Definition 1.1.3. Given propositions P and Q, the conjunction of P and Q (notation: P ∧ Q) is the proposition “P and Q”. The truth value of the conjunc- tion P ∧ Q is determined by the individual truth values of P and Q separately in accordance with the following truth table:

P Q P ∧ Q T T T T F F F T F F F F

In other words, P ∧ Q is true precisely when both P and Q are true.

Definition 1.1.4. Given propositions P and Q, the disjunction of P and Q (notation: P ∨ Q) is the proposition “P or Q”. The truth table for P ∨ Q is as follows: P Q P ∨ Q T T T T F T F T T F F F

In other words, P ∨ Q is true precisely when at least one of P or Q is true.

1

1.1. PROPOSITIONAL LOGIC 3

Convention 1.1.9. For more complicated propositions we technically need to in- troduce parentheses to ensure unique readability. However, we wish to avoid a proliferation of parentheses in our propositions as much as possible. Therefore, we introduce the following convention of operator precedence (or operator binding strength) akin to “order of operations” for basic arithmetic. We agree that, in the absence of parentheses, we evaluate the operators in the following order of priority:

(1st) ¬ (2nd) ∧ (3rd) ∨ (4th) → (5th) ↔

For example, instead of writing ( (¬P ) ∧ Q

∨ (¬R)

we can just write ¬P ∧ Q ∨ ¬R.

In general we will not go too overboard with applying these conventions, since sometimes redundant parentheses can still assist in readability. For example, we might choose to write the above proposition as

(¬P ∧ Q) ∨ ¬R,

so that it is easier for the eye to see the grouping.

Since we will be in the business of reading/writing propositions and analyzing their truth values, one fundamental issue we need to address is the following: how can we tell when two propositions are actually saying the same thing? This is taken care of by the notion of logical equivalence:

Definition 1.1.10. Suppose we are given propositions P and Q which are both built from simpler propositions p 1 ,... , pn. Then we say that P and Q are logi- cally equivalent (notation: P ≡ Q) if for all possible truth values for p 1 ,... , pn, the propositions P and Q have the same resulting truth value. In other words, P ≡ Q means that in a truth table which contains both P and Q, the columns corresponding to P and Q are identical.

Example 1.1.11. Given propositions p 1 and p 2 , define

P := p 1 → p 2 and Q := ¬p 1 ∨ p 2

(recall that ¬p 1 ∨p 2 is shorthand for (¬p 1 )∨p 2 and not ¬(p 1 ∨p 2 ), by our conventions for operator precedence). We claim that P ≡ Q.

Proof. To verify that P ≡ Q, we need to set up a truth table which contains both P and Q, and then observe that they have identical columns of truth values:

p 1 p 2 ¬p 1 P := p 1 → p 2 Q := ¬p 1 ∨ p 2 T T F T T T F F F F F T T T T F F T T T

Since we observe that the columns for P and Q are the same (T F T T ), we conclude that P ≡ Q. 

4 1. PROPOSITIONAL LOGIC, SETS, AND INDUCTION

As the previous example shows, there is nothing difficult involved with proving that two propositions are equivalent. Indeed, it is a completely mechanical process of filling out a truth table in accordance with the rules for the various logical operators.

Remark 1.1.12. Logical equivalence is a so-called equivalence relation on the collection of propositions (see Definition 2.5.1) in the sense that given propositions P , Q, and R, the following always hold:

(1) P ≡ P , (2) if P ≡ Q, then Q ≡ P , and (3) if P ≡ Q and Q ≡ R, then P ≡ R.

Furthermore, any time you know that two propositions are logically equivalent, then you are free to treat them as if they are exactly the same when doing proofs.

Sometimes we will encounter propositions which are always true and also proposi- tions which are always false. These have special names:

Definition 1.1.13. A tautology (or tautological statement) is a proposition which is always true, for all possible truth assignments. In other words, a tautology is a proposition whose column in a truth table has all T ’s. A contradiction (or contradictory statement) is a proposition which is always false, for all possible truth assignments (i.e., a contradiction has all F ’s in its column in a truth table).

We now record some common laws for propositional logic. The proofs of each of the laws follows by considering truth tables as in Example 1.1.11.

Boolean Algebra of Propositional Logic 1.1.14. Given propositions P , Q, and R, a tautology T , and a contradiction F , the following logical equivalences always hold:

(1) (Associative laws) (P ∨Q)∨R ≡ P ∨(Q∨R) and (P ∧Q)∧R ≡ P ∧(Q∧R) (2) (Commutative laws) P ∨ Q ≡ Q ∨ P and P ∧ Q ≡ Q ∧ P (3) (Distributive laws) P ∧ (Q ∨ R) ≡ (P ∧ Q) ∨ (P ∧ R) and P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R) (4) (Identity laws) P ∨ F ≡ P and P ∧ T ≡ P (5) (Negation laws) P ∨ ¬P ≡ T and P ∧ ¬P ≡ F (6) (Idempotent laws) P ∨ P ≡ P and P ∧ P ≡ P (7) (Bound laws) P ∨ T ≡ T and P ∧ F ≡ F (8) (Absorption laws) P ∨ (P ∧ Q) ≡ P and P ∧ (P ∨ Q) ≡ P (9) (Double negation law) ¬(¬P ) ≡ P (10) (T/F laws) ¬F ≡ T and ¬T ≡ F (11) (De Morgan’s laws) ¬(P ∨ Q) ≡ ¬P ∧ ¬Q and ¬(P ∧ Q) ≡ ¬P ∨ ¬Q

1.2. Sets and set constructions

A set is a collection of mathematical objects. Mathematical objects can be almost anything: numbers, other sets, functions, vectors, relations, matrices, graphs etc. For instance: { 2 , 5 , 7 },

, and { 1 , 3 , 5 , 7 ,.. .}

are all sets. A member of a set is called is called an element of the set. The membership relation is denoted with the symbol “∈”, for instance, we write “2 ∈ { 2 , 5 , 7 }” (pronounced “2 is an element of the set { 2 , 5 , 7 }”) to denote that the number 2 is a member of the set { 2 , 5 , 7 }. There are several ways to describe a set:

6 1. PROPOSITIONAL LOGIC, SETS, AND INDUCTION

A ⊆ B). This means that there is at least one x ∈ A such that x 6 ∈ B. Given an x like this, you then argue (using the specifics of whatever is assumed about A and B) to get some contradiction. Once you get a contradiction, you can conclude that it must actually be the case that A ⊆ B. 

Example 1.2.4. Prove that { (a, b, c) ∈ R^3 : a = 0 and b = 0

(a, b, c) ∈ R^3 : a + b = 0

Proof. Call the first set A and the second set B. We want to prove that A ⊆ B. Let (a, b, c) ∈ A be arbitrary. This means that a = 0 and b = 0. We want to show that (a, b, c) is an element of B. In order to be an element of B, it would have to be true that a + b = 0. However, since a = 0 and b = 0, then we have a + b = 0 + 0 = 0. Thus (a, b, c) satisfies the membership requirement for B so we can conclude that (a, b, c) ∈ B. Since (a, b, c) was an arbitrary element of A, we can conclude that A ⊆ B. 

INCORRECT proof. We want to show that A ⊆ B. Let (a, b, c) be an element of A, for instance, (0, 0 , 2). The vector (0, 0 , 2) is also in B since a + b = 0 + 0 = 0 for this vector. Thus A ⊆ B. [Here, the crime is that we showed that a single specific vector from A is also in B. This does not constitute a proof that all vectors from A are also elements of B.] 

Question 1.2.5. Suppose you are asked to prove that A = B where A and B are sets (possibly with two different-seeming descriptions). How do you prove that A = B?

Answer. This means you have to prove two separate things:

(1) prove A ⊆ B, and (2) prove B ⊆ A.

So this breaks down to two different proofs, each one then reduces to answering Question 1.2.3 for those particular sets. 

Definition 1.2.6. Given sets A and B, we define their union (notation: A ∪ B) to be the set of all elements that are in either A or B, i.e.,

A ∪ B := {x : x ∈ A or x ∈ B}.

A B

Figure 1.1: Venn diagram of the union A ∪ B of the sets A and B

Definition 1.2.7. Given sets A and B, we define their intersection (notation: A ∩ B) to be the set of all elements they have in common, i.e.,

A ∩ B := {x : x ∈ A and x ∈ B}.

1.2. SETS AND SET CONSTRUCTIONS 7

A B

Figure 1.2: Venn diagram of the intersection A ∩ B of the sets A and B

Definition 1.2.8. Given sets A and B, we define their (set) difference (or rel- ative complement) (notation: A \ B) to be the subset of A of all elements in A that are not in B, i.e.,

A \ B := {x : x ∈ A and x 6 ∈ B}.

A B

Figure 1.3: Venn diagram of the difference A \ B of the sets A and B

Occasionally we will be in a mathematical situation where all relevant sets under discussion are subsets of one large sets. For example:

(1) In probability, all events E are subsets of the sample space Ω (2) In real analysis, all relevant sets at a given moment might be subsets of the real numbers R

In such situations, it is convenient to work with a so-called universal set. A univer- sal set (or universe) is a set U such that all sets under discussion are implicitly assumed to be a subset of U. In such a situation, it makes sense to talk about the complement of a set:

Definition 1.2.9. Suppose U is a universal set, and X ⊆ U. We define the complement of X (notation: X) to be the subset of U consisting of all elements which are not in X, i.e.,

X := U \ X = {x ∈ U : x 6 ∈ X}.

Note that when we are working in a universal set, we can rewrite set difference in terms of intersection and complement:

A \ B = A ∩ B

Warning: the operation of complement only makes sense when it is clear what the universal set U is. Usually this will be explicitly told to you or easily inferred from

1.2. SETS AND SET CONSTRUCTIONS 9

In practice, the Ordered Pair Property 1.2.15 is really the only feature of ordered pairs that is ever relevant. You will almost never have to actually deal with the definition “

{a}, {a, b}

”, except when it comes proving the Ordered Pair Property.

Definition 1.2.16. Given sets X and Y , we define the cartesian product (of X and Y ) (notation: X × Y ) to be the following set:

X × Y :=

(x, y) : x ∈ X and y ∈ Y

Example 1.2.17. Suppose X = { 0 , 1 } and Y = {a, b, c}. Then the cartesian product of X and Y is

X × Y =

(0, a), (0, b), (0, c), (1, a), (1, b), (1, c)

Note that |X| = 2, |Y | = 3, and |X × Y | = 2 · 3 = 6.

We conclude this section with the set-theoretic analogue of the identities in Boolean Algebra for Proposition Logic.

Boolean Algebra of Sets 1.2.18. Given sets X, Y , and Z, and a universal set U , the following set equalities always hold:

(1) (Associative laws) (X ∪Y )∪Z = X ∪(Y ∪Z) and (X ∩Y )∩Z = X ∩(Y ∩Z) (2) (Commutative laws) X ∪ Y = Y ∪ X and X ∩ Y = Y ∩ X (3) (Distributive laws) X ∩ (Y ∪ Z) = (X ∩ Y ) ∪ (X ∩ Z) and X ∪ (Y ∩ Z) = (X ∪ Y ) ∩ (X ∪ Z) (4) (Identity laws) X ∪ ∅ = X and X ∩ U = X (5) (Complement laws) X ∪ X = U and X ∩ X = ∅ (6) (Idempotent laws) X ∪ X = X and X ∩ X = X (7) (Bound laws) X ∪ U = U and X ∩ ∅ = ∅ (8) (Absorption laws) X ∪ (X ∩ Y ) = X and X ∩ (X ∪ Y ) = X (9) (Double complement law) X = X (10) (0/1 laws) ∅ = U and U = ∅ (11) (De Morgan’s laws) (X ∪ Y ) = X ∩ Y and X ∩ Y = X ∪ Y

Proof. We will only give a proof for the first De Morgan’s law:

(X ∪ Y ) = X ∩ Y.

This will also be an example of how to prove a universal statement. Recall from the definition of two sets being equal (i.e., having exactly the same elements), the statement we need to prove written out formally is:

∀x ∈ U (x ∈ (X ∪ Y ) ↔ x ∈ X ∩ Y ),

10 1. PROPOSITIONAL LOGIC, SETS, AND INDUCTION

i.e., we need to show the “iff” statement is true for every x ∈ U. Let x ∈ U be arbitrary. We will prove this by a trail of equivalences and definition-unwinding:

x ∈ (X ∪ Y ) ⇔ x 6 ∈ X ∪ Y (by def. of complement) ⇔ ¬(x ∈ X ∪ Y ) (by def. of 6 ∈) ⇔ ¬(x︸ ︷︷ ︸ ∈ X P

∨ x︸ ︷︷ ︸ ∈ Y Q

) (by def. of union ∪)

⇔ ¬(x︸ ︷︷ ︸ ∈ X P

) ∧ ¬(x︸ ︷︷ ︸ ∈ Y Q

(by De Morgan’s law for Propositions: ¬(P ∨ Q) ≡ ¬P ∧ ¬Q)) ⇔ x 6 ∈ X ∧ x 6 ∈ Y ⇔ x ∈ X ∧ x ∈ Y ⇔ x ∈ X ∩ Y.

Comparing the first and last statement, we see that x ∈ (X ∪ Y ) iff x ∈ X ∩ Y. Since x ∈ U was arbitrary (i.e., we didn’t assume anything special about x beyond the assumption x ∈ U ), we conclude that this is true for all x ∈ U. [Note: In Answer to Question 1.2.5 we said you need to prove two set containments A ⊆ B and B ⊆ A separately to conclude A = B. The proof here is an exception because every step along the way was easily reversible, but in general that might not be the case.] The proofs for the rest of the laws work exactly the same way: unwinding definitions, writing everything out fully in terms of logical operators, and applying the appropriate Propositional Logic equivalence. As an exercise, you are encouraged to prove the other laws. 

Remark 1.2.19. (⇔ vs. ↔) In the above proof, ⇔ is an abbreviation for “if and only if”. So when we write “x ∈ X ∧ x ∈ Y ⇔ x ∈ X ∩ Y ”, this is just shorthand for a longer English sentence asserting that whenever x makes the proposition on the lefthand side true, it also makes the proposition on the righthand side true, and vice-versa (in this case, because of the definition of intersection ∩). There is a subtle distinction between this usage of “if and only if” and the logical operator ↔. Namely, when writing “if and only if” in a proof, we are actually asserting as the prover that two things are equivalent. The symbol ↔ does not do this; given propositions P and Q (which each could either be true or false), the symbol ↔ allows us to build a new proposition P ↔ Q (which could also be either true or false). In other words, ↔ is part of the formal language for writing propositions (it’s a symbol which combines two propositions, equipped with a rule determining the overall truth value given the truth values of the individual propositions), whereas ⇔ is part of the meta-language of English in which we are expressing our argument in.

We conclude this section with a few more constructions and definitions we will need later: