The Identity and Its Ingredients
Stanley’s formula turns an orientation-counting problem into an evaluation of a polynomial. The sign in the formula is determined by the number of vertices, not the number of edges. To prove it, we will connect three facts: the characteristic polynomial of a graphic hyperplane arrangement is the chromatic polynomial; the number of regions satisfies a deletion–restriction recurrence; and each region determines exactly one acyclic orientation.
Throughout, graphs are finite and simple. An orientation chooses a direction for each edge. It is acyclic if it has no directed cycle. For a graph \(G\), write \(a(G)\) for its number of acyclic orientations and \(P_G(q)\) for its chromatic polynomial, which counts proper vertex colorings when \(q\) is a positive integer.
For a finite arrangement \(\mathcal{A}\) in an \(n\)-dimensional real vector space, its characteristic polynomial is \(\chi_{\mathcal{A}}(q)=\sum_{\mathcal{B}\subseteq\mathcal{A}}(-1)^{|\mathcal{B}|}q^{\dim(\bigcap_{H\in\mathcal{B}}H)}\). The intersection for \(\mathcal{B}=\varnothing\) is the whole space, of dimension \(n\). In the graphic arrangement, the hyperplanes indexed by an edge set \(F\) impose equality of coordinates along every edge of \(F\). Coordinates are therefore constant on each component of \((V(G),F)\), so the intersection has dimension equal to the number of those components.
The Graphic Characteristic Polynomial
Proof. Fix a positive integer \(q\), and assign each vertex one of \(q\) colors. For an edge \(uv\), let the bad event be that \(u\) and \(v\) receive the same color. Inclusion–exclusion over the edge events gives the number of assignments avoiding all bad events. For a selected edge set \(F\), requiring equality at the endpoints of every edge in \(F\) forces one color per component of \((V(G),F)\), including its isolated vertices. Thus there are \(q^{c(F)}\) assignments satisfying those requirements, where \(c(F)\) is the number of components. As noted above, \(c(F)\) is also the dimension of the corresponding hyperplane intersection. Inclusion–exclusion therefore gives \(P_G(q)=\sum_{F\subseteq E(G)}(-1)^{|F|}q^{c(F)}=\chi_{\mathcal{A}_G}(q)\). This holds for every positive integer \(q\). Both sides are polynomials, and two polynomials agreeing at infinitely many values are identical. If \(V(G)=\varnothing\), the sum has one term, equal to \(1\), and the same identity holds. \(\square\)
Why Regions Satisfy a Recurrence
For an arrangement \(\mathcal{A}\), let \(r(\mathcal{A})\) be its number of regions. Choose one hyperplane \(H\in\mathcal{A}\). The deletion is \(\mathcal{A}\setminus\{H\}\); the restriction is the arrangement in \(H\) formed by the intersections \(H\cap K\) for \(K\in\mathcal{A}\setminus\{H\}\), with repeated hyperplanes counted only once.
Proof. A region of the deletion is an intersection of open half-spaces, hence is open and convex. If it does not meet \(H\), it remains one region when \(H\) is restored. If it meets \(H\), openness means it has points on both sides of \(H\), and adding \(H\) splits it into two regions. The regions that are split correspond one-to-one to the regions of the restriction: intersect a split deletion region with \(H\) to obtain one restriction region. Conversely, each restriction region lies in a unique deletion region, since it avoids every hyperplane of the deletion. These operations are inverse, so the number of newly created regions is \(r(\mathcal{A}^{H})\). Adding that to the number of deletion regions proves the recurrence. \(\square\)
Apply the lemma to \(\mathcal{A}_G\) and the hyperplane \(H_{uv}\) for an edge \(e=uv\). Deleting this hyperplane gives \(\mathcal{A}_{G-e}\). In the restriction to \(H_{uv}\), the coordinates \(x_u\) and \(x_v\) are identified. Every other edge hyperplane becomes the hyperplane associated with the corresponding edge after \(u\) and \(v\) are identified. If two such edges give the same hyperplane, the duplicate is discarded. This is precisely the graphic arrangement of the simple graph \(G/e\), obtained by contracting \(e\) and replacing any parallel edges by one edge. Therefore \(r(\mathcal{A}_G)=r(\mathcal{A}_{G-e})+r(\mathcal{A}_{G/e})\).
The chromatic polynomial has the matching deletion–contraction identity \(P_G(q)=P_{G-e}(q)-P_{G/e}(q)\). Indeed, a proper coloring of \(G-e\) either gives different colors to \(u,v\), in which case it is a coloring of \(G\), or gives them the same color, in which case it corresponds to a coloring of \(G/e\). Thus \(P_{G-e}(q)=P_G(q)+P_{G/e}(q)\) for positive integer \(q\), and hence as a polynomial.
Regions and Acyclic Orientations
Proof. Take a point \(x=(x_v)_{v\in V(G)}\) outside every hyperplane. For each edge \(uv\), its endpoint coordinates are unequal, so orient the edge from the smaller coordinate to the larger. Along any directed cycle the coordinates would strictly increase at every edge and return to their starting value, which is impossible. The orientation is therefore acyclic. Throughout any one region, each comparison \(x_u<x_v\) or \(x_v<x_u\) has a fixed sign, so the orientation is constant there.
For the converse, let an acyclic orientation be given. Every finite directed acyclic graph has an ordering of its vertices in which every directed edge points forward. To see this, there must be a vertex with no incoming edge: otherwise, repeatedly following an incoming edge would eventually revisit a vertex and produce a directed cycle. Remove such a vertex and repeat on the remaining acyclic digraph. Listing the removed vertices in order gives the required ordering. Assign distinct increasing real coordinates in that order. Every edge then points from its smaller coordinate to its larger coordinate, so the resulting point lies outside the arrangement and induces the given orientation. Finally, the set of points inducing a fixed orientation is described by strict linear inequalities, one for each edge. It is convex and hence connected, so it lies in exactly one region. This proves the bijection. If the graph has no vertices, there is one empty orientation and the complement in the zero-dimensional space has one region, so the statement holds in that case as well. \(\square\)
Stanley’s Formula
Proof. We use induction on the number of edges. For an edgeless graph with \(n\) vertices, there is exactly one orientation, and it is acyclic. Its chromatic polynomial is \(P_G(q)=q^n\), so \((-1)^nP_G(-1)=(-1)^n(-1)^n=1\). This also covers the graph with no vertices, since then \(n=0\) and \(q^0=1\).
Now suppose \(G\) has an edge \(e\), and assume the formula holds for graphs with fewer edges. The region–orientation bijection and the region recurrence give \(a(G)=a(G-e)+a(G/e)\). The contracted graph has fewer edges than \(G\): contracting \(e\) removes \(e\), and any duplicated edges are discarded. Write \(n=|V(G)|\); then \(G-e\) has \(n\) vertices, while \(G/e\) has \(n-1\). By the induction hypothesis and the chromatic deletion–contraction identity, \[ \begin{aligned} a(G) &=(-1)^nP_{G-e}(-1)+(-1)^{n-1}P_{G/e}(-1)\\ &=(-1)^n\bigl(P_{G-e}(-1)-P_{G/e}(-1)\bigr)\\ &=(-1)^nP_G(-1). \end{aligned} \] The second equality uses \((-1)^{n-1}=-(-1)^n\), and the last uses deletion–contraction. This proves the formula. \(\square\)
Worked Example: The Path on Three Vertices
Let \(G\) have \(V(G)=\{1,2,3\}\) and \(E(G)=\{12,23\}\). This is a path. Choose the color of vertex \(1\) in \(q\) ways, then vertex \(2\) in \(q-1\) ways and vertex \(3\) in \(q-1\) ways. Thus \(P_G(q)=q(q-1)^2\). Substituting \(q=-1\) gives \(P_G(-1)=(-1)(-2)^2=-4\), and \((-1)^3P_G(-1)=(-1)(-4)=4\).
There are \(2^2=4\) orientations, since each of the two edges has two choices of direction. A path has no cycle, so all four orientations are acyclic. The direct count agrees with the formula.
Check: the four orientations can be specified by the direction of \(12\) and the direction of \(23\); each pair of choices occurs once. Hence the direct count is \(4\), as calculated from the polynomial.
Worked Example: The Triangle
Let \(G\) have \(V(G)=\{1,2,3\}\) and \(E(G)=\{12,23,13\}\). A proper coloring assigns \(q\) choices to vertex \(1\), \(q-1\) to vertex \(2\), and \(q-2\) to vertex \(3\). Therefore \(P_G(q)=q(q-1)(q-2)\). At \(q=-1\), this is \((-1)(-2)(-3)=-6\), and multiplying by \((-1)^3=-1\) gives \(6\).
There are \(2^3=8\) orientations in total. Exactly two are directed cycles: \(1\to2\to3\to1\) and its reverse. Every other orientation is acyclic, so \(a(G)=8-2=6\).
Check: the direct count \(6\) equals \((-1)^3P_G(-1)=(-1)(-6)=6\). The recurrence gives the same result: deleting \(13\) leaves a path with \(4\) acyclic orientations; contracting \(13\) leaves a single edge with \(2\). Their sum is \(4+2=6\).
Worked Example: The Four-Cycle
Let \(G\) have \(V(G)=\{1,2,3,4\}\) and \(E(G)=\{12,23,34,41\}\). For a cycle \(C_n\), the chromatic polynomial is \((q-1)^n+(-1)^n(q-1)\): color the first \(n-1\) vertices along a path, then exclude colors at the final vertex that conflict with its two neighbors, or equivalently apply deletion–contraction to the closing edge. For \(C_4\), this gives \(P_G(q)=(q-1)^4+(q-1)\). Substitution yields \(P_G(-1)=(-2)^4+(-2)=16-2=14\). Since \(n=4\), \((-1)^4P_G(-1)=14\).
There are \(2^4=16\) orientations. An orientation is cyclic only if the entire cycle is directed consistently: once one edge is directed, a directed cycle requires each succeeding edge to continue around the cycle. There are exactly two such orientations, one in each direction. Thus \(a(G)=16-2=14\).
Check: the direct count \(16-2=14\) agrees with \((-1)^4(16-2)=14\). No other directed cycle is possible because the graph has no other cycle.
A Common Sign Error
The exponent in Stanley’s formula is the number of vertices, because the graphic arrangement lives in a space with one coordinate per vertex. It is not the number of edges. For the three-vertex path above, using the edge count \(m=2\) would give \((-1)^mP_G(-1)=(-1)^2(-4)=-4\), which cannot count orientations. The correct exponent is \(n=3\), giving \((-1)^3(-4)=4\). A useful check is that the answer must be a nonnegative integer; the sign correction comes from the vertex count.
The proof also explains why the evaluation at \(-1\) appears: deletion–restriction adds region counts, while chromatic deletion–contraction subtracts polynomial values. Changing the sign when the vertex count drops by one converts that subtraction into the required addition. The geometric bijection then identifies those regions with acyclic orientations.
Check Your Understanding
Use the definitions and recurrences in the proof to justify each answer.
- For a graph on four vertices with no edges, compute \(P_G(-1)\) and verify Stanley’s formula directly.
- Explain why an orientation induced by real coordinates cannot contain a directed cycle.
- In the restriction of \(\mathcal{A}_G\) to \(x_u=x_v\), why can two different edges produce the same hyperplane?
- For a triangle, use deletion–contraction to compute the acyclic-orientation count from a path and a single edge.
- For the four-cycle, explain why its only directed cycles are the two orientations that go consistently around the whole cycle.