Matchgates Revisited

We study a collection of concepts and theorems that laid the foundation of matchgate computation. This includes the signature theory of planar matchgates, and the parallel theory of characters of not necessarily planar matchgates. Our aim is to present a unified and, whenever possible, simplified account of this challenging theory. Our results include: (1) A direct proof that Matchgate Identities (MGI) are necessary and sufficient conditions for matchgate signatures. This proof is self-contained and does not go through the character theory. More importantly it rectifies a gap in the existing proof. (2) A proof that Matchgate Identities already imply the Parity Condition. (3) A simplified construction of a crossover gadget. This is used in the proof of sufficiency of MGI for matchgate signatures. This is also used to give a proof of equivalence between the signature theory and the character theory which permits omittable nodes. (4) A direct construction of matchgates realizing all matchgate-realizable symmetric signatures.


Introduction
Leslie Valiant introduced matchgates in a seminal paper [25]. In that paper he presented a way to encode computation via Pfaffian and Pfaffian Sum, and showed that a non-trivial, though restricted, fragment of quantum computation can be simulated in classical polynomial time. Underlying this magic is a way to encode certain quantum states by a classical computation of perfect matchings, and to simulate certain quantum gates by the so-called matchgates. These matchgates are weighted graphs, not necessarily planar, and are equipped with input and output nodes, as well as the socalled omittable nodes. Each matchgate is associated with a character, whose entries are defined in terms of Pfaffian and Pfaffian Sum.
Three years later, there was great excitement when Valiant invented holographic algorithms [28], where he also introduced planar matchgates. These matchgates are planar graphs, have a subset of vertices on the outer face designated as external nodes, and each matchgate is associated with a signature. The entries of a signature are defined in terms of the perfect matching polynomial, PerfMatch(·). For planar weighted graphs, this quantity can be computed by the well-known Kasteleyn's algorithm [15] (a.k.a. FKT algorithm [22]) in polynomial time, which uses Pfaffian and a Pfaffian orientation.
These holographic algorithms are quite exotic, and use a quantum-like superposition of fragments of computation to achieve custom designed cancellations. The two basic ingredients of holographic algorithms from [28] are matchgates and holographic transformations. A number of concrete problems are shown to be polynomial time computable by this novel technique, even though they appear to require exponential time, and minor variations of which are NP-hard. They challenge our perceived boundary of what polynomial time computation can do. Since we don't really have any reasonable absolute lower bounds that apply to unrestricted computational models, our faith in such well-known conjectures such as P = NP or P = P #P are based primarily on the inability of existing algorithmic techniques to solve NP-hard or #P-hard problems in polynomial time. To maintain this faith, it is imperative that we gain a better understanding of what the new methodology can or cannot do. To quote Valiant [28], "any proof of P = NP may need to explain, and not only to imply, the unsolvability" of NP-complete or #P-complete problems by this methodology. It becomes apparent that there is a fundamental problem of what are the intrinsic limitations of these matchgates, and what is the relationship between characters of general matchgates and signatures of planar matchgates.
In [24], Valiant showed that the character of every 2-input 2-output matchgate must satisfy five polynomial identities, called Matchgate Identities. Valiant used this to show that certain quantum gate cannot be simulated by the characters of these matchgates. In a sequence of two papers [1,3] a general study of the character theory and the signature theory of matchgates was undertaken. These papers achieved the following general results: Essentially there is an equivalence between the character theory and the signature theory of matchgates, and a set of useful Grassmann-Plücker identities together with the Parity Condition are a necessary and sufficient condition for a sequence of values to be the signature of a planar matchgate. This set of useful Grassmann-Plücker identities will be called Matchgate Identities (MGI) in the general sense. Along the way they also established a concrete characterization of symmetric signatures, which are signatures whose entries only depend on the Hamming weight of the index.
However, this proof is tortuous. In particular the proof for the signature theory of planar matchgates goes through characters. More importantly, there is a subtle but important gap in the proof that every planar matchgate signature must satisfy these Matchgate Identities. The gap has to do with the non-uniform and exponentially many ways in which the induced Pfaffian orientations on subgraphs of a planar graph can introduce a correction factor (−1) to Pfaffian values, relative to perfect matchings.
In this paper we present a full, self-contained proof that MGI characterize planar matchgate signatures. This proof does not involve character theory or any non-planar matchgate. Moreover, we include a short proof demonstrating that MGI imply the Parity Condition. Previously this was presented as a separate requirement for matchgates, but now we show MGI entirely characterize matchgate signatures. We then revisit and clarify the equivalence between planar matchgates and the original general matchgates. Along the way we introduce a concise matchgate for the "crossover gadget", using only real weights 1 and −1. Previously the only known such gadget uses complex values. Finally, it has been known that the MGI greatly simplify for symmetric signatures. By the general theory any symmetric sequence satisfying MGI must be realizable as the signature of a planar matchgate. However, previously this existence is only known by going through the entire equivalence proof of characters and signatures, which also uses the only known "crossover gadget". In this paper, we present a simple, direct construction of a planar matchgate realizing any symmetric sequence satisfying MGI.
The most intricate part of this paper is the proof that planar matchgate signatures must satisfy MGI. The subtle gap in the existing proof stems from the following. To compute the signature of a matchgate G, we assume it has a fixed Pfaffian orientation − → G . This induces a natural Pfaffian orientation for every subgraph, − → G α , where α is a bitstring specifying a removal pattern of the external nodes from G. A Pfaffian orientation may introduce an extra (−1) factor, a "sign change", to the corresponding perfect matching value. However, whether − → G has a sign change does not immediately imply if − → G α has a sign change: the presence or absence of the "sign change" may itself change between different external node removals! As there are exponentially many possible bitstrings α for possible removal patterns, this severely complicates any proof trying to show they must satisfy MGI. We note that Pfaffian orientations are themselves an important topic [23], and this result is the first to our knowledge concerning the behavior of Pfaffian orientations of exponentially many subgraphs under node removals.
Thus, our main goal is to show that the change of the sign change occurs in a pattern such that MGI still hold. We do so using Theorem 6. Essentially, it proves the following. For any two fixed bit positions i < j referencing the external nodes, let b i b j ∈ {0, 1} 2 be the bit pattern on these two bits. Then, while the sign change may be different for different values of b i b j , the change of sign change when we go from b i b j to b i b j is always the same, independent of the removal pattern on the other external nodes. This is succinctly expressed as a quadruple product identity. Moreover, this is in fact the strongest statement we can say about a pair of nodes and their change of signs, (see Fig. 1). Fortunately this is also sufficient to prove MGI. This paper is organized as follows. In Section 2 we define all the concepts and terminology in the signature theory of planar matchgates. We will also prove that MGI imply the Parity Condition. We will restrict to planar matchgates pertaining to signature theory here. The terminology having to do with general (not necessarily planar) matchgates and characters will be delayed till Section 6. In Section 3 we will give a self-contained proof of some known identities. This is partly for the convenience of the readers, partly to give simplified proofs when possible. For example, the earlier proof of Theorem 5 from [11] goes through skew-symmetric bilinear forms and operators acting on the exterior algebra of a module over some commutative ring. Here we present a direct, elementary proof. In Section 4 we prove that every matchgate signature satisfies MGI. In Section 5 we prove that MGI are also sufficient to be realizable as a matchgate signature. Here we also give the simplified construction of a crossover gadget. In Section 6 we discuss the character theory. In Section 7 we give the direct construction for matchgates realizing symmetric signatures. Some concluding remarks are in Section 8.

Preliminaries
Matchgate, PerfMatch definitions A matchgate is an undirected weighted plane graph G with k distinguished "external" nodes on its outer face, ordered in a clockwise order. (We will see shortly that without loss of generality we may assume the graph G is connected. Therefore it is a plane graph, i.e., a planar graph given with a particular planar embedding, and the outer face is both uniquely defined and has a connected boundary.) Without loss of generality, we assume all edge weights are non-zero; zero weighted edges can be deleted. We define the perfect matching polynomial, PerfMatch(G), as the following: where M(G) is the set of all perfect matchings in G and w(e) is the weight of edge e in G. For each length-k bitstring α, G defines a subgraph G α obtained from G by the following operation: For all 1 ≤ i ≤ k, if the i-th bit α i of α is 1, then we remove the i-th external node and all its incident edges. Thus, G 00...0 = G, and G 11...1 is G with all external nodes removed.
Signature, perfect matching term definitions We define the signature of the matchgate G as the vector Γ G = (Γ α G ), indexed by α ∈ {0, 1} k , as follows: For a perfect matching M ∈ M(G α ) we define Γ α G (M ) = e∈M w(e) as the perfect matching term, equal to the product of the edge weights for the matching M . Where G is clear, we omit the subscript G, and write Γ α for Γ α G , and Γ α (M ) for Γ α G (M ).
Pfaffian orientations, induced Pfaffian orientations For a plane graph G, we can compute PerfMatch(G) using Kasteleyn's algorithm [15] via the Pfaffian. A Pfaffian orientation on G is an assignment of a direction to each edge of G in such a way that each face, except possibly the outer face, has an odd number of clockwise oriented edges when one traverses the boundary of the face. Such an orientation is easy to compute for any plane graph. Note that any "bridge edge" (an edge both sides of which belong to the same face) can be oriented arbitrarily, and the traversal of the face will count the edge twice, once clockwise and once counter-clockwise. Under a Pfaffian orientation on G, the Pfaffian of a skew-symmetric matrix defined by G and the orientation, defined below, is equal to ±PerfMatch(G). We fix a single Pfaffian orientation for G and call the directed graph − → G . Note that − → G α , which is obtained from − → G by removing some vertices and their incident edges according to α, is also Pfaffian-oriented. This is because we only remove zero or more vertices on the outer face, and the removal of these vertices and their incident edges do not create any non-outer face. Thus a single fixed Pfaffian orientation for G induces a set of Pfaffian orientations, one for each G α . We consider a Pfaffian orientation for G is fixed, and each G α inherits the induced Pfaffian orientation.
Skew-symmetric matrix Now we assume the vertices of G are labeled by a totally ordered set, for example, 1 < 2 < . . . < n. Given an orientation on G, we define a skew-symmetric adjacency matrix A = A− → G for − → G as follows. Let (u, v) be a directed edge from u to v in − → G . Then A u,v = w({u, v}), and A v,u = −w({u, v}), where w({u, v}) is the weight of the corresponding edge in G. Note that if the labels u < v, then the entry above the diagonal A u,v = w({u, v}), and its reflected entry below the diagonal A v,u = −w({u, v}). If u > v then the entry above the diagonal A v,u = −w({u, v}) and its reflected entry below the diagonal A u,v = w({u, v}) instead. The diagonal and all other locations (u, v) not corresponding to an edge in the matrix A are set to 0. The lower-left triangle of A is the negation of the upper-right triangle.
Pfaffian The Pfaffian of an n × n matrix, where n ≥ 2 is even, is defined as follows: where the sum is over all permutations π = 1 2 . . . n i 1 i 2 . . . in such that i 1 < i 2 , i 3 < i 4 , . . ., i n−1 < i n and i 1 < i 3 < i 5 < . . . < i n−1 . The term ǫ π is −1 or 1 depending on whether the parity of π is odd or even, respectively. We note that there is a natural 1-1 correspondence between permutations π in this canonical expression and the set of partitions of [n] into disjoint pairs, which are potential perfect matchings. A permutation π corresponds to an actual perfect matching iff all the pairs are edges. It is known and easy to verify that the sign ǫ π can also be computed by the parity of the number of overlapping pairs (+1 if it is even, −1 if it is odd). We say {i 2k−1 , i 2k } and {i 2ℓ−1 , i 2ℓ } is an overlapping pair We note that the term ǫ π A i 1 ,i 2 A i 3 ,i 4 , . . . , A i n−1 ,in is the same for any listing of the partition . . in , independent of the ordering of the pairs, as well as the order within each pair. We also note that this definition is valid for any linear order on the vertices; it need not be the set of consecutive integers from 1 to n. This is particularly relevant when we consider the Pfaffian of − → G α , where the vertices will inherit the labeling from G.
As convention, if n is odd, then Pf(A) = 0; if n is zero, then Pf(A) = 1.
. . , A i n−1 ,in a Pfaffian term. As observed, there is a 1-to-1 correspondence between all non-zero Pfaffian terms and perfect matchings in M(G). If M is a perfect matching, we denote the corresponding Pfaffian term by Pf− → G (M ). A perfect matching term has the same value, up to a ± sign, as the corresponding Pfaffian term. In other words, Pf− → G (M ) = ±Γ G (M ). They may indeed differ, even under a Pfaffian orientation. The heart of the FKT algorithm is the proof that for the skew symmetric matrix of a Pfaffianoriented graph, either every pair of corresponding terms are the same, or every pair of corresponding terms differ by a minus sign. Thus, Pf(A− → G ) = ±PerfMatch(G). This equality is an equality of polynomials: Given a Pfaffian oriented − → G , there exists an ǫ = ±1, such that and if (4) holds for one set of edge weights, then every Pfaffian term is ǫ times its corresponding perfect matching term, for every set of weights.
Pfaffian signature definition As the orientation in − → G induces a Pfaffian orientation for all G α , we can naturally refer to − → G α . Note that − → G α = − → G α , the oriented graph obtained by − → G after removing some vertices and incident edges according to α, in the same way as before. Also note that A−→ G α is obtained from A− → G by removing the appropriate columns and rows indicated by α. We With a given Pfaffian orientation on the plane graph G, and a given labeling of its k external nodes in clockwise order, we define the Pfaffian Signature of − → G to be the vector (Pf α ) indexed by α ∈ {0, 1} k . Each Pf α is a sum of Pfaffian terms, by the definition of Pf(A−→ G α ), under the induced Pfaffian orientation.
Critically, eq. (4) is a term by term equation: Matchgate Identities We state the Matchgate Identities, or MGI.
Theorem 1. Let Γ be the signature of a matchgate with k external nodes. For any length-k bitstrings α, β ∈ {0, 1} k , let α ⊕ β ∈ {0, 1} k be their bitwise XOR, and let P = {p 1 , . . . , p l }, where p 1 < . . . < p l , be the subset of [k] whose characteristic sequence is α ⊕ β. Here p i is the i-th bit where α and β differ. Then, the signature Γ satisfies: where e j denotes a length-k bitstring with a 1 in the j-th index, and 0 elsewhere.
We will show that this is a complete characterization of what vectors can be planar matchgate signatures.
Parity Condition A perfect matching has an even number of vertices. Therefore it follows that PerfMatch(G α ) = 0, whenever G α has an odd number of vertices. Thus, either for all α of odd Hamming weight, or for all α of even Hamming weight, Γ α = 0.

Matchgate Identities Imply Parity Condition
Here we show that this Parity Condition is a consequence of MGI.
Theorem 2. If a vector Γ obeys the MGI, then it also obeys the Parity Condition.
Let β ′ = {p 1 , . . . , p l } be of minimum odd Hamming weight such that Γ β ′ = 0, where l ≥ 1. Now invoke the MGI on the bitstrings 00 . . . 0 ⊕ e p 1 and β ′ ⊕ e p 1 . That gives If l = 1 then the sum l i=2 is vacuous, and we have a contradiction. So l ≥ 2 and we consider each term in the sum l i=2 . Observe that for every 2 ≤ i ≤ l, β ′ ⊕ e p 1 ⊕ e p i has an odd Hamming weight less than that of β ′ , hence Γ β ′ ⊕ep 1 ⊕ep i = 0. Thus the sum l i=2 is zero but Γ 00...0 Γ β ′ = 0, a contradiction.
Nonetheless, in further development of the signature theory, our experience is that the Parity Condition is a good criterion to apply first.
The Sign MGI were first introduced by Valiant in [24] in the context of proving certain 2-input 2-output quantum gate cannot be realized by a matchgate. It was shown that 2-input 2-output matchgates must satisfy certain identities which are named Matchgate Identities. These identities are actually concerned with characters of matchgates. These so-called characters are defined directly in terms of Pfaffians, and their underlying matchgates need not be planar by definition. In the case of 2-input 2-output matchgates, these character values constitute a 4 by 4 matrix, called a character matrix. Subsequently in [1] and [3], this theory is generalized to matchgates of an arbitrary number of external nodes. The ultimate result is that there is an equivalence of matchgate characters (of not necessarily planar matchgates) and matchgate signatures (of planar matchgates). See Section 6. Furthermore Matchgate Identities (together with the Parity Condition) are a necessary and sufficient condition for a vector of values to be the signature of a (planar) matchgate. By Theorem 2, in fact the Matchgate Identities already logically imply the Parity Condition.
The existing proof of the equivalence of being a matchgate signature and satisfaction of MGI (together with parity requirements) is quite long and tortuous. In particular it goes through characters. More importantly, there is a gap in the existing proof that Matchgate Identities are a necessary condition for a matchgate signature. The gap is to exactly account for the change of signs from Pfaffians to signatures. We will rectify this situation. Our new proof is direct and selfcontained; we show that Matchgate Identities are a necessary condition for matchgate signatures without going through characters.
We will first establish the Pfaffian Signature Identities.
Theorem 3. Let − → G be a plane graph with a Pfaffian orientation and k external nodes. For any length-k bitstrings α, β ∈ {0, 1} k , let α ⊕ β ∈ {0, 1} k be their bitwise XOR, and let P = {p 1 , . . . , p l }, where p 1 < . . . < p l , be the subset of [k] whose characteristic sequence is α ⊕ β. Then, Because of the "sign change" between Pf α and Γ α , this statement does not immediately imply Theorem 1. We need to know that the extra −1 factors between Pf α and Γ α appear in just such a pattern that the −1 factors all cancel each other in the Matchgate Identities in (6) relative to the Pfaffian Signature Identities in (8). Before doing so, we will prove Theorem 3.

Proving the Pfaffian Signature Identities
Theorem 3 will follow from the Grassmann-Plücker Identities over Pfaffian minors of a matrix. We state the following definition of the Grassmann-Plücker Identities for a skew-symmetric matrix A. In writing Pf(i 1 , i 2 , . . . , i L ) we mean the Pfaffian of the L × L matrix whose rows and columns are the i 1 , i 2 , . . . , i L -th rows and columns of A, in that order. The order matters: Pf(i 1 , i 2 , . . .) = −Pf(i 2 , i 1 , . . .), for instance. When we write Pf(i 1 , i 2 , . . . , i k , . . . , i K ), the i k means that i k is explicitly excluded from that list.
Proof of Theorem 4. From the definition of Pfaffian: and also The proof is completed by substituting these into the left hand side of eq. (9).
There is another form of these identities which is more closely related to the Pfaffian Signature Identities. We state this theorem next. An earlier proof of Theorem 5 appears in [11]. They go through skew-symmetric bilinear forms and operators acting on the exterior algebra Λ(M ) of an R-module M over some commutative ring R. Here we present a direct, elementary proof.
Proof of Theorem 5. We prove Theorem 5 by Theorem 4. Considering a term in eq. (9), and let x be the element being moved from the index set of one Pfaffian to another. If x ∈ I ∩ J, clearly the term is 0. It follows that there is a one-to-one correspondence between the remaining terms in eq. (9) and (13). All that remains is showing that each such term in eq. (9) has the same sign as its counterpart in (13). Suppose x ∈ J − I. In that case, the term in eq. (9) is where z is the number of elements in J preceding x, equivalently those elements in J less than x.
and we also define When we put the indices in Pf(x, i 1 , . . . , i K ) in increasing order we move x along until it is in the sorted order, we move x exactly b + c times. Thus and so it follows that It is clear that a + c is precisely the number of those in D preceding x, exactly the sign in front of the corresponding term in (13).
The argument for the case x ∈ J − I is symmetric.
Now we are ready to prove Theorem 3.
Proof of Theorem 3. We prove Theorem 3 by Theorem 5. For a matchgate G, let α, β be two bitstrings of length k, where k is the number of external nodes in G. The i-th bit of α, denoted α i , corresponds to the i-th external node in G in clockwise order. Let U be the set of all internal (that is, not external) nodes in G. We define It follows that there is a term-for-term correspondence between (13) of Theorem 5 and (8) of Theorem 3.

Matchgates Satisfy Matchgate Identities
We will now prove that while Pf α may differ from Γ α by a sign depending on α, the differences occur in just such a pattern that they cancel in the MGI. This will allow us to conclude that the Pfaffian Signature Identities (8) differ from the MGI (6) by a global ±1 factor, thus proving the Matchgate Identities.
we define the sign of the perfect matching M to be: Recall that it is a polynomial equality that the Pfaffian is equal to ±PerfMatch, under a Pfaffian orientation. Thus we can conclude that, for Pf−→ G α (M ) and Γ G α (M ), the value of sgn(M ) is the same ±1 for every perfect matching M ∈ M(G α ). This allows us to define a very useful function: For any α such that M(G α ) = ∅, we take any M ∈ M(G α ) and define the function δ: Note that δ(α) is well-defined; the value is independent of the choice of M ∈ M(G α ). It is defined whenever M(G α ) = ∅. Recall that we have a fixed Pfaffian orientation for G and a fixed induced orientation for all G α .
We are ready to state the key theorem which implies the MGI.
, 1} k be a possibly different bitstring, but with b, c still referencing the i-th bit and j-th bit, respectively. Let b = 1 − b and c = 1 − c. Then the following is true: when all four δ terms involved are defined.  (22). Let the external nodes be 5, 6, 7, 8.
Observe that δ(0000) = 1, δ(1100) = −1, δ(0011) = −1, δ(1111) = 1. Thus, if we let b, c refer to the first two external nodes, u, v both be the empty string, and w = 00 andw = 11, we get the situation where equation (22) becomes (1) Note that the only equality we claim here is the pair-wise product being the same. The individual δ terms can vary; for example there are cases when the above equation resolves to (1)(−1) = (−1)(1) (see Fig. 1). The theorem asserts that if flipping two fixed bits changes the "sign change" δ for some u, v, w, then it will change the sign change for all u, v, w of the same lengths whenever δ is defined. It is an invariance of the change of sign change.
Since each factor in (22) is ±1, this equation can also be equivalently expressed as the following quadruple product identity: Theorem 6 implies the MGI Before proving Theorem 6 we show how it proves Theorem 1.
If there are no non-zero terms in a particular MGI indexed by α, β ∈ {0, 1} k , then the MGI is trivial.
There is a 1-1 correspondence between the non-zero terms in (6) and (8). Since (8) is an equality, if there are non-zero terms in (6), then there are at least two such terms. Consider all non-zero terms in (6), and let each non-zero term from the Pfaffian identity (8) be divided by its corresponding MGI term in (6). The ratio is of the form where i is a bit location where α i = β i . Consider any two such terms and form the product of the two products of the pairs. This quadruple product has the form for some 1 ≤ i < j ≤ k, which is the same as Let α ℓ be the ℓ-th bit in α (1 ≤ ℓ ≤ k). Recall that α i = β i , α j = β j . Letting b = α i and c = α j , we see that we can use Theorem 6 to conclude that the product of the first two terms equals the product of the other two terms in (26), and so the whole product must be 1. This implies that all Pfaffian identity terms differ from their corresponding MGI terms by the same global ±1 constant. Note that δ is not defined exactly when that term in the MGI is 0 (and the corresponding Pfaffian Signature Identity term is also 0), so it is sufficient to consider only those terms in the MGI where the relevant δ is defined. Theorem 1 is proved assuming Theorem 6. Now we will prove Theorem 6. We first prove for the case b = c = 0. The proof for the case b = 1, c = 0 is similar with only a few extra complications. The other cases follow by symmetry.
Preprocessing We assume that G is preprocessed in the following way: First we append a path of length 2 from each external node in G. For the i-th external node, we will connect it to a new node calledî, which is then connected to another new node called i. The new nodes 1, 2, . . . , k are now considered external nodes, and are labeled as such within the graph. All other nodes, including all original nodes and all1,2, . . . ,k are non-external nodes.î will be given the label 2k + 1 − i. Thus1,2, . . . ,k are ordered reversely 2k > 2k − 1 > . . . > k + 1 respectively. All other nodes (the original nodes of G) are labeled arbitrarily starting from 2k + 1. The modified graph will now be called G. Now all external nodes are at the end of a path of length at least 2. It is easy to check that the signature Γ is not changed. As an example of the preprocessing for k = 5, consider Fig. 2.
Second, we make G a connected graph. If the graph is already connected then we do nothing. Suppose it is not connected and there are several connected components G i . Consider a clockwise traversal of all the external nodes. We may consider the planar embedding is on the sphere with one fixed point in the outer face designated as ∞. We temporarily connect each external node to ∞ by non-intersecting paths. As we clockwise-traverse from one external node to the next, if they belong to different components G i and G j , we can connect one non-external node u from G i to one non-external node v from G j by a path of length 2: u, e = {u, w}, w, e ′ = {w, v}, v, together with one extra node w ′ and an edge {w, w ′ }. This gadget can be made disjoint from all the temporary paths to ∞, and also disjoint from each other. All new edges (there are three edges on each such gadget) have weight 1. In any perfect matching, w is matched to w ′ and therefore this gadget has no effect on the signature. Then we remove the temporary paths to ∞. The only purpose is to make the matchgate graph (1) connected, and (2) its outer face uniquely well-defined for the given planar embedding, with a connected boundary.
Lastly, we concern ourselves with the orientation − → G for G. The k external nodes are labeled clockwise 1 through k exactly in that order. When we index G with a length-k bitstring α, the bits in α refer to the external nodes in G in this clockwise order. The neighborî of i is labeled 2k + 1 − i. Then we let − → G be any Pfaffian orientation of G. Note that the orientation of bridge edges (edges that are not part of any cycle) have no bearing on the orientation being a Pfaffian orientation, and therefore can be arbitrary. In particular, for each {i,î} edge (being a bridge edge) we assume it is oriented in the order (i,î): from low to high.
With our graph so preprocessed, we are ready to prove our theorem. For every bit values b and c, and strings u, v, w, for brevity we will use G bc to refer to the graph G ubvcw , suppressing u, v, w.
Proof for the case b = 0, c = 0. We assume that δ(u0v0w) and δ(u1v1w) are both defined (for the particular u, v, w).
Hence there exists a perfect matching in G 00 , call it M 00 . Similarly there exists a perfect matching in G 11 , call it M 11 . Let e * = {i, j} be a new edge (recall that i < j are the external nodes referenced by b, c). This is an undirected edge placed in the outer face. Define the graph G * = G 00 ∪ {e * }, having the same set of vertices as G 00 and one extra edge e * . See Fig. 3. This introduces a new non-outer face, consisting of the segment from external nodes i to j (corresponding to bvc) followed by e * . The segment has a path from i to j through all the external nodes ℓ or its neighborl referenced in v because the boundary of the outer face is connected. Viewed from within the new non-outer face just formed by this path and e * , the segment bvc is traversed in counter-clockwise direction.
By adding e * we have exactly one more face in G * compared to G, as well as compared to G 00 and G 11 . Let − → e * oriented either as (i, j) or as (j, i), such that that new face has an odd number of clockwise oriented edges, as demanded by Kasteleyn's algorithm to produce a Pfaffian orientation. We note that each existing bridge edge {ℓ,l} corresponding to a bit 0 in v contributes exactly one extra clockwise oriented edge in the traversal around the boundary of the new face, since it is traversed in both directions exactly once. We define M * = M 11 ∪ {e * }. Note that M * ∈ M(G * ) and we may also consider M 00 ∈ M(G * ).
We shall use M * as an intermediate step to understand how δ(u0v0w) and δ(u1v1w) are related. Our goal is to show that their product is a function entirely of i, j and − → G , and independent of u, v and w, thus proving our theorem. Claim: The signs of M * and M 00 are the same. Formally: The first equality follows from the fact that adding the edge e * to G 00 does not change the Pfaffian term nor the perfect matching term, both corresponding to the perfect matching M 00 , since M 00 does not contain the edge e * . The second equality follows from the fact that all perfect matchings in a Pfaffian-oriented graph must have the same sign. terms in a Pfaffian-oriented graph must have the same sign. Now we compare M * and M 11 . The perfect matching terms are the same, Γ G * (M * ) = Γ G 11 (M 11 ), since the additional edge e * has weight 1. We write out their Pfaffian terms explicitly. For Pf− − → G 11 (M 11 ) we will write it in the canonical form where the listing of matched edges are given according to the stipulation after (3). Note that the nodes of G 11 are linearly ordered by the induced order from that of G. For Pf− → G * (M * ) we will write it by appending the extra matched pair {i, j} in the order i < j at the end.
where We account for these two sources of change in values separately. Consider ǫ π 2 /ǫ π 1 . To form an overlapping pair with {i, j}, a pair must be an edge with one label between i and j and one label outside. Vertices with a label between i and j correspond exactly to the external nodes within the segment v that are not removed. These external nodes must be matched within M 11 to a node of a label greater than j. It follows that z is precisely the number of 0's within v. Now consider A i,j . It is −1 if e * is oriented high-to-low in − → G * , and 1 otherwise. Let f ( − → G , i, j) be this value when the orientation of e * is made to the graph G 11...1⊕e i ⊕e j -the graph obtained from G with all external nodes removed except i and j-according to Kasteleyn's algorithm. Relative to this, if the orientation of e * is made to the graph G * , the orientation is changed according to the parity of the number of zeros in v, the removal pattern within the segment between i and j. More precisely, each 0 within v adds one more bridge edge of the form {ℓ,l} where i < ℓ < j and changes the orientation of e * exactly once. Hence the value A i,j is precisely f ( − → G, i, j)(−1) z , where, again z is the number of 0's within v.
Returning to our Pfaffian terms: Note that the two factors (−1) z are canceled. So the sign difference between δ(u0v0w) and δ(u1v1w) is entirely a function of − → G and i, j, and not the constituent u, v, w.
Proof for the case b = 1, c = 0. Following the idea of M 00 and M 11 from the previous proof, we define M 01 and M 10 in the graphs G 01 , G 10 respectively. Recall that the neighbor of i isî, and the neighbor of j isĵ, {i,î} ∈ M 01 and {j,ĵ} ∈ M 10 , and that they are specially labeled such that i < j <ĵ <î. We define a new edge e * = {j,î}, and G * = G 10 ∪ {e * }. See Fig. 4. The edge e * is drawn on the outer face of G 10 so that G * is a plane graph with one more non-outer face. We orient G * to − → G * , namely to orient the edge e * appropriately as before by Kasteleyn's algorithm.
We claim, using the same reasoning from the previous proof, that M * and M 10 have the same sign.
The first equality is because M 10 does not contain the edge e * which was added to G 10 to obtain G * . The second equality is because M 10 and M * are both perfect matchings in a Pfaffian oriented graph − → G * . Now we only need to compare M * and M 01 . The perfect matching terms are the same, Γ G * (M * ) = Γ G 01 (M 01 ), since both edges e * and {i,î} have weight 1. We shall use the same approach as before to analyze the Pfaffian terms. Once again we write their Pfaffian terms explicitly: where the labels of the matching edges satisfy x 1 < x 2 , x 3 < x 4 , . . . , x n−1 < x n , x 1 < x 3 < . . . < x n−1 , and ǫ π 1 and ǫ π 2 count the parity of the number of overlapping pairs among the matching edges in M 01 and M * respectively. To compute ǫ π 2 /ǫ π 1 , we only need to account for the parities of the number of overlapping pairs between {i,î} and the other matching edges in M 01 , and between {j,î} and the other matching edges in M * . As a necessary condition, any such an overlapping edge must have at least one end point strictly less thanî. Let us account for all edges {x, y} with the minimum label min{x, y} <î. Those with min{x, y} < i are not overlapping edges since each has a unique neighbor with label greater thanî. The unique edge with min{x, y} = i is {i,î} in G 01 , which is not present in G * . The edges with i < min{x, y} < j are of the form {ℓ,l}. They are in 1-1 correspondence with the 0's in v, and do contribute an overlapping pair in M * but not in M 01 . The vertex j is not present in G 01 , and the edge e * = {j,î} has min{x, y} = j, and is in M * . All edges with j < min{x, y} <î either do not contribute to an overlap in both M 01 and M * (when j < min{x, y} ≤ k), or do contribute to an overlap in both M 01 and M * (when k < min{x, y} <î).
The conclusion is that ǫ π 2 /ǫ π 1 = (−1) z , where z is the number of 0's in v. Now consider A i,î and A j,î . Because we oriented the bridge edge {i,î} from low to high, we know that A i,î is 1. We now need only consider A j,î . By the same reasoning to the previous proof, we conclude where f ( − → G , i, j) is the ±1 value for A j,î when we introduce the edge {j,î} to the graph obtained from G with all external nodes removed except j, according to Kasteleyn's algorithm.
Our conclusion is the same: again with the two factors (−1) z canceled. The second line follows from the fact that A i,î = 1. Again we conclude that the difference in sign between ubvcw and ubvcw is entirely a function of − → G and i, j, and not of u, v, w.
With this, the proof of Theorem 1 is complete, namely (planar) matchgate signatures satisfy the Matchgate Identities.

MGI Imply Matchgate-Realizable
Any signature of a matchgate must satisfy the Matchgate Identities. In this section, we show that any Γ ∈ (C 2 ) ⊗k = C 2 k satisfying the Matchgate Identities can be realized as the signature of a matchgate with k external nodes. Thus MGI are not only necessary but also sufficient conditions for matchgate signatures.
Consider a length 2 k vector Γ indexed by {0, 1} k satisfying MGI. If it is the all-zeros vector then it is trivially realizable. So assume there is at least one non-zero value.
Preprocessing Assume Γ β = 0, for some β ∈ {0, 1} k . Define Γ ′α = Γ α⊕β /Γ β , where β = β ⊕ 11 . . . 1. Thus, Γ ′11...1 = 1, and Γ ′ also satisfies MGI. In this section we will create a matchgate G ′ with signature Γ ′ . Given such a G ′ , we can create a matchgate G with signature Γ as follows: First we add two new non-external nodes u, v to G ′ and an edge {u, v} of weight Γ β . Those two nodes are not connected to any other nodes-in effect they contribute exactly a factor Γ β to each perfect matching term. Then, if the i-th bit of β is one, we add a new edge {v i , v ′ i } of weight one to the i-th external node v i , and making v ′ i the new i-th external node. It follows that the signature of G is exactly Γ. Construction We now show that we can realize Γ satisfying MGI and Γ 11...1 = 1. Let K k denote the complete graph on k vertices. The labels of K k are ordered 1 < 2 < . . . < k, and correspond to the bit positions in the index for Γ. We place the nodes of K k on a convex curve, as illustrated in Fig. 5. The nodes are arranged in clockwise order by their index, and two edges cross each other geometrically in the drawing of the graph iff their labels form an overlapping pair as defined before algebraically. (We assume the k nodes are placed in general position, so that any pair of crossing edges intersect at a unique point. There are exactly k 4 such intersection points.) For each α of Hamming weight k − 2, note that K α k has exactly one edge left. For each such α, set the weight of the unique edge in K α k to be Γ α . This defines a weight for every edge of K k .
Equality with Pfaffian Clearly our embedding of K k is not planar for a general k ≥ 4. We first prove the following equality: Let Pf(K α k ) be the Pfaffian value of the skew-symmetric matrix representing K α k where the nodes of K α k have the induced order from 1 < 2 < . . . < k. Then for all α ∈ {0, 1} k : It follows that the k 2 edge weights of K k determine the 2 k values of any Γ satisfying MGI. Clearly (41) holds for any α of Hamming weight greater than or equal to k − 2. By assumption Γ satisfies the Matchgate Identities (6). Inductively, consider α with Hamming weight k − l for some even l > 2. Let {p 1 , . . . , p l } be the set of indices listed in increasing order p 1 < . . . < p l , where α has the bit 0. These are the bit positions where α differs from 1 k . Consider the MGI on α ⊕ e p 1 and 1 k ⊕ e p 1 : As Γ 11...1 = 1, we see that Γ α is defined by higher Hamming weight terms. Thus all lower Hamming weight terms of Γ are determined by those of weight k − 2. However we observe that, by (13), the Pfaffian values also satisfy exactly the same identities as MGI. By induction, it follows that Pf(K α k ) = Γ α for all α.
Planarizing K k We want to show next that there exists a planar matchgate G with signature Γ G = Γ. We construct such a G from K k . Consider the convex embedding of K k . For k ≥ 4 it has some edge crossings, as shown in Fig. 5. The planar graph G is created by replacing each edge crossing with a crossover gadget from Fig. 6. The crossover gadget is itself a matchgate X with 1 2 4 3 −1 Figure 6: The crossover gadget. The external nodes are those labeled, and all edge weights are 1, except the edge labeled −1.
the following signature: and for all other β ∈ {0, 1} 4 , X β = 0. We note that even though geometrically this gadget is only symmetric under a rotation of π (but not π/2), its signature is invariant under a cyclic permutation, and thus functionally it is symmetric under a rotation of π/2. Now we replace every crossing of a pair of edges in the embedded K k by a copy of X. For example, this replacement by the crossover gadget changes Fig. 5 to Fig. 7. If an edge {i, j} in K k crosses some other edges (this happens for every non-adjacent i and j in the cyclic sense), then this replacement breaks the edge {i, j} into several parts. If {i, j} crosses t ≥ 0 other edges, then it is replaced by t + 1 edges (outside of crossover gadgets)-we will call them the i-j-passage-in addition to t copies of the crossover gadget. Of course one copy of the crossover gadget is used for both edges of a pair of crossing edges in this replacement. Define I to be the set of all edges in G that are not part of a crossover gadget. Then each edge {i, j} in K k defines a unique subset of edges in I, which is the i-j-passage. It is clear that I is a disjoint union of these i-j-passages, over all k 2 pairs 1 ≤ i < j ≤ k. Finally we choose one edge in each i-j-passage to have the weight Γ [k]−{i,j} , namely the edge weight of {i, j} in K k . To be specific, we will choose this edge to be the one adjacent to i, the lower indexed external node of {i, j}. All other edges of I are assigned weight one. See Fig. 8. This defines our planar matchgate G with external nodes 1 < 2 < . . . < k.
We claim that Γ G = Γ. ). The set S(M ) for G 00010 is indicated in Fig. 9. We will show that, for the purpose of computing the signature entry Γ α G , we only need to consider those perfect matchings M ′ ∈ M(G α ) that satisfy the following property:   Property: There exists an M ∈ M(K α k ), such that This is a consequence of properties of the crossover gadget. If i is an external node in G α , then any M ′ ∈ M(G α ) must contain a unique edge e ′ adjacent to i. There is a unique j, which is another external node in G, such that e ′ belongs to the i-j-passage. Then by the properties of the crossover gadgets along this i-j-passage, we may assume M ′ contains all edges of this ij-passage, saturating j. In particular j belongs to G α . All other M ′ collectively contribute 0, since the evaluation of the crossover gadget X will be 0. More generally, in the computation of In fact, for any M ′ ∈ M(G α ) such that M ′ ∩ I = S which is not S(M ) for any M ∈ M(K α k ), it must be the case that at some crossover gadget X, S induces an external removal pattern β ∈ {0000, 0101, 1010, 1111}. Then X β = 0, and (48) follows.
Thus we restrict to those perfect matchings M ′ ∈ M(G α ) that satisfy the property (47). For any M ∈ M(K α k ), it is clear that where c(M ) counts the number of copies of X where the external removal pattern is β = 1111.
Thus c(M ) is exactly the number of overlapping pairs in M . It follows that The last equality is because each Pfaffian term in Pf(K α k ) has exactly the same sign as in (49). Hence Γ G = Γ follows from this and (41).
Theorem 7. Any Γ ∈ (C 2 ) ⊗k satisfying the Matchgate Identities is the signature of a matchgate with k external nodes. The matchgate has O(k 4 ) nodes. If Γ 11...1 = 1, achievable by a normalization for every nonzero Γ, there exists a skew-symmetric matrix M ∈ C k×k such that Γ α = Pf(M α ), where M α is the matrix obtained from M by deleting all rows and columns belonging to the subset denoted by α.

Character
In [25] Valiant showed that a fragment of quantum computation could be simulated in polynomial time through the character of general (not-necessarily-planar) matchgates. The notion of a general matchgate and its character ultimately inspired planar matchgates and their signatures. The character is directly based on the notion of the Pfaffian, and what counting problems are expressible in that form. This section will be concerned with characters and general matchgates. It will conclude by proving that characters of general matchgates are essentially equivalent to signatures of planar matchgates.

Definitions
The Pfaffian of an Undirected Graph For an undirected, labeled, weighted graph G = (V, E, W ) there is a skew-symmetric matrix M G . For i < j, we define (M G ) i,j = w({i, j}), the weight of the edge {i, j} ∈ E. If that edge does not exist, we say the weight is 0. For i > j, we define (M G ) i,j = −w({i, j}). We define Pf(G) = Pf(M G ).
General Matchgate A general matchgate G = (V, E, W ) is an undirected, labeled, weighted graph with three designated subsets of V . The set X ⊆ V is the set of input nodes, the set Y ⊆ V is the set of output nodes, and the set T ⊆ V is the set of omittable nodes. These three subsets are disjoint. The nodes in X ∪ Y are called external nodes. They also define a (possibly nonempty) The ordered labeling of the nodes of G obey some rules: ∀i ∈ X, ∀j ∈ T : i < j, and ∀j ∈ T, ∀ℓ ∈ Y : j < ℓ. In other words, ordered from low-to-high, the input nodes X come first, then the omittable nodes T , and finally the output nodes Y . The remaining nodes can be interspersed throughout the ordering.
The Omittable Nodes For G with a set of omittable nodes T , we define the "Pfaffian Sum", PfS, as follows: where the sum is over all subsets W of T , and G − W is the graph obtained from G with all nodes in W and their incident edges removed. We can express this solely in terms of Pfaffians as well. Let I be the index set of M G . Define λ i = 1 if i is an index corresponding to an omittable node, and λ i = 0 otherwise. Then, where the sum is over all subsets A of I, and M G [A] is the matrix obtained from M G with the rows and columns indexed by A removed. It was shown in [25] that, for a size-n graph: where Λ (n) is a simple matrix constructed from the λ i values and M + G is M G with an additional final row, column of all zeros. Thus the Pfaffian Sum PfS(G) is also computable in polynomial time. This "omittable node" feature seems to be quite different from what has been presented for planar matchgate signatures. However, we shall see that it ultimately does not add more power.
The Character of a Matchgate Consider any Z ⊆ X ∪ Y , a subset of the external nodes of G. A general matchgate is ultimately part of a larger matchcircuit, and the external nodes in G are connected to external edges. The following is from [25], "[w]e consider there to exist one external edge from each node in X ∩ Z and from each node in Y ∩ Z. The other endpoint of each of the former is some node of lower index than any in V and of each of the latter is some node of index higher than any in V ." The character of a matchgate G is defined as The term µ(G, Z) is called the modifier value. It is one of ±1, and corresponds to the parity of the overlapping pairs between matching edges in E and external edges. Recall that the number of overlapping pairs is computed as a function of node labels. Due to the rules of index ordering, this value is determined by (G, Z), and is independent of the particular matching in PfS(G − Z). Thus µ(G, Z) is well-defined for any (G, Z).
We also define the naked characterχ of a matchgate, without the modifier.
For brevity and consistency, we write χ α G = χ(G, Z), where α is the characteristic bitstring of Z. The naked character will be referred to asχ α G . Where G is clear we may omit it.
Matchcircuits These matchgates, not necessarily planar, were designed to show that the evaluation of some quantum circuits could be done in polynomial time. Matchgates can be combined into matchcircuits in specific ways. The composition is helped by the modifiers; in fact their sole purpose is to make this composition nicely expressible as a Pfaffian. We will not go into this detail; please see [25]. From another perspective, a matchcircuit is simply a larger matchgate with a modifier value set to a constant 1, as there are no more edges external to the entire matchcircuit.
The naked character of a matchcircuit is its character.

Equivalence of Naked Characters and Signatures
We will prove the following theorem: Theorem 8. For a general matchgate G with k external nodes, there exist two planar matchgates G 1 and G 2 such that for all α ∈ {0, 1} k ,χ Proof. G may not be a planar graph. We draw it by placing its nodes on a semi-circle arc. The nodes appear in a clockwise ordering, ordered exactly by their labels in the graph. The edges are drawing as chords inside the semi-circle arc. If we place the nodes in general position, then any pair of intersecting chords intersect at a unique point. Observe that two edges (u, v), (x, y), where u < v and x < y, cross in the drawing exactly when u < x < v < y or x < u < y < v, i.e., exactly when they form an overlapping pair. This arrangement is very similar to the planar matchgate construction in Section 5. We start by replacing every crossing of chords by the planar crossover gadget from Fig. 6. For the purpose of this proof, we may consider G as a subgraph of some K n . After each crossing has been replaced by the crossover gadget we have a planar matchgate G ′ . We consider X ∪ T ∪ Y as its external nodes. Let Γ ′ be its signature. Let α ∈ {0, 1} |X∪T ∪Y | indicate a bit removal pattern, and let β and γ be its restrictions to X ∪ Y and T respectively. The same proof in Section 5 shows that where W γ is the subset of T indicated by γ. Fix any β ∈ {0, 1} |X∪Y | , such that G β has an even number of nodes. Then we only need to consider γ ∈ {0, 1} |T | of even Hamming weight in the sum (60). Similarly, if G β has an odd number of nodes, then we only need to consider γ of odd Hamming weight in (60).
The following idea is from [28] (p. 1952). There exists a planar matchgate H with t = |T | external nodes such that for any γ ∈ {0, 1} |T | of even Hamming weight, H γ = 1, and for any bitstring γ of odd Hamming weight, H γ = 0 (see Section 7). Clearly H has an even number of nodes, since H 00...0 = 1. We define the planar matchgate G ′ 1 by attaching H to the set T of G ′ on the side of the semi-circle arc opposite to all the intersecting chords in the embedding of G. Each node in T is connected to a distinct external node of H by an edge of weight 1. We note that composing G ′ with H in this fashion does not introduce any more edge crossings, and all external nodes X ∪ Y still remain on the outer face.
For all β where G ′β 1 has an even number of nodes, which happens exactly when G β has an even number of nodes, the following hold: where the sum over W even is for all even-sized subsets of T , and α(β, γ) is the bit string in {0, 1} |X∪T ∪Y | formed by concatenating β and γ, in the proper order. If G ′β 1 has an odd number of nodes, then Γ β G ′ 1 = 0. There also exists a planar matchgate H ′ of arity t = |T | such that for any β of odd Hamming weight, H ′β = 1, and for any bitstring β of even Hamming weight, H ′β = 0 (see Section 7). Use H ′ instead of H we can define a planar matchgate G ′ 2 , which will have the signature values equal to the naked character values of G for all β for which G β has an odd number of nodes. If G ′β 2 has an even number of nodes, then Γ β In particular, if i is even and 0 ≤ i ≤ k − 4, then If z i+2 = 0, then both z i = 0 and z i+4 = 0. This means that if any even indexed entry that is not the first or the last even indexed entry (call it a non-extremal entry) is nonzero, then all even indexed entries are nonzero. In this case, the geometric progression is established, with common ratio z i+2 /z i = z i+4 /z i+2 , for even 0 ≤ i ≤ k − 4. Suppose all non-extremal even indexed entries are zero. If k ≤ 3 then the theorem is self-evident. Suppose k ≥ 4. Let k * ≤ k be the maximum even index. Then k * ≥ 4 and we have Note that k * − 2 ≥ 2 and therefore it is non-extremal. It follows that z 0 z k * = 0 and therefore at most one extremal even indexed entry can be nonzero. It is also easy to verify that a sequence satisfying the conditions of this theorem also satisfies MGI, and hence is a matchgate signature.
(See Section 7.1 for a direct construction.) This completes the proof for even signatures. The proof for odd signatures is similar. The theorem follows.
Explicitly, there are just four cases for symmetric signatures of arity k:

Matchgates for Symmetric Signatures
We have already demonstrated how to build a planar matchgate realizing any MGI-satisfying signature, through a planarizing procedure. Up till now the only known construction of a matchgate realizing an arbitrary symmetric signature is through this general procedure. This is unsatisfactory, since they ought to have more symmetry. However it is difficult to imagine a geometric construction that is planar and symmetric for all pairs of external nodes 1 ≤ i < j ≤ k, if k ≥ 4. Now we will present a simple and direct construction. The constructed matchgates are not geometrically symmetric for all pairs of external nodes, but functionally they are, in terms of the signatures. We present two closely related matchgate constructions, one for even symmetric signatures, and the other for odd, which is a simple modification for the even signature case. Our constructions for both these cases work regardless if the signature has odd or even arity.
In Fig. 10 we have an example of a planar matchgate for an even, arity-6 signature. Its design can be described as a cycle of triangles which share vertices (each triangle has two weight x edges, and a weight y base). For odd signatures, the construction is changed very slightly, as shown in Fig. 11. The only modification is to delete one external node in a matchgate for an even symmetric signature of arity one higher.
More specifically, to construct in general an even matchgate G of arity k, we first take k triangles with vertices weight y. We link them in a cycle, identifying c i with b i+1 , where the index is counted modulo k. The matchgate G has k external nodes {a 1 , . . . , a k }, and a total of 2k nodes.
Consider any α ∈ {0, 1} k of even Hamming weight. α i = 0 iff a i remains in G α . If α = 1 k , then G α is a cycle of length k. If k is odd, of course G α has no perfect matchings. If k is even, there are exactly two perfect matchings, each having weight y k/2 . Now assume α = 1 k . Then cyclically α alternates between consecutive 0's (called a 0-run) and consecutive 1's (called a 1-run). Each a i that remains in G α must be matched to either b i (we call it left-match) or c i = b i+1 (we call it right-match), both with weight x. Consider any 0-run. It is clear that either all a i within this 0-run left-match or all right-match. Next consider a 1-run of m 1's; it is between two 0-runs. If m is even, then the path of m edges all with weight y forces the two neighboring 0-runs to take either both left-match or both right-match. Moreover, both possibilities are realizable, and in each case the 1-run contributes a weight y m/2 . If m is odd, then the path of m edges forces the two neighboring 0-runs to take opposite types of left-match and right-match. Again both possibilities are realizable; in one case the 1-run contributes a weight y (m−1)/2 , and in another case it contributes a weight y (m+1)/2 . Furthermore, for two 1-runs 1 m and 1 m ′ both of odd length and are consecutive in the sense that the only 1-runs in between are of even length, they contribute a combined weight y (m+m ′ )/2 . Since α has an even Hamming weight |α|, there is an even number of 1-runs of odd length. Hence together the 1-runs contribute a weight y |α|/2 . There are exactly two perfect matchings in G α , each uniquely determined by the left-match or right-match choice of any particular a i in G α . It follows that the signature value is Γ α = 2x k−|α| y |α|/2 . Clearly by choosing x and y suitably, we can realize an arbitrary even symmetric signature.
The construction for odd symmetric signatures is to remove one external vertex in the matchgate for an even symmetric signature of arity one higher. By the general form of odd symmetric signatures, being a sub-signature [z 1 , . . . , z n ] of an even symmetric signature [z 0 , z 1 , . . . , z n ], the proof is complete.

Conclusion
Substantial work has been built on top of MGI in the signature theory of matchgates [7,5,18,6,17,16,8,19,9,12]. In particular, a number of complexity dichotomy theorems have been proved that use this understanding of what matchgates can and cannot compute. A general theme of these theorems asserts that a wide class of locally constrained counting problems can be classified into three types: (1) Those that are computable in polynomial time for general graphs; (2) Those that are #P-hard for general graphs but computable in polynomial time over planar graphs; and (3) Those that remain #P-hard for planar graphs. Moreover type (2) occurs precise for problems which can be described by signatures that are realizable by planar matchgates after a holographic transformation. This theme is generally proved for symmetric signatures [16,9,12]. For notnecessarily-symmetric signatures, these are only proved in special cases [4]. This paper provides a firm foundation for this theory and for future explorations.