In mathematics, the Hamiltonian cycle polynomial of an n×n-matrix is a polynomial in the entries of the matrix, defined as where is the set of n-permutations having exactly onecycle. This is an algebraic option useful, in a number of cases, for determining the existence of a Hamiltonian cycle in a directed graph. It is a generalization of the number of Hamiltonian cycles of a digraph as the sum of the products of its Hamiltonian cycles' arc weights for weighted digraphs with arc weights taken from a given commutative ring. In the meantime, for an undirected weighted graph the sum of the products of the edge weights of its Hamiltonian cycles containing any fixed edge can be expressed as the product of the weight of and the Hamiltonian cycle polynomial of the matrix received from its weighted adjacency matrix via removing the i-th row and the j-th column. In it was shown that where is the submatrix of induced by the rows and columns of indexed by, and is the complement of in, while the determinant of the empty submatrix is defined to be 1. In a field of characteristic 2 the latter equality turns into what therefore provides an opportunity to polynomial-time calculate the Hamiltonian cycle polynomial of any unitary matrix , because in such a field each minor of a unitary matrix coincides with its algebraic complement: where is the identity n×n-matrix with the entry of indexes 1,1 replaced by 0. Hence if it's possible to polynomial-time assign weights from a field of characteristic 2 to a digraph's arcs that make its weighted adjacency matrix unitary and having a non-zero Hamiltonian cycle polynomial then the digraph is Hamiltonian. Therefore the Hamiltonian cycle problem is computable on such graphs in polynomial time. In characteristic 2, the Hamiltonian cycle polynomial of an n×n-matrix is zero ifn > 2k where k is its rank or if it's involutory and n > 1. Besides, in an arbitrary ring for any skew-symmetric n×n-matrix there exists a power series in a formal variable : such that it's a unitary n×n-matrix over and,, while for any satisfying these conditions equals the coefficient at the -th power of in the power series. It implies that computing, up to the -th power of, the Hamiltonian cycle polynomial of a unitary n×n-matrix over the infinite extension of any ring of characteristic q by the formal variable is a #q-P-complete problem if isn't 2 and computing the Hamiltonian cycle polynomial of a -semi-unitary matrix over such an extension of any ring of characteristic 2 is a #2-P-complete problem for any > 0. For the latter statement can be re-formulated as the #2-P-completeness of computing, for a given unitary n×n-matrix over a field of characteristic 2, the n×n-matrix whose i,j-th entry is the Hamiltonian cycle polynomial of the matrix received from via removing its i-th row and j-th column. This matrix satisfies the following matrix equation:. Moreover, it would be worth noting that in characteristic 2 the Hamiltonian cycle polynomial possesses its invariant matrix compressions, taking into account the fact that for any t×t-matrix having three equal rows or, if > 2, a pair of indexes i,j such that its i-th and j-th rows are identical and its i-th and j-th columns are identical too. Hence if a matrix has two equal rows with indexes i and j then adding one of them to any third one doesn't change this polynomial in characteristic 2 what allows to Gaussian-style eliminate all the entries of its i-th column except the i,i-th and j,i-th ones and remove its i-th column and j-th row – then the Hamiltonian cycle polynomial of the initial matrix equals this polynomial of the new one multiplied by the initial j,i-th entry. Also in characteristic 2 and for matrices with more than two rows the Hamiltonian cycle polynomial isn't changed by adding the i-th column to the j-th one in a matrix where the i-th and j-th rows are identical what, particularly, yields the identity for an n×n-matrix, m×m-matrices and diagonal, m×n-matrix and n×m-matrix. This identity's restriction to the case when is unitary, and, where is the identity m×m-matrix, makes the ×-matrix in the equality's right side unitary and its Hamiltonian cycle polynomial computable, hence, in polynomial time what therefore generalizes the above-given formula for the Hamiltonian cycle polynomial of a unitary matrix. Apart from the above-mentioned compression transformations, in characteristic 2 the following relation is also valid for the Hamiltonian cycle polynomials of a matrix and its partial inverse : and, due to the fact that the Hamiltonian cycle polynomial doesn't depend on the matrix's diagonal entries, adding an arbitrary diagonal matrix doesn't change this polynomial too. These two types of transformation don't compress the matrix, but keep its size unchanged. However, in a number of cases their application allows to reduce the matrix's size by some of the above-mentioned compression operators. Hence there is a variety of matrix compression operators performed in polynomial time and preserving the Hamiltonian cycle polynomial in characteristic 2 whose sequential application, together with the transpose transformation, has, for each matrix, a certain limit that can be defined as the compression-closure operator. When applied to classes of matrices, that operator thus maps one class to another. As it was proven in, if the compression-closure operator maps the class of unitary matrices onto all the set of square matrices over an infinite field of characteristic 2 then the Hamiltonian cycle polynomial is computable in polynomial time over any field of this characteristic what would imply the equality RP = NP.