# Talk:Pfaffian

## Introduction

The intro says: "The Pfaffian is nonvanishing only for 2n × 2n skew-symmetric matrices". This is not true. As a counter example, take some skew-symmetric matrix A, which has some nonzero pfaffian Pf(A). All of the diagonal elements ${\displaystyle A_{ii}}$ must be zero by assumption of skew-symmetry. Now change ${\displaystyle A_{11}}$ to one. A is no longer skew symmetric, but it still has the same Pfaffian because the definition of the Pfaffian does not "see" the diagonal elements. It is only a function of matrix elements like ${\displaystyle A_{P(a)P(2)}}$ which are permutations of distinct indices. Ltgoff —Preceding undated comment added 22:52, 2 February 2010 (UTC). Indeed - the definition of the Pfaffian projects out the symmetric part of the matrix, but there is no harm in starting with a general matrix.

The attribution of ${\displaystyle \operatorname {pf} ^{2}(A)=\operatorname {det} (A)}$ to Muir is likely incorrect. Contributors to the FKT algorithm article attribute this to Caley, and give ref Cayley, Arthur (1847). "Sur les determinants gauches" [On skew determinants]. Crelle's Journal 38: 93–96. — Preceding unsigned comment added by 70.72.144.66 (talk) 00:20, 19 June 2015 (UTC)

I don't see any problem in the introduction. Pfaffian is only defined for 2n × 2n skew-symmetric matrices. Applying Pfaffian to a non-skew-symmetric matrix is illegal and not defined. For skew-symmetric matrices, it is always true that the Pfaffian squares to the determinant.Everett (talk) 23:46, 7 April 2016 (UTC) It can be easily defined using the sum over permutations, even if it is not obviously useful to do so. N Geraint Jones (talk) 14:57, 8 April 2016 (UTC)

## Derivation from Determinant

Although we have

${\displaystyle C_{ij}^{2}=\det(A_{ij,ij})\det(A),\,}$

It doesn't directly imply the sign of ${\displaystyle C_{ij}}$ as ${\displaystyle (-1)^{i+j}}$ by simply taking the square root. May I know how to reach this step in detail?

--221.127.68.176 (talk) 16:26, 28 July 2009 (UTC)

I do not think one should try hard to change \times to x both ways it looks ugly, but hopefully with Mathml the first one will look better...

Tosha 15:29, 23 May 2004 (UTC)


## Johann Friedrich Pfaff

Is this the guy? Tosha

Do you know the story? Gauss's mother asked a mathematician 'who is the best mathematician in Germany?' and the answer was 'Pfaff'. 'What about my son?' - 'Oh, he's the best mathematician in Europe!'. Pfaff was Gauss's teacher, in a sense.

Charles Matthews 09:04, 9 Sep 2004 (UTC)

Nice story, but is Johann Friedrich Pfaff is one who responsible for Pfaffian?

This web page says so: http://members.aol.com/jeff570/p.html. He had a brother JW Pfaff, who was also a mathematician, which I hadn't realised. Charles Matthews 18:55, 9 Sep 2004 (UTC)

Thank you Tosha

## The Pfaffian in coordinates

(moved from generalized Gauss-Bonnet theorem)

Suppose given a coordinate coframe ${\displaystyle dx^{i}}$. The curvature 2-form admits an expression ${\displaystyle {\Omega _{i}}^{j}}$ relative to this coframe. Define the alternating Kronecker tensor

${\displaystyle \delta _{j_{1}j_{2}\dots j_{k}}^{i_{1}i_{2}\dots i_{k}}}$

to be the identity endomorphism of ${\displaystyle \bigwedge ^{k}T^{*}M}$. Then

${\displaystyle Pf(\Omega )=\delta _{j_{1}j_{2}\dots j_{n}}^{i_{1}i_{2}\dots i_{n}}{\Omega _{i_{1}}}^{j_{1}}\wedge {\Omega _{i_{2}}}^{j_{2}}\wedge \dots \wedge {\Omega _{i_{n}}}^{j_{n}}}$

where repeated indices are summed.

## Mathematica code

Here's a Mathematica function for computing the Pfaffian of a matrix. I don't suspect this belongs on the main page, so I'll just post it here and let the Wikipedia experts decide:

 Pf[A_] := If[Length[A] == 0, 1,
Module[{L, A1, MatrixDelete},
MatrixDelete[M_, i_] := Delete[#, i] & /@ Delete[M, i];
L = Length[A]; A1 = MatrixDelete[A, 1];
Sum[(-1)^i (A[[1]][[i]] Pf[MatrixDelete[A1, i - 1]]), {i, 2, L}]]]


The above recursive algorithm calculates the pfaffian for the general n×n matrix in O(n!) time. However for a skew symmetric matrix, the pfaffian can be calculated more efficiently in O(n3) time by generalized Gaussian elimination. The Mathematica package implements such algorithm is originally written by R. W. Cherng, which is available here: http://physics.harvard.edu/~cherng/programs.html. However the package is written in a C/FORTRAN manner, which runs slowly on Mathematica. I modify the code by vectorizing loops [1] to avoid explicit part references, which allows Mathematica to optimize the performance. The modified package code is posted as bellow. To use the package: copy and past to Mathematica notebook, and evaluate the cell once, then can use Pf[A] to obtain the pfaffian of the skew symmetric matrix A. Everett (talk) 08:35, 27 November 2010 (UTC)
BeginPackage["Pfaffian"];
Pf::usage="Pf[A] gives the pfaffian of the skew symmetric A.";
Begin["Private"];
Pf[A_] :=
Switch[Length[A], 0, 1, _?OddQ, 0, _?EvenQ, xPf[A, 1]];
xPf[A_, p0_] := Module[{A0, n, pivot, sign = 1, A1, p1},
n = Length[A]/2;
If[n != 1, A0 = A;
pivot = First[Ordering[Normal[Abs[A0[[2 n - 1, All]]]], -1]];
If[pivot != 2 n, A0[[{pivot, 2 n}, All]] = A0[[{2 n, pivot}, All]];
A0[[All, {pivot, 2 n}]] = A0[[All, {2 n, pivot}]];
sign = -1;];
p1 = A0[[2 n - 1, 2 n]];
A1 = p1 A0[[1 ;; 2 n - 2, 1 ;; 2 n - 2]];
A1 += (# - Transpose[#]) &@
Outer[Times, A0[[1 ;; 2 n - 2, 2 n]],
A0[[1 ;; 2 n - 2, 2 n - 1]]];
A1 /= p0;
sign xPf[A1, p1], A[[1, 2]]]];
End[];
EndPackage[];

`

## Applications

It would be nice to see a qualified writer add to the applications section to include minimal free resolutions of codimension three Gorenstein quotients (a la Buchsbaum-Eisenbud in the 70s). Courtney Gibbons 24 Mar 2011 — Preceding unsigned comment added by Virtualcourtney (talkcontribs) 22:47, 24 March 2011 (UTC)

While unifying the format of the references, I noticed that most of the references in this article where about an application that was removed in the revision made on 14:27, 2 February 2011. I personally agree with the removal (at least it should have been clarified where the Pfaffian enters there!), and would also favor removing the corresponding references.

However, before doing so, I wanted to start a general discussion about the Applications section. The two mathematical contexts in which Pfaffians arise seem fine to me. However, the physics and especially the machine learning applications mentioned there (with references) seem somewhat arbitrary and biased to me - at least I don't see why these applications should be so outstanding that they are mentioned as sole examples in a wikipedia article.

In my opinion, one should probably extend the Applications section by more examples, to make it more biased again. Alternatively, one could restrict the whole Applications section to the pure mathematical level, but that would mean removing more examples and references, and I'm not a particular fan of that.

I know a lot of physics examples (with references), but that alone would be biased again. Any other ideas?

Wmmrmchl (talk) 13:32, 8 April 2011 (UTC)

## Simple proof of equation ${\displaystyle \operatorname {pf||O^{T}AO||} =\operatorname {det||O||} \operatorname {pf||A||} }$

The definition of Pfaffian:

${\displaystyle \mathrm {pf} \left\|A\right\|={\frac {1}{2^{n}n!}}\epsilon _{i_{1}i_{2}...i_{2n}}A_{i_{1}i_{2}}A_{i_{3}i_{4}}...A_{i_{2n-1}i_{2n}}.}$

Here ε is the totally antisymmetric tensor, ε12...2n = 1. One has

${\displaystyle \mathrm {pf} \left\|O^{T}AO\right\|={\frac {1}{2^{n}n!}}\epsilon _{i_{1}i_{2}...i_{2n}}\left(O_{i_{1}j_{1}}O_{i_{2}j_{2}}A_{j_{1}j_{2}}\right)\left(O_{i_{3}j_{3}}O_{i_{4}j_{4}}A_{j_{3}j_{4}}\right)...\left(O_{i_{2n-1}j_{2n-1}}O_{i_{2n}j_{2n}}A_{j_{2n-1}j_{2n}}\right)}$
${\displaystyle ={\frac {1}{2^{n}n!}}\det \left\|O\right\|\epsilon _{j_{1}j_{2}...j_{2n}}A_{j_{1}j_{2}}A_{j_{3}j_{4}}...A_{j_{2n-1}j_{2n}}=\det \left\|O\right\|\mathrm {pf} \left\|A\right\|.}$

## Simple proof of equation ${\displaystyle \operatorname {pf^{2}||A||} =\operatorname {det||A||} }$

Matrix A is antisymmetric. It defines a symplectic structure. According to the Darboux theorem, there exists 2n × 2n matrix O that brings A into the canonical form

${\displaystyle O^{T}AO=J\equiv {\begin{bmatrix}{\begin{matrix}0&1\\-1&0\end{matrix}}&0&\cdots &0\\0&{\begin{matrix}0&1\\-1&0\end{matrix}}&&0\\\vdots &&\ddots &\vdots \\0&0&\cdots &{\begin{matrix}0&1\\-1&0\end{matrix}}\end{bmatrix}}.}$

One can check that det||J|| = pf||J|| = 1, and so

${\displaystyle \operatorname {det||O^{T}AO||} =\operatorname {det^{2}||O||} \operatorname {det||A||} =1,}$
${\displaystyle \operatorname {pf||O^{T}AO||} =\operatorname {det||O||} \operatorname {pf||A||} =1.}$

These two lines being combined give

${\displaystyle \operatorname {pf^{2}||A||} =\operatorname {det||A||} .}$

Trompedo (talk) 08:21, 16 January 2013 (UTC)

## Simple proof of equation ${\displaystyle \operatorname {pf||A^{2m+1}||} =(-1)^{nm}\operatorname {pf||A||} ^{2m+1}}$

that caused difficulties for Ms. Pendleton. The following equations are obvious

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

and

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

Comparing these two lines, we obtain

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

In the special case m = - 1, we arrive at the equation in the text. Trompedo (talk) 06:30, 21 February 2013 (UTC)