0% found this document useful (0 votes)
60 views13 pages

(Coequal in Order) (Coequal in Order)

This document provides definitions and examples of various logical concepts and proof techniques, including: 1) It defines conditional statements, contrapositives, converses, inverses, biconditionals, and necessary and sufficient conditions. 2) It explains three common proof techniques - proof by construction, proof by contraposition, and proof by contradiction - and provides examples of each. 3) It also defines key logical concepts like statements, negation, conjunction, disjunction, tautologies, contradictions, logical equivalence, arguments and their validity.

Uploaded by

mo dolet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views13 pages

(Coequal in Order) (Coequal in Order)

This document provides definitions and examples of various logical concepts and proof techniques, including: 1) It defines conditional statements, contrapositives, converses, inverses, biconditionals, and necessary and sufficient conditions. 2) It explains three common proof techniques - proof by construction, proof by contraposition, and proof by contradiction - and provides examples of each. 3) It also defines key logical concepts like statements, negation, conjunction, disjunction, tautologies, contradictions, logical equivalence, arguments and their validity.

Uploaded by

mo dolet
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

By Construction (With Example): By Contraposition (With Example): By Contradiction (With Example):

Prove that there exist irrational numbers p and q such pq is rational. The contrapositive of “if P then Q” is “if ~Q then ~P”. Prove that 7 is not colourful (an integer n is said to be colourful
1. We know from Theorem 4.7.1 (Epp) that √2 is irrational Both statements are logically equivalent. if there exists some integer k such that n = 3k).
√2
2. Consider √2 : it is either rational or unrational
Prove that if x 2 is irrational then x is irrational. 1. Suppose 7 is colourful.
3. Case 1: It is rational 2. Then, by definition of colourful, 7 = 3k for k ∈ Z
3.1 Let p = q = √2, and we are done
Proof Techniques

1. Contrapositive: if x is rational then x 2 is rational 3. 1 = 3k – 6 (by basic algebra)


4. Case 2: It is irrational 2. Since x is rational, there exists a, b ∈ Z such that b ≠ 0 4. 1 = 3(k – 2) (by basic algebra)
√2 a
4.1 Let p = √2 and q = √2. and x = 5. Since (k – 2) is an integer by the closure property, then 3 | 1
b
4.2 p is irrational (by assumption) and so is q by Theorem 4.7.1 (Epp) a×a by definition of divisibility.
3. So x 2 = by basic algebra
√2 b×b 6. Then by Theorem 4.3.1 (Epp), this means 3 ≤ 1.
4.3 Consider pq = (√2 )√2 4. The numerator and denominator are integers, by the 7. Clearly, this is absurd, so the statement is true (by
√2 × √2 closure property of integers. contradiction rule).
= √2 (by the power law)
2 5. Also, by rule T21 of Appendix A (Epp), b2 ≠ 0
= √2 = 2 (by algebra) 6. Therefore, x 2 is a ratio of two integers
4.4 Clearly, 2 is rational 7. And by definition of rationals, x 2 is rational.
5. In either case, we have found the required p and q 8. Since the contrapositive of the original statement is
true, then the original statement is true.
Definition 2.1.1 – Statement Definition 2.2.1 – Conditional Definition 2.3.1 – Argument
A statement or proposition is a sentence that is true or false, but not The conditional of q by p is “if p then q”, denoted p → q, where p is An argument is a sequence of statements. All
both. the hypothesis/antecedent and q is the conclusion/consequent. statements in an argument, except the final one, are
Definition 2.1.2 – Negation premises/assumptions/hypotheses. The final
The negation of p is “not p” and is denoted ~p. Definition 2.2.2 – Contrapositive statement is the conclusion.
The contrapositive of conditional statement “if p then q” is “if ~q
Definition 2.1.3 – Conjunction then ~p”, denoted ~q → ~p. An argument is valid if, and only if, whenever
The conjunction of p and q is “p and q”, denoted p ꓥ q. statements are substituted that make all the premises
Definition 2.1.4 – Disjunction Definition 2.2.3 – Converse (i.e. converse error) true, the conclusion is also true.
Logic of Compound Statements

The disjunction of p and q is “p or q”, denoted as p ꓦ q. The converse of conditional statement “if p then q” is “if q then p”,
Definition 2.1.5 – Statement/Propositional Form denoted q → p. Definition 2.3.2 – Sound and Unsound Arguments
A statement/propositional form is an expression made up of statement An argument is sound if, and only if, it is valid and all
variables and logical connectives that becomes a statement when Definition 2.2.4 – Inverse (i.e. inverse error) its premises are true. Otherwise, it is unsound.
actual statements are substituted for the component statement The inverse of conditional statement “if p then q” is “if ~p then ~q”,
variables. denoted ~p → ~q.
Order of Operations
Definition 2.1.6 – Logical Equivalence Definition 2.2.5 – Only If
Two statements are logically equivalent only if they have identical truth Performed ~ (not)
If “p only if q”, it means “if not q then not p” or “if p then q”. first
values for each possible situation of statements for their statement
variables. The logical equivalence of p and q is denoted by p ≡ q. ꓥ (and), ꓦ (or)
Definition 2.2.6 – Biconditional {coequal in order}
Definition 2.1.7 – Tautology The biconditional of p and q is “p if, and only if q”, denoted p ↔ q. Performed → (if-then), ↔ (if, and only if)
A tautology is a statement form that is always true regardless of the last {coequal in order}
truth values of the individual statements substituted for its statement Definition 2.2.7 – Necessary and Sufficient Conditions
variables. The statement “p is a sufficient condition for q” means “if p then q”.
Definition 2.1.8 – Contradiction The statement “p is a necessary condition for q” means “if ~p then
A contradiction is a statement form that is always false regardless of ~q” or “if q then p”.
the truth values of the individual statements substituted for its
statement variables.
Theorem 2.1.1 – Logical Equivalences Table 2.3.1 – Rules of Inference
1 Commutative Laws pꓥq≡qꓥp pꓦq≡qꓦp 1 Modus Ponens p→q
p
2 Associative Laws (p ꓥ q) ꓥ r ≡ p ꓥ (q ꓥ r) (p ꓦ q) ꓦ r ≡ p ꓥ (q ꓦ r) ●q

2 Modus Tollens p→q


3 Distributive Laws p ꓥ (q ꓦ r) ≡ (p ꓥ q) ꓦ (p ꓥ r) p ꓦ (q ꓥ r) ≡ (p ꓦ q) ꓥ (p ꓦ r)
~q
● ~p
4 Identity Laws p ꓥ true ≡ p p ꓦ false ≡ p
3 Generalisation p q
5 Negation Laws p ꓥ ~p ≡ false p ꓦ ~p ≡ true pꓦq pꓦq
Logic of Compound Statements

4 Specialisation pꓥq pꓥq


6 Double Negative Law ~(~p) ≡ p p q
5 Conjunction p
7 Idempotent Laws pꓥp≡p pꓦp≡p
q
●pꓥq
8 Universal Bound Laws p ꓥ false ≡ false p ꓦ true ≡ true
6 Elimination pꓦq pꓦq
9 De Morgan’s Laws ~(p ꓥ q) ≡ ~p ꓦ ~q ~(p ꓦ q) ≡ ~p ꓥ ~q ~q ~p
●p ●q
10 Absorption Laws p ꓥ (p ꓦ q) ≡ p p ꓦ (p ꓥ q) ≡ p 7 Transitivity p→q
q→r
11 Negation of True and False ~true ≡ false ~false ≡ true
●p→r

12 Implication Law p → q ≡ ~p ꓦ q 8 Proof by Division into Cases pꓦq


p→r
13 Contrapositive p → q ≡ ~q → ~p q→r
●r
14 Converse and Inverse q → p ≡ ~p → ~q 9 Contradiction Rule ~p → false
●p

Definition 3.1.1 – Predicate Definition 3.1.4 – Existential Statement


Logic of Quantified Statements

A predicate is a sentence that contains a finite number of variables, and it becomes a statement when specific An existential statement is of the form “Ǝx ∈ D, such that Q(x)”. It is true if and only if
values are substituted for the variables. The domain of a predicate variable is the set of all values that may be Q(x) is true for at least one x in D. It is false if and only if Q(x) is false for at all x in D.
substituted in place of the variable.
Definition 3.1.2 – Truth Set Notation
If P(x) is a predicate and x has the domain D, the truth set is the set of all elements of D that make P(x) true when P(x) ⇒ Q(x): Every element in truth set of P(x) is in the truth set of Q(x), equivalently,
they are substituted for x. The truth set of P(x) is denoted {x ∈ D | P(x)}. “∀x, P(x) → Q(x)”.
Definition 3.1.3 – Universal Statement
P(x) ⇔ Q(x): P(x) and Q(x) have identical truth sets, equivalently, “∀x, P(x) ↔ Q(x)”.
A universal statement is of the form “∀x ∈ D, Q(x)”. It is true if and only if Q(x) is true for every x in D. It is false if
and only if Q(x) is false for at least one x in D. Such a value for x for which Q(x) is false is a counterexample.
Definition 3.2.1 – Contrapositive, Converse, Inverse Theorem 3.2.1 (Epp) – Negation of a Universal Statement Universal Modus Ponens
For statement “∀x ∈ D, if P(x) then Q(x)”: The negation of statement “∀x ∈ D, P(x)” is logically equivalent to ∀x, if P(x) then Q(x)
1. Contrapositive: “∀x ∈ D, if ~Q(x) then ~P(x)”. statement “Ǝx ∈ D, such that ~P(x)”. P(a) for a particular a.
2. Converse: “∀x ∈ D, if Q(x) then P(x)”. ● Q(a)
~(∀x ∈ D, P(x)) ≡ Ǝx ∈ D, such that ~P(x)
Logic of Quantified Statements

3. Inverse: “∀x ∈ D, if ~P(x) then ~Q(x)”. Universal Modus Tollens


Theorem 3.2.2 (Epp) – Negation of an Existential Statement
∀x, if P(x) then Q(x)
Definition 3.2.2 – Necessary and Sufficient Conditions, and Only If The negation of statement “Ǝx ∈ D, such that P(x)” is logically equivalent
~Q(a) for a particular a.
1. If “∀x, R(x) is a sufficient condition for S(x)”, it means “∀x, if R(x) then S(x)”. to statement “∀x ∈ D, ~P(x)”. ● ~P(a)
2. If “∀x, R(x) is a necessary condition for S(x)”, it means “∀x, if ~R(x) then ~S(x)”, or
~(Ǝx ∈ D, such that P(x)) ≡ ∀x ∈ D, ~P(x) Converse Error (Quantified Form)
equivalently, “∀x, if S(x) then R(x)”.
Universal Instantiation ∀x, if P(x) then Q(x)
3. If “∀x, R(x) only if S(x)”, it means “∀x, if ~S(x) then ~R(x)”, or equivalently, “∀x, if
If some property is true of everything in the set, then it is true for any Q(a) for a particular a.
R(x) then S(x)”.
particular thing in the set. ● P(a)

Definition 3.4.1 – Valid Argument Form Existential Instantiation Inverse Error (Quantified Form)
An argument is valid when no matter what particular predicates are substituted for If the existence of a certain kind of object is assumed or has been ∀x, if P(x) then Q(x)
the predicate symbols in its premises, if the resulting premise statements are all true, deduced then it can be given a name, as long as that name is not ~P(a) for a particular a.
then the conclusion is also true. An argument is valid if and only if its form is valid. currently being used to denote something else. ● ~Q(a)

Regular Induction Strong Induction


1. Base Step: P(0) (or P(a) where k ∈ Z, depending on the question) 1. Base Step: P(0) (or P(a) where k ∈ Z, depending on the question)
2. Inductive Step: ∀k ∈ N, P(k) → P(k + 1) 2. Inductive Step: ∀k ∈ N, P(k), P(k – 1), P(k – 2), …, P(a) → P(k + 1)
3. Conclusion: ∀n ∈ N, P(n) 3. Conclusion: ● ∀n ∈ N, P(n)

*N = {0, 1, 2, 3, 4, 5, … } in CS1231 Example


Example Prove that ∀ integers n > 1, n has a prime factorisation.
Prove that ∀n ∈ N, (4n − 1) is divisible by 3. 1. ∀ integers n > 1, let P(n) = (n has a prime factorisation).
1. For ∀n ∈ N, let P(n) = (3 | (4n − 1)) 2. Base Case: let n = 2
2. Base Case: let n = 0 2.1. Since 2 is a prime, 2 = 2 is a trivial prime factorisation.
Mathematical Induction

2.1 Clearly, (40 − 1) = 0 = 3 x 0 2.2. Thus, P(2) is true.


2.2 Thus, P(0) is true. 3. Inductive Step: for any integer k > 1:
3. Inductive Step: for any k ∈ N: 3.1. Assume P(i) is true for 1 < i ≤ k (stronger assumption)
3.2. That is, all integers i within the range 1 < i ≤ k have prime factorisations.
3.1. Assume P(k) is true, i.e. 3 | (4k − 1)
3.2. Consider the k + 1 case: 3.3. Consider the integer k + 1:
3.4. If k + 1 is prime, then k + 1 = k + 1 is a trivial prime factorisation, and P(k+1) is true.
3.3. (4k+1 − 1) = (4 × 4k − 1) = 4(4k − 1) + 3, by basic algebra
3.5. If k + 1 is composite, then k + 1 = rs for some integers r and s, such that 1 < r, s < k + 1,
3.4. By inductive hypothesis, 3 | (4k − 1)
by the definition of composite.
3.5. Clearly, 3 | 3
3.6. By the inductive hypothesis, both r and s have prime factorisations.
3.6. By Theorem 4.1.1, 3 | (4(4k − 1) + 3) 3.7. Let r = p1 p2 … pu and s = q1 q2 … qv , where all the factors are prime.
3.7. P(k) is true → P(k + 1) is true 3.8. Then k + 1 = rs = p1 p2 … pu q1 q2 … qv , by basic algebra.
4. So by Mathematical Induction, the statement is true. 3.9. Thus k + 1 has a prime factorisation and P(k + 1) is true.
Note: 4. So, by Strong Induction, the statement is true.
- “For ∀n ∈ N” is needed to qualify the domain of n, and it is also Note:
- Do not define the predicate as “P(n) = (4n − 1)”! This is not a statement and it cannot be - Regular induction cannot be applied here because that hypothesis says only P(k) is true, but r and s
evaluated to be true or false. may not equal to k.
Definition 1.3.1 – Divisibility Theorem 4.3.2 – Well Ordering 2 Proposition 4.5.2 – Existence of GCD
If n and d are integers and d ≠ 0, then n is divisible by d (i.e. d | n) if, If a non-empty set S ⊆ Z has an upper bound, then S has a greatest For any non-zero integers a and b, their gcd exists and is
and only if, for some integer k, n = dk. element. unique.
Theorem 4.1.1
Proposition 4.3.4 – Uniqueness of Greatest Element Euclid’s Algorithm (With Steps and Examples):
For ∀a, b, c ∈ Z, if a | b and a | c, then for ∀x, y ∈ Z, a | (bx + cy). If a set S of integers has a greatest element, then the greatest Finding gcd(a, b) is based on two facts:
Definition 4.2.1 – Prime and Composite Numbers element is unique. a. gcd(a, 0) = a
Every integer n > 1 is either prime or composite. b. gcd(a, b) = gcd(b, r), where r = a % b
Theorem 4.4.1 – Quotient-Remainder Theorem
1. An integer n is a prime if, and only if, n > 1 and for all
Given any integer a and any positive integer b, there exist unique Calculate gcd(330, 156):
positive integers r and s, if n = rs, then either r or s equals
integers q (quotient) and r (remainder) such that: 330 = 156 x 2 + 18 ← gcd(156, 18)
n.
a = bq + r and 0 ≤ r < b 156 = 18 x 8 + 12 ← gcd(18, 12)
2. An integer n is composite if, and only if, n > 1 and n = rs
18 = 12 x 1 + 6 ← gcd(12, 6)
for some integers r and s with 1 < r < n and 1 < s < n.
Representation of Integers (With Steps and Examples): 12 = 6 x 2 + 0 ← gcd(6, 0)
Proposition 4.2.2 Express (109)10 in base 2: 1. Use the quotient-remainder Thus, the gcd(330, 156) is 6.
For any two primes p and p’, if p | p’ then p = p’. 109 = 2 x 54 + 1 theorem to find the binary
54 = 2 x 27 + 0 representation of 109. Theorem 4.5.3 – Bézout’s Identity
Proposition 4.7.3 (Epp)
27 = 2 x 13 + 1 Let a and b be non-zero integers, and let d = gcd(a, b).
For any a ∈ Z and any prime p, if p | a then p ł (a + 1). 2. Read the remainders from
13 = 2 x 6 + 1 There exist integers x and y such that:
Theorem 4.7.4 (Epp) – Infinitude of Primes 6=2x3+0 bottom up.
ax + by = d
Number Theory

The set of primes is infinite. 3=2x1+1


1=2x0+1 3. Read the binary representation
Theorem 4.2.3 from right to left: Using the example of gcd(330, 156):
If p is a prime and x1 , x2 , … , xn are any integers such that p | (109)10 = (1101101)2 (20 ∙ 1) + (21 ∙ 0) + (22 ∙ 1) + 6 = 18 – 12 x 1
x1 x2 … xn , then p | xi for some xi (1 ≤ i ≤ n). (23 ∙ 1) + (24 ∙ 0) + (25 ∙ 1) + 6 = 18 + 12 x (-1)
(26 ∙ 1) 6 = 18 + (156 – 18 x 8) x (-1)
Theorem 4.3.5 (Epp) – Unique Prime Factorisation 6 = 156 x (-1) + 18 x 9
Given any integer n > 1, there exists a positive integer k, distinct (10110101)2 to base 10: (10110101)2 to base 8:
(20 ∙ 1) + (21 ∙ 0) + 181 = 8 x 22 + 5 6 = 156 x (-1) + (330 – 156 x 2) x 9
prime numbers p1 , p2 , … , pk and positive integers e1 , e2 , … , ek such 6 = 330 x 9 + 156 x (-19)
e e e e (22 ∙ 1) + (23 ∙ 0) + 22 = 8 x 2 + 6
that n = p11 p22 p33 … pkk , and any other expression for n as a
.

(24 ∙ 1) + (25 ∙ 1) + 2=8x0+2 So x = 9 and y = -19.


product of prime numbers is identical to this except, perhaps, for
.

(26 ∙ 0) + (27 ∙ 0)
the order in which the factors are written.
.

= (181)10 So (10110101)2 = (265)8 Take note there are multiple solutions to x and y (non-
Theorem 4.3.1 – Lower Bound uniqueness of Bézout’s Identity). Once a solution pair (x,
An integer b is said to be a lower bound for a set X ⊆ Z if b ≤ x for all Binary Notation – Base 2 to Base 16 (Hexadecimal) y) is found, additional pairs may be generated by
kb ka
x ∈ X. 0000 = 0 0001 = 1 0010 = 2 0011 = 3 (x + ,y- ), where k is any integer.
d d
0100 = 4 0101 = 5 0110 = 6 0111 = 7
Theorem 4.3.2 – Well Ordering Principle
1000 = 8 1001 = 9 1010 = A 1011 = B Definition 4.5.4 – Relatively Prime
If a non-empty set S ⊆ Z has a lower bound, then S has a least
1100 = C 1101 = D 1110 = E 1111 = F Integers a and b are relatively prime (or coprime) if, and
element.
i.e. (109)10 = (0110 1101)2 = (6D)16 only if, gcd(a, b) = 1.
Proposition 4.3.3 – Uniqueness of Least Element
If a set S of integers has a least element, then the least element is Definition 4.5.1 – Greatest Common Divisor Proposition 4.5.5
unique. Let a and b be non-zero integers. The greatest common divisor of a For any non-zero integers a and b, if c is a common divisor
and b, denoted gcd(a, b), is the integer d satisfying: of a and b, then c | gcd(a, b).
a. d | a and d | b
b. ∀c ∈ Z, if c | a and c | b, then c ≤ d
Definition 4.6.1 – Least Common Multiple Corollary 8.4.4 (Epp)
For any non-zero integers a and b, their least common multiple, denoted lcm(a, b), is the Let a, b and n be integers with n > 1. Then:
positive integer m such that: a. ab ≡ [(a mod n)(b mod n)] (mod n)
a. a | m and b | m b. am ≡ [(a mod n)m ] (mod n), for a positive integers m
b. ∀c ∈ Z, if a | c and b | c, then m ≤ c
Definition 4.7.2 – Multiplicative Inverse of Modulo n
Take note that gcd(a, b) x lcm(a, b) = ab. For any integers a and n with n > 1, if an integer s such that as ≡ 1 (mod n), then s is called the
Definition 4.7.1 – Congruence Modulo multiplicative inverse of a mod n, and the inverse may be written as a−1 .
Let m and n be integers, and let d be a positive integer. We say that m is congruent to n By commutative law (which still applies in modulo arithmetic),
modulo d, denoted as m ≡ n (mod d), if, and only if, d | (m – n). a−1 a ≡ 1 (mod n).
Number Theory

m ≡ n (mod d) ⇔ d | (m – n)
Theorem 4.7.3 – Existence of Multiplicative Inverses
Theorem 8.4.1 (Epp) – Modular Equivalences For any integer a, its multiplicative inverse modulo n (where n > 1) a−1 exists if, and only if, a and n are
Let a, b and n be any integers and suppose n > 1. The following statements are all equivalent: coprime.
a. n | (a – b)
b. a ≡ b (mod n) Corollary 4.7.4 – Special Case: n is Prime
c. a = b + kn, for some integer k If n = p is a prime number, then all the integers in the range 0 < a < p have multiplicative inverses
d. a and b have the same non-negative remainder when divided by n modulo p.
e. a mod n = b mod n
Theorem 8.4.9 (Epp)
Theorem 8.4.3 (Epp) – Modulo Arithmetic
For all integers a, b, c and n with n > 1 and a and n are coprime, if ab ≡ ac (mod n), then b ≡ c (mod n).
Let a, b, c, d and n be integers with n > 1 and suppose a ≡ c (mod n) and b ≡ d (mod n), then:
a. (a + b) ≡ (c + d) (mod n)
b. (a – b) ≡ (c – d) (mod n)
c. ab ≡ cd (mod n)
d. am ≡ c m (mod n), for all positive integers m

5.3.1 – Arithmetic Sequence 5.3.3 – Square Numbers 5.3.6 – Binomial Numbers (Pascal’s/Yang Hui’s Triangle) 5.4.0 – Solving Recurrences
Explicit Formula: an = a0 + nd Explicit Formula: □n = n2 1. Look it up.
n
Sum of first n terms: Sn = (2a + (n − 1)d)
2
5.3.4 – Triangle Numbers 2. Guess and check (aka iteration).
Sequences

n(n+1)
5.3.2 – Geometric Sequence Explicit Formula: △n =
2
Explicit Formula: an = a0 r n 3. Use formula (Theorem 5.8.1/5.8.3 (Epp)).
a(rn −1)
Sum of first n terms: Sn = 5.3.5 – Fibonacci Numbers
r−1
a (1+√5)n −(1−√5)n
Sum to infinity (where |r| < 1): S∞ = Explicit Formula: Fn = Explicit Formula (entry in nth row and kth column):
1−r 2n √5
n n−1 n−1
( )=( )+( )
k k−1 k

Definition 6.3.1 – Empty Set Proposition 6.3.3 Definition 6.3.4 – Power Set
An empty set has no element, and is denoted as ∅ or {}. For any two sets X and Y, X is a subset of Y and Y is a subset of X Given any set S, the power set of S, denoted by P(S), or 2S , is the
if, and only if, X = Y . set whose elements are all the subsets of S, nothing less and
Theorem 6.2.4 (Epp) – An Empty Set is a Subset of all Sets
∀X ∀Y ((Z ⊆ X ꓥ Z ⊆ Y) ↔ X = Y) nothing more. That is, given set S, if T = P(S), then:
Sets

∀X ∀Z ((∀Y ~ (Y ∈ X)) → (X ⊆ Z))


Corollary 6.2.5 (Epp) – The Empty Set is Unique ∀X ((X ∈ T ↔ X ⊆ S))
Definition 6.3.2 – Set Equality
Two sets are equal if and only if they have the same elements. ∀X1 ∀X2 ((∀Y (~(Y ∈ X1 )) ꓥ (~(Y ∈ X2 ))) → X1 = X2 ) If S has n elements, then 2S has 2n elements.
∀X ∀Y ((∀Z (Z ∈ X ↔ Z ∈ Y)) ↔ X = Y)
Definition 6.4.1 – Union Definition 6.4.3 – Intersection Definition 6.4.7 – Partition
Let S be a set of sets, then we say that T is the union of the Let S be a non-empty set of sets. The intersection of the sets in S Let S be a set, and let V be a set of non-empty
sets in S, and write: is the set T whose elements belong to all the sets in S, nothing subsets of S. Then V is called a partition of S if,
T = ⋃S = ⋃ X less and nothing more. That is, given S, the set T is such that: and only if, the sets in V are mutually disjoint and
the union of the sets in V equals S.
X∈S ∀Y ((Y ∈ T) ↔ ∀Z((Z ∈ S) → (Y ∈ Z)))
If, and only if, each element of T belongs to some set in S,
nothing less and nothing more. That is, given S, the set T is Definition 6.4.8 – Non-symmetric Difference
We write:
such that: Let S and T be two sets. The (non-symmetric)
T = ⋂S = ⋂ X difference (or relative complement) of S and T,
∀Y ((Y ∈ T) ↔ ∃Z((Z ∈ S) ꓥ (Y ∈ Z)))
X∈S denoted S − T 3 is the set whose elements
For two sets A and B, we may simply write T = A ∪ B. For two sets A and B, we may simply write T = A ∩ B. belong to S and do not belong to T, nothing
less and nothing more.
Proposition 6.4.2 Proposition 6.4.4 ∀X ((X ∈ S - T) ↔ (X ∈ S ꓥ ~ (X ∈ T)))
Let A, B and C be sets. Then: Let A, B and C be sets. Then:
• ⋃ ∅ = ⋃A ∈ ∅ A = ∅ • A∩∅=∅ Definition 6.4.9 – Symmetric Difference
Sets

• ⋃{A} = A • A∩B=B∩A Let S and T be two sets. The symmetric


• A∪∅=A • A ∩ (B ∩ C) = (A ∩ B) ∩ C difference of S and T, denoted S − T 4 is the set
• A∪B=B∪A • A⊆B↔A∩B=A whose elements belong to S or T but not both,
• A ∪ (B ∪ C) = (A ∪ B) ∪ C Distributivity Laws: nothing less and nothing more.
• A∪A=A • A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
• A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
∀X ((X ∈ S ⦵ T) ↔ (X ∈ S ⨁ X ∈ T))
• A⊆B↔A∪B=B
Definition 6.4.10 – Set Complement
Definition 6.4.5 – Disjoint
Let U be the Universal set (or the Universe of
Let S and T be two sets. S and T are disjoint if, and only if, A ∩ B
Discourse) and let A be a subset of U. Then, the
= ∅.
complement (or absolute complement) of A,
Definition 6.4.6 – Mutually Disjoint denoted AC , is U - A.
Let V be a set of sets. The sets T 2 V are mutually disjoint if, and
only if, every two distinct sets are disjoint.
∀X, Y ∈ V (X ≠ Y → X ∩ Y = ∅)

Definition 8.1.1 – Ordered Pair Definition 8.1.3 – Cartesian Product Definition 8.2.3 – Image/Range
Let S be a non-empty set, and let x; y be two elements in S. The Let S and T be two sets. The Cartesian product (or cross product) of S The image (or the range) of R is the set Im(R) = {t ∈ T | ∃s ∈
ordered pair, denoted (x; y), is a mathematical object in which and T, noted S x T is the set such that: S (s R t)}.
the first element of the pair is x and the second element is y. ∀X ∀Y ((X, Y) ∈ S x T ↔ (X ∈ S) ꓥ (Y ∈ T))
Two ordered pairs (x, y) and (a, b) are equal if, and only if, x = a Definition 8.2.4 – Co-domain
and y = b. Definition 8.1.4 – Generalised Cartesian Product The co-domain of R is the set coDom(R) = T.
Given sets A1 , A2 , … , An , the Cartesian product of A1 , A2 , … , An,
Relations

Definition 8.1.2 – Ordered n-tuple denoted A1 × A2 × … × An, is the set of all ordered n-tuples Proposition 8.2.5
Let n be a positive integer and let x1 , x2 , … , xn be (not (a1 , a2 , … , an ) where a1 ∈ A1 , a2 ∈ A1 , . . . , an ∈ An . Let R be a binary relation. Then Im(R) ⊆ coDom(R).
necessarily distinct) elements. The ordered n-tuple,
(x1 , x2 , … , xn ), consists of x1 , x2 , … , xn together with the Definition 8.2.1 – Binary Relation Definition 8.2.6
ordering: first x1 , then x2 , and so forth up to xn . An ordered 2- Let S and T be two sets. A binary relation from S to T, noted R, is a Let S and T be sets. Let R ⊆ S x T be a binary relation. The
tuple is called an ordered pair, and an ordered 3-tuple is called subset of the Cartesian product S x T. inverse of the relation R, denoted R−1 , is the relation from
an ordered triple. T to S such that:
Definition 8.2.2 – Domain
∀s ∈ S, ∀t ∈ T (t R−1 s ↔ s R t)
The domain of R is the set Dom(R) = {s ∈ S | ∃t ∈ T (s R t)}.
Definition 8.2.7 Theorem 8.3.4 (Epp) – Partition Induced by an Equivalence Relation Hasse Diagrams
Let Si , for i = 1 to n, be n sets. An n-ary relation on the sets Si , Let R be an equivalence relation on a set A. Then the set of distinct
denoted R, is a subset of the Cartesian product ∏ni=1 Si . We call equivalence classes form a partition of A.
n the arity or degree of the relation.
Lemma 8.3.2 (Epp)
Definition 8.2.8 Let R be an equivalence relation on a set A and let a and b be two
Let S, T and U be sets. Let R ⊆ S x T be a relation. Let R’ ⊆ T x U elements in A. if a R b then [a] = [b].
be a relation. The composition of R with R’, denoted R’ o R, is
the relation from S to U such that: Lemma 8.3.3 (Epp)
∀x ∈ S, ∀z ∈ U (x R’ o R z ↔ (∃y ∈ T (x Ry ꓥ y R’ z)). If R be an equivalence relation on a set A and a and b are elements in
A, then either [a] ∩ [b] = ∅ or [a] = [b]. - Draw the directed graph so that all arrows point upwards.
Proposition 8.2.9 – Composition is Associative - Eliminate all self-loops.
Let S, T, U and V be sets. Let R ⊆ S x T be a relation. R’ ⊆ T x U Theorem 8.3.1 (Epp) – Equivalence Relation Induced by a Partition - Eliminate all arrows implied by the transitive property.
be a relation. Let R’’ ⊆ T x U be a relation. Given a partition S1 , S2 , … of a set A, there exists an equivalence - Remove the direction of the arrows.
R’’ o (R’ o R) = (R’’ o R’) o R = R’’ o R’ o R relation R on A whose equivalence classes make up precisely that
partition. Definition 8.6.3 – Comparable
Proposition 8.2.10 Let ≼ be a partial order on a set A. Elements a, b of A are
Let S, T, and U be sets. Let R ⊆ S x T be a relation. R’ ⊆ T x U be a Definition 8.5.1 – Transitive Closure said to be comparable if, and only if, either a ≼ b or b ≼ a.
relation. Let A be a set. Let R be a relation on A. The transitive closure of R, Otherwise, a and b are called noncomparable.
(R’ o R) −1 = R−1 o R′−1 denoted Rt , is a relation that satisfies these three properties:
1. Rt is transitive. Definition 8.6.4 – Total Order
Definition 8.3.1 – Reflexive 2. R⊆ Rt . Let ≼ be a partial order on a set A. ≼ is said to be a total
3. If S is any other transitive relation such that R⊆ S, then Rt ⊆ order if, and only if, ∀x, y ∈ A (x ≼ y ꓦ y ≼ x). In other
Relations

R is said to be reflexive if, and only if, ∀x ∈ A (x R x).


S. words, ≼ is a total order if ≼ is a partial order and all x and
Definition 8.3.2 – Symmetric y are comparable.
R is said to be symmetric if, and only if, ∀x, y ∈ A (x R y → y R x). Proposition 8.5.2
Let R be a relation on set A. Then, Definition 8.6.5 – Maximal

Definition 8.3.3 – Transitive An element x is a maximal element if, and only if, ∀y ∈ A (x
Rt = ⋃ Ri ≼ y → x = y).
R is said to be transitive if, and only if, ∀x, y, z ∈ A ((x R y ꓥ y R z)
𝐢=𝟏
→ x R z).
Definition 8.6.6 – Maximum
Definition 8.6.1 – Anti-symmetric
Definition 8.3.4 – Equivalence Relation An element T is the maximum element if, and only if, ∀x ∈
R is said to be anti-symmetric if, and only if,
R is called an equivalence relation if and only if R is reflexive, A (x ≼ T).
∀x ∈ A, ∀y ∈ A ((x R y ꓥ y R x) → x = y)
symmetric, and transitive.
Definition 8.6.7 – Minimal
Definition 8.6.2 – Partial Order
Definition 8.3.5 – Equivalence Class An element x is a minimal element if, and only if, ∀y ∈ A (y
R is said to be a partial order if, and only if, it is reflexive, anti-
Let x ∈ A. The equivalence class of x, denoted [x], is the set of all ≼ x → x = y).
symmetric and transitive.
elements y ∈ A that are in relation with x.
[x] = {y ∈ A | x R y} Definition 8.6.8 – Minimum
An element ⊥ is the minimum element if, and only if, ∀x ∈
A (⊥ ≼ x).

Definition 8.6.9 – Well Ordered


Let ≼ be a total order on a set A. A is well ordered if, and
only if, every non-empty subset of A contains a minimum
element, formally:
∀S ∈ P(A) (S ≠ ∅ → (∃x ∈ S ∀y ∈ S (x ≼ y)))
Definition 7.1.1 – Function Definition 7.2.1 – Injective Proposition 7.3.1 – Composition
Let f be a relation such that f ⊆ S x T. Then f is a function from S Let f : S → T be a function. f is injective if, and only if, Let f : S → T be a function. Let g : T → U be a function. The
to T, denoted f : S → T if, and only if, ∀y ∈ T, ∀x1 , x2 ∈ S ((f(x1 ) = y ꓥ f(x2 ) = y) → x1 = x2 ) composition of f and g, g o f, is a function from S to U.
∀x ∈ S, ∃y ∈ T (x f y ꓥ (∀z ∈ T (x f z → y = z))) We also say that f is an injection/one-to-one.
Every dot in T has at most one incoming arrow. Definition 7.3.2 – Identity Function
Definition 7.1.2 – Pre-image Given a set A, the identity function IA from A to A is:
Let f : S → T be a function. Let x ∈ S. Let y ∈ T such that f(x) = y. Definition 7.2.2 – Surjective ∀x ∈ A, (IA (x) = x)
Then x is called the pre-image of y. Let f : S → T be a function. f is surjective if, and only if,
∀y ∈ T, ∃x ∈ S (f(x) = y) Proposition 7.3.3
Functions

Definition 7.1.3 – Inverse Image (1) We also say that f is a surjection/onto. Let f : A → A be an injective function on A. Then f −1 o f = IA .
Let f : S → T be a function. Let y ∈ T. The inverse image of y is the Every dot in T has at least one incoming arrow.
set of all its pre-images: {x ∈ S | f(x) = y}. Definition 7.3.4 – n-ary Operation
Definition 7.2.3 – Bijective An n-ary operation on set A is a function f : ∏n1 A → A. n is
Definition 7.1.4 – Inverse Image (2) Let f : S → T be a function. f is bijective if, and only if, f called the arity or degree of the operation.
Let f : S → T be a function. Let U ⊆ T. The inverse image of U is is injective and f is surjective. We also say that f is a
the set of all the pre-images of all elements of U: bijection. Definition 7.3.5 – Unary Operation
{x ∈ S | ∃y ∈ U, f(x) = y}. Every dot in T has exactly one incoming arrow. An unary operation on a set A is a function f : A → A.

Definition 7.1.5 – Restriction Proposition 7.2.4 – Inverse Definition 7.3.6 – Binary Operation
Let f : S → T be a function. Let U ⊆ S. The restriction of f to U is Let f : S → T be a function and let f −1 be the inverse relation of f from A binary operation on a set A is a function f : A x A → A.
the set {(x, y) ∈ U x T | f(x) = y}. T to S. Then f is bijective if, and only if, f −1 is a function.

Definition – Sample Space Theorem 9.2.2 (Epp) – Permutations Theorem 9.4.1 (Epp)– The Pigeonhole Principle
A sample space is the set of all possible outcomes of a random process The number of permutations of a set with n ≥ 1 elements is n!. For any function f from a finite set X with n elements to
or experiment. a finite set Y with m elements, if n > m, then f is not
Theorem 9.2.3 (Epp) – r-permutations from a Set of n Elements one-to-one.
Notation If n and r are integers and 1 ≤ r ≤ n, then the number of r-
For a finite set A, N(A) denotes the number of elements in A. permutations of a set of n elements is given by the formulas Generalised Pigeonhole Principle: for any function f
n! from a finite set X with n elements to a finite set Y with
P(n, r) = n(n – 1)(n – 2)…(n – r + 1) or P(n, r) = (n−r)!
Equally Likely Probability Formula m elements and for any positive integer k, if k < n/m,
If S is a finite sample space in which all outcomes are equally likely and then there is some y ∈ Y such that y is the image of at
Counting & Probability

Theorem 9.3.1 (Epp) – The Addition Rule


E is an event in S, then the probability of E, denoted P(E), is: least k + 1 distinct elements of X.
Number of outcomes in E N(E) Suppose a finite set A equals the union of k distinct mutually
P(E) = = disjoint subsets A1 , A2 , … , Ak . Then N(A) =
Total number of outcomes in S N(S) Contrapositive Form: If for each y ∈ Y, f −1 (y) has at
N(A1 ), N(A2 ), … , N(Ak ).
most k elements, then X has at most km elements (n ≤
Theorem 9.1.1 (Epp) – The Number of Elements in a List km).
Theorem 9.3.2 (Epp) – The Difference Rule
If m and n are integers and m ≤ n, then there are n – m + 1 integers
If A is a finite set and B is a subset of A, then N(A – B) = N(A) – N(B).
from m to n inclusive. Theorem 9.4.2 (Epp) – One-to-One & Onto Finite Sets
Let X and Y be finite sets with the same number of
Theorem 9.3.3 (Epp) – The Inclusion/Exclusion Rule for 2/3 Sets
Theorem 9.2.1 (Epp) – Multiplication Rule elements and suppose f is a function from X to Y. Then f
If A, B and C are any finite sets, then
If an operation consists of k steps and the first step can be completed in is one-to-one if, and only if, f is onto.
n1 ways, the second step in n2 ways (regardless of how the first step N(A ∪ B) = N(A) + N(B) – N(A ∩ B)
was performed), ... , the kth step in nk ways (regardless of how the and
preceding steps were performed), then the entire operation can be
N(A ∪ B ∪ C) = N(A) + N(B) + N(C)
performed in n1 × n2 × … × nk ways.
– N(A ∩ B) – N(A ∩ C) – N(B ∩ C) + N(A ∩ B ∩ C)
Theorem 9.5.1 (Epp) – Formula For (𝐧𝐫) Which Formula to Use? Definition – Expected Value
The number of subsets of size r (or r-combinations) that can be chosen Repetition Order Matters Order Doesn’t Matter Suppose the possible outcomes of an experiment, or
from a set of n elements, (nr), is given by the formulas random process, are real numbers a1 , a2 , ⋯ , an which
k+n−1
P(n,r) n! Allowed nk ( ) occur with probabilities p1 , p2 , ⋯ , pn . The expected
(nr) = or (nr) = k
r! r!(n−r)! value of the process is
where n and r are non-negative integers with r ≤ n. n n
Not Allowed P(n, k) ( )
k ∑ ak pk = a1 p1 + a2 p2 + a3 p3 + ⋯ + an pn
Theorem 9.5.2 (Epp) – Permutations with Sets of [Identical] Objects Theorem 9.7.1 (Epp) – Pascal’s Formula k=1
Suppose a collection of n objects of which n1 are of type 1 and are Let n and r be positive integers, r ≤ n. Then
indistinguishable from each other, n2 are of type 2 and are Definition – Conditional Probability
n+1 n n
indistinguishable from each other, … , and nk are of type k and are ( )=( )+( ) Let A and B be events in a sample space S. If P(A)  0,
r r−1 r
indistinguishable from each other. Suppose n1 + n2 + ⋯ + nk = n, then the conditional probability of B given A, denoted
then the number of distinguishable permutations of the n objects is Theorem 9.7.2 (Epp) – Binomial Theorem P(B|A), is
n n − n1 n − n1 − n2 n − n1 − ⋯ − nk−1 n! P(A ∩ B)
( )( )( )…( )= Given any real numbers a and b and any non-negative integer n, P(B|A) =
n1 n2 n3 nk n1 ! n2 ! … nk ! (a + b)n = ∑nk=0(nk) an−k bk = an + (n1)an−1 b1 + ⋯ + bn P(A)
Counting & Probability

Definition – Multiset Theorem 9.9.1 (Epp) – Bayes’ Theorem


Probability Axioms
An r-combination with repetition allowed, or multiset of size r, chosen Suppose that a sample space S is a union of mutually
Let S be a sample space. A probability function P from the set of all
from a set X of n elements is an unordered selection of elements taken disjoint events B1, B2, …, Bn. Suppose A is an event in S,
events in S to the set of real numbers satisfies the following
from X with repetition allowed. If X = {x1 , x2 , … , xn }, we write an r- and suppose A and all the Bi have non-zero
axioms:
combination with repetition allowed as [xi1 , xi2 , … , xir ] where each xij probabilities. If k is an integer with 1  k  n, then
For all events A and B in S, P(A|Bk )∙P(Bk )
is in X and some of the xij may equal each other. 1. 0 ≤ P(A) ≤ 1 P(Bk |A) =
P(A|B1 )∙P(B1 )+P(A|B2 )∙P(B2 )+⋯+P(A|Bn )∙P(Bn )
2. P(∅) = 0 and P(S) = 1
Theorem 9.6.1 (Epp) – Number of r-combinations (Repetition Allowed) 3. If A and B are disjoint (A ∩ B = ∅), Definition – Independent Events
The number of r-combinations with repetitions allowed (multisets of then P(A ∪ B) = P(A) + P(B) If A and B are events in a sample space S, then A and B
size r) that can be selected from a set of n elements is: are independent, if and only if, P(A ∩ B) = P(A) x P(B).
r+n−1 Probability of the Complement of an Event
( )
r If A is any event in a sample space S, then P(AC ) = 1 - P(A). Definition – Pairwise and Mutually Independent
This equals the number of ways r objects can be selected from n Let A, B and C be events in a sample space S. A , B and C
categories of objects with repetitions allowed. Probability of a General Union of Two Events are pairwise independent, if and only if, they satisfy
If A and B are any events in a sample space S, then P(A ∪ B) = P(A) conditions 1 – 3 below. They are mutually independent
+ P(B) - P(A ∩ B). if, and only if, they satisfy all four conditions below.
1. P(A ∩ B) = P(A)  P(B)
2. P(A ∩ C) = P(A)  P(C)
3. P(B ∩ C) = P(B)  P(C)
4. P(A ∩ B ∩ C) = P(A)  P(B)  P(C)

10.1 – Definitions and Basic Properties


A graph G consists of Edges incident on v4: e1, e4 and e5
▪ a set of vertices V(G), and Vertices adjacent to v4: v1, v3 and v4
Graphs & Trees

▪ a set of edges E(G). Edges adjacent to e2: e3 and e4


We also write G = {V, E}.
Where V = {v1, v2, v3, v4, v5, v6, v7} and E = {e1, e2, e3, e4, e5, e6},
e1 = {v1, v4}, e2 = e3 = {v2, v3}, e4 = {v3, v4}, e5 = {v4, v4} and e6 = {v6, v7}.
Definition – Directed Graph Proposition 10.1.3 (Epp) Definition – Euler Circuit
A directed graph, or digraph, G, consists of 2 finite sets: a In any graph, there are an even number of vertices of odd degree. Let G be a graph. An Euler circuit for G is a circuit that
nonempty set V(G) of vertices and a set D(G) of directed contains every vertex and every edge of G. That is, an Euler
edges, where each edge is associated with an ordered pair of circuit for G is a sequence of adjacent vertices and edges in
10.2 – Trails, Paths and Circuits
vertices called its endpoints. If edge e is associated with the G that has at least one edge, starts and ends at the same
Let G be a graph, and let v and w be vertices of G.
pair (v, w) of vertices, then e is said to be the (directed) edge vertex, uses every vertex of G at least once, and uses every
A walk from v to w is a finite alternating sequence of adjacent vertices
from v to w. We write e = (v, w). edge of G exactly once.
and edges of G. Thus a walk has the form v0 e1 v1 e2 … vn-1 en vn , where
Definition – Simple Graph the v’s represent vertices, the e’s represent edges, v0=v, vn=w, and for Theorem 10.2.2 (Epp)
A simple graph is an undirected graph that does not have any all i  {1, 2, …, n}, vi-1 and vi are the endpoints of ei. If a graph has an Euler circuit, then every vertex of the
loops or parallel edges. • The trivial walk from v to v consists of the single vertex v. graph has positive even degree.
• A trail from v to w is a walk from v to w that does not contain Contrapositive: If some vertex of a graph has odd degree,
Definition – Complete Graph
a repeated edge. then the graph does not have an Euler circuit.
A complete graph on n vertices, n > 0, denoted Kn, is a simple
• A path from v to w is a trail that does not contain a repeated
graph with n vertices and exactly one edge connecting each Theorem 10.2.3 (Epp)
vertex.
pair of distinct vertices. If a graph G is connected and the degree of every vertex of
• A closed walk is a walk that starts and ends at the same
Definition – Complete Bipartite Graph vertex. G is a positive even integer, then G has an Euler circuit.
A complete bipartite graph on (m, n) vertices, where m, n > 0, • A circuit (or cycle) is a closed walk that contains at least one Definition – Euler Trail
denoted Km,n, is a simple graph with distinct vertices v1, v2,…, edge and does not contain a repeated edge. Let G be a graph, and let v and w be two distinct vertices of
vm, and w1, w2,…, wn that satisfies the following properties: • A simple circuit (or simple cycle) is a circuit that does not have G. An Euler trail/path from v to w is a sequence of adjacent
For all i, k = 1, 2, …, m and for all j, l = 1, 2, …, n, any other repeated vertex except the first and last. edges and vertices that starts at v, ends at w, passes
1. There is an edge from each vertex vi to each vertex
Graphs & Trees

through every vertex of G at least once, and traverses every


w j. Repeated Repeated Starts And Ends Must Contain At
Edge Vertex At Same Point Least One Edge edge of G exactly once.
2. There is no edge from any vertex vi to any other
vertex vk. Walk Allowed ✓ Allowed ✓ Allowed ✓ No ✘ Theorem 10.2.4 (Epp)
3. There is no edge from any vertex wj to any other Trail No ✘ Allowed ✓ Allowed ✓ No ✘ A graph G has an Euler circuit if, and only if, G is connected
vertex wl. and every vertex of G has positive even degree.
Path No ✘ No ✘ No ✘ No ✘
Definition – Subgraph of a Graph Closed Corollary 10.2.5 (Epp)
Allowed ✓ Allowed ✓ Yes ✓ No ✘ Let G be a graph, and let v and w be two distinct vertices of
A graph H is said to be a subgraph of graph G if, and only if, Walk
every vertex in H is also a vertex in H, every edge in H is also Circuit No ✘ Allowed ✓ Yes ✓ Yes ✓ G. There is an Euler trail from v to w if, and only if, G is
an edge in G, and every edge in H has the same endpoints as it connected, v and w have odd degree, and all other vertices
Simple First and
has in G. No ✘ Yes ✓ Yes ✓ of G have positive even degree.
Circuit Last only
Definition – Degree of a Vertex and Total Degree of a Graph Definition – Hamiltonian Circuit
Let G be a graph and v a vertex of G. The degree of v, denoted Definition – Connectedness Given a graph G, a Hamiltonian circuit for G is a simple
deg(v), equals the number of edges that are incident on v, Two vertices v and w of a graph G are connected if, and only if, there is a circuit that includes every vertex of G. That is, a
with an edge that is a loop counted twice. The total degree of walk from v to w. The graph G is connected if, and only if, given any two Hamiltonian circuit for G is a sequence of adjacent vertices
G is the sum of the degrees of all the vertices of G. vertices v and w in G, there is a walk from v to w. Symbolically, G is and distinct edges in which every vertex of G appears
connected if, and only if,  vertices v, w V(G),  a walk from v to w. exactly once, except for the first and the last, which are the
Theorem 10.1.1 (Epp) – The Handshake Theorem same.
If the vertices of G are v1, v2, …, vn, where n  0, then the total Definition – Connected Component
degree of G = deg(v1) + deg(v2) + … + deg(vn) = 2  (the A graph H is a connected component of a graph G if, and only if, Proposition 10.2.6 (Epp)
number of edges of G). 1. The graph H is a subgraph of G; If a graph G has a Hamiltonian circuit, then G has a
2. The graph H is connected; and subgraph H with the following properties:
Corollary 10.1.2 (Epp) 3. No connected subgraph of G has H has a subgraph and 1. H contains every vertex of G.
The total degree of a graph is even. contains vertices or edges that are not in H. 2. H is connected.
3. H has the same number of edges as vertices.
4. Every vertex of H has degree 2.
10.3 – Matrix Representation of Graphs 10.4 – Isomorphisms of Graphs Lemma 10.5.1 (Epp)
Any non-trivial tree has at least one vertex of degree 1.
Definition – Adjacency Matrix of a Directed Graph Definition – Isomorphic Graph
Let G be a directed graph with ordered vertices v1, v2, … vn. Let G and G' be graphs with vertex sets V(G) and V(G') and edge sets
Theorem 10.5.2 (Epp)
The adjacency matrix of G is the n  n matrix A = (aij ) over the E(G) and E(G') respectively. G is isomorphic to G' if, and only if, there
Any tree with n vertices (n > 0) has n – 1 edges.
set of non-negative integers such that aij = the number of exist one-to-one correspondences g: V(G)  V(G') and h: E(G)  E(G')
arrows from vi to vj for all i, j = 1, 2, …, n. that preserve the edge-endpoint functions of G and G' in the sense that
Lemma 10.5.3 (Epp)
for all v  V(G) and e  E(G), v is an endpoint of e  g(v) is an endpoint If G is any connected graph, C is any circuit in G, and one of
Definition – Adjacency Matrix of an Undirected Graph of h(e). the edges of C is removed from G, then the graph that
Let G be an undirected graph with ordered vertices v1, v2, … Theorem 10.4.1 (Epp) – Graph Isomorphism is an Equivalence Relation remains is still connected.
vn. The adjacency matrix of G is the n  n matrix A = (aij ) over Let S be a set of graphs and let R be the relation of graph isomorphism
the set of non-negative integers such that aij = the number of on S. Then R is an equivalence relation on S. Theorem 10.5.4 (Epp)
edges connecting vi and vj for all i, j = 1, 2, …, n. Definition – Invariant for Graph Isomorphism If G is a connected graph with n vertices and n – 1 edges,
A property P is called an invariant for graph isomorphism iff given any then G is a tree.
Definition – Symmetric Matrix graphs G and G', if G has property P and G' is isomorphic to G, then G'
An n  n square matrix A = (aij ) is called symmetric if, and only has property P.
10.6 – Rooted Trees
if, for all i, j = 1, 2, …, n, aij = aji . Definitions – Rooted Tree, Level & Height
Theorem 10.4.2 (Epp) – Invariants for Graph Isomorphism
Each of the following properties is an invariant for graph isomorphism, 1. A rooted tree is a tree in which there is one vertex
Theorem 10.3.1 (Epp) that is distinguished from the others and is called
where n, m, and k are all non-negative integers:
Let G be a graph with connected components G1, G1, …, Gk. If the root.
1. has n vertices; 6. has a simple circuit of length k;
there are ni vertices in each connected component Gi and 2. The level of a vertex is the number of edges along
2. has m edges; 7. has m simple circuits of length k;
Graphs & Trees

these vertices are numbered consecutively, then the the unique path between it and the root.
3. has a vertex of degree k; 8. is connected;
adjacency matrix of G has the form: 3. The height of a rooted tree is the maximum level
A1 O O 4. has m vertices of degree k; 9. has an Euler circuit;
O O of any vertex of the tree.
O A2 O ⋯ O O 5. has a circuit of length k; 10. has a Hamiltonian circuit.
O O A3 O O Definitions – Child, Parent, Sibling, Ancestor & Descendent
⋮ ⋮ Definition – Isomorphic
1. Given the root or any internal vertex v of a rooted
[O O O ⋯ O Ak ] If G and G' are simple graphs, then G is isomorphic to G' iff there exists a
tree, the children of v are all those vertices that
where each Ai is ni  ni adjacency matrix of Gi, for all i = 1, 2, …, one-to-one correspondence g from the vertex set V(G) of G to the
are adjacent to v and are one level farther away
k, and the O’s represent matrices whose entries are all 0s. vertex set V(G') of G' that preserves the edge-endpoint functions of G
from the root than v.
and G' in the sense that for all vertices u and v of G, {u, v} is an edge in G
2. If w is a child of v, then v is called the parent of w,
Definition – nth Power of a Matrix  {g(u), g(v)} is an edge in G'. and two distinct vertices that are both children of
For any n  n matrix A, the powers of A are defined as follows: the same parent are called siblings.
1. A0 = I where I is the n  n identity matrix 10.5 – Trees 3. Given two distinct vertices v and w, if v lies on the
2. An = A An – 1 for all integers n  1 Definitions – Circuit-Free, Tree, Trivial Tree & Forest unique path between w and the root, then v is an
1. A graph is said to be circuit-free if, and only if, it has no ancestor of w, and w is a descendant of v.
Theorem 10.3.2 (Epp) circuits.
If G is a graph with vertices v1, v2, …, vm and A is the adjacency 2. A graph is called a tree if, and only if, it is circuit-free and Definitions – Binary Tree & Full Binary Tree
matrix of G, then for each positive integer n and for all connected. 1. A binary tree is a rooted tree in which every
integers i, j = 1, 2, …, m, the ij-th entry of An = the number of 3. A trivial tree is a graph that consists of a single vertex. parent has at most two children. Each child is
walks of length n from vi to vj. 4. A graph is called a forest if, and only if, it is circuit-free and not designated either a left child or a right child (but
connected. not both), and every parent has at most one left
child and one right child.
Definitions – Terminal Vertex (Leaf) & Internal Vertex
2. A full binary tree is a binary tree in which each
Let T be a tree. If T has only one or two vertices, then each is called a
parent has exactly two children.
terminal vertex (or leaf). If T has at least three vertices, then a vertex of
degree 1 in T is called a terminal vertex (or leaf), and a vertex of degree
greater than 1 in T is called an internal vertex.
Definition – Left/Right Subtree 2. In-order (i.e. A, B, C, D, E, F, G, H, I) Definitions – Weighted Graph & Minimum Spanning Tree
Given any parent v in a binary tree T, if v has a left child, then 1. A weighted graph is a graph for which each edge
the left subtree of v is the binary tree whose root is the left has an associated positive real number weight.
child of v, whose vertices consist of the left child of v and all The sum of the weights of all the edges is the total
its descendants, and whose edges consist of all those edges of weight of the graph.
T that connect the vertices of the left subtree. The right 2. A minimum spanning tree for a connected
subtree of v is defined analogously. weighted graph is a spanning tree that has the
least possible total weight compared to all other
Theorem 10.6.1 (Epp) – Full Binary Tree Theorem
spanning trees for the graph.
If T is a full binary tree with k internal vertices, then T has a
3. If G is a weighted graph and e is an edge of G,
total of 2k + 1 vertices and has k + 1 terminal vertices (leaves).
then w(e) denotes the weight of e and w(G)
a. Traverse the left subtree by recursively calling the
Theorem 10.6.2 (Epp) denotes the total weight of G.
in-order function
For non-negative integers h, if T is any binary tree with height b. Print the data of the root (or current vertex)
h and t terminal vertices (leaves), then t  2h. Equivalently, Algorithm 10.7.1 – Kruskal
c. Traverse the right subtree by recursively calling the Input: G (a connected weighted graph with n vertices]
log2 t  h. in-order function Algorithm:
Binary Tree Traversal 3. Post-order (i.e. A, C, E, D, B, H, I, G, F) 1. Initialize T to have all the vertices of G and no
Breadth-First Search: In breadth-first search (by E.F. Moore), it edges.
starts at the root and visits its adjacent vertices, and then 2. Let E be the set of all edges of G, and let m = 0.
moves to the next level. The figure below shows the order of 3. While (m < n – 1)
the vertices visited: a. Find an edge e in E of least weight.
Graphs & Trees

b. Delete e from E.
c. If addition of e to the edge set of T does not
produce a circuit, then add e to the edge set of T
and set m = m + 1
d. End while
a. Traverse the left subtree by recursively calling the Output: T (T is a minimum spanning tree for G]
post-order function
b. Traverse the right subtree by recursively calling the Algorithm 10.7.2 – Prim
Depth-First Search:
post-order function Input: G (a connected weighted graph with n vertices)
There are three types of depth-first traversal:
c. Print the data of the root (or current vertex) Algorithm:
1. Pre-order (i.e. F, B, A, D, C, E, G, I, H)
1. Pick a vertex v of G and let T be the graph with
10.7 – Spanning Trees & Shortest Paths this vertex only.
2. Let V be the set of all vertices of G except v.
Definition – Spanning Tree 3. For i = 1 to n – 1
A spanning tree for a graph G is a subgraph of G that contains every a. Find an edge e of G such that (1) e connects
vertex of G and is a tree. T to one of the vertices in V, and (2) e has the
Proposition 10.7.1 least weight of all edges connecting T to a
Every connected graph has a spanning tree. Also, any two spanning vertex in V. Let w be the endpoint of e that is
trees for a graph have the same number of edges. in V.
a. Print the data of the root (or current b. Add e and w to the edge and vertex sets of T,
vertex) and delete w from V.
b. Traverse the left subtree by recursively Output: T (T is a minimum spanning tree for G]
calling the pre-order function
c. Traverse the right subtree by recursively
calling the pre-order function
Algorithm 10.7.3 – Dijkstra
Input: G (a connected simple graph with positive weight for
every edge),  (a number greater than the sum of the weights
of all the edges in G), w(u, v) (the weight of edge {u, v}), a (the
source vertex), z (the destination vertex).
Algorithm:
1. Initialize T to be the graph with vertex a and no
edges.
Let V(T) be the set of vertices of T, and let E(T) be
the set of edges of T.
2. Let L(a) = 0, and for all vertices in G except a, let L(u)
=.
Graphs & Trees

(The number L(x) is called the label of x.)


3. Initialize v to equal a and F to be {a}. (The symbol v is
used to denote the vertex most recently added to T)
4. Let Adj(x) denote the set of vertices adjacent to
vertex x. While (z V(T))
a. F  (F – {v}) ∪ {vertices  Adj(v) ꓥ  V(T)}
(The set F is the set of fringe vertices)
b. For each vertex u  Adj(v) ꓥ  V(T),
if L(v) + w(v, u) < L(u) then
L(u)  L(v) + w(v, u)
D(u)  v
c. Find a vertex x in F with the smallest label.
Add vertex x to V(T), and add edge {D(x), x} to
E(T).
vx
Output: L(z) (the length of the shortest path from a to z)

Created By: Stanley Tay Last Updated: 21/11/16

You might also like