You are on page 1of 65

Discrete Mathematics

Final Review
Zeph Grunschlag

Review

Agenda
List of sections covered
Review major concepts with formulae

Review

Sections Covered
1.1 Logic
1.2 Tautologies/Equivalence
1.3 Predicates/Quantifiers
1.4 Sets
1.5 Set Theory Operations
1.6 Functions
1.7 Sequences/Sums
1.8 Big-O, Big-, Big-
2.1 Algorithms
2.2 Complexity
2.3 Basic Number Theory
2.4 Number Theory Algorithms
2.5 RSA
(2.6 Matrices)
Review

3.1 Proofs
3.2 Induction
3.3 Recursive Definitions
3.4 Recursion
(3.5 Program Correctness)
4.1 Counting Basics
4.2 Pigeonhole Principle
4.3 Permutations and Combinations
4.4 Discrete Probability
4.5 Probability Theory
4.6 Generalizations
5.1 Recurrence Relations
5.2 Solving Linear Recurrences
5.5 Inclusion-Exclusion
5.6 More Inclusion-Exclusion
3

Sections Covered
6.1
6.2
6.3
7.1
7.2
7.3
7.4
7.5
7.7
7.8

Relation Basics
n-ary Relation
Representing Relations
Graph Basics
Graph Terminology
Graph Representations
Connectedness
Euler and Hamilton
Planar Graphs
Coloring

Review

Sections Skipped
2.6
3.5
4.7
5.3, 5.4
6.4, 6.5, 6.6
7.6

Logic
A proposition is a statement that is true
or false. Atomic propositions p,q,r
are combined to form compound
propositions using the following
logical connectives :

Review

Logical Connectives
Operator
Negation
Conjunction
Disjunction
Exclusive or
Conditional
Biconditional
Review

Symbol Usage

Java

not

and

&&

or

||

xor

(p||q)&&(!p||!q)

if,then

p?q:true

iff

(p&&q)||(!p&&!q)
6

Truth Tables
Logical operators/connectives are defined by
truth tables:
p
p
Negation truth table (unary):
F
T
T
F
Binary truth tables:
p
q
pq pq p q p q p q
T
T
F
F

T
F
T
F

T
F
F
F

T
T
T
F

F
T
T
F

T
F
T
T

T
F
F
T

Bit Strings
Can define logical operators on bit
strings. This is done bit by bit. No
carry-over is taken.
EG:
01 1011 0010 1001

Review

10 0010 1111 1001


11 1001 1101 0000
8

Tautologies
Logical Equivalence
A compound proposition is a tautology if it
is always true, regardless of the its
atomic propositions (e.g. p p ). If its
always false, its a contradiction (e.g.
pp ). If neither, its a contingency
(e.g. p p ).
Two compound propositions p, q are
logically equivalent if p q is a
tautology. Notation: p q .
Review

Contrapositive vs. Converse


Given an implication p q
the converse is q p
while the contrapositive is q p

Review

10

Logical Proofs
There are two basic techniques for proving
tautologies and logical equivalences:
1) Build a truth table. Verify that
last column is all TRUE for tautology
relevant columns equal for equivalence

2) Using tables on next pages, derive


TRUE starting from supposed tautology
1st proposition from 2nd
Review

11

Tables of Logical Equivalences


 Identity laws
Like adding 0

 Domination laws
Like multiplying by 0

 Idempotent laws
Delete redundancies

 Double negation
I dont like you, not

 Commutativity
Like x+y = y+x
 Associativity
Like (x+y)+z = y+(x+z)
 Distributivity
Like (x+y)z = xz+yz
Review

 De Morgan

12

Tables of Logical Equivalences

 Excluded middle
 Negating creates opposite
 Definition of implication in

terms of Not and Or

Review

13

Quantifiers
Existential Quantifier
reads there exists
Universal Quantifier
reads for all
Order matters:
y x R (x,y ) and x y R (x,y ) may
not be logically equivalent to.
Review

14

DeMorgan Identities
Not all true iff one is false.


Conjunctional version:
(p1p2pn) (p1p2pn)
Universal quantifier version:
x P(x ) x P(x )

Not one is true iff all are false.




Review

Disjunctional version:
(p1p2pn) (p1p2pn)
Existential quantifier version:
x P(x ) x P(x )

15

Logical English
Logical Puzzles
Precise English statements can be expressed in
terms of logical constructs. In cases of English
puzzles, this can be useful for solving.
EG: Can there be a man that shaves exactly all
the people that dont shave themselves.
Let S(x,y) = x shaves y. Asking if following
statement satisfiable:
x y S(y,y )  S(x,y)
Not satisfiable (trying plugging in y = x )1
Review

16

Standard Numerical Sets


Natural numbers: N = { 0, 1, 2, 3, 4, }
Integers: Z = { -3, -2, -1, 0, 1, 2, 3, }
Positive integers: Z+ = {1, 2, 3, 4, 5, }
Real numbers: R
Rational numbers: Q (decimal numbers with
repeating decimal expansion)

Review

17

Set Notation
element : 3 S
not an element : 3 S
subset : S T
strict subset : S T
empty (or null) set : {} or
cardinality : |{1, -13, 4, -13, 1}| = 3

Review

18

Set Theoretic Operations


power set : P (S ) or 2s


2nd version reminds us that |2s| = 2|s|

Cartesian product :



A B = { (a, b) | a A and b B }
|A1A2An| = |A1||A2| |An|

complement :
A={x|xA}
union :
A B = { x | x A x B }
intersection : A B = { x | x A x B }
difference :
A-B={x|xA xB}
symmetric difference:AB={ x | xA xB }
Review

19

Venn Diagrams
Complement

Intersection

Union

Review

Disjoint Union

AB
A

AB

A B

20

Venn Diagrams
Difference

Symmetric Difference

AB

U
AB

U
B

Review

21

Sets as Bit-Strings
If elements ordered, each set can be viewed as
bit-string s. Operators act on bit-strings:
complement A  1s complement -s
union A B  disjunction s t
intersection A B  conjunction s t
difference A - B  s (-t )
symmetric difference AB  s t
EG: If U = {1,2,3,4}, A = {2}=0100,
B = {1,2,4}=1101 then:

AB = 0100 1101 = 1001 = {1,4}


Review

22

Functions
One-to-One


NO:

NO:

YES:

NO:
 Reverse

YES:

Onto


Bijection (1-to-1 and onto)

NO:
 reverse:

YES:
 reverse:

Review

23

Function Notation
Composition : f g (a) = g ( f (a) )
n
Exponentiation :
f n (x ) = f f f f f (x )
Floor and Ceiling : x , x
f : A  B --function from A to B

 


domain

codomain

Range : f (A )
Review

24

Sequences and Strings


A sequence is a function N  S. A finite
sequence in S is a function from first n
numbers to S. Notation {ai } or just ai usually
used instead of f (i ). Finite sequences
expressed as n-tuples, e.g. (1,2,3,4,5).
A string is just a finite sequence where S is a set
of characters. Strings denoted by putting
characters together, e.g. 12345. Empty
string denoted by . Can concatenate strings
u and v to obtain u v (or usually just uv ).
EG: v = v = v. Reverse of w is denoted
by w R .
Review

25

Summations
Sum of first n
numbers: n
n(n + 1)
i=

2
i =1
Sum of first n k th
powers: n
k +1
k
i
=

(
n
)

Sum of a sequence
n from 0 to n :

a
i =0

= a0 + a1 + a2 + ... + an

Sum of all the


number in S :

x
xS

i =1

Double sum:
2

i=0

Review

j =1

Geometric sum:
ar n +1 a
ar = a + ar + ar + ... + ar =

r 1
i =0
n

ij

26

Cardinality and Countability


Countable ( 0 ): Same cardinality as N. I.e.,
there is a bijection with the natural numbers.
Lemmas: S is countable if
there is an onto function from another
countable set
there is an onto function from another
countable set
EG: Z is countable because it is enumerated by
the sequence

i + 1
ai = (1)

Review

27

Uncountability of R
Cantors Diabolical Diagonal
If R were countable could list all numbers in
(0,1) by a sequence:
r1 , r2 , r3 , r4 , r5 , r6 , r7,
Cantors diabolical diagonalization creates a
number revil between 0 and 1 which is not
on the list, contradicting countability
assumption. Let ri,j be the j th decimal digit
in the fractional part of i th number ri .
Define digits of revil by the following rule:
The j th digit of revil is 5 if rj,j 5. Otherwise
the j th digit is 4.
revil is an anti-diagonal of the seqencs {rn }
Review

28

Cantor's Diagonalization
Example

 Decimal expansions of ri 

r1
r2
r3
r4
r5
r6
r7
:
r
evil
Review

0.
0.
0.
0.
0.
0.
0.

1
1
2
7
0
5
7

2
5
5
8
1
5
6

3
1
4
9
1
5
7

4
1
2
0
0
5
9

5
1
0
6
1
5
5

6
1
9
2
0
5
4

7
1
0
3
1
5
4

0.

29

Big-O, Big-, Big-


DEF: Let f and g be functions with domain R0 or N
and codomain R.
f (x ) = O ( g (x ) ) if there are constants C and k
such x > k, |f (x )| C |g (x )|
f (x ) = (g (x )) iff g (x ) = O (f (x ))

f (x ) = (g (x )) iff f (x )=O(g(x)) f (x)=(g(x))


Evaluate lim f ( x) = a Limit exists
x g ( x )



if and only if f (x ) = O ( g (x ) )
and positive, then f (x ) = (g (x ))

Polynomials are big- of largest term


Sums are big-O of biggest term
Non-zero constants are irrelevant

30

Asymptotically Incomparable
Functions
Some functions are incomparable.
EG: |x 2 sin(x)| vs. 5x 1.5 :
y = x2
y = 5x 1.5
y = |x 2 sin(x)|

Review

31

Division, mod function


Divisor (or factor): If a = bc then b | a
How many pos. no.s N divisible by d ?
Answer:
N/d
Identities:




a|b a|c  a|(b + c )


a|b  a|bc
a|b b|c  a|c

Division Algorithm: Given dividend a and


divisor d there is a unique quotient q with
remainder r [0,d-1] satisfying: a = dq + r


Review

mod function : With a,d,q,r as above, define


a mod d = r

32

Primality, gcd, lcd


Prime : A number divisible only by itself and 1
Composite : A number that isnt prime.
Primality Test : x is composite iff its divisible by some
prime x
Fundamental Theorem of Arithmetic : Every number
can be decomposed uniquely into a product of prime
numbers.
Greatest common divisor (gcd): Biggest number which
divides both x and y.


THEOREM: There are integers s,t such that gcd(x,y) = sx+ty

lcm(x,y) = xy / gcd(x,y)

Least common multiple (lcm): Smallest number divisibl


by both x and y
Relatively Prime : two numbers with no common
factors. Equivalently: gcd(x,y ) = 1

Review

33

Euclidean and Extended


Euclidean Algorithm
INPUT : integers m, n
(m > 0, n 0 )
OUTPUT : gcd(m,n)
integer euclid(m,n)
x = m, y = n
while(y > 0)
r = x mod y
x=y
y=r
return x
Review

INPUT : integers m, n
(m > 0, n 0 )
OUTPUT : s, t such that
sm+tn = gcd(m,n)
(int.,int.) ext_euclid(m,n)
r = m mod n
//remainder
q = m/n
//quotient
(s,t ) = ext_euclid(n,r)
return ( t , s-tq )

34

Modular Congruence
Often confused with mod function.
a a (mod b) is a relation on Z, not a function!
DEF: a a (mod b) ) iff b | (a a ).


Equivalently: a a (mod b) ) iff a mod b = a mod b

Identities. Allow arithmetic in (mod b) world to make sense





a mod b a (mod b)
Suppose a a (mod b) and c c (mod b). Then:




a+c (a+c )(mod b)


ac ac (mod b)
a k a k (mod b)

Modular Inverse:




If a and b are relatively prime, can invert a in (mod b) world. x is


an inverse of a if ax 1 (mod b).
If x also in range [1,b -1], use notation x = a -1 (mod b)
Compute using extended Euclidean algorithm
1.
2.

3.
Review

Find s,t such that sa + tb = 1


Therefore sa = 1 tb so mod-b we have sa 1 (mod b)

a -1 (mod b) = s mod b is the inverse of a modulo b


35

Number Systems
A base-b number is a string
u = ak ak-1 ak-2 a2 a1 a0
with the ai taken from
{0,1,2,3,,b-2,b-1}.
u represents the number
(u )b = akbk+ak-1bk-1++a1b + a0
When b > 10, use capital letters:
A=10, B=11, C=12, etc.
Standard bases:
Binary (base-2)
Octal (base-8)
Decimal (base-10)
Hexadecimal (base-16)

Review

Base-b representation and/or


conversion algorithm :
INPUT :
positive integer n
positive integer b // the base
string represent(n,b)
q = n, i = 0
while( q > 0 )
ui = q mod b
q = q/b
i = i +1
return ui ui-1 ui-2 u2 u1 u0

36

Arithmetical Algorithms
Addition and Multiplication
Addition in any base b :
Binary multiplication:
string add(xk xk-1x1x0,
bitstring multiply(xk xk-1x1x0,
yk yk-1y1y0)
yk yk-1y1y0 , int b)
x = xk xk-1x1x0
carry = 0, xk+1 = yk+1 = 0
p=0
for(i = 0 to k+1)
for(i = 0 to k+1)
digitSum=carry+xi
+yi
if(yi == 1)
p = add(p , x << i )
zi =digitSum mod b
carry =digitSum /b return p
return zk+1zk zk-1z1z0
Review

37

1s and 2s Complement
1s Complement
Fix k bits.
Represent numbers |x | < 2k-1
Most significant bit tells the
sign



0 positive
1 negative

Positive numbers the same as


standard binary expansion
Negate numbers by flipping
all bits
Adding numbers:
1.
2.

Review

Add as usual.
If there was carryover, add 1

2s Complement
Fix k bits.
Represent no.s in [-2(k-1),2(k-1))
Most significant bit tells the
sign



0 positive
1 negative

Positive numbers the same as


standard binary expansion
Negate numbers by flipping all
bits then adding 1
Adding numbers:
1.
2.

Add as usual.
Drop any carryover!
38

Fast Modular Exponentiation


Fermats Little Theorem
To exponentiate quickly mod-N :
Use repeated squaring
technique coded on the right
Simplify as much as possible
before any squaring


(-7)2 mod 23 much easier


than 392 mod 23

May find cyclical pattern


Use Fermats Little Theorem1
when possible:



Review

a n a n mod p-1(mod p)
EG: 923 mod 23
= 9(23 mod 22) mod 23
= 91 mod 23 = 9

INPUT : integers m,e,N s.t e,N >0


fastExp(m,e,N)
unun-1 un-2 u2 u1 u0 =
representInBinary(e)
sqPow0= m mod N
for( i = 0 to n-1)
sqPowi+1 = sqPowi 2 mod N
pow = 1
for(i = 0 to n)
if (ui == 1 )
pow = powsqPowi mod N
return pow

39

Chinese Remainder Theorem


Solve1 x [0, m1m2m3)
x a1 (mod m1)
x a2 (mod m2)
x a3 (mod m3)
1. y1=a2a3 , y2=a1a3,
y3=a1a2
2. z1=y1(y1-1mod m1),
z2=y2(y2-1mod m2),
z3=y3(y3-1mod m3)
3. z = a1z1+a2z2+a3z3
4. x = z mod m1m2m3
Review

Theorem says solution


exists and is unique in
range [0, m1m2m3)
assuming m1 , m2 , m3
relatively prime.
Useful for carrying
arithmetic out relative a
big number N = m1m2m3
1.
2.

Carry out relative each mi


Patch solutions together by
Chinese remaindering

Proves that RSA


decryption works
40

Encryption and Decryption


Including RSA and Caesar
1. Messages are converted into blocks of numbers.
2. Each number block m is scrambled using some
modular function f (m).
Examples of f (m):

f (m) = (m+h) mod N with constants1 h,N
Decrypt  g (n) = (n - h) mod N

f (m) = (cm ) mod N with constants c,N
Decrypt  g (n) = (c-1n ) mod N

f (m)=(cm+h) mod N with constants c,h,N
Decrypt  g (n) = c-1 (n - h) mod N

f (m) = m e mod N with constants2 e,N
Decrypt  g (n) = m d mod N [d = e -1 (mod (p-1)(q -1))]
Review

41

Basic Proof Techniques


Prove statement P Q
Direct Proof

Useful Tricks
Try to use algebraic
Assume P true, show Q true
form of definition and
Indirect Proof
reduce algebraically
Assume Q false, show P false
Write rational numbers
Reductio Ad Absurdum1
(in Q) p/q with p,q
Assume P Q true,
show P Q true
relatively prime

Disrefutation of x P (x):
Just find a counterexample

Review

42

Mathematical Induction
Well Ordering Property: Non-empty subsets S of
N have a smallest element.
Simple Induction:
If the following hold:
1)
[basis] P (0) is true
2)
[induction] n P(n)P(n+1) is true
Then n P(n) is true

Strong Induction:
If the following hold:

[basis] P (0) (sometimes need more base cases)


2)
[strong induction] n [P (0)
P (1)
P (n)]  P(n+1)
Then: n P(n) is true
1)

Review

43

Recursive Definitions
Factorial
Fibonacci sequence
Binomial Coefficients
n-choose-k
Addition of nonnegative integers

1, if n = 0
n! =
n ( n 1)! , if n 1
n , if k = 0 or 1
f (n) =
f ( n 2 ) + f ( n 1), if k 2

0, if k < 0 or k > n

C (n, k ) = 1, if k = n = 0
C (n 1, k 1) + C (n 1, k ), otherwise

m, if n = 0

m + n = m + 1, if n = 1
( m + (n 1)) + 1, if n > 1

0, if n = 0
n 1
=
a

i
i =1
ai + an , if n > 0
i =1
1, if n = 0
n
n 1
a
=

i
a

i =1
i an , if n > 0
i =1
n

Summation Notation
Product Notation
Review

44

More Recursion:
Sets, Relations, Graphs
Can define sets and relations recursively as well.
Set of quantities payable with dimes and quarters:



BASE: 0 S
RECURSE: u + 10, u + 25 pal if u pal

Set of palindromes :



BASE:
, 0, 1 pal
RECURSE: 0u 0, 1u 1 pal if u pal

Connectedness relation R in a simple graph G=(E,V ):





Review

BASE:
RECURSE:
connected
connected

V R (every vertex is connected to itself)


If (a,b) R and {b,c} E then (a,c) R (if a is
to b, and there is an edge from b to c, then a is
to c)

45

Basic Counting Rules


Sum Rule : If A and B are
disjoint, then
|A B| = |A|+|B|
Product Rule


Set theoretic:
|A B| = |A||B|
Combinatorial: If have n
stages, where i th stage
allows ai different situation,
total number of combinations
is a1a2a3an
 EG: No. of ways to order 5

cards. No. of choices for 1st


card 52, 2nd choice 51 cards
remaining, etc. for total of
5251504948 orderings
 EG: Method 1 for counting
anagrams

Review

Division Rule: IfS is partitioned


into cells of size d then each cell
contains |S |/d elements


Combinatorial: If over-counting
by a factor of d for each case of
interest, divide by d
 EG: No. of 5 cards hands.

5251504948 would be the


answer if order matters. Since
order irrelevant, and there are 5!
different orderings of 5 elements,
answer is 5251504948 / 5!
 EG: Method 2 for counting
anagrams

46

Inclusion-Exclusion
2 sets:
|A B | = |A|+|B |- |A B |
3 sets:

| ABC| = | A| +| B| +| C| | AB| | AC| | BC| +| ABC|


n - sets:

| A1 A2  An |

| A1 | + | A2 | +  + | An |
| A1 A2 | | A1 A3 | 
+ | A1 A2 A3 | + | A1 A2 A4 | + 

+ ( 1) n 1 | A1 A2  An |
Review

47

Pigeonhole Principle
Simple pigeonhole:
If N+1 objects are placed into N boxes,
there is at least one box containing 2
objects.

Generalized pigeonhole:
If N objects are placed into k boxes, there is
at least one box containing N/k objects.

Review

48

r-permutations
r-combinations
r-permutations P (n,r )




Number of r-tuples in a set of size n


Order matters
P (n,r ) =n r = n (n-1)(n-2)(n-3)(n-r+1)

r-combinations C (n,r )





L18

Number of r-tuples in a set of size n


Value of (n,r )-element in Pascal triangle
Order irrelevant (so can pre-sort)
C (n,r ) = n r / r ! = n ! / ( r ! (n - r)! )
C (n,r ) =C (n,n-r ) (symmetry of Pascal)
49

Counting Formulas
Perms and Combos
Anagrams : with n letters with repetition
numbers a1, a2 , a3 , . , ak number of
anagrams is n ! / (a1! a2 ! a3 ! ak !)
Functions : Domain size m, codomain size n





General :
Bijections (m =n ):
One-to-one (m n ):
Onto (m n):

nm
n!
P (n,m )

nm - C (n,1)(n -1)m + C (n,2)(n -2)m +


+(-1)iC (n,i )(n-i )m ++ (-1)n-1C (n,n-1)1m

L18

Derangements (Domain=Codomain, m=n, f (i ) = i ):


1 1 1 1
n 1
Dn = n!1 + + + h + ( 1)
n!
1! 2! 3! 4!

50

Counting Formulas
Stars and Bars
Number of solutions in N of x1+x2++xk+1=n



C (n+k,k)
Also the number of different arrangement of n s
and k |s in a string

Further constraints



Review

If variable xi k, change RHS to n-k


If variable xi < k use Inclusion-Exclusion on
constraint xi k
If have inequality x1+x2++xk+1 n, add dummy
variable and count solutions to x1+x2++xk+1+y =n
51

Cards
52 cards per deck (not including Jokers)
4 suits :
Hearts

Diamonds Spades

Clubs

13 ranks :

L18

52

Glossary of Poker Hands


Straight flush
Five cards in sequence in the
same suit. A royal straight
flush (A-K-Q-J-10 in same
suit) is the highest non-joker
poker hand possible.
Four of a kind
Four cards of the same rank.
Full house
Three of a kind and a pair.
When matching full houses,
the one with the higher three
of a kind wins.
Flush
Five cards of the same suit.
L18

Straight
Any five cards in sequence but
not all of the same suit.
Three of a kind
Three of the same rank with
two unmatched cards.
Two pairs
Two cards of one rank with two
cards of a different rank with
one dissimilar card. When
matching pairs occurs between
players, the one with the
higher fifth card wins.
One pair
Any two cards of the same
rank.
53

Probability
If all outcomes equally likely the probability of
event E in sample space S is the ratio
p (E ) = |E | / |S |
If each outcome s has probability p (s )
probability of event E is
p( E ) = p( s )
sE

Random variable : a real function X : S  R


p( s ) X ( s )
Expectation of X : E( X ) =
sS


Sum rule: E(X1+X2++Xn ) = E(X1)+ E(X2 )++E(Xn )

Bernoulli experiments : Suppose A has


probability p of occurring. Probability that A
occurs exactly k times in n trials is
p k (1-p)n-k C (n,k )
L18
54

Conditional Probability
Independence
If E and F are events and p (F ) > 0 then
the conditional probability of E given F
is defined by: p (E |F ) = p (EF ) / p (F )
Independent events : p(EF )=p(E )p(F )

Review

55

Relations
n -ary relation on sets (A1,A2, ,An) is a
subset of A1A2 An.
binary relations : n = 2


Notations for (a,b) R


 Infix notation : aRb
 Prefix functional notation : R(a,b) has value 1
 EG: R = <:


Review

(3,2)
<  <(3,2) = 0  (3 < 2) = 0

Composition : aRb and bSc  a (S R )c


56

Relations
Relations on A


Representations
 Adjacency matrix
 Digraph

Properties
 Reflexive : every element self-related
 Symmetric : (a,b) R  (b,a) R
 Transitive :(a,b),(b,c) R (a,c) R

Exponentiation : R n = L
R OM
R m
R
O
ON
O
n times

Review

57

Projection and Join


n-Join of R with S



Jn (R,S )
Each element in R whose last n coordinates match
with first n coordinates of S, create an element of join
EG, 2-join: (0,1,1)
2-join (0,1,1,1)

(1,1,1)
Projection of R to sub-coordinates




Review

Pi1,i2,, ik (R )
Keep only the indexed coordinates
EG: (0,1,1)
1,3 projection

(0,1)
58

Graphs
Undirected graphs




Simple graphs : No loops, or multiple edges


Multigraphs : Multiple edges allowed. No loops.
Pseudographs : Loops and multiple edges allowed.

Directed graphs



Digraphs : Loops allowed


Directed multigraph: multiple edges also allowed

Graph families





Complete graphs Kn
Cycles Cn
Wheels Wn
Cubes Qn

Degrees and Handshaking


Vertex degree :


Undirected graphs: contribution of 1 for each simple


edge, 2 for each loop
1
 Edge-Vertex Handshaking: | E | =
deg(e)

2 eE
Directed graphs:
 in-degree deg-: the number of edges that stick in
 out-degree deg+:the number of edges that stick out
 Handshaking Theorem: | E | =

deg

( e) =

eE

deg

( e)

eE

Face degree (undirected planar graphs):




Review

The number of edges surrounding a face


Edge-Face Handshaking: | E | = 1
deg( F )

F R

60

Coloring and Bipartiteness


n colorable : can use n colors so that no
two adjacent vertices have same color
Chromatic number : smallest number n
for which it is n colorable
Bipartite : same as 2-colorable


Complete Bipartite Graphs


K2,3

K4,5

4-Color Theorem: Any planar graph is 4colorable.


Review

61

Graph Isomorphism
Isomorphism from G1=(V1,E1) to G2=(V2,E2). A
function on vertices satisfying:
1)
2)




f is bijective
number of edges bet. u,v in G1 is same as bet. f
(u), f (v ) in G2
To prove isomorphism, describe f explicitly
To prove non-isomorphism, show that a graph
invariant differs for G1 vs. G2





Review

Number of vertices, edges


Degrees, degree numbers
Non-isomorphic subgraphs
Girth, connectivity
62

Paths and Connectivity


Path : a sequence of edges in graph with incident
consecutive edges





In simple graph: Any sequence of vertices with adjacent


consecutive vertices
Simple path: no repeated edge
Circuit : first and last vertex the same
Length of path: number of edges traversed

Connectedness

Undirected graph







Review

Standard: every vertex pair has a connecting path


2-Connected: Connected and no cut vertices
Connected Components: subgraphs that are connected and as
large as possible

Weakly connected digraph: if without orientation, connected


Strongly connected digraph: given any vertices (a , b) there
is a path from a to b and vice versa
63

Euler and Hamilton Paths


Euler path




Simple path containing all edges in graph


Euler circuit : Euler path thats a circuit
THM: Euler path or circuit iff there are 2
vertices of odd degree.

Hamilton path




Review

A path visiting every vertex in G exactly once.


Hamilton circuit : allowed to start vertex twice.
No simple all-inclusive theorem for Hamilton paths
(NP-complete problem).

64

Planar Graphs
Planar if can be drawn in
plane without any crossing
edges.


To prove planar, find a way


to redraw graph without
crossing edges:


To prove non planar use one


of:
 Kurotowskis theorem (see

text)
 Euler formula method (see
next column)
Review

Euler Formula Method




Eulers Formula for number


of regions:
r = |E | - |V | + 2
Girth g: smallest cycle length
in G
Face-Edge handshaking +
girth :

1
| E | rg
2

Often last formula forces too


many edges, showing that
planarity assumption was
false
65