From a Polynomial Evaluation to an Orientation Count
A chromatic polynomial is usually used to count proper colorings when the number of available colors is a positive integer. Stanley’s identity gives it another role: its value at \(-1\), after a sign correction determined by the number of vertices, counts the acyclic orientations of the graph. The evaluation at \(-1\) is algebraic; it does not mean that a graph is being colored with a negative number of colors.
Throughout, graphs are finite and simple. An orientation of an undirected graph \(G=(V,E)\) assigns exactly one direction to each edge: an edge \(uv\) becomes either \(u\to v\) or \(v\to u\), but not both. A directed cycle is a cycle whose edges all point consistently around it. An orientation is acyclic if it contains no directed cycle. Write \(a(G)\) for the number of acyclic orientations of \(G\), and let \(n=|V(G)|\).
For the empty graph, with no vertices and no edges, use \(P_G(x)=1\). It has one empty coloring and one orientation, so \(n=0\) and \(a(G)=1\). This convention is consistent with the identity below.
The factor \((-1)^n\) is essential: \(P_G(-1)\) itself may be negative. The identity is a standard result; its general proof is treated in the proof of Stanley’s formula. Here we apply it and independently verify it for paths, cycles and complete graphs. In each case, the direct orientation count also checks that the polynomial evaluation has the intended meaning.
Paths: Every Edge Can Be Oriented Freely
For \(n\geq 1\), the path \(P_n\) has \(n\) vertices and \(n-1\) edges. Its chromatic polynomial is $$ P_{P_n}(x)=x(x-1)^{n-1}. $$ Indeed, the first vertex has \(x\) color choices, and each subsequent vertex has \(x-1\) choices because it must differ from its one already-colored neighbor.
Worked Example: The Four-Vertex Path
Let \(G=P_4\), with \(V(G)=\{1,2,3,4\}\) and \(E(G)=\{12,23,34\}\). Its chromatic polynomial is \(P_G(x)=x(x-1)^3\). Substitute \(x=-1\):
Since \(n=4\), the sign factor is \((-1)^4=1\), and therefore $$ (-1)^4P_G(-1)=1\cdot 8=8. $$ To check the count directly, each of the three edges can point in either direction. The resulting orientation cannot contain a directed cycle, because the underlying graph is a path and has no cycle. Thus the number is \(2^3=8\), agreeing with the polynomial evaluation.
Check: the direct count is \(2\cdot2\cdot2=8\). The polynomial calculation also gives \(8\), not \(-8\): the cube \((-2)^3=-8\), and the leading factor \(-1\) changes its sign.
Proof. There are \(n-1\) edges, and each has two possible directions, so there are \(2^{n-1}\) orientations in total. None contains a directed cycle, since a directed cycle would require an undirected cycle in the underlying graph, while \(P_n\) has none. For the polynomial evaluation, $$ (-1)^nP_{P_n}(-1) =(-1)^n(-1)(-2)^{n-1} =(-1)^n(-1)^n2^{n-1} =2^{n-1}. $$ Here \((-1)(-2)^{n-1}=(-1)^n2^{n-1}\), so the two sign factors multiply to \(1\). For \(n=1\), this gives \(2^0=1\), as required: the one-vertex graph has no edges and exactly one orientation. \(\square\)
Cycles: Exclude the Two Directed Cycles
For \(n\geq3\), the cycle \(C_n\) has \(n\) vertices and \(n\) edges. Its chromatic polynomial is $$ P_{C_n}(x)=(x-1)^n+(-1)^n(x-1). $$ This standard cycle formula counts proper colorings with the requirement that the last vertex also differ in color from the first. Substituting \(-1\) gives $$ P_{C_n}(-1)=(-2)^n+(-1)^n(-2)=(-1)^n(2^n-2). $$ Thus \((-1)^nP_{C_n}(-1)=2^n-2\).
Worked Example: The Five-Cycle
Let \(G=C_5\), with \(V(G)=\{1,2,3,4,5\}\) and \(E(G)=\{12,23,34,45,51\}\). Its chromatic polynomial is \(P_G(x)=(x-1)^5-(x-1)\). At \(x=-1\), the two terms evaluate as \((-2)^5=-32\) and \(-(-2)=2\). Therefore $$ P_G(-1)=-32+2=-30,\qquad (-1)^5P_G(-1)=(-1)(-30)=30. $$ For a direct count, there are \(2^5=32\) ways to orient the five edges. Exactly two orientations direct every edge consistently around the cycle, one clockwise and one counterclockwise; each is a directed cycle and hence is not acyclic. Any directed cycle in this graph must use all five edges, since the underlying graph is itself a cycle. The remaining \(32-2=30\) orientations are acyclic.
Check: the direct count is \(32-2=30\), and the polynomial calculation gives \((-1)(-30)=30\). The sign is positive, as a count must be.
Proof. Each of the \(n\) edges has two possible directions, giving \(2^n\) orientations. A directed cycle in an orientation of \(C_n\) must follow the full underlying cycle, so it occurs precisely when all edges point consistently around the cycle. There are two such orientations. Removing them leaves \(2^n-2\) acyclic orientations. The displayed cycle-polynomial calculation gives \((-1)^nP_{C_n}(-1)=2^n-2\), proving the claimed equality. \(\square\)
Complete Graphs: Acyclic Orientations Are Total Orders
The complete graph \(K_n\) has every pair of distinct vertices adjacent, and its chromatic polynomial is the falling factorial $$ P_{K_n}(x)=x(x-1)(x-2)\cdots(x-n+1). $$ For positive integer \(x\), this follows by choosing distinct colors for all \(n\) vertices in order. At \(-1\), its factors are \(-1,-2,\ldots,-n\), so $$ P_{K_n}(-1)=(-1)^n n!,\qquad (-1)^nP_{K_n}(-1)=n!. $$
Worked Example: Orientations of \(K_4\)
Let \(G=K_4\), with \(V(G)=\{1,2,3,4\}\) and \(E(G)=\{12,13,14,23,24,34\}\). Its polynomial is \(x(x-1)(x-2)(x-3)\). Substitution gives $$ P_G(-1)=(-1)(-2)(-3)(-4). $$ Multiplying in order, \((-1)(-2)=2\), \(2(-3)=-6\), and \((-6)(-4)=24\). Since \((-1)^4=1\), the signed value is \(1\cdot24=24\).
For the direct count, each acyclic orientation of \(K_4\) points from earlier to later in a unique ordering of its vertices. There are \(4\cdot3\cdot2\cdot1=24\) such orders. Hence there are 24 acyclic orientations, matching the evaluation.
Check: each ordering determines one orientation, and different orderings differ on the direction of at least one edge. The direct count \(4\cdot3\cdot2\cdot1=24\) agrees with \((-1)^4P_G(-1)=24\).
Proof. A total order of the vertices orients each edge from its earlier endpoint to its later endpoint. This orientation is acyclic, because following a directed edge strictly increases position in the order, which cannot happen all the way around a cycle. Conversely, consider an acyclic orientation of \(K_n\). It has a vertex with no incoming edge: otherwise, starting at any vertex and repeatedly following an incoming edge backwards would, by finiteness, revisit a vertex and produce a directed cycle. Remove such a vertex and repeat on the remaining acyclic orientation. This gives an order in which every edge points from earlier to later. At each stage the vertex with no incoming edge is unique, since any two vertices are adjacent and the edge between them points into one of them. Thus the order is unique. There are \(n!\) total orders, including one empty order when \(n=0\), so there are \(n!\) acyclic orientations. Finally, the falling-factorial formula gives \(P_{K_n}(-1)=(-1)^n n!\), and multiplication by \((-1)^n\) gives \(n!\). \(\square\)
Sign Checks and Common Uses
The three families illustrate how the same polynomial evaluation reflects different orientation counts: every edge direction is allowed on a path; a cycle excludes its two consistently directed orientations; and a complete graph encodes an ordering. The identity is useful when a chromatic polynomial is already known or computed: it turns one exact evaluation into a count of acyclic orientations without enumerating orientations individually.
A common mistake is to mishandle the sign when evaluating at \(-1\). For the four-vertex path, an incorrect calculation might write $$ (-1)(-2)^3=-8. $$ The correction is \((-2)^3=-8\), so \((-1)(-8)=8\). Then \((-1)^4=1\), and the signed value remains \(8\). The sign factor in Stanley’s identity is applied to the correctly evaluated polynomial; it is not an extra factor to insert inside the polynomial calculation.
Another useful check is that the final signed value must be a nonnegative integer, since it equals a number of orientations. That check can reveal an error but does not replace the calculation: a positive answer alone does not establish that the polynomial or orientation count was computed correctly. Verify both, as in the examples.
Check Your Understanding
For each question, show the substitution or orientation count that supports your answer.
- For \(P_5\), compute \((-1)^5P_{P_5}(-1)\) and verify the result by counting edge orientations.
- Why are there exactly two orientations of \(C_n\) that are not acyclic for \(n\geq3\)?
- Evaluate \((-1)^3P_{K_3}(-1)\), showing each factor, and explain the direct orientation count.
- Explain why an acyclic orientation of a complete graph determines a unique total order of its vertices.
- What is the acyclic-orientation count of the graph with no vertices, and how does the stated convention for its chromatic polynomial make the identity hold?