Listing Bit Strings List all bit strings of length 3. Listing Bit - - PowerPoint PPT Presentation

listing bit strings
SMART_READER_LITE
LIVE PREVIEW

Listing Bit Strings List all bit strings of length 3. Listing Bit - - PowerPoint PPT Presentation

Listing Bit Strings List all bit strings of length 3. Listing Bit Strings List all bit strings of length 3. 000, 001, 010, 011, 100, 101, 110, 111. Listing Bit Strings List all bit strings of length 3. 000, 001, 010, 011, 100, 101, 110, 111.


slide-1
SLIDE 1

Listing Bit Strings

List all bit strings of length 3.

slide-2
SLIDE 2

Listing Bit Strings

List all bit strings of length 3. 000, 001, 010, 011, 100, 101, 110, 111.

slide-3
SLIDE 3

Listing Bit Strings

List all bit strings of length 3. 000, 001, 010, 011, 100, 101, 110, 111. Now do it while only flipping one bit at a time!

slide-4
SLIDE 4

Listing Bit Strings

List all bit strings of length 3. 000, 001, 010, 011, 100, 101, 110, 111. Now do it while only flipping one bit at a time! Today: Finish graphs and talk about numbers.

slide-5
SLIDE 5

Forests

A forest is an acyclic graph. Each connected component of a forest is a tree.

slide-6
SLIDE 6

Forests

A forest is an acyclic graph. Each connected component of a forest is a tree. How many connected components in this graph?

slide-7
SLIDE 7

Forests

A forest is an acyclic graph. Each connected component of a forest is a tree. How many connected components in this graph? 6.

slide-8
SLIDE 8

Complete Graphs

The complete graph Kn has n vertices and all possible edges.

slide-9
SLIDE 9

Complete Graphs

The complete graph Kn has n vertices and all possible edges. A bipartite graph has left nodes L and right nodes R.

slide-10
SLIDE 10

Complete Graphs

The complete graph Kn has n vertices and all possible edges. A bipartite graph has left nodes L and right nodes R.

◮ The vertex set is V = L∪R.

slide-11
SLIDE 11

Complete Graphs

The complete graph Kn has n vertices and all possible edges. A bipartite graph has left nodes L and right nodes R.

◮ The vertex set is V = L∪R. ◮ Left nodes are only allowed to connect to right nodes; right

nodes are only allowed to connect to left nodes.

slide-12
SLIDE 12

Complete Graphs

The complete graph Kn has n vertices and all possible edges. A bipartite graph has left nodes L and right nodes R.

◮ The vertex set is V = L∪R. ◮ Left nodes are only allowed to connect to right nodes; right

nodes are only allowed to connect to left nodes. The complete bipartite graph Km,n has m left nodes, n right nodes, and all possible edges.

slide-13
SLIDE 13

Edge Sparsity

How many edges does Kn have?

slide-14
SLIDE 14

Edge Sparsity

How many edges does Kn have?

◮ Handshaking Lemma: ∑v∈V degv = 2|E|.

slide-15
SLIDE 15

Edge Sparsity

How many edges does Kn have?

◮ Handshaking Lemma: ∑v∈V degv = 2|E|. ◮ ∑v∈V degv = n(n −1).

slide-16
SLIDE 16

Edge Sparsity

How many edges does Kn have?

◮ Handshaking Lemma: ∑v∈V degv = 2|E|. ◮ ∑v∈V degv = n(n −1). ◮ So |E| = n(n −1)/2.

slide-17
SLIDE 17

Edge Sparsity

How many edges does Kn have?

◮ Handshaking Lemma: ∑v∈V degv = 2|E|. ◮ ∑v∈V degv = n(n −1). ◮ So |E| = n(n −1)/2.

Asymptotic notation from CS 61A/B: |E| = Θ(n2).

slide-18
SLIDE 18

Edge Sparsity

How many edges does Kn have?

◮ Handshaking Lemma: ∑v∈V degv = 2|E|. ◮ ∑v∈V degv = n(n −1). ◮ So |E| = n(n −1)/2.

Asymptotic notation from CS 61A/B: |E| = Θ(n2). For a tree on n vertices, |E| = n −1 = Θ(n).

slide-19
SLIDE 19

Edge Sparsity

How many edges does Kn have?

◮ Handshaking Lemma: ∑v∈V degv = 2|E|. ◮ ∑v∈V degv = n(n −1). ◮ So |E| = n(n −1)/2.

Asymptotic notation from CS 61A/B: |E| = Θ(n2). For a tree on n vertices, |E| = n −1 = Θ(n). The complete graph is called dense; trees are called sparse.

slide-20
SLIDE 20

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6.

slide-21
SLIDE 21

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

slide-22
SLIDE 22

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

◮ Each edge has two “sides”.

slide-23
SLIDE 23

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

◮ Each edge has two “sides”. So, if we add up all of the

sides, we get 2e.

slide-24
SLIDE 24

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

◮ Each edge has two “sides”. So, if we add up all of the

sides, we get 2e.

◮ Each face has at least three sides.

slide-25
SLIDE 25

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

◮ Each edge has two “sides”. So, if we add up all of the

sides, we get 2e.

◮ Each face has at least three sides. So the total number of

sides is at least 3f.

slide-26
SLIDE 26

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

◮ Each edge has two “sides”. So, if we add up all of the

sides, we get 2e.

◮ Each face has at least three sides. So the total number of

sides is at least 3f.

◮ Thus, 2e ≥ 3f.

slide-27
SLIDE 27

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

◮ Each edge has two “sides”. So, if we add up all of the

sides, we get 2e.

◮ Each face has at least three sides. So the total number of

sides is at least 3f.

◮ Thus, 2e ≥ 3f. ◮ Euler’s Formula: v +f = e +2.

slide-28
SLIDE 28

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

◮ Each edge has two “sides”. So, if we add up all of the

sides, we get 2e.

◮ Each face has at least three sides. So the total number of

sides is at least 3f.

◮ Thus, 2e ≥ 3f. ◮ Euler’s Formula: v +f = e +2. ◮ Rearrange: e ≤ 3v −6.

slide-29
SLIDE 29

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

◮ Each edge has two “sides”. So, if we add up all of the

sides, we get 2e.

◮ Each face has at least three sides. So the total number of

sides is at least 3f.

◮ Thus, 2e ≥ 3f. ◮ Euler’s Formula: v +f = e +2. ◮ Rearrange: e ≤ 3v −6.

If the graph has n vertices, then |E| = Θ(n).

slide-30
SLIDE 30

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

◮ Each edge has two “sides”. So, if we add up all of the

sides, we get 2e.

◮ Each face has at least three sides. So the total number of

sides is at least 3f.

◮ Thus, 2e ≥ 3f. ◮ Euler’s Formula: v +f = e +2. ◮ Rearrange: e ≤ 3v −6.

If the graph has n vertices, then |E| = Θ(n). Like trees.

slide-31
SLIDE 31

Planar Graphs Are Sparse

Theorem: For a connected planar graph with |V| ≥ 3, we have e ≤ 3v −6. Proof.

◮ Each edge has two “sides”. So, if we add up all of the

sides, we get 2e.

◮ Each face has at least three sides. So the total number of

sides is at least 3f.

◮ Thus, 2e ≥ 3f. ◮ Euler’s Formula: v +f = e +2. ◮ Rearrange: e ≤ 3v −6.

If the graph has n vertices, then |E| = Θ(n). Like trees. Planar graphs are sparse.

slide-32
SLIDE 32

K5 Is Not Planar

How many edges does K5 have?

slide-33
SLIDE 33

K5 Is Not Planar

How many edges does K5 have? 10.

slide-34
SLIDE 34

K5 Is Not Planar

How many edges does K5 have? 10.

◮ e = 10.

slide-35
SLIDE 35

K5 Is Not Planar

How many edges does K5 have? 10.

◮ e = 10. ◮ 3v −6 = 9.

slide-36
SLIDE 36

K5 Is Not Planar

How many edges does K5 have? 10.

◮ e = 10. ◮ 3v −6 = 9.

This violates e ≤ 3v −6 for planar graphs.

slide-37
SLIDE 37

K5 Is Not Planar

How many edges does K5 have? 10.

◮ e = 10. ◮ 3v −6 = 9.

This violates e ≤ 3v −6 for planar graphs. K5 is not planar.

slide-38
SLIDE 38

K3,3 Is Not Planar

Consider K3,3.

slide-39
SLIDE 39

K3,3 Is Not Planar

Consider K3,3. Edges?

slide-40
SLIDE 40

K3,3 Is Not Planar

Consider K3,3. Edges? 9.

slide-41
SLIDE 41

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices?

slide-42
SLIDE 42

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices? 6.

slide-43
SLIDE 43

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices? 6. So 3v −6 = 12.

slide-44
SLIDE 44

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices? 6. So 3v −6 = 12. The previous proof fails.

slide-45
SLIDE 45

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices? 6. So 3v −6 = 12. The previous proof fails. Make it stronger!

slide-46
SLIDE 46

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices? 6. So 3v −6 = 12. The previous proof fails. Make it stronger!

◮ The total number of sides is 2e.

slide-47
SLIDE 47

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices? 6. So 3v −6 = 12. The previous proof fails. Make it stronger!

◮ The total number of sides is 2e. ◮ Each face has at least three sides.

slide-48
SLIDE 48

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices? 6. So 3v −6 = 12. The previous proof fails. Make it stronger!

◮ The total number of sides is 2e. ◮ Each face has at least three sides. Actually, at least four!

slide-49
SLIDE 49

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices? 6. So 3v −6 = 12. The previous proof fails. Make it stronger!

◮ The total number of sides is 2e. ◮ Each face has at least three sides. Actually, at least four! ◮ In a bipartite graph, cycles are of even length.

slide-50
SLIDE 50

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices? 6. So 3v −6 = 12. The previous proof fails. Make it stronger!

◮ The total number of sides is 2e. ◮ Each face has at least three sides. Actually, at least four! ◮ In a bipartite graph, cycles are of even length. ◮ So, 2e ≥ 4f and v +f = e +2, so rearranging gives

e ≤ 2v −4 for bipartite planar graphs.

slide-51
SLIDE 51

K3,3 Is Not Planar

Consider K3,3. Edges? 9. Vertices? 6. So 3v −6 = 12. The previous proof fails. Make it stronger!

◮ The total number of sides is 2e. ◮ Each face has at least three sides. Actually, at least four! ◮ In a bipartite graph, cycles are of even length. ◮ So, 2e ≥ 4f and v +f = e +2, so rearranging gives

e ≤ 2v −4 for bipartite planar graphs. Conclusion: K3,3 is not planar.

slide-52
SLIDE 52

Why K5 and K3,3?

Why did we show that K5 and K3,3 are non-planar?

slide-53
SLIDE 53

Why K5 and K3,3?

Why did we show that K5 and K3,3 are non-planar? Kuratowski’s Theorem: A graph is non-planar if and only if it “contains” K5 or K3,3.

slide-54
SLIDE 54

Why K5 and K3,3?

Why did we show that K5 and K3,3 are non-planar? Kuratowski’s Theorem: A graph is non-planar if and only if it “contains” K5 or K3,3.

◮ The word “contains” is tricky. . .

slide-55
SLIDE 55

Why K5 and K3,3?

Why did we show that K5 and K3,3 are non-planar? Kuratowski’s Theorem: A graph is non-planar if and only if it “contains” K5 or K3,3.

◮ The word “contains” is tricky. . . do not worry about the

details.

slide-56
SLIDE 56

Why K5 and K3,3?

Why did we show that K5 and K3,3 are non-planar? Kuratowski’s Theorem: A graph is non-planar if and only if it “contains” K5 or K3,3.

◮ The word “contains” is tricky. . . do not worry about the

  • details. Not important for the course.
slide-57
SLIDE 57

Why K5 and K3,3?

Why did we show that K5 and K3,3 are non-planar? Kuratowski’s Theorem: A graph is non-planar if and only if it “contains” K5 or K3,3.

◮ The word “contains” is tricky. . . do not worry about the

  • details. Not important for the course.

◮ Content of theorem: essentially K5 and K3,3 are the only

  • bstructions to non-planarity.
slide-58
SLIDE 58

Graph Coloring

A (vertex) coloring of a graph G is an assignment of colors to vertices so that no two colors are joined by an edge.

slide-59
SLIDE 59

Graph Coloring

A (vertex) coloring of a graph G is an assignment of colors to vertices so that no two colors are joined by an edge. Why do we care about graph coloring?

slide-60
SLIDE 60

Graph Coloring

A (vertex) coloring of a graph G is an assignment of colors to vertices so that no two colors are joined by an edge. Why do we care about graph coloring?

◮ Edges are used to encode constraints.

slide-61
SLIDE 61

Graph Coloring

A (vertex) coloring of a graph G is an assignment of colors to vertices so that no two colors are joined by an edge. Why do we care about graph coloring?

◮ Edges are used to encode constraints. ◮ Graph colorings can be used for scheduling, etc.

slide-62
SLIDE 62

Coloring with Maximum Degree +1

  • Theorem. Let dmax be the maximum degree of any vertex in G.

Then G can be colored with dmax +1 colors.

slide-63
SLIDE 63

Coloring with Maximum Degree +1

  • Theorem. Let dmax be the maximum degree of any vertex in G.

Then G can be colored with dmax +1 colors. Proof.

slide-64
SLIDE 64

Coloring with Maximum Degree +1

  • Theorem. Let dmax be the maximum degree of any vertex in G.

Then G can be colored with dmax +1 colors. Proof.

◮ Use induction on |V|.

slide-65
SLIDE 65

Coloring with Maximum Degree +1

  • Theorem. Let dmax be the maximum degree of any vertex in G.

Then G can be colored with dmax +1 colors. Proof.

◮ Use induction on |V|. ◮ For |V| ≥ 2, remove a vertex v.

slide-66
SLIDE 66

Coloring with Maximum Degree +1

  • Theorem. Let dmax be the maximum degree of any vertex in G.

Then G can be colored with dmax +1 colors. Proof.

◮ Use induction on |V|. ◮ For |V| ≥ 2, remove a vertex v. ◮ Inductively color the resulting graph with dmax +1 colors.

slide-67
SLIDE 67

Coloring with Maximum Degree +1

  • Theorem. Let dmax be the maximum degree of any vertex in G.

Then G can be colored with dmax +1 colors. Proof.

◮ Use induction on |V|. ◮ For |V| ≥ 2, remove a vertex v. ◮ Inductively color the resulting graph with dmax +1 colors. ◮ Add v back in.

slide-68
SLIDE 68

Coloring with Maximum Degree +1

  • Theorem. Let dmax be the maximum degree of any vertex in G.

Then G can be colored with dmax +1 colors. Proof.

◮ Use induction on |V|. ◮ For |V| ≥ 2, remove a vertex v. ◮ Inductively color the resulting graph with dmax +1 colors. ◮ Add v back in. ◮ Since v has at most dmax neighbors which use at most

dmax colors, use an unused color to color v.

slide-69
SLIDE 69

Coloring with Maximum Degree +1

  • Theorem. Let dmax be the maximum degree of any vertex in G.

Then G can be colored with dmax +1 colors. Proof.

◮ Use induction on |V|. ◮ For |V| ≥ 2, remove a vertex v. ◮ Inductively color the resulting graph with dmax +1 colors. ◮ Add v back in. ◮ Since v has at most dmax neighbors which use at most

dmax colors, use an unused color to color v. For some types of graphs, this bound is very bad.

slide-70
SLIDE 70

Bipartite Graphs Are 2-Colorable

Theorem: G is bipartite ⇐ ⇒ G can be 2-colored.

slide-71
SLIDE 71

Bipartite Graphs Are 2-Colorable

Theorem: G is bipartite ⇐ ⇒ G can be 2-colored. Proof.

slide-72
SLIDE 72

Bipartite Graphs Are 2-Colorable

Theorem: G is bipartite ⇐ ⇒ G can be 2-colored. Proof.

◮ If G is bipartite with V = L∪R, color vertices in L blue and

vertices in R red.

slide-73
SLIDE 73

Bipartite Graphs Are 2-Colorable

Theorem: G is bipartite ⇐ ⇒ G can be 2-colored. Proof.

◮ If G is bipartite with V = L∪R, color vertices in L blue and

vertices in R red.

◮ Conversely, suppose G is 2-colorable.

slide-74
SLIDE 74

Bipartite Graphs Are 2-Colorable

Theorem: G is bipartite ⇐ ⇒ G can be 2-colored. Proof.

◮ If G is bipartite with V = L∪R, color vertices in L blue and

vertices in R red.

◮ Conversely, suppose G is 2-colorable. ◮ In the 2-coloring of G, the red vertices have no edges

between them, and similarly for blue vertices.

slide-75
SLIDE 75

Bipartite Graphs Are 2-Colorable

Theorem: G is bipartite ⇐ ⇒ G can be 2-colored. Proof.

◮ If G is bipartite with V = L∪R, color vertices in L blue and

vertices in R red.

◮ Conversely, suppose G is 2-colorable. ◮ In the 2-coloring of G, the red vertices have no edges

between them, and similarly for blue vertices.

◮ So the graph is bipartite.

slide-76
SLIDE 76

Bipartite Graphs Are 2-Colorable

Theorem: G is bipartite ⇐ ⇒ G can be 2-colored. Proof.

◮ If G is bipartite with V = L∪R, color vertices in L blue and

vertices in R red.

◮ Conversely, suppose G is 2-colorable. ◮ In the 2-coloring of G, the red vertices have no edges

between them, and similarly for blue vertices.

◮ So the graph is bipartite.

Consider Kn,n.

slide-77
SLIDE 77

Bipartite Graphs Are 2-Colorable

Theorem: G is bipartite ⇐ ⇒ G can be 2-colored. Proof.

◮ If G is bipartite with V = L∪R, color vertices in L blue and

vertices in R red.

◮ Conversely, suppose G is 2-colorable. ◮ In the 2-coloring of G, the red vertices have no edges

between them, and similarly for blue vertices.

◮ So the graph is bipartite.

Consider Kn,n. Then dmax +1 = n +1, but it can be 2-colored.

slide-78
SLIDE 78

Graph Coloring & Planarity

Consider a colored map and its planar dual: (Ignore the infinite face.)

slide-79
SLIDE 79

Graph Coloring & Planarity

Consider a colored map and its planar dual: (Ignore the infinite face.) Coloring a map so no adjacent regions have the same color is equivalent to coloring a planar graph.

slide-80
SLIDE 80

Four Color Theorem

Four Color Theorem: Every planar graph can be 4-colored.

slide-81
SLIDE 81

Four Color Theorem

Four Color Theorem: Every planar graph can be 4-colored.

◮ The proof required a human to narrow down the cases,

and a computer to exhaustively check the remaining cases.

slide-82
SLIDE 82

Four Color Theorem

Four Color Theorem: Every planar graph can be 4-colored.

◮ The proof required a human to narrow down the cases,

and a computer to exhaustively check the remaining cases.

◮ The proof has not yet been simplified to the point where a

human can easily read over it.

slide-83
SLIDE 83

Four Color Theorem

Four Color Theorem: Every planar graph can be 4-colored.

◮ The proof required a human to narrow down the cases,

and a computer to exhaustively check the remaining cases.

◮ The proof has not yet been simplified to the point where a

human can easily read over it.

◮ Note: K5 requires 5 colors.

slide-84
SLIDE 84

Hypercubes

The hypercube of dimension d, Qd, where d is a positive integer, has:

◮ vertices which are labeled by length-d bit strings, and ◮ an edge between two vertices if and only if they differ in

exactly one bit.

slide-85
SLIDE 85

Hypercubes

The hypercube of dimension d, Qd, where d is a positive integer, has:

◮ vertices which are labeled by length-d bit strings, and ◮ an edge between two vertices if and only if they differ in

exactly one bit. Here is a picture of Q3. 000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111

slide-86
SLIDE 86

Hypercube Facts

000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 The 0-face is the part of the hypercube whose vertices begin with 0.

slide-87
SLIDE 87

Hypercube Facts

000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 The 0-face is the part of the hypercube whose vertices begin with 0. Similarly for the 1-face.

slide-88
SLIDE 88

Hypercube Facts

000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 The 0-face is the part of the hypercube whose vertices begin with 0. Similarly for the 1-face. The 0-face is a lower-dimensional hypercube.

slide-89
SLIDE 89

Hypercube Facts

000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 The 0-face is the part of the hypercube whose vertices begin with 0. Similarly for the 1-face. The 0-face is a lower-dimensional hypercube. Induction!

slide-90
SLIDE 90

Hypercube Facts

000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 The 0-face is the part of the hypercube whose vertices begin with 0. Similarly for the 1-face. The 0-face is a lower-dimensional hypercube. Induction! Number of vertices?

slide-91
SLIDE 91

Hypercube Facts

000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 The 0-face is the part of the hypercube whose vertices begin with 0. Similarly for the 1-face. The 0-face is a lower-dimensional hypercube. Induction! Number of vertices? 2d.

slide-92
SLIDE 92

Hypercube Facts

000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 The 0-face is the part of the hypercube whose vertices begin with 0. Similarly for the 1-face. The 0-face is a lower-dimensional hypercube. Induction! Number of vertices? 2d. Number of edges?

slide-93
SLIDE 93

Hypercube Facts

000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 The 0-face is the part of the hypercube whose vertices begin with 0. Similarly for the 1-face. The 0-face is a lower-dimensional hypercube. Induction! Number of vertices? 2d. Number of edges? ∑v∈V degv = d2d, so |E| = d2d−1.

slide-94
SLIDE 94

Hypercube Facts

000 000 001 001 010 010 011 011 100 100 101 101 110 110 111 111 The 0-face is the part of the hypercube whose vertices begin with 0. Similarly for the 1-face. The 0-face is a lower-dimensional hypercube. Induction! Number of vertices? 2d. Number of edges? ∑v∈V degv = d2d, so |E| = d2d−1. So for a hypercube with n vertices, |E| = Θ(nlogn).

slide-95
SLIDE 95

Hypercubes Are Bipartite

Theorem: Hypercubes are 2-colorable.

slide-96
SLIDE 96

Hypercubes Are Bipartite

Theorem: Hypercubes are 2-colorable. Proof.

slide-97
SLIDE 97

Hypercubes Are Bipartite

Theorem: Hypercubes are 2-colorable. Proof.

◮ Color all vertices with an even number of 0s blue and an

  • dd number of 0s orange.
slide-98
SLIDE 98

Hypercubes Are Bipartite

Theorem: Hypercubes are 2-colorable. Proof.

◮ Color all vertices with an even number of 0s blue and an

  • dd number of 0s orange.

◮ Since each edge flips a bit, edges only connect vertices of

different parity.

slide-99
SLIDE 99

Hypercubes Are Bipartite

Theorem: Hypercubes are 2-colorable. Proof.

◮ Color all vertices with an even number of 0s blue and an

  • dd number of 0s orange.

◮ Since each edge flips a bit, edges only connect vertices of

different parity. Inductive Proof.

slide-100
SLIDE 100

Hypercubes Are Bipartite

Theorem: Hypercubes are 2-colorable. Proof.

◮ Color all vertices with an even number of 0s blue and an

  • dd number of 0s orange.

◮ Since each edge flips a bit, edges only connect vertices of

different parity. Inductive Proof.

◮ Check the base case.

slide-101
SLIDE 101

Hypercubes Are Bipartite

Theorem: Hypercubes are 2-colorable. Proof.

◮ Color all vertices with an even number of 0s blue and an

  • dd number of 0s orange.

◮ Since each edge flips a bit, edges only connect vertices of

different parity. Inductive Proof.

◮ Check the base case. ◮ Inductively color the 0-face.

slide-102
SLIDE 102

Hypercubes Are Bipartite

Theorem: Hypercubes are 2-colorable. Proof.

◮ Color all vertices with an even number of 0s blue and an

  • dd number of 0s orange.

◮ Since each edge flips a bit, edges only connect vertices of

different parity. Inductive Proof.

◮ Check the base case. ◮ Inductively color the 0-face. ◮ If 0x is a vertex colored blue, color the vertex 1x orange

and if 0x is orange, color 1x blue.

slide-103
SLIDE 103

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time.

slide-104
SLIDE 104

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once.

slide-105
SLIDE 105

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once. Listing the bit strings while flipping one bit at a time is exactly a Hamiltonian cycle on the hypercube.

slide-106
SLIDE 106

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once. Listing the bit strings while flipping one bit at a time is exactly a Hamiltonian cycle on the hypercube. Inductive construction:

slide-107
SLIDE 107

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once. Listing the bit strings while flipping one bit at a time is exactly a Hamiltonian cycle on the hypercube. Inductive construction:

◮ Length 1: 0, 1.

slide-108
SLIDE 108

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once. Listing the bit strings while flipping one bit at a time is exactly a Hamiltonian cycle on the hypercube. Inductive construction:

◮ Length 1: 0, 1. ◮ Length 2: Length-1 sequence with 0s prepended.

slide-109
SLIDE 109

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once. Listing the bit strings while flipping one bit at a time is exactly a Hamiltonian cycle on the hypercube. Inductive construction:

◮ Length 1: 0, 1. ◮ Length 2: Length-1 sequence with 0s prepended. 00, 01.

slide-110
SLIDE 110

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once. Listing the bit strings while flipping one bit at a time is exactly a Hamiltonian cycle on the hypercube. Inductive construction:

◮ Length 1: 0, 1. ◮ Length 2: Length-1 sequence with 0s prepended. 00, 01.

Length-1 sequence backwards with 1s prepended.

slide-111
SLIDE 111

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once. Listing the bit strings while flipping one bit at a time is exactly a Hamiltonian cycle on the hypercube. Inductive construction:

◮ Length 1: 0, 1. ◮ Length 2: Length-1 sequence with 0s prepended. 00, 01.

Length-1 sequence backwards with 1s prepended. 11, 10.

slide-112
SLIDE 112

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once. Listing the bit strings while flipping one bit at a time is exactly a Hamiltonian cycle on the hypercube. Inductive construction:

◮ Length 1: 0, 1. ◮ Length 2: Length-1 sequence with 0s prepended. 00, 01.

Length-1 sequence backwards with 1s prepended. 11, 10. Put it together: 00, 01, 11, 10.

slide-113
SLIDE 113

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once. Listing the bit strings while flipping one bit at a time is exactly a Hamiltonian cycle on the hypercube. Inductive construction:

◮ Length 1: 0, 1. ◮ Length 2: Length-1 sequence with 0s prepended. 00, 01.

Length-1 sequence backwards with 1s prepended. 11, 10. Put it together: 00, 01, 11, 10.

◮ Length 3: 000, 001, 011, 010, 110, 111, 101, 100.

slide-114
SLIDE 114

Hamiltonian Paths

Recall: List all bit strings of length 3, flipping one bit at a time. A Hamiltonian cycle is a cycle that includes every vertex exactly once. Listing the bit strings while flipping one bit at a time is exactly a Hamiltonian cycle on the hypercube. Inductive construction:

◮ Length 1: 0, 1. ◮ Length 2: Length-1 sequence with 0s prepended. 00, 01.

Length-1 sequence backwards with 1s prepended. 11, 10. Put it together: 00, 01, 11, 10.

◮ Length 3: 000, 001, 011, 010, 110, 111, 101, 100.

Hypercubes have Hamiltonian cycles.

slide-115
SLIDE 115

Clock Mathematics

If it is 2:00 right now, what time is it in 24 hours?

slide-116
SLIDE 116

Clock Mathematics

If it is 2:00 right now, what time is it in 24 hours? Still 2:00.

slide-117
SLIDE 117

Clock Mathematics

If it is 2:00 right now, what time is it in 24 hours? Still 2:00. In the clock mathematics, the numbers wrap around: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, . . .

slide-118
SLIDE 118

Clock Mathematics

If it is 2:00 right now, what time is it in 24 hours? Still 2:00. In the clock mathematics, the numbers wrap around: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, . . . We will do the same thing for bases other than 12.

slide-119
SLIDE 119

Clock Mathematics

If it is 2:00 right now, what time is it in 24 hours? Still 2:00. In the clock mathematics, the numbers wrap around: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, . . . We will do the same thing for bases other than 12. Also, we will typically use the representatives {0,1,...,11} rather than {1,...,12}.

slide-120
SLIDE 120

Clock Mathematics

If it is 2:00 right now, what time is it in 24 hours? Still 2:00. In the clock mathematics, the numbers wrap around: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, . . . We will do the same thing for bases other than 12. Also, we will typically use the representatives {0,1,...,11} rather than {1,...,12}. Question to ponder: What time will it be in 21000000 hours from now?

slide-121
SLIDE 121

Clock Mathematics

If it is 2:00 right now, what time is it in 24 hours? Still 2:00. In the clock mathematics, the numbers wrap around: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, . . . We will do the same thing for bases other than 12. Also, we will typically use the representatives {0,1,...,11} rather than {1,...,12}. Question to ponder: What time will it be in 21000000 hours from now? Can this even be computed?

slide-122
SLIDE 122

Modular Equivalence

Let m be a positive integer.

slide-123
SLIDE 123

Modular Equivalence

Let m be a positive integer. For the next few lectures, m will be called the modulus.

slide-124
SLIDE 124

Modular Equivalence

Let m be a positive integer. For the next few lectures, m will be called the modulus. Say that x ≡ y (mod m) if m | x −y.

slide-125
SLIDE 125

Modular Equivalence

Let m be a positive integer. For the next few lectures, m will be called the modulus. Say that x ≡ y (mod m) if m | x −y. Read this as “x is equivalent to y, modulo m.”

slide-126
SLIDE 126

Modular Equivalence

Let m be a positive integer. For the next few lectures, m will be called the modulus. Say that x ≡ y (mod m) if m | x −y. Read this as “x is equivalent to y, modulo m.” Examples: What numbers are equivalent to 0, modulo 6?

slide-127
SLIDE 127

Modular Equivalence

Let m be a positive integer. For the next few lectures, m will be called the modulus. Say that x ≡ y (mod m) if m | x −y. Read this as “x is equivalent to y, modulo m.” Examples: What numbers are equivalent to 0, modulo 6?

◮ ...,−18,−12,−6,0,6,12,18,....

slide-128
SLIDE 128

Modular Equivalence

Let m be a positive integer. For the next few lectures, m will be called the modulus. Say that x ≡ y (mod m) if m | x −y. Read this as “x is equivalent to y, modulo m.” Examples: What numbers are equivalent to 0, modulo 6?

◮ ...,−18,−12,−6,0,6,12,18,....

In the “modulo 6” system, think of these numbers as the same.

slide-129
SLIDE 129

Modular Equivalence: Addition, Multiplication

Theorem: If a,b,c,d ∈ Z with a ≡ c (mod m) and b ≡ d (mod m), then a+b ≡ c +d (mod m) and ab ≡ cd (mod m).

slide-130
SLIDE 130

Modular Equivalence: Addition, Multiplication

Theorem: If a,b,c,d ∈ Z with a ≡ c (mod m) and b ≡ d (mod m), then a+b ≡ c +d (mod m) and ab ≡ cd (mod m). Addition and multiplication work as usual in modular arithmetic.

slide-131
SLIDE 131

Modular Equivalence: Addition, Multiplication

Theorem: If a,b,c,d ∈ Z with a ≡ c (mod m) and b ≡ d (mod m), then a+b ≡ c +d (mod m) and ab ≡ cd (mod m). Addition and multiplication work as usual in modular arithmetic. Proof.

slide-132
SLIDE 132

Modular Equivalence: Addition, Multiplication

Theorem: If a,b,c,d ∈ Z with a ≡ c (mod m) and b ≡ d (mod m), then a+b ≡ c +d (mod m) and ab ≡ cd (mod m). Addition and multiplication work as usual in modular arithmetic. Proof.

◮ By definition, m | a−c and m | b −d.

slide-133
SLIDE 133

Modular Equivalence: Addition, Multiplication

Theorem: If a,b,c,d ∈ Z with a ≡ c (mod m) and b ≡ d (mod m), then a+b ≡ c +d (mod m) and ab ≡ cd (mod m). Addition and multiplication work as usual in modular arithmetic. Proof.

◮ By definition, m | a−c and m | b −d. ◮ So, m | a+b −(c +d).

slide-134
SLIDE 134

Modular Equivalence: Addition, Multiplication

Theorem: If a,b,c,d ∈ Z with a ≡ c (mod m) and b ≡ d (mod m), then a+b ≡ c +d (mod m) and ab ≡ cd (mod m). Addition and multiplication work as usual in modular arithmetic. Proof.

◮ By definition, m | a−c and m | b −d. ◮ So, m | a+b −(c +d). ◮ Also a = km +c and b = ℓm +d for some k,ℓ ∈ Z.

slide-135
SLIDE 135

Modular Equivalence: Addition, Multiplication

Theorem: If a,b,c,d ∈ Z with a ≡ c (mod m) and b ≡ d (mod m), then a+b ≡ c +d (mod m) and ab ≡ cd (mod m). Addition and multiplication work as usual in modular arithmetic. Proof.

◮ By definition, m | a−c and m | b −d. ◮ So, m | a+b −(c +d). ◮ Also a = km +c and b = ℓm +d for some k,ℓ ∈ Z. ◮ So, ab = kℓm2 +dkm +cℓm +cd.

slide-136
SLIDE 136

Modular Equivalence: Addition, Multiplication

Theorem: If a,b,c,d ∈ Z with a ≡ c (mod m) and b ≡ d (mod m), then a+b ≡ c +d (mod m) and ab ≡ cd (mod m). Addition and multiplication work as usual in modular arithmetic. Proof.

◮ By definition, m | a−c and m | b −d. ◮ So, m | a+b −(c +d). ◮ Also a = km +c and b = ℓm +d for some k,ℓ ∈ Z. ◮ So, ab = kℓm2 +dkm +cℓm +cd. ◮ Hence m | ab −cd.

slide-137
SLIDE 137

Representatives

Theorem: Each integer x is equivalent to a unique member of {0,1,...,m −1} modulo m.

slide-138
SLIDE 138

Representatives

Theorem: Each integer x is equivalent to a unique member of {0,1,...,m −1} modulo m. Proof.

slide-139
SLIDE 139

Representatives

Theorem: Each integer x is equivalent to a unique member of {0,1,...,m −1} modulo m. Proof.

◮ By Division Algorithm, x = qm +r for some q ∈ Z and

r ∈ {0,1,...,m −1}.

slide-140
SLIDE 140

Representatives

Theorem: Each integer x is equivalent to a unique member of {0,1,...,m −1} modulo m. Proof.

◮ By Division Algorithm, x = qm +r for some q ∈ Z and

r ∈ {0,1,...,m −1}.

◮ Thus m | x −r, i.e., x ≡ r (mod m).

slide-141
SLIDE 141

Representatives

Theorem: Each integer x is equivalent to a unique member of {0,1,...,m −1} modulo m. Proof.

◮ By Division Algorithm, x = qm +r for some q ∈ Z and

r ∈ {0,1,...,m −1}.

◮ Thus m | x −r, i.e., x ≡ r (mod m). ◮ If x ≡ r1 (mod m) and x ≡ r2 (mod m), then (by

subtracting) r1 −r2 ≡ 0 (mod m).

slide-142
SLIDE 142

Representatives

Theorem: Each integer x is equivalent to a unique member of {0,1,...,m −1} modulo m. Proof.

◮ By Division Algorithm, x = qm +r for some q ∈ Z and

r ∈ {0,1,...,m −1}.

◮ Thus m | x −r, i.e., x ≡ r (mod m). ◮ If x ≡ r1 (mod m) and x ≡ r2 (mod m), then (by

subtracting) r1 −r2 ≡ 0 (mod m).

◮ But this is impossible if r1,r2 ∈ {0,1,...,m −1} are distinct.

slide-143
SLIDE 143

Representatives

Theorem: Each integer x is equivalent to a unique member of {0,1,...,m −1} modulo m. Proof.

◮ By Division Algorithm, x = qm +r for some q ∈ Z and

r ∈ {0,1,...,m −1}.

◮ Thus m | x −r, i.e., x ≡ r (mod m). ◮ If x ≡ r1 (mod m) and x ≡ r2 (mod m), then (by

subtracting) r1 −r2 ≡ 0 (mod m).

◮ But this is impossible if r1,r2 ∈ {0,1,...,m −1} are distinct.

Now we can think of the numbers {0,1,...,m −1} with addition and multiplication (modulo m) as a number system.

slide-144
SLIDE 144

Representatives

Theorem: Each integer x is equivalent to a unique member of {0,1,...,m −1} modulo m. Proof.

◮ By Division Algorithm, x = qm +r for some q ∈ Z and

r ∈ {0,1,...,m −1}.

◮ Thus m | x −r, i.e., x ≡ r (mod m). ◮ If x ≡ r1 (mod m) and x ≡ r2 (mod m), then (by

subtracting) r1 −r2 ≡ 0 (mod m).

◮ But this is impossible if r1,r2 ∈ {0,1,...,m −1} are distinct.

Now we can think of the numbers {0,1,...,m −1} with addition and multiplication (modulo m) as a number system. This system is usually called Z/mZ.

slide-145
SLIDE 145

Multiplication in Modular Arithmetic

Modulo 6: 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 Left: Going from left to right is multiplication by 3. Right: Going from left to right is multiplication by 5.

slide-146
SLIDE 146

Bijections

A function f : A → B is:

slide-147
SLIDE 147

Bijections

A function f : A → B is:

◮ injective (or one-to-one) if for x1 = x2, f(x1) = f(x2)

slide-148
SLIDE 148

Bijections

A function f : A → B is:

◮ injective (or one-to-one) if for x1 = x2, f(x1) = f(x2)

(different inputs mapped to different outputs);

slide-149
SLIDE 149

Bijections

A function f : A → B is:

◮ injective (or one-to-one) if for x1 = x2, f(x1) = f(x2)

(different inputs mapped to different outputs);

◮ surjective (or onto) if for every y ∈ B, there is an x ∈ A

with f(x) = y

slide-150
SLIDE 150

Bijections

A function f : A → B is:

◮ injective (or one-to-one) if for x1 = x2, f(x1) = f(x2)

(different inputs mapped to different outputs);

◮ surjective (or onto) if for every y ∈ B, there is an x ∈ A

with f(x) = y (every element of B is hit);

slide-151
SLIDE 151

Bijections

A function f : A → B is:

◮ injective (or one-to-one) if for x1 = x2, f(x1) = f(x2)

(different inputs mapped to different outputs);

◮ surjective (or onto) if for every y ∈ B, there is an x ∈ A

with f(x) = y (every element of B is hit);

◮ bijective if it is both injective and surjective.

slide-152
SLIDE 152

Bijections

A function f : A → B is:

◮ injective (or one-to-one) if for x1 = x2, f(x1) = f(x2)

(different inputs mapped to different outputs);

◮ surjective (or onto) if for every y ∈ B, there is an x ∈ A

with f(x) = y (every element of B is hit);

◮ bijective if it is both injective and surjective.

A bijection is like relabeling the elements of A.

slide-153
SLIDE 153

Bijections

A function f : A → B is:

◮ injective (or one-to-one) if for x1 = x2, f(x1) = f(x2)

(different inputs mapped to different outputs);

◮ surjective (or onto) if for every y ∈ B, there is an x ∈ A

with f(x) = y (every element of B is hit);

◮ bijective if it is both injective and surjective.

A bijection is like relabeling the elements of A. Consider the map “multiplication by a, modulo m”.

slide-154
SLIDE 154

Bijections

A function f : A → B is:

◮ injective (or one-to-one) if for x1 = x2, f(x1) = f(x2)

(different inputs mapped to different outputs);

◮ surjective (or onto) if for every y ∈ B, there is an x ∈ A

with f(x) = y (every element of B is hit);

◮ bijective if it is both injective and surjective.

A bijection is like relabeling the elements of A. Consider the map “multiplication by a, modulo m”. That is, f(x) := ax mod m.

slide-155
SLIDE 155

Bijections

A function f : A → B is:

◮ injective (or one-to-one) if for x1 = x2, f(x1) = f(x2)

(different inputs mapped to different outputs);

◮ surjective (or onto) if for every y ∈ B, there is an x ∈ A

with f(x) = y (every element of B is hit);

◮ bijective if it is both injective and surjective.

A bijection is like relabeling the elements of A. Consider the map “multiplication by a, modulo m”. That is, f(x) := ax mod m. When is this map bijective?

slide-156
SLIDE 156

Greatest Common Divisor

For two integers a,b ∈ Z, the greatest common divisor (GCD)

  • f a and b is the largest number that divides both a and b.
slide-157
SLIDE 157

Greatest Common Divisor

For two integers a,b ∈ Z, the greatest common divisor (GCD)

  • f a and b is the largest number that divides both a and b.

Fact: Any common divisor of a and b also divides gcd(a,b).

slide-158
SLIDE 158

Greatest Common Divisor

For two integers a,b ∈ Z, the greatest common divisor (GCD)

  • f a and b is the largest number that divides both a and b.

Fact: Any common divisor of a and b also divides gcd(a,b). (Proof: Next time!)

slide-159
SLIDE 159

Existence of Multiplicative Inverses

Theorem: f(x) = ax mod m is bijective if and only if gcd(a,m) = 1.

slide-160
SLIDE 160

Existence of Multiplicative Inverses

Theorem: f(x) = ax mod m is bijective if and only if gcd(a,m) = 1. For a ∈ Z/mZ, a multiplicative inverse x is an element of Z/mZ for which ax ≡ 1 (mod m).

slide-161
SLIDE 161

Existence of Multiplicative Inverses

Theorem: f(x) = ax mod m is bijective if and only if gcd(a,m) = 1. For a ∈ Z/mZ, a multiplicative inverse x is an element of Z/mZ for which ax ≡ 1 (mod m). Corollary: For all a ∈ Z/mZ, a has a multiplicative inverse (necessarily unique) if and only if gcd(a,m) = 1.

slide-162
SLIDE 162

Existence of Multiplicative Inverses

Theorem: f(x) = ax mod m is bijective if and only if gcd(a,m) = 1. For a ∈ Z/mZ, a multiplicative inverse x is an element of Z/mZ for which ax ≡ 1 (mod m). Corollary: For all a ∈ Z/mZ, a has a multiplicative inverse (necessarily unique) if and only if gcd(a,m) = 1. (Proof: Next time!)

slide-163
SLIDE 163

Summary

Graphs.

◮ Consequences of Euler’s Formula: non-planarity of K5 and

K3,3; planar graphs are sparse.

◮ Types of graphs: forests, hypercubes. ◮ Graph colorings: ≤ dmax +1 for general graphs, 2 for

bipartite graphs.

◮ Hypercubes have Hamiltonian cycles.

Modular arithmetic.

◮ a ≡ b (mod m) if m | a−b. ◮ Each number modulo m has a representative in

{0,1,...,m −1}.

◮ Injections, surjections, bijections. . . ◮ a has a multiplicative inverse modulo m if and only if

gcd(a,m) = 1.