Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 28 of 34

Count colorings with a recurrence

Prove deletion–contraction.

Loading your saved responses…

Try the optional starting-point checks and targeted refreshers. You can continue directly into this lesson.

Try

Counting colorings is more informative than asking only whether three colors suffice. A triangle has k(k−1)(k−2) proper colorings with k named colors. The labels on the colors matter: swapping red and blue usually creates a different coloring in this count. The resulting polynomial P_G(k) is the chromatic polynomial, and its smallest positive integer input with a positive value is the chromatic number for a nonempty graph.

Predict

Predict how removing an edge partitions the newly allowed colorings. If the endpoints still receive different colors, the coloring was already valid before deletion. If they receive the same color, merge those endpoints and count colorings of the contracted graph. This gives deletion–contraction. It is a classification of colorings, not an approximate recurrence based on graph size.

Experiment

Apply the recurrence to one edge of a triangle.

GraphColoring count
Edge deleted: three-vertex pathk(k−1)²
Edge contracted: two adjacent verticesk(k−1)
Triangle: differencek(k−1)(k−2)

The contraction can create parallel edges, but duplicate adjacency constraints do not change proper colorings. A loop, by contrast, makes every proper-coloring count zero.

Understand

For a nonloop edge e, every proper coloring of G−e either separates its endpoints or identifies their colors. The first class has size P_G(k); the second corresponds bijectively to proper colorings of G/e. Therefore P_G=P_(G−e)−P_(G/e). Starting from edgeless graphs, whose count is k^n, induction proves polynomiality. A tree rooted at one vertex has k choices at the root and k−1 at each remaining vertex, giving k(k−1)^(n−1). The recurrence also yields the cycle formula P_(C_n)(k)=(k−1)^n+(−1)^n(k−1), which can be checked inductively by deleting and contracting a cycle edge.

Apply

An alternative inclusion–exclusion formula sums over edge subsets F: P_G(k)=Σ_F(−1)^(size (F)) k^(c(F)), where c(F) is the number of components in the spanning subgraph with edge set F. Requiring every selected edge monochromatic forces each component to one color, explaining the exponent. For a simple n-vertex graph, the leading term is k^n and the next coefficient is minus the number of edges. A single selected edge reduces components by one; any two distinct edges reduce them by at least two. This gives a useful consistency check on a computed polynomial.

A computed polynomial should satisfy several independent checks: degree equals the vertex count, the leading coefficient is one, and P(1)=0 whenever an edge exists. For a graph with at least one edge, P(0)=0 as well. These are necessary checks, not a proof that every coefficient is correct; evaluate a small positive color count by direct enumeration to test the recurrence output.

Continue

The polynomial is an invariant under graph isomorphism but not a complete one: every tree on the same number of vertices has the same polynomial. Its values at nonpositive integers have other interpretations, but those require separate theorems and are not ordinary counts of colorings with negative colors. As a coding exercise, implement deletion–contraction with memoization and compare small results against exhaustive color assignments. State the exponential worst-case cost of the basic recursion rather than presenting it as an efficient general solution to graph coloring.

Return to the combinatorics and graph theory unit for prerequisite choices and targeted retries. Continue with use faces to certify planar obstructions.

Apply · explain · revise

Practice and reasoning

Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.

How many proper colorings of a triangle use three available named colors?

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

How many proper colorings of a four-cycle use three named colors?

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

Prove P_G(k)=P_(G−e)(k)−P_(G/e)(k) for a nonloop edge.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Prove a tree on n≥1 vertices has polynomial k(k−1)^(n−1).

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Explain why the coefficient of k^(n−1) in a simple graph is minus its edge count.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Why does a chromatic polynomial not determine graph isomorphism?

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Reflect and continue

Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.