Discrete Mathematics and Proof

Graph coloring

Some pairs of meetings cannot happen at the same time. What is the fewest number of time slots that works, and why can every map, however tangled, be colored with only four colors so that no two neighboring countries match?

Where you are 10 in Introductory graph theory

Why this exists

Exams that share a student cannot be given in the same period. Rehearsals that share a player cannot be held in the same hour. Neighboring countries on a map should not get the same color. Each time things in conflict must be kept apart in as few groups as possible. Join two things that conflict, and a plan is a coloring of the graph in which joined vertices differ; the fewest groups is the chromatic number. For maps the graph is planar, and Planar graphs and Euler's formula gives the fact that shows six colors always suffice.

Definition

This lesson takes two days. Day 1 is colorings, the chromatic number and its bounds, with scheduling (Results 1 to 5, Examples 1 to 3). Day 2 is maps and planar graphs, and a bound linking a graph to its complement (Results 6 to 10, Examples 4 to 6).

Graphs are finite and simple, in the notation of Degree, the handshake lemma and complete graphs (\deg(v), \Delta(G), K_n, the complement \overline{G}) and Walks, paths, cycles and connected graphs (the cycle graph C_n on the vertices 0, 1, \ldots, n - 1). H is a subgraph of G when every vertex and every edge of H is one of G, and G - u is G with the vertex u and its edges erased.

  • A coloring of G with k colors is a function \varphi : V \to \{1, 2, \ldots, k\}. It is proper when \varphi(u) \ne \varphi(v) for every edge uv. The numbers are only names for colors. G is k-colorable when it has a proper coloring with k colors.
  • The chromatic number \chi(G) is the smallest k for which G is k-colorable. Giving each vertex its own color is proper, so \chi(G) \le \lvert V \rvert and the smallest k exists.
  • The vertices of one color form a color class. A set of vertices no two of which are adjacent is independent, so a coloring is proper exactly when every color class is independent.
  • A clique is a set of vertices every two of which are adjacent. The clique number \omega(G) is the size of a largest clique.
  • Greedy coloring in the order v_1, v_2, \ldots, v_n gives each v_i in turn the smallest positive integer not already given to a neighbor of v_i among v_1, \ldots, v_{i-1}.
  • (Day 2) A map divides part of the plane into countries, each one connected piece. Two countries are neighbors when their borders share a stretch of positive length; meeting at a single point does not count. A map is colored properly when neighbors get different colors.

Intuition

1 O 3 F 2 P 2 B 1 J 2 C
Figure 1Melisandre’s ensembles, joined when they share a player. The color is the rehearsal hour.

Melisandre runs a summer music camp with six ensembles: brass (B), choir (C), flute choir (F), jazz band (J), orchestra (O) and percussion (P). Two ensembles that share a player cannot rehearse in the same hour. Join two ensembles when they share a player: a schedule with k hours is exactly a proper coloring with k colors, the hour being the color, and the fewest hours is \chi.

Every value of \chi is pinned by two arguments of different kinds. A proper coloring with k colors shows \chi \le k. A lower bound needs a reason that no smaller number works: a clique, whose vertices all need different colors, or an odd cycle, around which two colors cannot alternate.

A map becomes a graph the same way. Put a capital in each country and run a road from each capital to each neighbor’s capital, crossing their shared border. The roads can be drawn so that none cross, so the graph of a map is planar, and every plane drawing of a graph arises from some map in this way (both stated without proof). Coloring maps is coloring planar graphs.

Results

1. Complete graphs. \chi(K_n) = n.

2. Subgraphs and cliques. If H is a subgraph of G, then \chi(H) \le \chi(G). In particular \omega(G) \le \chi(G).

3. Cycles. \chi(C_n) = 2 when n is even and \chi(C_n) = 3 when n is odd. So every graph with an odd cycle has \chi(G) \ge 3.

4. Trees. Every tree with at least two vertices has chromatic number 2.

5. The greedy bound. Greedy coloring in any order is proper and uses at most \Delta(G) + 1 colors. So

\omega(G) \le \chi(G) \le \Delta(G) + 1.

6. Six colors (Day 2). Every simple planar graph has \chi(G) \le 6.

7. The five color theorem (Day 2). Every simple planar graph has \chi(G) \le 5.

8. The four color theorem (Day 2). Every simple planar graph has \chi(G) \le 4, so every map can be colored properly with four colors. The question dates from 1852, when Francis Guthrie, coloring England’s counties, asked whether four colors always suffice. Kenneth Appel and Wolfgang Haken answered yes in 1976, with a computer checking a very large number of cases. It is stated here without proof; no proof short enough to check by hand is known.

9. No triangle, many colors (Day 2). For every k \ge 3 there is a graph with no triangle and chromatic number k (Jan Mycielski gave one construction; stated without proof). So no lower bound built from cliques alone can find \chi.

10. A graph and its complement (Day 2). If G has n vertices, then

\chi(G) \cdot \chi(\overline{G}) \ge n.
Why it is true

Result 1. Proof. In K_n every two vertices are adjacent, so a proper coloring gives all n of them different colors and \chi(K_n) \ge n. One color each is proper, so \chi(K_n) \le n. \square

Result 2. Proof. Take a proper coloring of G with \chi(G) colors and keep only its values on the vertices of H. Every edge of H is an edge of G, so its ends still differ, and H is \chi(G)-colorable. A clique of size \omega(G), with the edges among its vertices, is a subgraph equal to K_{\omega(G)}, so by Result 1, \omega(G) = \chi(K_{\omega(G)}) \le \chi(G). \square

Result 3. Proof. C_n has an edge, so \chi(C_n) \ge 2. Let n be even and give i the color 1 when i is even and 2 when i is odd. The edge \{i, i + 1\} joins integers of opposite parity, and so does the closing edge \{n - 1, 0\}, since n - 1 is odd. So \chi(C_n) = 2.

Let n be odd and suppose \varphi is a proper coloring with colors 1 and 2. Along the path 0, 1, \ldots, n - 1 the colors must alternate, so \varphi(i) = \varphi(0) exactly when i is even. Then n - 1, which is even, has \varphi(n - 1) = \varphi(0), yet n - 1 and 0 are adjacent: a contradiction, so \chi(C_n) \ge 3. Alternating 1 and 2 on 0, \ldots, n - 2 and giving n - 1 the color 3 is proper, so \chi(C_n) = 3. A graph with an odd cycle has a subgraph equal to some C_n with n odd, and Result 2 gives the last claim. \square

Result 4. Proof. By induction on the number of vertices n \ge 2 (How induction works: base case, hypothesis and step). A tree on two vertices is one edge, and needs and has two colors. Let T be a tree on n + 1 \ge 3 vertices, and assume the claim for trees on n vertices. T has a leaf \ell (Trees, Result 1), and T - \ell is a tree on n \ge 2 vertices (Result 2 there), so it has a proper coloring with colors 1 and 2. The leaf has one neighbor; give \ell the other color. The result is proper, and T has an edge, so \chi(T) = 2. \square

Result 5. Proof. Each edge v_i v_j with i < j is checked when v_j is colored, and v_j avoids the colors of its earlier neighbors, so the coloring is proper. When v_i is colored it has at most \deg(v_i) \le \Delta(G) earlier neighbors, which hold at most \Delta(G) of the colors 1, 2, \ldots, \Delta(G) + 1. So one of those is free and the smallest free color is at most \Delta(G) + 1. Result 2 gives the left inequality. \square

Result 6. Proof. By induction on v, the number of vertices. A graph with one vertex needs one color. Let G be simple and planar with v \ge 2, and assume every simple planar graph with v - 1 vertices is 6-colorable. G has a vertex u of degree at most 5 (Planar graphs and Euler's formula, Result 6). G - u is a subgraph of G, so it is simple and planar, and it has v - 1 vertices; color it properly with six colors. The at most five neighbors of u use at most five of the six colors, and u takes one they do not use. \square

Result 7. Sketch, not a full proof. Run the same induction with five colors. The only trouble is a vertex u of degree 5 whose neighbors w_1, \ldots, w_5, in order around u in a plane drawing, carry all five colors 1, \ldots, 5. Look at the vertices colored 1 or 3 and the edges among them, and let K be the component of that subgraph containing w_1. Swapping colors 1 and 3 throughout K keeps the coloring proper: an edge inside K still joins 1 and 3, and an edge from K to a vertex outside it goes to a color other than 1 and 3, since otherwise that vertex would be in K. If w_3 is not in K, after the swap w_1 and w_3 both have color 3, and color 1 is free for u.

If w_3 is in K, a path from w_1 to w_3 colored only 1 and 3, together with u, is a cycle. In the plane it separates w_2 from w_4, one inside and one outside (this step rests on the Jordan curve theorem, the topology behind planarity). A path from w_2 to w_4 colored only 2 and 4 would have to meet that cycle at a vertex, but the cycle’s vertices other than u are colored 1 and 3. So w_2 and w_4 lie in different components of the subgraph colored 2 or 4, and swapping 2 and 4 in the component of w_2 frees color 2 for u.

The swapping chains are called Kempe chains. Alfred Kempe used them in 1879 in a claimed proof of four colors; in 1890 Percy Heawood found its gap and saved five colors from the argument.

Result 10. Proof. Let k = \chi(G) and let S_1, \ldots, S_k be the color classes of a proper coloring of G. Each S_i is independent in G, so every two of its vertices are adjacent in \overline{G}: S_i is a clique of \overline{G}. By Result 2, \lvert S_i \rvert \le \omega(\overline{G}) \le \chi(\overline{G}). The classes divide up all n vertices, so

n = \lvert S_1 \rvert + \cdots + \lvert S_k \rvert \le k \cdot \chi(\overline{G}) = \chi(G) \cdot \chi(\overline{G}). \quad \square

Worked examples

Example 1

Rehearsal hours

At Melisandre’s camp, the orchestra shares players with brass, percussion and the flute choir; percussion also shares with the jazz band and the flute choir; the jazz band also shares with brass and the choir; and the choir also shares with the flute choir. What is the fewest number of rehearsal hours, and which ensembles share an hour?

Solution

The graph (Figure 1) has the eight edges OB, OP, OF, PJ, PF, JB, JC, CF. The orchestra, percussion and the flute choir share players pairwise, a clique of size 3, so \chi \ge 3 by Result 2.

Three colors suffice. O, P, F need three different colors: 1, 2, 3. B meets O and J, and J is not yet colored, so B can take 2. J meets B and P, both colored 2, and C, not yet colored, so J takes 1. C meets J (color 1) and F (color 3), so C takes 2. All eight edges join different colors, so \chi = 3:

HourEnsembles
1O, J
2B, P, C
3F

The largest degree is 3, so Result 5 promises only \chi \le 4; here the clique bound is exact.

Example 2

Greedy coloring and the order

1 a 2 b 3 c 1 d order a, d, b, c 1 a 2 b 1 c 2 d order a, b, c, d
Figure 2Greedy coloring of one path in two orders. The same rule uses three colors or two.

Run greedy coloring on the path a, b, c, d (edges ab, bc, cd), first in the order a, b, c, d and then in the order a, d, b, c.

Solution

In the order a, b, c, d: a gets 1; b has the earlier neighbor a, so it gets 2; c has the earlier neighbor b (color 2), so it gets 1; d has the earlier neighbor c (color 1), so it gets 2. Two colors, which is \chi, since the path is a tree (Result 4).

In the order a, d, b, c: a gets 1. The only neighbor of d is c, which comes later, so d also gets 1. b has the earlier neighbor a, so it gets 2. c has the earlier neighbors b and d, colored 2 and 1, so it gets 3. Three colors, one more than needed, though still within \Delta + 1 = 3 as Result 5 promises. Greedy coloring is quick and always proper, but the number of colors depends on the order. Some order always reaches \chi(G) (Exercise 13); finding one is as hard as finding \chi(G).

Example 3

A ring with no four-clique

1 0 2 1 3 2 1 3 2 4 3 5 4 6
Figure 3The graph R of Example 3, properly colored with four colors.

The graph R has vertices 0, 1, \ldots, 6 around a circle, each joined to the vertices one and two steps away on either side. Find \omega(R) and \chi(R).

Solution

0, 1, 2 are pairwise joined, so \omega(R) \ge 3. The neighbors of a vertex x are x - 2, x - 1, x + 1, x + 2 (counting around the circle). Of these, only x - 2 and x - 1, x - 1 and x + 1, and x + 1 and x + 2 are joined; the other pairs are three steps apart the short way. Those four neighbors form a path, which has no triangle, so no clique of size 4 contains x. So \omega(R) = 3.

The clique bound gives only \chi(R) \ge 3, and the truth is larger. Three vertices cut the circle into three gaps, counted in steps, adding up to 7. If every gap were at least 3 the sum would be at least 9, so some gap is at most 2, and two of the three vertices are joined. So an independent set has at most 2 vertices. With k colors the classes hold at most 2k vertices, and 2k \ge 7 forces k \ge 4.

Four colors suffice: give 0, 1, \ldots, 6 the colors 1, 2, 3, 1, 2, 3, 4 (Figure 3). The pairs sharing a color, \{0, 3\}, \{1, 4\} and \{2, 5\}, are three steps apart, so they are not joined. So \chi(R) = 4 > \omega(R) = 3, while \Delta(R) + 1 = 5.

Example 4

Melisandre’s map

A 1 B 2 C 4 D 3 E 4
Figure 4Melisandre’s map. C and E do not touch, so they may share a color.

Melisandre draws a map of the five townships around the camp (Figure 4). How few colors can it be colored with?

Solution

Read off the neighbors, counting only borders of positive length. A borders B (along the short east edge of A), C, D and E. B borders C and D along the bottom and E along the bottom and the east. D borders C and E. C and E do not touch. So the graph is K_5 with the one edge CE missing.

A, B, C, D are pairwise neighbors, a clique of size 4, so at least four colors are needed. Give A, B, D the colors 1, 2, 3. Then C borders A, B, D, and so does E, so each needs a fourth color; they are not neighbors, so both take 4. The fewest is four. The four color theorem says no map needs five; this one shows four can be needed.

Example 5

Four colors without triangles

Prove, without the four color theorem, that every simple planar graph with no triangle is 4-colorable.

Solution

Proof. First, such a graph G has a vertex of degree at most 3. If a component has at most 2 vertices, a vertex in it has degree at most 1. Otherwise take a component H with v_H \ge 3 vertices and e_H edges. It is simple, connected, planar and has no triangle, so e_H \le 2v_H - 4 (Planar graphs and Euler's formula, Result 4), and by the handshake lemma

\sum_{x \in H} \deg(x) = 2e_H \le 4v_H - 8 < 4v_H.

So not every vertex of H has degree 4 or more.

Now induct on v as in Result 6. One vertex needs one color. For v \ge 2, take u of degree at most 3. G - u is simple, planar and still has no triangle, so by the induction hypothesis it is 4-colorable. The at most three neighbors of u leave a fourth color for u. \square

A much harder theorem shows that three colors suffice here (stated without proof).

Example 6

A complement drawn flat

A graph G has 13 vertices, and its complement \overline{G} is planar. Show that \chi(G) \ge 4. What would Result 6 alone give?

Solution

\overline{G} is simple and planar, so \chi(\overline{G}) \le 4 by the four color theorem. By Result 10,

\chi(G) \ge \frac{13}{\chi(\overline{G})} \ge \frac{13}{4} = 3.25,

and \chi(G) is an integer, so \chi(G) \ge 4. With only \chi(\overline{G}) \le 6 from Result 6, the same steps give \displaystyle \chi(G) \ge \frac{13}{6}, so only \chi(G) \ge 3.

Boundaries

  • Simple graphs. A loop at v would ask \varphi(v) \ne \varphi(v), so no proper coloring exists; repeated edges change nothing.
  • Bounds, not a formula. \omega(G) can sit below \chi(G) (Example 3), far below by Result 9, and \Delta(G) + 1 can sit far above (a star with 100 leaves is a tree, with \chi = 2). For a connected graph, \chi(G) = \Delta(G) + 1 only for complete graphs and odd cycles, a theorem of Brooks stated here without proof. No quick method is known for computing \chi(G) for every graph.
  • Planar only. Results 6 to 8 are about planar graphs; K_n needs n colors. On the surface of a donut (a torus) some maps need seven colors (stated without proof).
  • What counts as a map. Each country must be one piece: if a country had two separate pieces that must share its color, the graph need not be planar and four colors can fail. Corners do not count as borders: a pie cut into n slices meeting at the center would otherwise need n colors.

Where this goes next

A graph has \chi(G) \le 2 exactly when its vertices split into two groups with every edge running between them, and Bipartite graphs proves that this happens exactly when there is no odd cycle; Result 3 is the easy half.

Exercises

Colorings, bounds and scheduling (Day 1)

  1. The graph with vertices 1 to 6 has edges 12, 13, 23, 34, 45, 46, 56. Find \omega, \chi and \Delta + 1.
  2. Add the edge \{0, 3\} to C_6 and find \chi. Then add \{0, 2\} to C_6 instead and find \chi.
  3. Melisandre’s camp runs five workshops V, W, X, Y, Z. V shares an instructor with W and with Z, W with X, X with Y, and Y with Z; no other pairs share. What is the fewest number of time slots, and which workshops share a slot?
  4. Six courses A to F give final exams, and five students take the course lists \{A, B, C\}, \{C, D, E\}, \{A, E\}, \{B, F\} and \{D, F\}. Two exams with a student in common need different periods. What is the fewest number of periods?
  5. Run greedy coloring on C_6 in the order 0, 3, 1, 4, 2, 5, and then in the order 0, 1, 2, 3, 4, 5. How many colors does each use?
  6. Build graphs as in Example 3 on 8 vertices and on 9 vertices: i joined to the vertices one and two steps away on either side. Find \chi of each.

Maps and planar graphs (Day 2)

  1. A square map is cut into a 3 \times 3 grid of square countries. How many colors does it need? How many would it need if countries meeting only at a corner also counted as neighbors?
  2. The octahedron has 6 corners, each joined by an edge to every corner except the one opposite it. Find \chi of its graph.
  3. Find \chi(C_6) and \chi(\overline{C_6}), and compare their product with Result 10.
  4. Use Example 7 of Planar graphs and Euler's formula (every simple planar graph with at most 11 vertices has a vertex of degree at most 4) to prove, without Result 7, that every simple planar graph with at most 11 vertices is 5-colorable.

Reasoning

  1. Prove that a graph G with n vertices has \chi(G) = n only when G = K_n.
  2. Prove that if \chi(G) = k, then G has at least \displaystyle \frac{k(k-1)}{2} edges.
  3. Prove that every graph has an order of its vertices in which greedy coloring uses exactly \chi(G) colors.
  4. Prove that \chi(G) is the largest of the chromatic numbers of the components of G.
  5. Prove that \displaystyle \chi(G) + \chi(\overline{G}) \ge 2\sqrt{n} for every graph G with n vertices.
  6. Prove that if \chi(G) = k, then G has at least k vertices of degree at least k - 1.
  7. “Every simple planar graph is 5-colorable: run the proof of Result 6 with five colors in place of six.” Find the step that fails.
Answers
  1. \omega = 3, \chi = 3, \Delta + 1 = 4. The triangle 1, 2, 3 gives \chi \ge 3; color 1, 2, 3 with 1, 2, 3, then 4 with 1, and 5, 6 with 2, 3. Only 3 and 4 have degree 3, so there is no clique of size 4.
  2. \chi = 2, then \chi = 3. With \{0, 3\}, the parity coloring of Result 3 still works, since 0 is even and 3 odd. With \{0, 2\}, the triangle 0, 1, 2 forces 3, and the colors 1, 2, 3, 1, 2, 3 around the cycle are proper.
  3. Three slots: \{V, X\}, \{W, Y\}, \{Z\}. The graph is the cycle V, W, X, Y, Z, V, of odd length 5, so Result 3 gives \chi = 3.
  4. Three periods: \{A, D\}, \{B, E\}, \{C, F\}. The edges are AB, AC, BC, CD, CE, DE, AE, BF, DF; the triangle A, B, C forces three, and each period is independent.
  5. 3 colors, then 2. First order: 0 \to 1, 3 \to 1, 1 \to 2, 4 \to 2, 2 \to 3 (its neighbors 1, 3 hold 2, 1), 5 \to 3. Second order: 1, 2, 1, 2, 1, 2.
  6. 4 on 8 vertices, 3 on 9. For 8: three gaps add up to 8, so some gap is at most 2, an independent set has at most 2 vertices, and 2k \ge 8 gives k \ge 4; the colors 1, 2, 3, 4, 1, 2, 3, 4 repeat only four steps apart. For 9: a triangle forces 3, and the colors 1, 2, 3 repeated three times repeat only three or six steps apart.
  7. 2, then 4. Color the square in row i, column j by the parity of i + j; side neighbors differ by 1 in one coordinate. With corners, the four squares of any 2 \times 2 block touch pairwise, a clique of size 4; coloring by the parities of i and j works, since squares sharing both parities differ by 2 in a row or column and do not touch.
  8. \chi = 3. Each face is a triangle, so \chi \ge 3. The only non-adjacent pairs are the three opposite pairs; use them as the three color classes.
  9. \chi(C_6) = 2 and \chi(\overline{C_6}) = 3, with product 6 = n, so Result 10 holds with equality. In \overline{C_6}, 0, 2, 4 form a triangle, and \{0, 1\}, \{2, 3\}, \{4, 5\} are independent there, so they serve as color classes.
  10. Induct on v \le 11. One vertex needs one color. For 2 \le v \le 11, take u of degree at most 4; G - u is simple, planar, with v - 1 \le 11 vertices, so it is 5-colorable, and the at most four neighbors of u leave a color free.
  11. If some u, v are not adjacent, give both color 1 and the other n - 2 vertices the colors 2, \ldots, n - 1: proper with n - 1 colors. So \chi(G) = n forces every pair adjacent.
  12. Take a proper coloring with classes S_1, \ldots, S_k. For i \ne j some edge joins S_i to S_j, or S_i \cup S_j would be independent and one color could replace two, giving k - 1. Different pairs \{i, j\} give different edges, so there are at least \binom{k}{2} edges.
  13. Take a proper coloring with classes S_1, \ldots, S_k, k = \chi(G), and list S_1, then S_2, and so on. By induction along the list, greedy gives each vertex of S_i a color at most i: its earlier neighbors lie in S_1, \ldots, S_{i-1} (none in S_i, which is independent), so they hold colors at most i - 1 and some color at most i is free. So greedy uses at most k colors, and never fewer than \chi(G) = k.
  14. Each component is a subgraph, so Result 2 gives \chi(G) \ge each. Color each component properly with colors 1 up to its own chromatic number; no edge joins two components, so the whole is proper and uses the largest of these numbers.
  15. Let a = \chi(G) and b = \chi(\overline{G}). Since (a - b)^2 \ge 0, (a + b)^2 \ge 4ab \ge 4n by Result 10, and \displaystyle a + b \ge 2\sqrt{n}.
  16. Take a proper coloring with classes S_1, \ldots, S_k. If every vertex of S_i lacked a neighbor of some color j \ne i, recolor each to such a missing color. Two recolored vertices are not adjacent, since S_i is independent, so the coloring stays proper and uses only k - 1 colors. So each S_i has a vertex with neighbors of all k - 1 other colors, of degree at least k - 1, and these k vertices lie in different classes.
  17. The last step. u may have degree exactly 5 with its five neighbors carrying all five colors, and then no color is free. The swaps in the sketch of Result 7 are what repair it.
kg1128 · updated 2026-10-22 · CC-BY-SA-4.0