# Pfaffian

In mathematics, the determinant of a skew-symmetric matrix can always be written as the square of a polynomial in the matrix entries, a polynomial with integer coefficients that only depend on the size of the matrix. The value of this polynomial, when applied to the coefficients of a skew-symmetric matrix, is called the Pfaffian of that matrix. The term Pfaffian was introduced by Cayley (1852) who indirectly named them after Johann Friedrich Pfaff. The Pfaffian (considered as a polynomial) is nonvanishing only for 2n × 2n skew-symmetric matrices, in which case it is a polynomial of degree n.

Explicitly, for a skew-symmetric matrix A,

${\displaystyle \operatorname {pf} (A)^{2}=\det(A),}$

which was first proved by Cayley (1849), a work based on earlier work on Pfaffian systems of ordinary differential equations by Jacobi.

The fact that the determinant of any skew symmetric matrix is the square of a polynomial can be shown by writing the matrix as a block matrix, then using induction and examining the Schur complement, which is skew symmetric as well.[1]

## Examples

${\displaystyle A={\begin{bmatrix}0&a\\-a&0\end{bmatrix}}.\qquad \operatorname {pf} (A)=a.}$
${\displaystyle B={\begin{bmatrix}0&a&b\\-a&0&c\\-b&-c&0\end{bmatrix}}.\qquad \operatorname {pf} (B)=0.}$

(3 is odd, so Pfaffian of B is 0)

${\displaystyle \operatorname {pf} {\begin{bmatrix}0&a&b&c\\-a&0&d&e\\-b&-d&0&f\\-c&-e&-f&0\end{bmatrix}}=af-be+dc.}$

The Pfaffian of a 2n × 2n skew-symmetric tridiagonal matrix is given as

${\displaystyle \operatorname {pf} {\begin{bmatrix}0&a_{1}&0&0\\-a_{1}&0&b_{1}&0\\0&-b_{1}&0&a_{2}\\0&0&-a_{2}&\ddots &\ddots \\&&&\ddots &\ddots &b_{n-1}\\&&&&-b_{n-1}&0&a_{n}\\&&&&&-a_{n}&0\end{bmatrix}}=a_{1}a_{2}\cdots a_{n}.}$

(Note that any skew-symmetric matrix can be reduced to this form with all ${\displaystyle b_{i}}$ equal to zero, see Spectral theory of a skew-symmetric matrix..)

## Formal definition

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

${\displaystyle \operatorname {pf} (A)={\frac {1}{2^{n}n!}}\sum _{\sigma \in S_{2n}}\operatorname {sgn} (\sigma )\prod _{i=1}^{n}a_{\sigma (2i-1),\sigma (2i)}}$

where S2n is the symmetric group of order (2n)! 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)!/(2nn!) = (2n - 1)!! such partitions. An element α ∈ Π can be written as

${\displaystyle \alpha =\{(i_{1},j_{1}),(i_{2},j_{2}),\cdots ,(i_{n},j_{n})\}}$

with ik < jk and ${\displaystyle i_{1}. Let

${\displaystyle \pi _{\alpha }={\begin{bmatrix}1&2&3&4&\cdots &2n-1&2n\\i_{1}&j_{1}&i_{2}&j_{2}&\cdots &i_{n}&j_{n}\end{bmatrix}}}$

be the corresponding permutation. Given a partition α as above, define

${\displaystyle A_{\alpha }=\operatorname {sgn} (\pi _{\alpha })a_{i_{1},j_{1}}a_{i_{2},j_{2}}\cdots a_{i_{n},j_{n}}.}$

The Pfaffian of A is then given by

${\displaystyle \operatorname {pf} (A)=\sum _{\alpha \in \Pi }A_{\alpha }.}$

The Pfaffian of a n×n skew-symmetric matrix for n odd is defined to be zero, as the determinant of an odd skew-symmetric matrix is zero, since for a skew-symmetric matrix,

${\displaystyle \det \,A=\det \,A^{\text{T}}=\det \left(-A\right)=(-1)^{n}\det \,A,}$

and for n odd, this implies ${\displaystyle \det \,A=0}$.

### Recursive definition

By convention, the Pfaffian of the 0×0 matrix is equal to one. The Pfaffian of a skew-symmetric 2n×2n matrix A with n>0 can be computed recursively as

${\displaystyle \operatorname {pf} (A)=\sum _{{j=1} \atop {j\neq i}}^{2n}(-1)^{i+j+1+\theta (i-j)}a_{ij}\operatorname {pf} (A_{{\hat {\imath }}{\hat {\jmath }}}),}$

where index i can be selected arbitrarily, ${\displaystyle \theta (i-j)}$ is the Heaviside step function, and ${\displaystyle A_{{\hat {\imath }}{\hat {\jmath }}}}$ denotes the matrix A with both the i-th and j-th rows and columns removed.[2] Note how for the special choice ${\displaystyle i=1}$ this reduces to the simpler expression:

${\displaystyle \operatorname {pf} (A)=\sum _{j=2}^{2n}(-1)^{j}a_{1j}\operatorname {pf} (A_{{\hat {1}}{\hat {\jmath }}}).}$

### Alternative definitions

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

${\displaystyle \omega =\sum _{i

where {e1, e2, ..., e2n} is the standard basis of R2n. The Pfaffian is then defined by the equation

${\displaystyle {\frac {1}{n!}}\omega ^{n}=\operatorname {pf} (A)\;e_{1}\wedge e_{2}\wedge \cdots \wedge e_{2n},}$

here ωn denotes the wedge product of n copies of ω.

A non-zero generalisation of the Pfaffian to odd dimensional matrices is given in the work of de Bruijn on multiple integrals involving determinants.[3] In particular for any m x m matrix A, we use the formal definition above but set ${\displaystyle n=\lfloor m/2\rfloor }$. For m odd, one can then show that this is equal to the usual Pfaffian of an m+1 x m+1 dimensional skew symmetric matrix where we have added an m+1th column consisting of m elements 1, an m+1th row consisting of m elements -1, and the corner element is zero. The usual properties of Pfaffians, for example the relation to the determinant, then apply to this extended matrix.

## Properties and identities

Pfaffians have the following properties, which are similar to those of determinants.

• Multiplication of a row and a column by a constant is equivalent to multiplication of the Pfaffian by the same constant.
• Simultaneous interchange of two different rows and corresponding columns changes the sign of the Pfaffian.
• A multiple of a row and corresponding column added to another row and corresponding column does not change the value of the Pfaffian.

Using these properties, Pfaffians can be computed quickly, akin to the computation of determinants.

### Miscellaneous

For a 2n × 2n skew-symmetric matrix A

${\displaystyle \operatorname {pf} (A^{\text{T}})=(-1)^{n}\operatorname {pf} (A).}$
${\displaystyle \operatorname {pf} (\lambda A)=\lambda ^{n}\operatorname {pf} (A).}$
${\displaystyle \operatorname {pf} (A)^{2}=\det(A).}$

For an arbitrary 2n × 2n matrix B,

${\displaystyle \operatorname {pf} (BAB^{\text{T}})=\det(B)\operatorname {pf} (A).}$

Substituting in this equation B = Am, one gets for all integer m

${\displaystyle \operatorname {pf} (A^{2m+1})=(-1)^{nm}\operatorname {pf} (A)^{2m+1}.}$

### Derivative identities

If A depends on some variable xi, then the gradient of a Pfaffian is given by

${\displaystyle {\frac {1}{\operatorname {pf} (A)}}{\frac {\partial \operatorname {pf} (A)}{\partial x_{i}}}={\frac {1}{2}}\operatorname {tr} \left(A^{-1}{\frac {\partial A}{\partial x_{i}}}\right),}$

and the Hessian of a Pfaffian is given by

${\displaystyle {\frac {1}{\operatorname {pf} (A)}}{\frac {\partial ^{2}\operatorname {pf} (A)}{\partial x_{i}\partial x_{j}}}={\frac {1}{2}}\operatorname {tr} \left(A^{-1}{\frac {\partial ^{2}A}{\partial x_{i}\partial x_{j}}}\right)-{\frac {1}{2}}\operatorname {tr} \left(A^{-1}{\frac {\partial A}{\partial x_{i}}}A^{-1}{\frac {\partial A}{\partial x_{j}}}\right)+{\frac {1}{4}}\operatorname {tr} \left(A^{-1}{\frac {\partial A}{\partial x_{i}}}\right)\operatorname {tr} \left(A^{-1}{\frac {\partial A}{\partial x_{j}}}\right).}$

### Trace identities

The product of the Pfaffians of skew-symmetric matrices A and B under the condition that ATB is a positive-definite matrix can be represented in the form of an exponential

${\displaystyle {\textrm {pf}}(A){\textrm {pf}}(B)=\exp({\frac {1}{2}}\mathrm {tr} \log(A^{\text{T}}B)).}$

Suppose A and B are 2n × 2n skew-symmetric matrices, then

${\displaystyle \mathrm {pf} (A)\mathrm {pf} (B)={\frac {1}{n!}}B_{n}(s_{1},s_{2},\ldots ,s_{n}),\qquad \mathrm {where} \qquad s_{l}=-{\frac {1}{2}}(l-1)!\mathrm {tr} ((AB)^{l})}$

and Bn(s1,s2,...,sn) are Bell polynomials.

### Block matrices

For a block-diagonal matrix

${\displaystyle A_{1}\oplus A_{2}={\begin{bmatrix}A_{1}&0\\0&A_{2}\end{bmatrix}},}$
${\displaystyle \operatorname {pf} (A_{1}\oplus A_{2})=\operatorname {pf} (A_{1})\operatorname {pf} (A_{2}).}$

For an arbitrary n × n matrix M:

${\displaystyle \operatorname {pf} {\begin{bmatrix}0&M\\-M^{\text{T}}&0\end{bmatrix}}=(-1)^{n(n-1)/2}\det M.}$

It is often required to compute the pfaffian of a skew-symmetric matrix ${\displaystyle S}$ with the block structure

${\displaystyle S={\begin{pmatrix}M&Q\\-Q^{T}&N\end{pmatrix}}\,}$

where ${\displaystyle M}$ and ${\displaystyle N}$ are skew-symmetric matrices and ${\displaystyle Q}$ is a general rectangular matrix.

When ${\displaystyle M}$ is invertible, one has

${\displaystyle \operatorname {pf} (S)=\operatorname {pf} (M)\operatorname {pf} (N+Q^{T}M^{-1}Q).}$

This can be seen from Aitken block-diagonalization formula,[4][5][6]

${\displaystyle {\begin{pmatrix}M&0\\0&N+Q^{T}M^{-1}Q\end{pmatrix}}={\begin{pmatrix}I&0\\Q^{T}M^{-1}&I\end{pmatrix}}{\begin{pmatrix}M&Q\\-Q^{T}&N\end{pmatrix}}{\begin{pmatrix}I&-M^{-1}Q\\0&I\end{pmatrix}}.}$

This decomposition involves a congruence transformations that allow to use the pfaffian property ${\displaystyle \operatorname {pf} (BAB^{T})=\operatorname {det} (B)\operatorname {pf} (A)}$.

Similarly, when ${\displaystyle N}$ is invertible, one has

${\displaystyle \operatorname {pf} (S)=\operatorname {pf} (N)\operatorname {pf} (M+QN^{-1}Q^{T}),}$

as can be seen by employing the decomposition

${\displaystyle {\begin{pmatrix}M+QN^{-1}Q^{T}&0\\0&N\end{pmatrix}}={\begin{pmatrix}I&-QN^{-1}\\0&I\end{pmatrix}}{\begin{pmatrix}M&Q\\-Q^{T}&N\end{pmatrix}}{\begin{pmatrix}I&0\\N^{-1}Q^{T}&I\end{pmatrix}}.}$

## Calculating the Pfaffian numerically

Suppose A is a 2n × 2n skew-symmetric matrices, then

${\displaystyle {\textrm {pf}}(A)=i^{(n^{2})}\exp \left({\frac {1}{2}}\mathrm {tr} \log((\sigma _{y}\otimes I_{n})^{T}\cdot A)\right),}$

where ${\displaystyle \sigma _{y}}$ is the second Pauli matrix, ${\displaystyle I_{n}}$ is an identity matrix of dimension n and we took the trace over a matrix logarithm.

This equality is based on the trace identity

${\displaystyle {\textrm {pf}}(A){\textrm {pf}}(B)=\exp \left({\frac {1}{2}}\mathrm {tr} \log(A^{\text{T}}B)\right)}$

and on the observation that ${\displaystyle {\textrm {pf}}(\sigma _{y}\otimes I_{n})=(-i)^{n^{2}}}$.

Since calculating the Logarithm of a matrix is a computationally demanding task, one can instead compute all eigenvalues of ${\displaystyle ((\sigma _{y}\otimes I_{n})^{T}\cdot A)}$, take the log of all of these and sum them up. This procedure merely exploits the property ${\displaystyle \operatorname {tr} {\log {(AB)}}=\operatorname {tr} {\log {(A)}}+\operatorname {tr} {\log {(B)}}}$. This can be implemented in Mathematica within a single line:

 Pf[x_] := Module[{n = Dimensions[x][[1]] / 2}, I^(n^2) Exp[ 1/2 Total[ Log[Eigenvalues[ Dot[KroneckerProduct[PauliMatrix[2], IdentityMatrix[n]], x] ]]]]]

For other efficient algorithms see (Wimmer 2012).

## Notes

1. Ledermann, W. "A note on skew-symmetric determinants"
2. http://jesusmtz.public.iastate.edu/soliton/REPORT%202.pdf
3. http://alexandria.tue.nl/repository/freearticles/597510.pdf
4. A. C. Aitken. Determinants and matrices. Oliver and Boyd, Edinburgh, fourth edition, 1939.
5. Zhang, Fuzhen, ed. The Schur complement and its applications. Vol. 4. Springer Science & Business Media, 2006.
6. Bunch, James R. "A note on the stable decomposition of skew-symmetric matrices." Mathematics of Computation 38.158 (1982): 475-479.

## References

• Cayley, Arthur (1849). "Sur les déterminants gauches". Journal für die reine und angewandte Mathematik. 38: 93–96.
• Cayley, Arthur (1852). "On the theory of permutants". Cambridge and Dublin Mathematical Journal. VII: 40–51 Reprinted in Collected mathematical papers, volume 2.
• Kasteleyn, P. W. (1961). "The statistics of dimers on a lattice. I. The number of dimer arrangements on a quadratic lattice". Physica. 27 (12): 1209–1225. Bibcode:1961Phy....27.1209K. doi:10.1016/0031-8914(61)90063-5.
• Propp, James (2004). "Lambda-determinants and domino-tilings". arXiv:math/0406301.
• Globerson, Amir; Jaakkola, Tommi (2007). "Approximate inference using planar graph decomposition" (PDF). Advances in Neural Information Processing Systems 19. MIT Press.
• Schraudolph, Nicol; Kamenetsky, Dmitry (2009). "Efficient exact inference in planar Ising models" (PDF). Advances in Neural Information Processing Systems 21. MIT Press.
• Jeliss, G.P.; Chapman, Robin J. (1996). "Dominizing the Chessboard". The Games and Puzzles Journal. 2 (14): 204–5.
• Sellers, James A. (2002). "Domino Tilings and Products of Fibonacci and Pell numbers". Journal of Integer Sequences. 5 (1): 02.1.2.
• Wells, David (1997). The Penguin Dictionary of Curious and Interesting Numbers (revised ed.). p. 182. ISBN 0-14-026149-4.
• Muir, Thomas (1882). A Treatise on the Theory of Determinants. Macmillan and Co. Online
• Parameswaran, S. (1954). "Skew-Symmetric Determinants". The American Mathematical Monthly. 61 (2): 116. doi:10.2307/2307800. JSTOR 2307800.
• Wimmer, M. (2012). "Efficient numerical computation of the Pfaffian for dense and banded skew-symmetric matrices". ACM Trans. Math. Softw. 38: 30. arXiv:1102.3440. doi:10.1145/2331130.2331138.
• de Bruijn, N. G. (1955). "On some multiple integrals involving determinants". J. Indian Math. Soc. 19: 131–151.