Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon...

141
Painting yourself into a corner: Graph colouring and optimization Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012.

Transcript of Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon...

Page 1: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Painting yourself into a corner:Graph colouring and optimization

Andrew D. King

Simon Fraser University, Burnaby, B.C.

A taste of π, December 1, 2012.

Page 2: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

É Studied math and computer science at University ofVictoria, University of Toronto, and McGill (Montréal).

É Worked at Institut Teoretické Informatiky, Prague, CZ,Columbia University, New York, and Simon FraserUniversity, Burnaby.

É I am a postdoctoral researcher: I finished my Ph.D.recently, and I research unsolved math problems.

É My research area is kind of like really complicatedsudoku.

É We call it graph theory.

Page 3: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

É Studied math and computer science at University ofVictoria, University of Toronto, and McGill (Montréal).

É Worked at Institut Teoretické Informatiky, Prague, CZ,Columbia University, New York, and Simon FraserUniversity, Burnaby.

É I am a postdoctoral researcher: I finished my Ph.D.recently, and I research unsolved math problems.

É My research area is kind of like really complicatedsudoku.

É We call it graph theory.

Page 4: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

É Studied math and computer science at University ofVictoria, University of Toronto, and McGill (Montréal).

É Worked at Institut Teoretické Informatiky, Prague, CZ,Columbia University, New York, and Simon FraserUniversity, Burnaby.

É I am a postdoctoral researcher: I finished my Ph.D.recently, and I research unsolved math problems.

É My research area is kind of like really complicatedsudoku.

É We call it graph theory.

Page 5: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

É Studied math and computer science at University ofVictoria, University of Toronto, and McGill (Montréal).

É Worked at Institut Teoretické Informatiky, Prague, CZ,Columbia University, New York, and Simon FraserUniversity, Burnaby.

É I am a postdoctoral researcher: I finished my Ph.D.recently, and I research unsolved math problems.

É My research area is kind of like really complicatedsudoku.

É We call it graph theory.

Page 6: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

Jessica McDonald speaking at a conference

Page 7: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

Daniel Kral figuring out some configurations in Montreal

Page 8: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

This is what the configurations turned into. We solved anold problem... older than me!

Page 9: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

My knowledge of Czech: pozor and nemazat. Useful!

Page 10: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

Lots of good reasons to pozor.

Page 11: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

This is what the configurations turned into. We solved anold problem... older than me!

Page 12: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

The research institute in Prague (yes, really)!

Page 13: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

A workshop in Barbados. Outdoor blackboards!

Page 14: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

Working with my Ph.D. advisor and officemate

Page 15: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

Pondering graph theory in Italy

Page 16: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A little about me

I said I study graph theory.What’s a graph?

Page 17: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

Graff: graffiti

Page 18: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

Graf, Steffi

Page 19: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

Graf, Iowa

Page 20: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

GTPase Regulator Associated with Focal Adhesion Kinase(GRAF)

Page 21: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

The graph of a function.

Close, but not that kind of graph.

Page 22: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

The graph of a function.Close, but not that kind of graph.

Page 23: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

A graph is a network of objects!

É Dots: vertices or nodes.É Lines: edges or connections.

Page 24: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

A graph is a network of objects!

É Dots: vertices or nodes.É Lines: edges or connections.

Page 25: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

A graph is a network of objects!

A social network, for example.The objects are people.

The connections represent relationships.

Page 26: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

A graph is a network of objects!

A social network, for example.The objects are people.

The connections represent relationships.

Page 27: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?

A graph is a network of objects!

A social network, for example.The objects are people.

The connections represent relationships.

Page 28: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?A graph isÉ A set of dots called verticesÉ Some pairs of dots are connected.É The connections are called edges.É Two vertices are connected or adjacent if they have

an edge between them.

Page 29: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What is a graph?A graph isÉ A set of dots called verticesÉ Some pairs of dots are connected.É The connections are called edges.É Two vertices are connected or adjacent if they have

an edge between them.

Page 30: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What can vertices and edges represent?A graph can represent something abstract andmathematical or something practical... or both!

É Vertices represent combinations of two buttons.É Exercise: Draw an edge between each pair of

combinations that doesn’t share a button.

Page 31: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What can vertices and edges represent?A graph can represent something abstract andmathematical or something practical... or both!

É Vertices represent combinations of two buttons.É Exercise: Draw an edge between each pair of

combinations that doesn’t share a button.

Page 32: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What can vertices and edges represent?A graph can represent something abstract andmathematical or something practical... or both!

É Vertices represent tennis games between two players.É Exercise: Draw an edge between each pair of games

that can happen simultaneously.

Page 33: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What can vertices and edges represent?A graph can represent something abstract andmathematical or something practical... or both!

É The resulting graph is the same either way.É Graphs provide a flexible way to model real-life

problems in a mathematical setting.

Page 34: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

What can vertices and edges represent?A graph can represent something abstract andmathematical or something practical... or both!

É The resulting graph is the same either way.É Graphs provide a flexible way to model real-life

problems in a mathematical setting.

Page 35: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Erdos Numbers

Paul Erdos, 1913–1996: A true master of graph theory.

É Published over 1500 papersÉ N is a Number – A documentary about him on

Youtube.

Page 36: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Erdos Numbers

Erdos numbers involve interconnectedness ofmathematicians!

É Take a graph where the vertices are mathematicians.É Two mathematicians are connected if they published

a paper together.É How long is the shortest path from me to Erdos?É That’s my Erdos number.

Page 37: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Erdos Numbers

Erdos numbers involve interconnectedness ofmathematicians!

É Take a graph where the vertices are mathematicians.

É Two mathematicians are connected if they publisheda paper together.

É How long is the shortest path from me to Erdos?É That’s my Erdos number.

Page 38: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Erdos Numbers

Erdos numbers involve interconnectedness ofmathematicians!

É Take a graph where the vertices are mathematicians.É Two mathematicians are connected if they published

a paper together.

É How long is the shortest path from me to Erdos?É That’s my Erdos number.

Page 39: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Erdos Numbers

Erdos numbers involve interconnectedness ofmathematicians!

É Take a graph where the vertices are mathematicians.É Two mathematicians are connected if they published

a paper together.É How long is the shortest path from me to Erdos?

É That’s my Erdos number.

Page 40: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Erdos Numbers

Erdos numbers involve interconnectedness ofmathematicians!

É Take a graph where the vertices are mathematicians.É Two mathematicians are connected if they published

a paper together.É How long is the shortest path from me to Erdos?É That’s my Erdos number.

Page 41: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapI am a cartographer on a budget. I can print my map infour colours, but neighbouring states should get differentcolours. Is this always possible?

Page 42: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapI am a cartographer on a budget. I can print my map infour colours, but neighbouring states should get differentcolours. Is this always possible?

Page 43: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapI am a cartographer on a budget. I can print my map infour colours, but neighbouring states should get differentcolours. Is this always possible?

Page 44: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapHow can we view this map as a graph? Remember,neighbouring states should get different colours.

Page 45: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapHow can we view this map as a graph? Remember,neighbouring states should get different colours. Verticesare states. Neighbouring states are connected.

Page 46: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapNow we want to give the vertices colours so that noadjacent (connected) vertices get the same colour!This is the graph colouring problem.

Page 47: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapLook at Washington State.

Page 48: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapLook at Washington State. Capital city?

Page 49: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapLook at Washington State. Capital city? Olympia.

Page 50: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapLook at Washington State. Capital city? Olympia.Washington only neighbours two states:

Page 51: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapLook at Washington State. Capital city? Olympia.Washington only neighbours two states:Oregon and Idaho.

Page 52: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapLook at Washington State. Capital city? Olympia.Washington only neighbours two states:Oregon and Idaho.

Page 53: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapIf we can 4-colour everything except Washington, we canextend the colouring to Washington.At least 4-2=2 colours are available for WA.

Page 54: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapWe can make the same argument for CA, FL, ME, NH, VM,RI, LA, GA, MI, NJ, CT, DE, ND, and MD.Oh and HI and AK, obviously.

Page 55: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapSo we can ignore these states, colour the rest, thenextend the colouring when we are done.

Page 56: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapBut we can repeat this argument. For example, Oregononly has two grey neighbours. We can remove a bunch ofstates this way!

Page 57: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapBut we can repeat this argument. For example, Oregononly has two grey neighbours. We can remove a bunch ofstates this way!

Page 58: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapNow we repeat the argument. Our map gets smaller...

Page 59: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapNow we repeat the argument. Our map gets smaller...And smaller...

Page 60: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapNow we repeat the argument. Our map gets smaller...And smaller...And smaller.

Page 61: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapNow we can colour the map in stages. First colour thestate numbered 1, then extend to states numbered 2,then 3, etc.

122

22

3

33

33

34

4

4 4

4 44 4

45

5

55

55

5

5 5

5

5

5 5

6

6

6

6

6

6

666

6

6 6

6

6

6

6

Page 62: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring a mapExercise: Can you colour the states with 4 colours, stageby stage, so no two neighbouring states get the samecolour?

122

22

3

33

33

34

4

4 4

4 44 4

45

5

55

55

5

5 5

5

5

5 5

6

6

6

6

6

6

666

6

6 6

6

6

6

6

Page 63: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A recursive 4-colouring algorithm

We just performed a recursive 4-colouring algorithm:É Recursive: To solve the problem on our graph, we

solve the same problem on a smaller graph.É 4-colouring: We colour the graph using 4 colours.É Algorithm: A step-by-step method for solving a

problem.

To 4-colour a map G:1. Find a vertex v with at most 3 neighbours (e.g. WA).2. Remove v and recursively 4-colour what remains.3. Since v has at most 3 neighbours, we can extend the

colouring to v.Does this always work?

Page 64: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A recursive 4-colouring algorithmTo 4-colour a map G:1. Find a vertex v with at most 3 neighbours (e.g. WA).2. Remove v and recursively 4-colour what remains.3. Since v has at most 3 neighbours, we can extend the

colouring to v.Does this always work?

Absolutely not! Maybe v does not exist. :(

Page 65: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

A recursive 4-colouring algorithmTo 4-colour a map G:1. Find a vertex v with at most 3 neighbours (e.g. WA).2. Remove v and recursively 4-colour what remains.3. Since v has at most 3 neighbours, we can extend the

colouring to v.Does this always work?

Absolutely not! Maybe v does not exist. :(

Page 66: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Are 4 colours always enough?

The graph associated with a map is called a planar graph,because it can be drawn in the plane (2-dimensionalspace) without any edges crossing each other.

Question (1852):Is every planar graph 4-colourable?

Answer (Appel and Haken, 1976):Yes!

Answer (Robertson Sanders Seymour Thomas, ’95):Yes!

Answer (Werner and Gonthier, 2005):Yes!Why did they prove the Four Colour Theorem so manytimes?

Page 67: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Are 4 colours always enough?

The graph associated with a map is called a planar graph,because it can be drawn in the plane (2-dimensionalspace) without any edges crossing each other.

Question (1852):Is every planar graph 4-colourable?

Answer (Appel and Haken, 1976):Yes!

Answer (Robertson Sanders Seymour Thomas, ’95):Yes!

Answer (Werner and Gonthier, 2005):Yes!Why did they prove the Four Colour Theorem so manytimes?

Page 68: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Are 4 colours always enough?

The graph associated with a map is called a planar graph,because it can be drawn in the plane (2-dimensionalspace) without any edges crossing each other.

Question (1852):Is every planar graph 4-colourable?

Answer (Appel and Haken, 1976):Yes!

Answer (Robertson Sanders Seymour Thomas, ’95):Yes!

Answer (Werner and Gonthier, 2005):Yes!Why did they prove the Four Colour Theorem so manytimes?

Page 69: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Are 4 colours always enough?

The graph associated with a map is called a planar graph,because it can be drawn in the plane (2-dimensionalspace) without any edges crossing each other.

Question (1852):Is every planar graph 4-colourable?

Answer (Appel and Haken, 1976):Yes!

Answer (Robertson Sanders Seymour Thomas, ’95):Yes!

Answer (Werner and Gonthier, 2005):Yes!

Why did they prove the Four Colour Theorem so manytimes?

Page 70: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Are 4 colours always enough?

The graph associated with a map is called a planar graph,because it can be drawn in the plane (2-dimensionalspace) without any edges crossing each other.

Question (1852):Is every planar graph 4-colourable?

Answer (Appel and Haken, 1976):Yes!

Answer (Robertson Sanders Seymour Thomas, ’95):Yes!

Answer (Werner and Gonthier, 2005):Yes!Why did they prove the Four Colour Theorem so manytimes?

Page 71: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

4 Colour Theorem: The proof

Four Colour Theorem: 1976, 1995, 2005Every planar graph (map) can be coloured with 4 colours.

"A proof is a proof. What kind of a proof? It’s a proof. Aproof is a proof, and when you have a good proof, it’sbecause it’s proven." – Jean Chrétien

Page 72: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

4 Colour Theorem: The proof

É 1976 proof was by computer.They proved the theorem by looking at nearly 2000configurations.The computation took more than a month.

É 1995 proof was also by computer.They reduced the proof to about 600 configurations.

É 2005 proof was generated by a computer system thatfinds mathematical proofs.The theorem is too complicated to prove by hand!

Page 73: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

4 Colour Theorem: The proof

Appel and Haken at work

Page 74: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

We wish to colour a graph G, whose vertices are in the setV and whose edges are in the set E.

É A colouring of G is proper if no two adjacent verticesget the same colour.

É What is the minimum number of colours we need?É This is the chromatic number of G, written χ(G)

(χ is chi, the Greek letter).

Computing χ is an NP complete problem.(This means it takes a long time — we think!)

Question: Is P = NP?Translation: Can we solve NP-complete problems quicklywith a “normal” computer?

Page 75: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

We wish to colour a graph G, whose vertices are in the setV and whose edges are in the set E.

É A colouring of G is proper if no two adjacent verticesget the same colour.

É What is the minimum number of colours we need?É This is the chromatic number of G, written χ(G)

(χ is chi, the Greek letter).

Computing χ is an NP complete problem.(This means it takes a long time — we think!)

Question: Is P = NP?Translation: Can we solve NP-complete problems quicklywith a “normal” computer?

Page 76: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

We wish to colour a graph G, whose vertices are in the setV and whose edges are in the set E.

É A colouring of G is proper if no two adjacent verticesget the same colour.

É What is the minimum number of colours we need?

É This is the chromatic number of G, written χ(G)(χ is chi, the Greek letter).

Computing χ is an NP complete problem.(This means it takes a long time — we think!)

Question: Is P = NP?Translation: Can we solve NP-complete problems quicklywith a “normal” computer?

Page 77: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

We wish to colour a graph G, whose vertices are in the setV and whose edges are in the set E.

É A colouring of G is proper if no two adjacent verticesget the same colour.

É What is the minimum number of colours we need?É This is the chromatic number of G, written χ(G)

(χ is chi, the Greek letter).

Computing χ is an NP complete problem.(This means it takes a long time — we think!)

Question: Is P = NP?Translation: Can we solve NP-complete problems quicklywith a “normal” computer?

Page 78: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

We wish to colour a graph G, whose vertices are in the setV and whose edges are in the set E.

É A colouring of G is proper if no two adjacent verticesget the same colour.

É What is the minimum number of colours we need?É This is the chromatic number of G, written χ(G)

(χ is chi, the Greek letter).

Computing χ is an NP complete problem.(This means it takes a long time — we think!)

Question: Is P = NP?Translation: Can we solve NP-complete problems quicklywith a “normal” computer?

Page 79: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

We wish to colour a graph G, whose vertices are in the setV and whose edges are in the set E.

É A colouring of G is proper if no two adjacent verticesget the same colour.

É What is the minimum number of colours we need?É This is the chromatic number of G, written χ(G)

(χ is chi, the Greek letter).

Computing χ is an NP complete problem.

(This means it takes a long time — we think!)

Question: Is P = NP?Translation: Can we solve NP-complete problems quicklywith a “normal” computer?

Page 80: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

We wish to colour a graph G, whose vertices are in the setV and whose edges are in the set E.

É A colouring of G is proper if no two adjacent verticesget the same colour.

É What is the minimum number of colours we need?É This is the chromatic number of G, written χ(G)

(χ is chi, the Greek letter).

Computing χ is an NP complete problem.(This means it takes a long time — we think!)

Question: Is P = NP?Translation: Can we solve NP-complete problems quicklywith a “normal” computer?

Page 81: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

We wish to colour a graph G, whose vertices are in the setV and whose edges are in the set E.

É A colouring of G is proper if no two adjacent verticesget the same colour.

É What is the minimum number of colours we need?É This is the chromatic number of G, written χ(G)

(χ is chi, the Greek letter).

Computing χ is an NP complete problem.(This means it takes a long time — we think!)

Question: Is P = NP?Translation: Can we solve NP-complete problems quicklywith a “normal” computer?

Page 82: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

What can we say about χ(G), the chromatic number of agraph?

Is there any structure in G that forces us to use manycolours? (Lower bound on χ)

Can we give an upper bound on χ?

Page 83: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

What can we say about χ(G), the chromatic number of agraph?

Is there any structure in G that forces us to use manycolours? (Lower bound on χ)

Can we give an upper bound on χ?

Page 84: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

What can we say about χ(G), the chromatic number of agraph?

Is there any structure in G that forces us to use manycolours? (Lower bound on χ)

Can we give an upper bound on χ?

Page 85: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouringSome more vocabulary:

É If v is a vertex, then any vertex adjacent to v is aneighbour of v.

É The degree of v is the number of neighbours of v.

É The maximum degree of a graph G is the highestdegree of a vertex in G.

É A clique in G is a set of vertices that are all connectedto each other.

A clique of size 4 in a map

Page 86: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouringSome more vocabulary:

É If v is a vertex, then any vertex adjacent to v is aneighbour of v.

É The degree of v is the number of neighbours of v.

É The maximum degree of a graph G is the highestdegree of a vertex in G.

É A clique in G is a set of vertices that are all connectedto each other.

A clique of size 4 in a map

Page 87: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouringSome more vocabulary:

É If v is a vertex, then any vertex adjacent to v is aneighbour of v.

É The degree of v is the number of neighbours of v.

É The maximum degree of a graph G is the highestdegree of a vertex in G.

É A clique in G is a set of vertices that are all connectedto each other.

A clique of size 4 in a map

Page 88: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouringSome more vocabulary:

É If v is a vertex, then any vertex adjacent to v is aneighbour of v.

É The degree of v is the number of neighbours of v.

É The maximum degree of a graph G is the highestdegree of a vertex in G.

É A clique in G is a set of vertices that are all connectedto each other.

A clique of size 4 in a map

Page 89: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

What is the largest clique you can find?

What is the highest degree you can find?What is the lowest degree you can find?

3 ≤ χ(G) ≤ 9

Page 90: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

What is the largest clique you can find?What is the highest degree you can find?

What is the lowest degree you can find?3 ≤ χ(G) ≤ 9

Page 91: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

What is the largest clique you can find?What is the highest degree you can find?What is the lowest degree you can find?

3 ≤ χ(G) ≤ 9

Page 92: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

What is the largest clique you can find?What is the highest degree you can find?What is the lowest degree you can find?

3 ≤ χ(G) ≤ 9

Page 93: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Graph colouring

Reed’s ConjectureThe chromatic number of any graph is at most theaverage of the clique number and the maximum degree,plus 1.

I wrote my Ph.D. dissertation on this problem.

Page 94: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Sudoku: Graph colouring in disguise

1 4

1 3

3

How can we model sudoku as a graph colouring problem?

É Every square is a vertexÉ Some vertices are already coloured... we just need to

finish the colouring!É This problem is called precolouring extension.

Page 95: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Sudoku: Graph colouring in disguise

1 4

1 3

3

How can we model sudoku as a graph colouring problem?

É Every square is a vertex

É Some vertices are already coloured... we just need tofinish the colouring!

É This problem is called precolouring extension.

Page 96: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Sudoku: Graph colouring in disguise

1 4

1 3

3

How can we model sudoku as a graph colouring problem?

É Every square is a vertexÉ Some vertices are already coloured... we just need to

finish the colouring!

É This problem is called precolouring extension.

Page 97: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Sudoku: Graph colouring in disguise

1 4

1 3

3

How can we model sudoku as a graph colouring problem?

É Every square is a vertexÉ Some vertices are already coloured... we just need to

finish the colouring!É This problem is called precolouring extension.

Page 98: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Sudoku: Graph colouring in disguise

1 4

1 3

3

How can we model sudoku as a graph colouring problem?

É Every square is a vertexÉ Some vertices are already coloured... we just need to

finish the colouring!É This problem is called precolouring extension.

Page 99: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

The game chromatic number

Feeling competitive? Paint your opponent into a corner!

É There are k colours to choose from.

É Two players take turns colouring one vertex at a time.

É The colouring must always be proper.

É Player 1 wins if the graph can be coloured completely.

É Player 2 wins if there is a stalemate.

É Game chromatic number of G: Smallest k so thatPlayer 1 can always win.

Page 100: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

The game chromatic number

Feeling competitive? Paint your opponent into a corner!

É There are k colours to choose from.

É Two players take turns colouring one vertex at a time.

É The colouring must always be proper.

É Player 1 wins if the graph can be coloured completely.

É Player 2 wins if there is a stalemate.

É Game chromatic number of G: Smallest k so thatPlayer 1 can always win.

Page 101: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

The game chromatic number

Feeling competitive? Paint your opponent into a corner!

É There are k colours to choose from.

É Two players take turns colouring one vertex at a time.

É The colouring must always be proper.

É Player 1 wins if the graph can be coloured completely.

É Player 2 wins if there is a stalemate.

É Game chromatic number of G: Smallest k so thatPlayer 1 can always win.

Page 102: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

The game chromatic number

Feeling competitive? Paint your opponent into a corner!

É There are k colours to choose from.

É Two players take turns colouring one vertex at a time.

É The colouring must always be proper.

É Player 1 wins if the graph can be coloured completely.

É Player 2 wins if there is a stalemate.

É Game chromatic number of G: Smallest k so thatPlayer 1 can always win.

Page 103: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

The game chromatic number

Feeling competitive? Paint your opponent into a corner!

É There are k colours to choose from.

É Two players take turns colouring one vertex at a time.

É The colouring must always be proper.

É Player 1 wins if the graph can be coloured completely.

É Player 2 wins if there is a stalemate.

É Game chromatic number of G: Smallest k so thatPlayer 1 can always win.

Page 104: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

The game chromatic number

Feeling competitive? Paint your opponent into a corner!

É There are k colours to choose from.

É Two players take turns colouring one vertex at a time.

É The colouring must always be proper.

É Player 1 wins if the graph can be coloured completely.

É Player 2 wins if there is a stalemate.

É Game chromatic number of G: Smallest k so thatPlayer 1 can always win.

Page 105: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring the plane

How many vertices can a graph have? Maybe ∞?

É Let every point in the plane be a vertex.

É Two points are connected if the distance betweenthem is exactly 1.

É How many colours do we need to colour the plane?É If two points are 1 apart, then they get different

colours.É Can you say why you need at least 3 colours?

Page 106: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring the plane

How many vertices can a graph have? Maybe ∞?

É Let every point in the plane be a vertex.É Two points are connected if the distance between

them is exactly 1.

É How many colours do we need to colour the plane?É If two points are 1 apart, then they get different

colours.É Can you say why you need at least 3 colours?

Page 107: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring the plane

How many vertices can a graph have? Maybe ∞?

É Let every point in the plane be a vertex.É Two points are connected if the distance between

them is exactly 1.É How many colours do we need to colour the plane?

É If two points are 1 apart, then they get differentcolours.

É Can you say why you need at least 3 colours?

Page 108: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring the plane

How many vertices can a graph have? Maybe ∞?

É Let every point in the plane be a vertex.É Two points are connected if the distance between

them is exactly 1.É How many colours do we need to colour the plane?É If two points are 1 apart, then they get different

colours.

É Can you say why you need at least 3 colours?

Page 109: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring the plane

How many vertices can a graph have? Maybe ∞?

É Let every point in the plane be a vertex.É Two points are connected if the distance between

them is exactly 1.É How many colours do we need to colour the plane?É If two points are 1 apart, then they get different

colours.É Can you say why you need at least 3 colours?

Page 110: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring the plane

Actually you need at least 4.This graph is called the Moser spindle.

But the bottom edge is much longer!

Page 111: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring the plane

You need between 4 and 7 colours.

É Nobody knows what the answer is.É If we change the rules a little bit, we need either 6 or

7 colours. But still, nobody knows.

Page 112: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring the plane

You need between 4 and 7 colours.

É Nobody knows what the answer is.

É If we change the rules a little bit, we need either 6 or7 colours. But still, nobody knows.

Page 113: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Colouring the plane

You need between 4 and 7 colours.

É Nobody knows what the answer is.É If we change the rules a little bit, we need either 6 or

7 colours. But still, nobody knows.

Page 114: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

He who laughs last laughs loudest.

He who plays last loses. (This is a misère game)

É There are three piles of stones.É Two players take turns, choosing a pile and removingat least one stone.

É Whoever removes the last stone loses.

There is a very clever strategy.É Can your team figure it out?É It may be difficult to explain.É Start with piles of size 1, then 1 or 2, and try to find

the pattern.

Page 115: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

He who laughs last laughs loudest.He who plays last loses. (This is a misère game)

É There are three piles of stones.É Two players take turns, choosing a pile and removingat least one stone.

É Whoever removes the last stone loses.

There is a very clever strategy.É Can your team figure it out?É It may be difficult to explain.É Start with piles of size 1, then 1 or 2, and try to find

the pattern.

Page 116: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

He who laughs last laughs loudest.He who plays last loses. (This is a misère game)

É There are three piles of stones.É Two players take turns, choosing a pile and removingat least one stone.

É Whoever removes the last stone loses.

There is a very clever strategy.É Can your team figure it out?É It may be difficult to explain.É Start with piles of size 1, then 1 or 2, and try to find

the pattern.

Page 117: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

He who laughs last laughs loudest.He who plays last loses. (This is a misère game)

É There are three piles of stones.É Two players take turns, choosing a pile and removingat least one stone.

É Whoever removes the last stone loses.

There is a very clever strategy.

É Can your team figure it out?É It may be difficult to explain.É Start with piles of size 1, then 1 or 2, and try to find

the pattern.

Page 118: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

He who laughs last laughs loudest.He who plays last loses. (This is a misère game)

É There are three piles of stones.É Two players take turns, choosing a pile and removingat least one stone.

É Whoever removes the last stone loses.

There is a very clever strategy.É Can your team figure it out?

É It may be difficult to explain.É Start with piles of size 1, then 1 or 2, and try to find

the pattern.

Page 119: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

He who laughs last laughs loudest.He who plays last loses. (This is a misère game)

É There are three piles of stones.É Two players take turns, choosing a pile and removingat least one stone.

É Whoever removes the last stone loses.

There is a very clever strategy.É Can your team figure it out?É It may be difficult to explain.

É Start with piles of size 1, then 1 or 2, and try to findthe pattern.

Page 120: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

He who laughs last laughs loudest.He who plays last loses. (This is a misère game)

É There are three piles of stones.É Two players take turns, choosing a pile and removingat least one stone.

É Whoever removes the last stone loses.

There is a very clever strategy.É Can your team figure it out?É It may be difficult to explain.É Start with piles of size 1, then 1 or 2, and try to find

the pattern.

Page 121: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Let’s write the numbers 0 to 7 inbinary.

É 0 = 000É 1 = 20 = 001É 2 = 21 = 010É 3 = 21 + 20 = 011É 4 = 22 = 100É 5 = 22 + 20 = 101É 6 = 22 + 21 = 110É 7 = 22 + 21 + 20 = 111

We want to add them without carrying.In this world, the only numbers are 0 and 1, and1+1 = 0.

Page 122: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Let’s write the numbers 0 to 7 inbinary.

É 0 = 000

É 1 = 20 = 001É 2 = 21 = 010É 3 = 21 + 20 = 011É 4 = 22 = 100É 5 = 22 + 20 = 101É 6 = 22 + 21 = 110É 7 = 22 + 21 + 20 = 111

We want to add them without carrying.In this world, the only numbers are 0 and 1, and1+1 = 0.

Page 123: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Let’s write the numbers 0 to 7 inbinary.

É 0 = 000É 1 = 20 = 001

É 2 = 21 = 010É 3 = 21 + 20 = 011É 4 = 22 = 100É 5 = 22 + 20 = 101É 6 = 22 + 21 = 110É 7 = 22 + 21 + 20 = 111

We want to add them without carrying.In this world, the only numbers are 0 and 1, and1+1 = 0.

Page 124: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Let’s write the numbers 0 to 7 inbinary.

É 0 = 000É 1 = 20 = 001É 2 = 21 = 010

É 3 = 21 + 20 = 011É 4 = 22 = 100É 5 = 22 + 20 = 101É 6 = 22 + 21 = 110É 7 = 22 + 21 + 20 = 111

We want to add them without carrying.In this world, the only numbers are 0 and 1, and1+1 = 0.

Page 125: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Let’s write the numbers 0 to 7 inbinary.

É 0 = 000É 1 = 20 = 001É 2 = 21 = 010É 3 = 21 + 20 = 011

É 4 = 22 = 100É 5 = 22 + 20 = 101É 6 = 22 + 21 = 110É 7 = 22 + 21 + 20 = 111

We want to add them without carrying.In this world, the only numbers are 0 and 1, and1+1 = 0.

Page 126: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Let’s write the numbers 0 to 7 inbinary.

É 0 = 000É 1 = 20 = 001É 2 = 21 = 010É 3 = 21 + 20 = 011É 4 = 22 = 100

É 5 = 22 + 20 = 101É 6 = 22 + 21 = 110É 7 = 22 + 21 + 20 = 111

We want to add them without carrying.In this world, the only numbers are 0 and 1, and1+1 = 0.

Page 127: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Let’s write the numbers 0 to 7 inbinary.

É 0 = 000É 1 = 20 = 001É 2 = 21 = 010É 3 = 21 + 20 = 011É 4 = 22 = 100É 5 = 22 + 20 = 101

É 6 = 22 + 21 = 110É 7 = 22 + 21 + 20 = 111

We want to add them without carrying.In this world, the only numbers are 0 and 1, and1+1 = 0.

Page 128: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Let’s write the numbers 0 to 7 inbinary.

É 0 = 000É 1 = 20 = 001É 2 = 21 = 010É 3 = 21 + 20 = 011É 4 = 22 = 100É 5 = 22 + 20 = 101É 6 = 22 + 21 = 110

É 7 = 22 + 21 + 20 = 111

We want to add them without carrying.In this world, the only numbers are 0 and 1, and1+1 = 0.

Page 129: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Let’s write the numbers 0 to 7 inbinary.

É 0 = 000É 1 = 20 = 001É 2 = 21 = 010É 3 = 21 + 20 = 011É 4 = 22 = 100É 5 = 22 + 20 = 101É 6 = 22 + 21 = 110É 7 = 22 + 21 + 20 = 111

We want to add them without carrying.In this world, the only numbers are 0 and 1, and1+1 = 0.

Page 130: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Let’s write the numbers 0 to 7 inbinary.

É 0 = 000É 1 = 20 = 001É 2 = 21 = 010É 3 = 21 + 20 = 011É 4 = 22 = 100É 5 = 22 + 20 = 101É 6 = 22 + 21 = 110É 7 = 22 + 21 + 20 = 111

We want to add them without carrying.In this world, the only numbers are 0 and 1, and1+1 = 0.

Page 131: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Normal sum and Nim sum.

É In binary, the sum of 010 and 011 is 101.É (in decimal, we are saying 2 + 3 = 5).É But the Nim sum of 010 and 011 is 001,

because we don’t carry the 1.

The strategy:

É When you finish your turn, you want the Nim sum ofthe sizes of the piles to be zero.

É If you can do this, your opponent can’t do the samething to you.

É You want to do this until you can leave your opponentwith an odd number of piles with only one stone.

Page 132: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Normal sum and Nim sum.

É In binary, the sum of 010 and 011 is 101.

É (in decimal, we are saying 2 + 3 = 5).É But the Nim sum of 010 and 011 is 001,

because we don’t carry the 1.

The strategy:

É When you finish your turn, you want the Nim sum ofthe sizes of the piles to be zero.

É If you can do this, your opponent can’t do the samething to you.

É You want to do this until you can leave your opponentwith an odd number of piles with only one stone.

Page 133: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Normal sum and Nim sum.

É In binary, the sum of 010 and 011 is 101.É (in decimal, we are saying 2 + 3 = 5).

É But the Nim sum of 010 and 011 is 001,because we don’t carry the 1.

The strategy:

É When you finish your turn, you want the Nim sum ofthe sizes of the piles to be zero.

É If you can do this, your opponent can’t do the samething to you.

É You want to do this until you can leave your opponentwith an odd number of piles with only one stone.

Page 134: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Normal sum and Nim sum.

É In binary, the sum of 010 and 011 is 101.É (in decimal, we are saying 2 + 3 = 5).É But the Nim sum of 010 and 011 is 001,

because we don’t carry the 1.

The strategy:

É When you finish your turn, you want the Nim sum ofthe sizes of the piles to be zero.

É If you can do this, your opponent can’t do the samething to you.

É You want to do this until you can leave your opponentwith an odd number of piles with only one stone.

Page 135: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

Binary numbers: Normal sum and Nim sum.

É In binary, the sum of 010 and 011 is 101.É (in decimal, we are saying 2 + 3 = 5).É But the Nim sum of 010 and 011 is 001,

because we don’t carry the 1.

The strategy:

É When you finish your turn, you want the Nim sum ofthe sizes of the piles to be zero.

É If you can do this, your opponent can’t do the samething to you.

É You want to do this until you can leave your opponentwith an odd number of piles with only one stone.

Page 136: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

The strategy:

É When you finish your turn, you want the Nim sum ofthe sizes of the piles to be zero.

É If you can do this, your opponent can’t do the samething to you.

É You want to do this until you can leave your opponentwith an odd number of piles with only one stone.

É If the Nim sum is not zero at the beginning of yourturn, can you always make it zero at the end of yourturn?

É If the Nim sum is zero at the beginning of your turn,can you make it nonzero at the end of your turn?

So Player 1 can win precisely if the Nim sum is not zero atthe beginning of the game.

Page 137: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

The strategy:

É When you finish your turn, you want the Nim sum ofthe sizes of the piles to be zero.

É If you can do this, your opponent can’t do the samething to you.

É You want to do this until you can leave your opponentwith an odd number of piles with only one stone.

É If the Nim sum is not zero at the beginning of yourturn, can you always make it zero at the end of yourturn?

É If the Nim sum is zero at the beginning of your turn,can you make it nonzero at the end of your turn?

So Player 1 can win precisely if the Nim sum is not zero atthe beginning of the game.

Page 138: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

The strategy:

É When you finish your turn, you want the Nim sum ofthe sizes of the piles to be zero.

É If you can do this, your opponent can’t do the samething to you.

É You want to do this until you can leave your opponentwith an odd number of piles with only one stone.

É If the Nim sum is not zero at the beginning of yourturn, can you always make it zero at the end of yourturn?

É If the Nim sum is zero at the beginning of your turn,can you make it nonzero at the end of your turn?

So Player 1 can win precisely if the Nim sum is not zero atthe beginning of the game.

Page 139: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Bonus round: The game of NIM

The strategy:

É When you finish your turn, you want the Nim sum ofthe sizes of the piles to be zero.

É If you can do this, your opponent can’t do the samething to you.

É You want to do this until you can leave your opponentwith an odd number of piles with only one stone.

É If the Nim sum is not zero at the beginning of yourturn, can you always make it zero at the end of yourturn?

É If the Nim sum is zero at the beginning of your turn,can you make it nonzero at the end of your turn?

So Player 1 can win precisely if the Nim sum is not zero atthe beginning of the game.

Page 140: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

More 4-colouring maps

4-colouring a planar graph

http://www.nikoli.com/en/take_a_break/four_color_problem/

Page 141: Andrew D. Kingandrewdouglasking.com.s3-website-us-west-2.amazonaws.com/... · Andrew D. King Simon Fraser University, Burnaby, B.C. A taste of π, December 1, 2012. A little about

Thanks!

Thank you for your attention!More questions? [email protected]