$SPAD/src/input pfaffian

Timothy Daly, Gunter Rote, Martin Rubey

February 21, 2023

Abstract

In mathematics, the determinant of a skew-symmetric matrix can always be written as the square of a polynomial in the matrix entries. This polynomial is called the Pfaffian of the matrix. The Pfaffian is nonvanishing only for 2n × 2n skew-symmetric matrices, in which case it is a polynomial of degree n.

Contents

1 Examples 3 2 Formal definition 3

2.1 Alternative definition . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2 Derivation from Determinant . . . . . . . . . . . . . . . . . . . . 4

3 Identities 5 4 Applications 6 5 History 7 6 Axiom code 7

1 Examples

Pfaffian [ \begin{matrix}0 & a \\ −a & 0 \end{matrix} ] = a

Pfaffian [ \begin{matrix}0 & a & b & c \\ −a & 0 & d & e \\ −b & −d & 0 & f \\ −c & −e & −f & 0 \end{matrix} ] = af − be + dc

Pfaffian [ \begin{matrix}\begin{matrix}0 & λ_{1} \\ −λ_{1} & 0 \end{matrix} & 0 & ⋯ & 0 \\ 0 & \begin{matrix}0 & λ_{2} \\ −λ_{2} & 0 \end{matrix} & & 0 \\ ⋮ & & ... & ⋮ \\ 0 & 0 & ⋯ & \begin{matrix}0 & λ_{n} \\ −λ_{n} & 0 \end{matrix} \end{matrix} ] = λ_{1}λ_{2} ⋯ λ_{n}

2 Formal definition

Let A = {a_{i,j}} be a 2n×2n skew-symmetric matrix. The Pfaffian of A is defined by the equation

P f(A) = \frac{1}{s^{n}n!} ∑_{σ∈S_{2n}} sgn(σ) ∏_{i=1}^{n} a_{σ(2i−1),σ(2i)}

where S_{2n} is the symmetric group and sgn(σ) is the signature of σ.

One can make use of the skew-symmetry of A to avoid summing over all possible permutations. Let Π be the set of all partitions of {1, 2, …, 2n} into pairs without regard to order. There are (2n − 1)!! such partitions. An element α ∈ Π, can be written as

α = {(i_{1}, j_{1}), (i_{2}, j_{2}), ⋯, (i_{n}, j_{n})}

with i_{k} < j_{k} and i_{1} < i_{2} < ⋯ < i_{n}. Let

π = [ \begin{matrix}1 & 2 & 3 & 4 & ⋯ & 2n \\ i_{1} & j_{1} & i_{2} & j_{2} & ⋯ & j_{n} \end{matrix} ]

be a corresponding permutation. This depends only on the partition α and not on the particular choice of Π. Given a partition α as above define

A_{α} = sgn(π)a_{i_{1},j_{1}}a_{i_{2},j_{2}} ⋯ a_{i_{n},j_{n}}

The Pfaffian of A is then given by

P f(A) = ∑_{α∈Π} A_{α}

The Pfaffian of a n × n skew-symmetric matrix for n odd is defined to be zero.

2.1 Alternative definition

One can associate to any skew-symmetric 2n × 2n matrix A = {a_{ij}} a bivector

ω = ∑_{i<j} a_{ij} e^{i} ∧ e^{j}

where {e^{1}, e^{2}, …, e^{2n}} is the standard basis of ℝ^{2n}. The Pfaffian is then defined by the equation

\frac{1}{n!}ω^{n} = Pf(A) e^{1} ∧ e^{2} ∧ ⋯ ∧ e^{2n}

here ω^{n} denotes the wedge product of n copies of ω^{n} with itself.

2.2 Derivation from Determinant

The Pfaffian can be derived from the determinant for a skew-symmetric matrix A as follows. Using Laplace’s formula we can write the determinant as

det(A) = (−1)^{p+1}a_{p1}A_{p1} + (−1)^{p+2}a_{p2}A_{p2} + ⋯ + (−1)^{n+p}a_{pn}A_{pn}

where A_{pi} is the p, i minor matrix of the matrix A. We further use Laplace’s formula to note that

det(A[A_{ij}]) = |A|^{n}

since this determinant is that of an n×n matrix whose only non-zero elements are the diagonals (each with value det(A)) and [A_{ij}] is a matrix whose i, jth component is the corresponding i, j minor matrix. In this way, following a proof by Parameswaran, we can write the determinant as,

det(A) ≡ Δ_{n} = | \begin{matrix}a_{11} & a_{12} & ⋯ & a_{1n} \\ a_{21} & a_{22} & ⋯ & a_{2n} \\ ⋮ & & & ⋮ \\ a_{n1} & a_{n2} & ⋯ & a_{nn} \end{matrix} |

The minor of

| \begin{matrix}a_{11} & a_{12} \\ a_{21} & a_{22} \end{matrix} |

would be Δ_{n−2}. With this notation

| \begin{matrix}1 & 0 & ⋯ & 0 \\ 0 & 1 & ⋯ & 0 \\ a_{31} & a_{32} & ⋯ & a_{3n} \\ ⋯ & ⋯ & ⋯ & ⋯ \\ a_{n1} & a_{n2} & ⋯ & a_{nn} \end{matrix} | × | \begin{matrix}A_{11} & A_{21} & ⋯ & A_{n1} \\ A_{12} & A_{22} & ⋯ & A_{n2} \\ A_{13} & A_{23} & ⋯ & A_{n3} \\ ⋯ & ⋯ & ⋯ & ⋯ \\ A_{1n} & A_{2n} & ⋯ & A_{nn} \end{matrix} | = | \begin{matrix}A_{11} & A_{21} \\ A_{12} & a_{22} \end{matrix} | Δ_{n}^{n−2}

Thus

Δ_{n−2}Δ_{n}^{n−1} = | \begin{matrix}A_{11} & A_{21} \\ A_{12} & a_{22} \end{matrix} | Δ_{n}^{n−2}

Of course, it was only arbitrarily that we chose to remove the first two rows, and more generically we can write

A_{rr}A_{ss} − A_{rs}A_{sr} = Δ_{rs,rs}Δ_{n}

where Δ_{rs,rs} is the determinant of the original matrix with the rows r and s, as well as the columns r and s removed. The equation above simplifies in the skew-symmetric case to

A_{rs} = \sqrt{Δ_{rs,rs}Δ_{n}}

We now plug this back into the original formula for the determinant,

Δ_{n} = (−1)^{p+1}a_{p1}\sqrt{Δ_{p1,p1}Δ_{n}}+(−1)^{p+2}a_{p2}\sqrt{Δ_{p2,p2}Δ_{n}}+⋯+(−1)^{n+p}a_{pn}\sqrt{Δ_{pn,pn}Δ_{n}}

or with slight manipulation,

\sqrt{Δ_{n}} = (−1)^{p+1} ( a_{p1}\sqrt{Δ_{p1,p1}} − a_{p2}\sqrt{Δ_{p2,p2}} + ⋯ + (−1)^{n−1}a_{pn}\sqrt{Δ_{pn,pn}} )

The determinant is thus the square of the right hand side, and so we identify the right hand side as the Pfaffian.

3 Identities

For a 2n × 2n skew-symmetric matrix A and an arbitrary 2n × 2n matrix B,

• P f(A)^{2} = det(A)

• P f(BAB^{T}) = det(B)P f(A)

• P f(λA) = λ^{n}P f(A)

• P f(A^{T}) = (−1)^{n}P f(A)

• For a block-diagonal matrix

A_{1} ⊕ A_{2} = [ \begin{matrix}A_{1} & 0 \\ 0 & A_{2} \end{matrix} ]

P f(A1 ⊕ A2) = P f(A_{1}1)P f(A_{2})

• For an arbitrary n × n matrix M:

Pf [ \begin{matrix}0 & M \\ −M^{T} & 0 \end{matrix} ] = (−1)^{n(n−1)/2} det M

4 Applications

The Pfaffian is an invariant polynomial of a skew-symmetric matrix (note that it is not invariant under a general change of basis but rather under a proper orthogonal transformation). As such, it is important in the theory of characteristic classes. In particular, it can be used to define the Euler class of a Riemannian manifold which is used in the generalized Gauss-Bonnet theorem.

The number of perfect matchings in a planar graph turns out to be the absolute value of a Pfaffian, hence is polynomial time computable. This is surprising given that for a general graph, the problem is very difficult (so called #P-complete). This result is used to calculate the partition function of Ising models of spin glasses in physics, respectively of Markov random fields in machine learning (Globerson and Jaakkola, 2007), where the underlying graph is planar. Recently it is also used to derive efficient algorithms for some otherwise seemingly intractable problems, including the efficient simulation of certain types of restricted quantum computation.

The calculation of the number of possible ways to tile a standard chessboard or 8-by-8 checkerboard with 32 dominoes is a simple example of a problem which may be solved through the use of the Pfaffian technique. There are 12,988,816 possible ways to tile a chessboard in this manner. Specifically, 12988816 is the number of possible ways to cover an 8-by-8 square with 32 1-by-2 rectangles. 12988816 is a square number: 12988816 = 3604^{2}). Note that 12988816 can be written in the form: 2 × 1802^{2} + 2 × 1802^{2}, where all the numbers have a digital root of 2.

More generally, the number of ways to cover a 2n×2n square with 2n^{2} dominoes (as calculated independently by Temperley and M.E. Fisher and Kasteleyn in 1961) is given by

∏_{j=1}^{N} ∏_{k=1}^{N} (4 cos^{2} \frac{πj}{2n + 1} + 4 cos^{2} \frac{πk}{2n + 1})

This technique can be applied in many mathematics-related subjects, for example, in the classical, 2-dimensional computation of the dimer-dimer correlator function in quantum mechanics.

5 History

The term Pfaffian was introduced by Arthur Cayley, who used the term in 1852: ”The permutants of this class (from their connection with the researches of Pfaff on differential equations) I shall term Pfaffians.” The term honors German mathematician Johann Friedrich Pfaff.

6 Axiom code

I have hacked together an algorithm to compute a Pfaffian, using an algorithm of Gunter Rote. Currently it’s only an .input script, but if it’s useful for somebody else than myself, we could make it a little more professional.

Martin

⟨* ⟩≡

)clear all
--S 1 of 9
B0 n == matrix [[(if i=j+1 and odd? j then -1 else _
               if i=j-1 and odd? i then 1 else 0) _
                 for j in 1..n] for i in 1..n]
--R
--R                                                                   Type: Void
--E 1
--S 2 of 9
PfChar(lambda, A) ==
n := nrows A
(n = 2) => lambda^2 + A.(1,2)
M := subMatrix(A, 3, n, 3, n)
r := subMatrix(A, 1, 1, 3, n)
s := subMatrix(A, 3, n, 2, 2)
p := PfChar(lambda, M)
d := degree(p, lambda)
B := B0(n-2)
C := r*B
g := [(C*s).(1,1), A.(1,2), 1]
if d >= 4 then
    B := M*B
    for i in 4..d by 2 repeat
        C := C*B
        g := cons((C*s).(1,1), g)
g := reverse! g

   res := 0
   for i in 0..d by 2 for j in 2..d+2 repeat
       c := coefficient(p, lambda, i)
       for e in first(g, j) for k in 2..-d by -2 repeat
           res := res +  c * e * lambda^(k+i)
   res
--R
--R                                                                   Type: Void
--E 2
--S 3 of 9
pfaffian A == eval(PfChar(l, A), l=0)
--R
--R                                                                   Type: Void
--E 3
--S 4 of 9
m:Matrix(Integer):=[[0,15],[-15,0]]
--R
--R        + 0    15+
--R   (4)  |        |
--R        +- 15  0 +
--R                                                         Type: Matrix Integer
--E 4
--S 5 of 9
pfaffian m
--R
--R   (5)  15
--R                                                     Type: Polynomial Integer
--E 5
--S 6 of 9
(a,b,c,d,e,f):=(3,5,7,11,13,17)
--R
--R   (6)  17
--R                                                        Type: PositiveInteger
--E
--S 7 of 9
m1:Matrix(Integer):=[[0,a,b,c],[-a,0,d,e],[-b,-d,0,f],[-c,-e,-f,0]]
--R
--R        + 0    3     5    7 +
--R        |                   |
--R        |- 3   0     11   13|

--R   (7)  |                   |
--R        |- 5  - 11   0    17|
--R        |                   |
--R        +- 7  - 13  - 17  0 +
--R                                                         Type: Matrix Integer
--E 7
--S 8 of 9
m1ans:=a*f-b*e+d*c
--R
--R
--R   (8)  63
--R                                                        Type: PositiveInteger
--E 8
--S 9 of 9
pfaffian m1
--R
--R   Compiling function B0 with type PositiveInteger -> Matrix Integer
--R
--R   (9)  63
--R                                                     Type: Polynomial Integer
--E 9
)spool
)lisp (bye)

References

[1] ”http://en.wikipedia.org/wiki/Pfaffian”

[2] “The statistics of dimers on a lattice, Part I”, Physica, vol.27, 1961, pp.1209-25, P.W. Kasteleyn.

[3] Propp, James (2004), “Lambda-determinants and domino-tilings”, arXiv:math.CO/0406301.

[4] Globerson, Amir and Tommi Jaakkola (2007), “Approximate inference using planar graph decomposition”, Advances in Neural Information Processing Systems 19, MIT Press.

[5] “The Games and Puzzles Journal”, No.14, 1996, pp.204-5, Robin J. Chapman, University of Exeter

[6] “Domino Tilings and Products of Fibonacci and Pell numbers”, Journal of Integer Sequences, Vol.5, 2002, Article 02.1.2, James A. Sellers, The Pennsylvania State University

[7] “The Penguin Dictionary of Curious and Interesting Numbers”, revised ed., 1997, ISBN 0-14-026149-4, David Wells, p.182.

[8] “A Treatise on the Theory of Determinants”, 1882, Macmillan and Co., Thomas Muir, Online

[9] “Skew-Symmetric Determinants”, The American Mathematical Monthly, vol. 61, no.2., 1954, p.116, S. Parameswaran Online-Subscription