Professional Documents
Culture Documents
• not: "not P" = ¬ P (takes on the opposite truth value of P) Order of operations:
1. Parentheses
2. ¬
Definition 1.4. A sentence is a: 3. ∨ and ∧
4. etc.
1. Tautology if it is always true.
3. Contingency otherwise.
2 anna brandenberger, binyuan sun
¬( P =⇒ Q) ≡ P ∧ ¬ Q P Q ¬P ∨ Q
T T T
( P =⇒ Q) ≡ ¬( P ∧ ¬ Q) double negation T F F
F T T
≡ ¬ P ∨ ¬(¬ Q) DeMorgan’s Law
F F T
≡ ¬P ∨ Q Table 4: Table illustrating Example 1.2.
math 240: discrete structures 3
1. Verify P ⇒ ( Q ∨ ¬ Q) is a tautology.
P ⇒ ( Q ∨ ¬ Q) ≡ P ⇒ T ("complement")
≡ ¬P ∨ T ("implies")
≡T (identity)
[¬ P ∨ (¬ P ∧ Q)] ∧ P ≡ [¬ P ∧ P] ∨ [(¬ P ∧ Q) ∧ P]
≡ F ∨ [¬ P ∧ P ∧ Q]
≡ F ∨ [F ∧ Q ]
≡ F∨F ≡ F
• P ⇔ Q ≡ ( P ⇒ Q) ∧ ( Q ⇒ P)
• P ⇔ Q ≡ ( P ∧ Q) ∨ (¬ P ∧ ¬ Q)
Updated order of operations:
1. Parentheses
Ambiguous statements: 2. ¬
3. ∨ and ∧
1. A ∧ B ∨ C
4. =⇒ and ⇔
( A ∧ B) ∨ C ≡ ( A ∨ C ) ∧ ( B ∨ C )
A ∧ ( B ∨ C ) ≡ ( A ∧ B) ∨ ( A ∧ C )
4 anna brandenberger, binyuan sun
2. P ⇒ Q ⇒ R
Check that:
( P ⇒ Q) ⇒ R 6≡ P ⇒ ( Q ⇒ R)
¬(¬ P ∨ Q) ∨ R 6≡ ¬ P ∨ (¬ Q ∨ R)
Phrasing of ⇔:
P ⇔ Q ≡ P if and only if Q
NECC: Q ⇒ P, SUFF: P ⇒ Q
≡ P if Q, and conversely
≡ P precisely when Q A note: P ≡ Q and P ⇔ Q essentially
mean the same thing.
≡ P is necessary and sufficient for Q
Symbolization
Examples 1.4.
1. If you study then, then you will pass 2 : S ⇒ P 2
S: you study
P: you pass
2. The ground gets wet whenever it rains 3 : R ⇒ W 3
W: the ground gets wet
R: it rains
3. The sun is out but it is raining 4 : S ∧ R 4
W: the sun is out
R: it is raining
4. You cannot scuba dive unless you have had lessons 5 : 5
W: can scuba dive
S ⇒ L or ¬ L ⇒ ¬S R: had lessons
• ¬(∃ xP( x )) ≡ ∀ x ¬ P( x )
Examples 1.9.
• "Not everything is about you".10 10
Y ( x ) : x is about you
claim: Everything is about you: ∀ xY ( x )
negation: There is a thing that is not about you: ¬(∀ xY ( x )) ≡
∃ x ¬Y ( x )
• "All cardinals are red".11 11
C ( x ) : x is a cardinal
claim: ∀ x (C ( x ) ⇒ R( x )) R( x ) : x is red
negation: ∃ x ¬(C ( x ) ⇒ R( x ))
≡ ∃ x ¬(¬C ( x ) ∨ R( x ))
≡ ∃ x (C ( x ) ∧ ¬ R( x ))
• "There is an even number greater than three which is prime".12 12
E( x ) : x is even
claim: ∃ x ( E( x ) ∧ G ( x ) ∧ P( x )) G ( x ) : x is greater than 3
P( x ) : x is prime
negation: ∀ x ¬(( E( x ) ∧ G ( x ) ∧ P( x ))
≡ ∀ x [¬ E( x ) ∨ ¬ G ( x ) ∨ ¬ P( x )]
6 anna brandenberger, binyuan sun
Arguments
Examples 1.13.
√ √
1. { x ∈ R| x2 − 3 = 0} = { 3, − 3}
2. { x ∈ N| x2 − 3 = 0} = ∅
Proposition 1.5. If A ⊆ B and A 6= B, we can write as above and say A is Notation {1, 2} 6⊆ {1, 2}
a proper subset of B. {1, 2} ⊂ {1, 2, π }
Examples 1.15.
{ a, b} ∈ { a, b, c}? F
{ a, b} ⊆ { a, b, c}? T
{ a, b} ∈ { a, b, { a, b}}? T
{ a, b} ⊆ { a, b, { a, b}}? T
Venn diagrams
Figure 1: A ∪ B Figure 2: A ∩ B
– union: A ∪ B = { x | x ∈ A ∨ x ∈ B}
– intersection: A ∩ B = { x | x ∈ A ∧ x ∈ B}
– complement: A = { x | x 6∈ A} = U \ A
– symmetric difference: A ⊕ B = { x | ( x ∈ A ∨ x ∈ B) ∧ x 6∈ A ∩ B}
= { x | x ∈ A ∪ B ∧ x 6∈ A ∩ B} Figure 5: A ⊕ B
8 anna brandenberger, binyuan sun
Proof Methods
• distributive: A ∩ ( B ∪ C ) = ( A ∩ B) ∪ ( A ∩ C ),
A ∪ ( B ∩ C ) = ( A ∪ B) ∩ ( A ∪ C )
1. Show A ∩ ( B ∪ C ) ⊆ ( A ∩ B) ∪ ( A ∩ C ):
Let x ∈ A ∩ ( B ∪ C )
⇒ x ∈ A & x ∈ (B ∪ C)
⇒ x ∈ A & ( x ∈ B || x ∈ C )
⇒ ( x ∈ A & x ∈ B) or ( x ∈ A&x ∈ C )
⇒ x ∈ A ∩ B || x ∈ A ∩ C
⇒ x ∈ ( A ∩ B) ∪ ( A ∩ C )
2. Show ( A ∩ B) ∪ ( A ∩ C ) ⊆ A ∩ ( B ∪ C ):
Let y ∈ ( A ∩ B) ∪ ( A ∩ C )
Either y ∈ A ∩ B or y ∈ A ∩ C ⇒ y ∈ A and either y ∈ B or y ∈ C
⇒ y ∈ (B ∪ C)
( A ∩ B) ∪ ( A ∩ C ) ⊆ A ∩ ( B ∪ C )
A ∩ ( B ∪ C ) = ( A ∩ B) ∪ ( A ∩ C )
Proposition 1.8. Two elements in A × B are equal precisely when they are
in both coordinates: ( a1 , b1 ) = ( a2 , b2 ) ⇔ a1 = a2 and b2 = b1
Example 1.19. A = {1, 2}, B = {3, 4}
A × B = {(1, 3), (2, 3), (1, 4), (2, 4)}
Example 1.20. Prove that A × ( B ∪ C ) ⊆ ( A × B) ∪ ( A × C ) B × A = {(3, 1), (3, 2), (4, 1), (4, 2)}
Proof. ⇒ x ∈ A and y ∈ B ∪ C
If y ∈ C, then ( x, y) ∈ A × C; if y ∈ B, then ( x, y) ∈ A × B
So either ( x, y) ∈ A × B or ( x, y) ∈ A × C
⇒ ( x, y) ∈ ( A × B) ∪ ( A × C )
⇒ A × ( B ∪ C ) ⊆ ( A × B) ∪ ( A × C )
Example 1.21.
Definition 1.18. Useful properties: Let R be a binary relation on A. {( x, y)|y = x2 } is a bin. rel. on R.
R is Definition {( x, y)| x = y2 } is a bin. rel. on R.
reflexive ∀ a ∈ A, ( a, a) ∈ R {(m, n)| mn ∈ Z} is a bin rel on Z.
symmetric ( a, b) ∈ R ⇒ (b, a) ∈ R
antisymmetric ( a, b) ∈ R and (b, a) ∈ R ⇒ a = b
transitive ( a, b), (b, c) ∈ R ⇒ ( a, c) ∈ R
– Reflexive: ∀ x ∈ R, x ≤ x ⇒ ( x, x ) ∈ R
– Reflexive: ∀ x ⊆ A, is ( x, x ) ∈ R?
– Antisymmetric: ( x, y) ∈ R ∧ (y, x ) ∈ R
⇒ X ⊆ Y∧Y ⊆ X
⇒X=Y
– Transitive: ( X, Y ) ∈ R, (Y, Z ) ∈ R
⇒ X ⊆ Y, Y ⊆ Z
⇒X⊆Z
⇒ ( X, Z ) ∈ R
Equivalence Relations
Recall: Definition 1.20: an equivalence
relation is a relation R which is:
Definition 1.22. We say a is related to b in a equivalent relation R if • Reflexive
( a, b) ∈ R, denoted as follows: • Symmetric
• Transitive
Notation 1.10. a is related to b in a equivalent relation R:
1. R: x − x = 0 ⇒ ( x, x ) ∈ R
S: x − y = 3k ⇒ y − x = 3k ⇒ ( x, y) ∈ R ⇒ (y, x ) ∈ R
I: ( x, y) ∈ R, (y, z) ∈ R
⇒ x − y = 3k, y − z = 3l ⇒ x − z = 3(k + l ) ∈ Z ⇒ ( x, z) ∈ R
(a) Let y ∈ [ x ] ⇒ y ∼ x.
Since x ∼ a, by transitivity, y ∼ a ⇒ y ∈ [ a] ⇒ [ x ] ⊆ [ a]
(b) z ∈ [ a]
⇒z∼a
⇒ z ∼ x (since x ∼ a)
⇒ z ∈ [x]
⇒ [ a] ⊆ [ x ]
Together, this gives [ a] = [ x ]
√
Theorem 1.13. 2 6∈ Q
√
Proof. Suppose 2∈Q
m
q
⇒ (2) = , m, n ∈ Q
n
m
We may assume, without loss of generality (WLOG), that n is in
reduced form, i.e they share no common factors.
m m2
q
(2) = ⇒2= 2
n n
⇒ m2 = 2n2
⇒ m is even ⇒ m = 2k for some k ∈ Z
2 2
⇒ (2k) = 2n ⇒ 4k2 = 2n2 ⇒ 2k2 = n2
⇒ n is even
q − p1 p2 . . . p n = 1
p1 k − p1 p2 . . . p n = 1
p1 ( k − p2 . . . p n ) = 1 ⇒⇐
|{z} | {z }
≥2 ∈N
Thus our assumption that there are finitely many primes was wrong.
2. When you can’t give the example, a "non constructive proof" can some-
times be found.
√
1± 5
2. "There is a real solution to x2 − x − 1 = 0". It’s 2 .
2 Number Theory
The study of properties of integers.
2.1 Division
qb ≤ a < (q + 1)b
Let r = a − qb, then:
a = qb + r
and:
0 ≤ a − qb < (q + 1)b − qb
0≤r<b
0 ≤ r1 < b
− b < −r2 ≤ 0
⇒ − b < r1 − r2 < b
and continue until the remainder becomes 0, rk+1 = 0. Then rk = gcd( a, b) 42 = 1(28) + 14
28 = 2(14) + 0
91 = 11(8) + 3
8 = 2(3) + 2
3 = 1(2) + 1
2 = 2(1) + 0
1 = (3) − 1(2)
= 3 − 1(8 − 2(3))
= 3(3) − 1(8)
= 3(91 − 11(8)) − 1(8)
3 (91) − |{z}
= |{z} 34 (8)
s t
n = xa + yb
Proof.
gcd( a, b) = 1
⇒∃s, t sa + tb = 1
⇒(sn) a + (tn)b = n
⇒ xa + yb = n
Proof.
∃ x, y such that ax + by = 1
⇒ c = cax + cby
Since a | a and a | bc
a | a( xc) + bc(y) ⇒ a | c( ax + by)
⇒a|c
Proof. Suppose n has no prime divisor. The set of all positive integers
with no prime divisors would be non-empty. By WOP (Lemma 2.2),
it has a smallest element. Call this m.15 . Since m | m, m is not prime. 15
Note: This variation on a proof by
Thus ∃d, 1 < d < m such that d | m. By minimality of m, d has a contradiction uses a minimal counterex-
ample
prime divisor, say p. p | d and d | m
⇒p|m ⇒⇐
math 240: discrete structures 17
Proof. p | a =⇒ done.
p - a =⇒ gcd( a, p) = 1 =⇒ p | b.
Example 2.5.
13 ≡ 83 (mod 10)
736 ≡ −1044 (mod 2)
Proof. To be proved.
Proof.
a = qn + r
⇒ a − r = qn
⇒n | a = r
⇒( a, r ) ∈ Ri
Example 2.6. Find an integer 0 ≤ k ≤
17 such that
1. 18 ≡ k (mod 17)
18 anna brandenberger, binyuan sun ⇒ k ≡ 1 (mod 17)
2. −18 ≡ (mod 17)
−18 ≡ −1 ≡ 16 (mod 17)
Equivalent statements:
1. a ≡ b (mod n)
2. n | ( a − b)
3. a − b ≡ 0 (mod n)
4. a ∈ [b] ∈ Rn
5. b ∈ [ a] ∈ Rn
6. [ a] = [b] ∈ Rn
Operations
1. ( a ± x ) ≡ (b ± y) (mod n)
2. ax ≡ by (mod n)
Proof.
1. n | ( a − b) and n | ( x − y)
⇒ n | ( a ± x ) − (b ± y)
⇒ ( a ± x ) ≡ (b ± y) (mod n)
2. Note that ax − by = ax − ay + ay − by = a( x − y) + y( x − y)
∵ n | ( x − y) ∧ n | ( a − b)
⇒ n | [ a( x − y) + y( a − b)]
= n | ( ax − by)
= ax ≡ by (mod n)
2x + 3y ≡ 1 (mod 6)
Example 2.7. Solve
x + 3y ≡ 5 (mod 6)
3x + 6y ≡ 6 (mod 6)
⇒ 3x ≡ 0 (mod 6)
=⇒ x = 0, 2, 4 (mod 6) are the possibilities.
math 240: discrete structures 19
If x ≡ 0 mod 6 ⇒ 3y ≡ 5 (mod 6)
But 3 6 | 3y − 5 ⇒ 6 6 | 3y − 5
So 3y 6≡ 5 mod 6 ∀y ∈ Z
If x ≡ 2 mod 6 ⇒ 2 + 3y ≡ 5 mod 6
⇒ 3y ≡ 3 mod 6
⇒ y ≡ 1 mod 2
Check: y ≡6 0, 1, 6 2, 3, 6 4, 5
ka ≡ kb mod kn ⇔ a ≡ b mod n
If x ≡ 4 mod 6 ⇒ 4 + 3y ≡ 5 mod 6
⇒ 3y ≡ 1 mod 6
But 3 6 | 3y − 1 ⇒ 6 6 | 3y − 1
So no solutions.
x ≡ 2 mod 6
=⇒ Final Solutions:
y ≡ 1, 3, 5 mod 6(y ≡ 1 mod 2)
Proof.
Proof.
9 = 4(2) + 1 ⇒ 1 = 9 − 4(2)
2 = 2(1) + 0
⇒ (−4)(2) ≡ 1 mod 9
2−1 ≡ − 4 ≡ 5 mod 9
So:
Not using inverse: Why no solutions for g - b? (recall
Using inverse: g = gcd( a, n))
2x ≡ 1 mod 9
2x ≡ 1 mod 9 ax ≡ b mod n
⇒ 10x ≡ 5 mod 9 ⇒ ax − b = kn
⇒ x ≡ (1)(2−1 ) mod 9
⇒ (1) x ≡ 5 mod 9 b = ax − kn
⇒ |{z}
⇒ x ≡ 5 mod 9 g-b
| {z }
divisible by g
⇒ x ≡ 5 mod 9
⇒ no solution.
⇔ x ≡ 47 mod 49
22 anna brandenberger, binyuan sun
2522 )76 ∗ 22
≡ ( |{z} mod 523 ≡ ar mod p
≡1 by FLT
Example 2.13.
≡ 64 mod 13
≡ 12 mod 13
3 Combinatorics
Glorified counting. How do we count?
3.1 Proof by Induction
2. Inductive step: S(n) ⇒ S(n + 1). Example 3.2. Prove that the sum of odd
n
integers ∑ (2i − 1) = n2 .
why does this work — ? S (1) ⇒ S (2) ⇒ S (3) ⇒ . . . i =1
n ( n +1) 1=1
Example 3.1. Prove 1 + 2 + 3 + · · · + (n − 1) + n = 2 for n ∈ N 1+3 = 4
(1)(2) 1+3+5 = 9
Proof. Base Case: n = 1: 1 = 2 X 1 + 3 + 5 + 7 = 16
n ( n +1)
Inductive Step: Assume 1 + 2 + ... + n = 2 (hypothesis). 1
(n+1)(n+2) Proof. Base case: n = 1: ∑ (2i − 1) = 1
Show 1 + 2 + · · · + (n + 1) = 2
i =1
Inductive step :
n
Assume ∑ (2i − 1) = n2
n ( n + 1) i =1
1 + 2 + · · · + ( n ) + ( n + 1) = + ( n + 1) n +1
2 Show =⇒ ∑ (2i − 1) = (n + 1)2
n i =1
= (n + 1)( + 1)
2 n n
= ( n + 2) ! − 1 = 5 (8n ) + 3 (8n − 3n )
5 | 5 (8 ) ∧ 5 | 3 (8n − 3n )
n
⇒ 5 | 8n +1 − 3n +1
24 anna brandenberger, binyuan sun
Base Case: n = 1:
With a square removed from a (2 × 2) board, the remaining part is
exactly one tromino piece. X 2n +1
Common Mistakes
1. S(1) true
n = a0 20 + a1 21 + · · · + ak 2k
for some k ∈ N ∪ {0}, where ai ∈ {0, 1}∀i. i.e. every n can be written in binary.
3.2 Recursion
f 1 + f 2 + · · · + f n + f n +1 = f n +2 − 1 + f n +1
= f n +3 − 1
math 240: discrete structures 27
f n2+1 + f n2 = ( f n + f n−1 )2 + f n2
= f n2 + 2 f n f n−1 + f n2−1 + f n2
= ( f n2 + f n2−1 ) + f n f n−1 + f n f n−1 + f n2
= f 2n−1 + f n f n−1 + f n ( f n−1 + f n )
= f 2n−1 + f n f n−1 + f n f n+1
= f 2n−1 + f 2n = f 2n+1
P(n + 1) true?
f n +2 f n +1 + f n +1 f n = ( f n +1 + f n ) f n +1 + ( f n + f n −1 ) f n
= f n2+1 + f n f n+1 + f n2 + f n f n−1
= f n2+1 + f n2 + f n f n+1 + f n f n−1
| {z } | {z }
Q ( n +1) P(n)
= f 2n+1 + f 2n
= f 2n+2
Definition 3.5. The characteristic polynomial of an = ran−1 + san−2 Example 3.15. Consider an = an−1 +
is x2 − rx − s. Its roots α, β are the characteristic roots of the relation. 2an−2 , a0 = 2, a1 = 1
a0 = 2 a1 = 1 a2 = 5 a3 = 7 a4 = 17
Theorem 3.3. Consider an = ran−1 + san−2 with specified a0 , a1 . If x2 − a5 = 31 a6 = 65 a7 = 127
n n
a n = c1 α + c2 β We could prove this by induction, but
we would rather have a method more
where c1 and c2 solve a0 = c1 + c2 , a1 = c1 α + c2 β. rigorous than "guess and check".
c 1 α n + c 2 β n = r [ c 1 α n −1 + c 2 β n −1 ] + s [ c 1 α n −2 + c 2 β n −2 ]
c1 αn − rc1 αn−1 − sc1 αn−2 = −c2 βn − rc2 βn−1 − sβn−2
c1 αn−2 [α2 − rα − s] = −c2 βn−2 [ β2 − rβ − s]
0=0X
a n = c1 α n + c2 β n
n=0: a0 = c1 + c2
n=1: a1 = c1 α + c2 β
28 anna brandenberger, binyuan sun
⇒ a n = 1 − 2n + 2 (3n )
Theorem 3.4. The recurrence relation an = ran−1 + san−2 + f (n) has so- Note: the method for finding pn is the
equivalent of the constant coefficient
lution pn + qn where pn is a particular solution of the recurrence (ignoring method for finding a particular solution
initial conditions) and qn is the general solution to an = ran−1 + san−2 , to a homogeneous second order ODE,
i.e. guess a solution.
where constants c1 , c2 in qn are found from initial conditions.
an = 2an−1 + 3an−2
x2 − 2x − 3 = 0
( x − 3)( x + 1) = 0
α = 3, β = −1
qn = c1 3n + c2 (−1)n
25 n
⇒ pn + qn = (5 ) + c1 3n + c2 (−1)n
12
math 240: discrete structures 29
An + B = 2A(n − 1) + 2B + 3A(n − 2) + 3B + 5n
0 = (−2 − 6) A + (−1 + 2 + 3) B + (−n + 2n + 3n) A + 5n
= 4B − 8A + 4An + 5n = (4B − 8A) + (4A + 5)n
5
4A + 5 = 0 ⇒ A = −
4
5
4B − 8A = 0 ⇒ B = −
2
5 5
pn = − n −
4 2
5 5
an = − n − + c1 3n + c2 (−1)n
4 2
5
n = 0 : 0 = − + c1 + c2 c = 29
2 ⇒
1 16
5 5 c2 = 11
n = 1 : 1 = − − + 3c − c 2 16
2 4
5 5 29 11
⇒ an = − n − + 3n + (−1)n
4 2 16 16
3.4 Functions
A function f from X to Y, written f : X → Y is a binary relation
Figure 8: Surjective (non injective) map.
f ⊂ X × Y such that for every x ∈ X, there is at most one y ∈ Y such
that ( x, y) ∈ f . Since y is unique for x we can write y = f ( x ).
1. ∃ a surjection, f : X → Y ⇔ | X | ≥ |Y |
3. ∃ a bijection, f : X → Y ⇔ | X | = |Y |
3.5 Counting
Counting objects/structures.
Principles of counting:
n Translated Princips of Counting:
1. | A1 ∪ A2 ∪ · · · ∪ An | = ∑ | Ai | Ai : ways in which a task can be done.
i =1
1. The number of ways which a collec-
if each pair ( Ai , A j ) is disjoint (Ai ∩ A j = ∅)
tion of tasks can be done if no two
n sets of ways of completing the tasks
2. | A1 × A2 × · · · × An | = ∏ | Ai | overlap is the sum of ways of the
i =1 numbers of ways each task can be
done.
Example 3.21. How many 4 digits number have no repeated digits? 2. The number of ways a sequence of
tasks can be done is the product of
the number of ways each task can be
Answer. The tasks are to choose each digit: 9 × 9 × 8 × 7 = 4536. done.
Since the first digit can’t be 0.
Total: 2296.
Some Questions:
Example 3.23. How many ways can you choose a president, vice
president, treasurer, secretary from a group of 7 people?
7!
P(7, 4) = 3! = 840
n!
4. P(n, k) = (n)(n − 1) · · · (n − k + 1) = (n−k)!
n
Proposition 3.5. (nk) = (n− k)
n
Proof. 1. (n− k) =
n!
(n−k)!(n−(n−k))!
= n!
(n−k)!k!
= (nk)
2. Choosing k elements to be in your set is equivalent to choosing the
n − k elements in its complement.
n
Lemma 3.7. ∑ (nk) = 2n .
k =0
Combinatorially:
n
n n n n
2 = + +···+ +
0 1 n−1 n
Lemma 3.8. An n-set, n ≥ 1, has the same number of even subsets as odd
subsets.
# odd = # even
n n n n n
− + 0= − + +...
0 1 2 3 4
n n n n n
+ +... = + + +...
1 3 0 2 4
(2n
n ): number of n-subsets
(nk)(n−
n
k ): number of ways to choose k elements from {1, . . . , n } and
the rest from {n + 1, . . . , 2n}.
Repetitions
1. If order matters:
∑ (−1)|S|−1 |
\
| A1 ∪ A2 ∪ · · · ∪ A n | = Ai |
S⊆[n] i ∈S
Here [n] represents [1, . . . , n].
S6=∅
Dn = | A 1 ∩ A 2 ∩ · · · ∩ A n |
= | A1 ∪ A2 ∪ · · · ∪ A n |
= n! − A1 ∪ A2 ∪ · · · ∪ An
math 240: discrete structures 35
However,
| S | = A1 ∪ A2 ∪ · · · ∪ A n
= (| A1 | + | A2 | + . . . ) − (| A1 ∩ A2 | + | A1 ∩ A3 | + . . . ) + . . .
n n n −1 n
= n · ( n − 1) ! − ( n − 2) ! + (n − 3)! + · · · + (−1) (n − n)!
2 3 n
n! n! n!
= n! − + + · · · + (−1)n−1
2! 3! n!
(−1) −1
n
1 1
= n! 1 − + + · · · +
2! 3! n!
(−1)n−1
1 1
Dn = n! − n! 1 − + + · · · +
2! 3! n!
(−1)n
1 1
= n! 1 − 1 + − + · · · +
2! 3! n!
(−1)n
1 1 1 1
= n! − + − +···+
0! 1! 2! 3! n!
n
(−1)k
= n! ∑ k!
k =0
∞
So calculating the probability: Recall e x = ∑ xk
k! x∈R
k =0
Dn Dn
P(a permutation is a derangement) = =
# permutations n!
n
(−1)k
= ∑ k!
= e −1
k =0
Theorem 3.14. Pigeon Hole Principle (PHP). If one distributes > n ob-
jects to n boxes, some box has more than one object.
Example 3.33. Show that if n + 1 numbers are chosen from [2n], then
there are
Answer. Boxes: {1, 2}, {3, 4}, {5, 6}, . . . , {2n − 1, 2n}
n boxes, n + 1 choices, therefore 2 integers in same box by PHP
which differ by 1.
Consider the list a1 , a2 , . . . , a37 , a1 + 13, a2 + 13, . . . , a37 + 13. There are
74 integers between 1 and 73 therefore 2 must be the same. ⇒ i, j s.t.
ai = a j + 13 ⇔ ai − a j = 13 ⇔ s j+1 + s j+2 + · · · + si = 13
math 240: discrete structures 37
4 Graph Theory
4.1 Introduction
∑ deg(v) = ∑ 2 = 2| E( G )|
v ∈V ( G ) e∈ E( G )
∑ deg(v) + ∑ deg(v) = 2| E( G )|
v ∈V ( G ) v ∈V ( G )
| {z }
even
deg(v) odd deg(v) even
| {z }
even
Special graphs:
• empty graph: E( G ) = ∅
– denoted Kn if |V ( G )| = n
– | E(Kn )| = (n2 ) [in general, 0 ≤ | E( G )| ≤ (n2 )]
– V (Km,n ) = {u1 , . . . , um , v1 , . . . , vn }
– E(Km,n ) = {ui v j |1 ≤ i ≤ m, 1 ≤ j ≤ n}
=⇒ |V (Km,n )| = m + n
=⇒ | E(Km,n )| = m · n
vv ∈ E( M)).
Proof.
(⇒) ∀ v ∈ V ( G ), the number of times an Eulerian walk enters v
equals the number of times it exits v. =⇒ deg(v) = k + k = 2k for
some k.
(⇐) Suppose G is connected and deg(v) even ∀ v ∈ V ( G ). Let W
be a longest walk in G with no repeated edges W = v0 , v1 , . . . , vk .
Suppose W is not Eulerian.
Claim: W is closed.
Proof. By adding edges to the graph and applying Theorem 4.5 re-
peatedly, we get a complete graph, which is Hamiltonian. By the "iff"
statements, G is Hamiltonian as well.
4.2 Trees
Definition 4.12. A graph is a tree if it is connected and has no cycles. Figure 20: Figure 21: Any
Binary tree. path Pn is a
A leaf of a graph is a vertex of degree 1. (Any k-ary K1,t tree.
is also a tree.)
(⇐) Let G be a connected graph that is not a tree. The G has a cycle,
C. If u, v ∈ V (C ), then there are ≥ 2 uv-paths.
Theorem 4.11. A connected graph is a tree ⇔ the deletion of any edge dis-
connects the graph.
Delete any vertex v from our graph, which does not disconnect
it.16 The resulting (n − 1)-vertex graph has a spanning tree. Add 16
Exercise: Prove that any connected
the edge vx to the tree for any x ∈ N (v). The resulting subgraph: graph has a vertex whose deletion does
not disconnect the graph.
– uses every vertex
– is connected
– contains no cycles (any cycle would contain v which has degree
1 in the subgraph).
Counting Trees
Proof.
- See LPV for proof using bijection between trees and "Prufer codes".
Start at root, draw the tree so that no edges cross and vertices at
distance i from root are at level i. Walk around the edges and record
D if you move down 1 edge and U if you move up one edge. Thus
the code has length 2| E( T )| = 2(n − 1) and has n − 1 U ’s and n − 1
D ’s, yielding a code that looks like UUDUDDUU . . . .
−2
Thus the number of combinations of codes is (2n n −1 ).
Some trees are counted more than once, but each tree is counted at
least once.
2n − 2
=⇒ Tn ≤
n−1
math 240: discrete structures 43
Using Stirling’s Approximation, we can say that for large n, Stirling’s Approximation:
√ n n
en 4n −1 lim n! = 2πn
n→∞
√ ≤ Tn ≤ √ e
2πn5/2 2πn − 1
Example 4.2.
G δ ∆ W α X
Pn 1 2 2 d n2 e 2
3 if n = 3 2 if n even
Cn 2 2 b n2 c
2 otherw. 3 if n odd
Kn n−1 n−1 n 1 n
Km,n m n 2 n 2
Lemma 4.18. Every closed odd walk of a graph contains an odd cycle where
length is defined as the number of edges.
Base: r = 3
The only closed walk of length 3 is a cycle of length 3.
General colorings
Lower bounds on G
math 240: discrete structures 45
X (G) ≥ W (G)
| V ( G )|
X (G) ≥
αG
To see this, let Ci = {v ∈ V ( G )|c(v) = i } for some proper X ( G )-
colouring, then:
X (G) X (G)
|V ( G )| = ∑ |Ci | ≤ ∑ α( G ) = X ( G )α( G )
i =1 i =1
Upper bounds on X ( G )
Proof. by algorithm:
Output: ordering of V ( G ) in the order they are marked visited. We can build a "BFS" tree, but we don’t
need it here.
Choose a vertex v1 whose degree is not ∆( G ): deg(v1 ) ≤ ∆( G ) − 1.
(We can do this since the graph is not regular.)
Now run BFS with v1 as the initial vertex, yielding an ordering of
V ( G ): v 1 , v 2 , . . . , v n −1 , v n .
46 anna brandenberger, binyuan sun
K5 seems like it cannot be planar since there are vertices that cannot
be joined without crossing other edges. But proofs along these lines
require the Jordan Curve Theorem which will not be touched in Math Figure 24: K2,3 and K4 have planar
240. We will use an alternate proof. representations. K5 seems like it does
not.
Definition 4.20. Given a plane drawing G ∗ of a planar graph G, we
define a face to be a maximal region bounded by edges.
2 5
3 4 6
Theorem 4.21 (Euler’s Formula). 1
If G ∗ is a plane drawing of a connected planar graph G with M vertices,
Figure 25: Example of a planar graph.
| E| edges, and | F | faces, then: |V | − | E| + | F | = 2. Every drawing has an unbounded face
called the outer face.
Proof. By induction on | E|.
Base: | F | = 1. If | F | = 1, then G ∗ has no cycles ⇒ G is a tree ⇒ | E| = Note: The vertices of any face in a
|V | − 1 and |V | − | E| + | F | = |V | − (|V | − 1) + 1 = 2 drawing can be made to be the vertices
of the outer face.
I.H.: Suppose true for | F | = k − 1. Note: Each edge touches at most 2
faces. If an edge touches exactly one
Let G ∗ have k ≥ 2 faces. Since G is not a tree, it has a cycle C. face, deleting it disconnects the graph.
Let e be an edge of C. Consider G − e. It is still planar. It is also Proofs are omitted since they use topology.
still connected any walk that used e can be modified by replacing
e with C − e. Thus e touches 2 faces since its deletion doesn’t
disconnect G ∗ (or G). Therefore deleting e merges the 2 faces into
1. By induction, the new graph with |V 0 |, | E0 |, | F 0 | satisfies
|V 0 | − | E 0 | + | F 0 | = 2
⇒ |V | − (| E| − 1) + (| F | − 1) = 2
⇒ |V | − | E | + | F | = 2
| E | ≤ 3|V | − 6
Proof. Count the number of pairs (e, f ) where e touches f . Call this
number T. Since each edge touches at most 2 faces, T ≤ 2| E|. But
every face touches at least 3 edges (no self-touching edge or 2 edges
with 2 vertices).
T ≥ 3| F |
3| F | ≤ T ≤ 2| E |
2
| F| ≤ | E| Example 4.3. Show K5 is non-planar:
3
2 |V | = 5
⇒ 2 = |V | − | E | + | F | ≤ |V | − | E | + | E |
3
5
| E| = = 10
1 2
⇒ | E | ≤ |V | − 2
3 10 6≤ 3(5) − 6 = 9
| E | ≤ 3|V | − 6
Proof. Count pairs (e, f ) where edge e touches face f . Let T be the
number of such pairs.
4| F | ≤ T ≤ 2| E |
1
| F| ≤ | E|
2
1
=⇒ 2 = |V | − | E| + | F | ≤ |V | − | E| + | E|
2
=⇒ | E| ≤ 2|V | − 4
∑ deg(v) = 2| E|
v ∈V ( G )
⇒ 6|V | ≤ 2| E |
⇒ | E | ≥ 3|V | ⇒⇐ since | E| ≤ 3|V | − 6
Proof. of Theorem 4.27, by induction on |V ( G )|.
Base: Trivial if |V ( G )| ≤ 5.
common with Tk than Topt 0 did, and so on. Eventually we stop when
TSP Algorithm( G )
1 Take a mwst.
2 Make a walk by starting at a root and walking down, then up
until you can walk down again, etc. Call the walk W.
Proof. As seen in Figure 30, w(W ) = 2w( Topt ). Also notice that
removing any edge from Copt gives a spanning tree (Hamiltonian
path).
Notes