On this page
An exam timetable and a map are the same puzzle. Draw a dot (a vertex) for each exam or region and join two dots (an edge) when they clash. In how many ways can you give every dot one of k colours so that no edge joins two dots of the same colour? That count, as a function of k, is the chromatic polynomial.
What is the chromatic polynomial of a graph?
The chromatic polynomial P(G, k) is the polynomial that equals the number of proper vertex colourings of G with k colours at every whole number k. Colourings that differ only by renaming colours count as different (MathWorld).
George D. Birkhoff introduced it in 1912 in A Determinant Formula for the Number of Ways of Coloring a Map. He hoped to prove the four colour theorem by showing P(G, 4) > 0 for every planar graph (background: our post on Euler's formula and why K₅ and K₃,₃ are not planar). For n vertices, P(G, k) has degree n, leading coefficient 1, and kⁿ⁻¹ coefficient equal to minus the number of edges.
How do you find P(Kₙ) and the polynomial of a tree?
Colour the vertices one at a time and multiply the choices. Both formulas are in the Wikipedia table of chromatic polynomials.
Complete graph Kₙ. Every pair is joined, so each new vertex has one choice fewer than the last: P(Kₙ, k) = k(k − 1)(k − 2)…(k − n + 1). For a triangle (K₃) with 3 colours that is 3 × 2 × 1 = 6.
Any tree with n vertices. A tree is connected with no cycles. Colour any vertex first (k ways), then grow outward: each new vertex touches exactly one coloured vertex, so it has k − 1 choices. So P(T, k) = k(k − 1)ⁿ⁻¹ whatever the tree's shape, and conversely a graph on n vertices with this polynomial must be a tree. For another famous tree count, see Cayley's formula for spanning trees.
What is the deletion–contraction rule?
For any edge uv, the deletion–contraction recurrence says P(G, k) = P(G − uv, k) − P(G / uv, k). Here G − uv deletes the edge and G / uv contracts it, merging u and v into one vertex.
Why it works: in a proper colouring of G − uv, either u and v differ (exactly the colourings of G) or they match (exactly the colourings of G / uv).
How does deletion–contraction work on a 4-cycle?
Label the corners of a square A, B, C, D, with edges AB, BC, CD and DA.
Delete DA: the path A–B–C–D is a tree on 4 vertices, giving k(k − 1)³.
Contract DA: A and D merge into one vertex joined to B and C, making a triangle, giving k(k − 1)(k − 2).
Subtract: P(C₄, k) = k(k − 1)³ − k(k − 1)(k − 2) = k(k − 1)(k² − 3k + 3).
Expand: k⁴ − 4k³ + 6k² − 3k. Degree 4 matches the vertices; −4 matches the edges.
Cross-check with the cycle formula (k − 1)ⁿ + (−1)ⁿ(k − 1) from MathWorld: n = 4 gives (k − 1)⁴ + (k − 1), the same polynomial.
If a contraction step trips you up, the Fermi Problem Library has a step-by-step solver that explains the reasoning rather than printing an answer.
How do you read the chromatic number from it?
The chromatic number χ(G) is the smallest positive integer that is not a root of the chromatic polynomial, the fewest colours with P(G, k) > 0.
For the 4-cycle, P(C₄, 1) = 0 and P(C₄, 2) = 2 × 1 × 1 = 2, so χ(C₄) = 2: A and C share one colour, B and D the other, or the reverse. With 3 colours there are 3 × 2 × 3 = 18.
Elsewhere:
Kₙ has roots 0, 1, …, n − 1, so χ(Kₙ) = n.
A tree with at least one edge has roots 0 and 1 only, so χ = 2.
A cycle at k = 2 gives 1 + (−1)ⁿ: that is 2 for even n and 0 for odd n, so even cycles need 2 colours and odd cycles need 3.
Which method should you use first?
Complete graph: the falling product.
Tree: k(k − 1)ⁿ⁻¹ straight away.
Single cycle: the cycle formula.
Anything else: delete and contract an edge on a cycle, and repeat until every piece is a tree, a cycle or a complete graph, merging any doubled edge a contraction creates.
One warning: the polynomial counts two colourings as different even if rotating the drawing turns one into the other. For counts up to symmetry, see our post on Burnside's lemma for counting colourings.
The Fermi Concept Library gives every concept in mathematics its own lesson and its place in the map. Then try the 5-cycle yourself: you should get k⁵ − 5k⁴ + 10k³ − 10k² + 4k.



