Hafnian
≈ 8 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
In mathematics, the hafnian is a scalar function of a symmetric matrix that generalizes the permanent. The hafnian was named by Eduardo R. Caianiello "to mark the fruitful period of stay in Copenhagen (Hafnia in Latin)."
In mathematics, the hafnian is a scalar function of a symmetric matrix that generalizes the permanent. The hafnian was named by Eduardo R. Caianiello "to mark the fruitful period of stay in Copenhagen (Hafnia in Latin)." \operatorname{haf}(A) = \sum_{\rho \in P_{2n}^2} \prod_{\{i,j\} \in \rho} A_{i,j}, where P_{2n}^2 is the set of all partitions of the set \{1, 2, \dots, 2n\} into subsets of size 2 .
This definition is similar to that of the Pfaffian, but differs in that the signatures of the permutations are not taken into account. Thus the relationship of the hafnian to the Pfaffian is the same as relationship of the permanent to the determinant. \operatorname{haf}(A)=\frac{1}{n!2^n}\sum_{\sigma\in S_{2n}}\prod_{i=1}^{n}A_{\sigma(2i-1),\sigma(2i)}, where S_{2n} is the symmetric group on \{1,2,\dots,2n\} .
An equivalent Levi-Civita representation holds for any even-dimensional symmetric matrix V=(V_{ij})_{i,j=1}^{N} : \operatorname{haf}(V)=\frac{1}{2^{N/2}(N/2)!}\sum_{i_1,\dots,i_N=1}^{N}|\epsilon^{i_1\cdots i_N}|V_{i_1 i_2}\cdots V_{i_{N-1}i_N}, where N is even. The hafnian also admits a fermionic (Berezin integral) representation.
If V is a symmetric 2L\times 2L matrix and \chi_i,\bar{\chi}_i are Grassmann variables, then \int D(\chi,\bar{\chi})\,\exp\!\left[\frac{1}{2}(\chi\bar{\chi})^{\mathsf T}V(\chi\bar{\chi})\right]=\operatorname{haf}(V), where (\chi\bar{\chi})^{\mathsf T}=\bigl(\bar{\chi}_1\chi_1,\dots,\bar{\chi}_{2L}\chi_{2L}\bigr) and D(\chi,\bar{\chi})=d\chi_1\,d\bar{\chi}_1\cdots d\chi_{2L}\,d\bar{\chi}_{2L}. For low-dimensional examples, \operatorname{haf}\!\begin{pmatrix}V_{11}&V_{12}\\V_{12}&V_{22}\end{pmatrix}=V_{12}, and for a 4\times 4 symmetric matrix, \operatorname{haf}\!\begin{pmatrix} V_{11}&V_{12}&V_{13}&V_{14}\\ V_{12}&V_{22}&V_{23}&V_{24}\\ V_{13}&V_{23}&V_{33}&V_{34}\\ V_{14}&V_{24}&V_{34}&V_{44} \end{pmatrix} = V_{12}V_{34}+V_{13}V_{24}+V_{14}V_{23}.
A useful scaling property is the following. If V=(V_{ij}) and S=(S_{ij}) are symmetric matrices such that V_{ij}=g_i g_j S_{ij}, then, for even N , \operatorname{haf}(V)=\left(\prod_{i=1}^{N} g_i\right)\operatorname{haf}(S). In particular, if V=gS for a scalar g , then \operatorname{haf}(gS)=g^{N/2}\operatorname{haf}(S). The hafnian of the adjacency matrix of a graph counts its perfect matchings (also known as 1-factors).
Indeed, a partition of \{1,2,\dots,2n\} into subsets of size 2 is equivalent to a perfect matching of the complete graph K_{2n} . The hafnian is closely related to the permanent. In particular, \operatorname{per}(C)=\operatorname{haf}\begin{pmatrix} 0 & C \\ C^\mathsf{T} & 0 \end{pmatrix} .
Thus, just as the hafnian counts perfect matchings in a graph from its adjacency matrix, the permanent counts matchings in a bipartite graph from its biadjacency matrix. The hafnian is also related to moments of multivariate Gaussian distributions.
By Wick's probability theorem, for a real 2n\times 2n symmetric matrix A , \operatorname{haf}(A)=\mathbb E_{\left(X_1,\dots,X_{2n}\right)\sim\mathcal N\left(0,A+\lambda I\right)}\left[X_1\cdots X_{2n}\right], where \lambda is any number large enough that A+\lambda I is positive semi-definite. Since the hafnian does not depend on the diagonal entries of the matrix, the expectation on the right-hand side is independent of the choice of \lambda .
Let S = \begin{pmatrix} A & C \\ C^\mathsf{T} & B \end{pmatrix} = S^\mathsf{T} be an arbitrary complex symmetric 2m \times 2m matrix composed of four m \times m blocks A = A^\mathsf{T} , B = B^\mathsf{T} , C and C^\mathsf{T} . Let z_1, \ldots, z_m be a set of m independent variables, and let Z = \begin{pmatrix} 0 & \textrm{diag}(z_1,z_2,\ldots,z_m) \\ \textrm{diag}(z_1,z_2,\ldots,z_m) & 0 \end{pmatrix} be an antidiagonal block matrix composed of entries z_j (each one is presented twice, one time per nonzero block).
Let I denote the identity matrix. Then the following identity holds: \frac{1}{\sqrt{\det \big(I - Z S\big) }} = \sum_{\{n_k\}} \operatorname{haf} \tilde{S}(\{n_k\}) \prod_{k=1}^m \frac{z_k^{n_k}}{n_k!} where the right-hand side involves hafnians of \Big(2\sum_k n_k\Big)\times\Big(2\sum_k n_k\Big) matrices \tilde{S}(\{n_k\}) = \begin{pmatrix} \tilde{A}(\{n_k\}) & \tilde{C}(\{n_k\}) \\ \tilde{C}^\mathsf{T}(\{n_k\}) & \tilde{B}(\{n_k\}) \\ \end{pmatrix} , whose blocks \tilde{A}(\{n_k\}) , \tilde{B}(\{n_k\}) , \tilde{C}(\{n_k\}) and \tilde{C}^\mathsf{T}(\{n_k\}) are built from the blocks A , B , C and C^\mathsf{T} respectively in the way introduced in MacMahon's Master theorem.
In particular, \tilde{A}(\{n_k\}) is a matrix built by replacing each entry A_{k,t} in the matrix A with a n_k \times n_t block filled with A_{k,t} ; the same scheme is applied to B , C and C^\mathsf{T} . The sum \sum_{\{n_k\}} runs over all k -tuples of non-negative integers, and it is assumed that \operatorname{haf} \tilde{S}(\{n_k=0|k=1\ldots m\}) = 1 .
The identity can be proved by means of multivariate Gaussian integrals and Wick's probability theorem. The expression in the left-hand side, 1 \Big/ \sqrt{\det \big(I - Z S\big)} \Big. , is in fact a multivariate generating function for a series of hafnians, and the right-hand side constitutes its multivariable Taylor expansion in the vicinity of the point z_1 = \ldots = z_m = 0.
As a consequence of the given relation, the hafnian of a symmetric 2m \times 2m matrix S can be represented as the following mixed derivative of the order m : \operatorname{haf}S = \bigg(\prod_{k=1}^m \frac{\partial}{\partial z_k} \bigg) \Bigg.\frac{1}{\sqrt{\det \big(I - Z S\big)}} \Bigg\vert_{z_j=0}. The hafnian generating function identity written above can be considered as a hafnian generalization of MacMahon's Master theorem, which introduces the generating function for matrix permanents and has the following form in terms of the introduced notation: \frac{1}{\det \big(I - \textrm{diag} (z_1,z_2,\ldots,z_m) C\big)} = \sum_{\{n_k\}} \operatorname{per} \tilde{C}(\{n_k\}) \prod_{k=1}^m \frac{z_k^{n_k}}{n_k!} Note that MacMahon's Master theorem comes as a simple corollary from the hafnian generating function identity due to the relation \operatorname{per} (C) = \operatorname{haf} \begin{pmatrix} 0 & C \\ C^\mathsf{T} & 0 \end{pmatrix} . \end{pmatrix}=\mathbb E\left[\left|X_1\dots X_n\right|^2\right] when \left(X_1,\dots,X_n\right) is a complex normal random vector with mean 0 , covariance matrix C and relation matrix B . This result is a generalization of the fact that the permanent of a Hermitian positive semi-definite matrix is non-negative.
This corresponds to the special case B=0 using the relation \operatorname{per} (C) = \operatorname{haf} \begin{pmatrix} 0 & C \\ C^\mathsf{T} & 0 \end{pmatrix} . \operatorname{lhaf}(A) = \sum_{\rho \in \mathcal{M}} \prod_{(i,j) \in \rho} A_{i,j} where \mathcal{M} is the set of all perfect matchings of the complete graph on m vertices with loops, i.e., the set of all ways to partition the set \{1, 2, \dots, m\} into pairs or singletons (treating a singleton (i) as the pair (i, i) ). Thus the loop hafnian depends on the diagonal entries of the matrix, unlike the hafnian. Furthermore, the loop hafnian can be non-zero when m is odd.
The loop hafnian can be used to count the total number of matchings in a graph (perfect or non-perfect), also known as its Hosoya index. Specifically, if one takes the adjacency matrix of a graph and sets the diagonal elements to 1, then the loop hafnian of the resulting matrix is equal to the total number of matchings in the graph.
The loop hafnian can also be thought of as incorporating a mean into the interpretation of the hafnian as a multivariate Gaussian moment. Specifically, by Wick's probability theorem again, the loop hafnian of a real m\times m symmetric matrix can be expressed as \operatorname{lhaf}(A) = \mathbb E_{\left(X_1,\dots,X_m\right)\sim\mathcal N\left(\operatorname{diag}\left(A\right),A+\lambda I\right)}\left[X_1\dots X_m\right], where \lambda is any number large enough to make A+\lambda I positive semi-definite.
See also
Permanent Pfaffian Boson sampling
Text derived from https://en.wikipedia.org/w/index.php?oldid=1357555971 under CC BY-SA 4.0; modifications have been made.