Enumeration of Parallelograms in Permutation Matrices for Improved Bounds on the Density of Costas Arrays

A Costas array of order n is an n × n permutation matrix such that all vectors between pairs of ones are distinct. Thus, a permutation matrix fails to be a Costas array if and only if it contains ones that form a (possibly degenerate) parallelogram. In this paper, we enumerate parallelograms in an n × n permutation matrix. We use our new formulas to improve Davies's O(n −1) result for the density of Costas arrays.


Introduction
In 1965, John P. Costas introduced a special class of permutations of n elements with applications to improving the target detection performance of radar and sonar systems [6], [7].Edgar Gilbert also wrote about this special class of permutations in the same year, referring to them as permutations with distinct differences and devising a construction method for certain values of n [14].Today, these permutations are referred to as Costas arrays and mathematicians and engineers alike have been studying these structures in an attempt to answer some fundamental questions about them, such as how to construct these arrays, whether these arrays exist for all n, and how many distinct Costas arrays of order n exist.Readers interested in more details regarding the applications of Costas arrays in target detection should read Section III of [1].
A Costas array of order n is an n × n matrix of ones and zeroes such that there is exactly one 1 per row and column (i.e., it is a permutation matrix) and such that all vectors between pairs of ones are distinct, i.e., if the permutation matrix has 1's at (i k , j k ) for k = 1, 2, 3, 4 and if i 1 − i 2 = i 3 − i 4 and j 1 − j 2 = j 3 − j 4 , then (i 1 , j 1 ) = (i 3 , j 3 ) and (i 2 , j 2 ) = (i 4 , j 4 ).Thus, a permutation matrix fails to be a Costas array if and only if it contains (at least 3) 1's that form a (possibly degenerate) parallelogram.
One easy way to check if a given permutation matrix is a Costas array is to consider its corresponding permutation and form a triangular difference table of values where the first row of the table contains the differences between the elements of the permutation that are adjacent, the second row contains the differences between the elements that are 2 places apart, etc.Then the permutation matrix is a Costas array if and only if the entries in each row of the triangular difference table are distinct.For example, consider the permutation 1243.Its triangular difference table and corresponding matrix are Since no row of this table has repeated entries, the permutation matrix A for 1243 is a Costas array.Alternatively, consider the permutation 3214.Its triangular difference table and corresponding matrix are Since the first row of this table contains the difference 1 twice, the permutation matrix B for 3214 is not a Costas array.
In this paper we count how many parallelograms of 1's are possible in an n × n permutation matrix.At first glance, this might seem like a tangential enumerative problem.However, by understanding the ways a permutation matrix fails to be a Costas array, we are led towards new insights about density among permutation matrices and enumeration.The proofs of our formulas make use of a geometric fact about quadrilaterals and a binomial coefficient identity known as the hockey-stick identity.

Challenges and Enumerative Progress
In 1984, S. Golomb, using previously available empirical constructions, stated and proved two algebraic construction methods for Costas arrays based on finite fields, known as the the electronic journal of combinatorics 23(1) (2016), #P1.44 Golomb and Welch methods [15], [16] (Gilbert's construction in [14] is the logarithmic Welch construction.)These remain the only general constructions available and work for infinitely many orders due to the infinitude of primes, but not all orders.It was then that Costas arrays acquired their present name and became an object of study (see [8] for more details and a summary of results).The challenges of enumerating Costas arrays and improving estimates of their asymptotic density are two of the four core challenges of Costas arrays [10].It is not known if Costas arrays of all orders exist.Besides arrays from the constructions that have been devised, sporadic arrays not arising from known constructions have also been found in exhaustive computer searches.Massively-distributed backtracking searches [13][11] [12] in recent years have helped to identify all Costas arrays for n 29.The search for n = 29 required the equivalent of 366.55 years for a single CPU [12].Define C(n) to be the number of Costas arrays of order n.All known values of C(n) are given in Table 1.Correll [3] used Möbius inversion to establish a theoretical formula for C(n), but the resulting summands are impractical to evaluate.James Beard has tabulated all known Costas arrays out to n = 500 [2].Discovery of arrays up to and including order 31 has been achieved but it is not known if any Costas arrays of order 32 or 33 exist.Aggressive computing with an efficient new recursive approach [17] to C(n) may change this, however.Verification of the Costas property for a candidate permutation of order n involves O(n 3 ) comparisons; therefore, the decision problem "Is C(n) > 0?" is in NP [10] [1].

Violating Configurations
Davies, within [8], notes that a permutation matrix fails to be a Costas array if it contains 3 equally-spaced collinear ones.Davies referred to these configurations as L 3 -configurations.An L 3 -configuration is not the only configuration of ones whose existence prevents a permutation matrix from being a Costas array.Four ones that form a non-degenerate parallelogram have this property.We will refer to such sets of ones as P 4 -configurations.Two equally-spaced pairs of ones forming four distinct ones, all of which are collinear, form a degenerate parallelogram and also have this property.We will refer to such sets of ones as L 4 -configurations.One may think of an L 3 -configuration as a degenerate L 4configuration in which two ones overlap.
For the 4 permutation matrices below, matrix A is a Costas array, matrix B is not a Costas array as it contains an L 3 -configuration, matrix C is not a Costas array as it contains a P 4 -configuration and matrix D is not a Costas array as it contains an L 4configuration (as well as two L 3 -configurations).
For n 3, Davies showed that the number of L 3 -configurations when considering permutations of n elements is He derived this by considering the placement of the endpoints of an L 3 -configurationsee [8] for details.We created an entry in the Online Encyclopedia of Integer Sequences (OEIS, http://oeis.org/)for l 3 (n) which was merged into A212892.The two distinct descriptions of the same sequence suggest the following: Problem: Let n 3 be a positive integer.Let A(n) be the number of ordered 4tuples (w, x, y, z) of positive integers such that w, x, y, z ∈ {0, 1, . . ., n} with the differences w − x, x − y, and y − z all odd.Show that A(n − 2) = l 3 (n).
Proof: Consider a 4-tuple (w, x, y, z) with the desired property.By parity arguments, the 4-tuple must be of the form (E,O,E,O) or (O,E,O,E) where O and E denote odd and even integers drawn with replacement from {0, 1, . . ., n}.It follows that 2 where e(n) is the number of even integers in the set and o(n) = n + 1 − e(n) is the number of odd integers in the set.It is readily seen that e(n) equals (n + 2)/2 if n is even and (n + 1)/2 if n is odd and that o(n) equals n/2 if n is even and (n + 1)/2 if n is odd, so the result follows.
So why should we care about violating configurations?Davies studied the the random variable X counting L 3 -configurations in a permutation matrix to prove the strongestknown result about the density C(n)  n! of Costas arrays among permutation matrices.He showed that as n → ∞ using the second moment method, thus settling Unsolved Problem 5 in [16].Davies reasoned that where the right-hand inequality follows from Chebyshev's Inequality.From the formula for l . Davies completed his proof by devising an upper bound on the second moment E(X 2 ) of X as a function of n by reasoning about how two L 3 -configurations intersect.Table 1 supports the stronger conjecture that C(n) n! has exponential decay [4], [9].
the electronic journal of combinatorics 23(1) (2016), #P1.44As Davies's result only used L 3 -configurations, it may be possible to improve on the upper bound of the asymptotic behavior of the density of Costas arrays by applying a similar technique that incorporates P 4 -configurations and/or L 4 -configurations.In order to do this, it is first necessary to determine how many L 4 -and P 4 -configurations exist in permutation matrices of order n, the theorems we present in this paper.

Configuration Enumeration
Let l 4 (n) and p 4 (n) denote the numbers of L 4 -and P 4 -configurations when considering permutations of n elements, respectively.Our main results are Theorem 1.For n > 3, Theorem 2. For n > 3, Theorem 2 refines the result of Appendix A of [17], which shows that ).We made use of Theorem 2 in [5] where it was stated with proof in conjunction with the Lovász Local Lemma to study the existence of Costas arrays and partial Costas arrays.Our proofs for Theorems 1 and 2 make use of the geometric result that a quadrilateral is a parallelogram if and only if its diagonals bisect each other.We apply this result bijectively to enumerate violating configurations by counting pairs of diagonals of a violating configuration with the same midpoint such that each of the 4 endpoints has distinct x-and y-coordinates (with values between 1 and n, inclusive) on an n×n grid.If the 4 endpoints are collinear, then they correspond to an L 4 -configuration while if they are not collinear, they correspond to a P 4 -configuration.
Focusing on counting the L 4 -configurations, let (x 1 , y 1 ) and (x 2 , y 2 ) be two points on the n × n grid with x 1 < x 2 and y 1 < y 2 and let M be the midpoint of the segment connecting these two points.Then the slope of the segment connecting these two points is positive and the number of additional grid points on this line segment is gcd( ) is even, then M is one of these grid points.These additional grid points (excluding M ) can be paired together to form line segments with midpoint M as well.Thus, the number of shorter line segments having midpoint M is . Summing this expression over all points (x 1 , y 1 ) and (x 2 , y 2 ) with x 1 < x 2 and y 1 < y 2 counts the number of L 4 -configurations on lines with positive slopes.Due to symmetry, there is the same number of L 4 -configurations on lines with negative slopes.Thus, the electronic journal of combinatorics 23(1) (2016), #P1.44 Turning our attention to proving Theorem 2, we need to count pairs of line segments with the same midpoint and with each endpoint having distinct x-and y-coordinates on the n×n grid.Note the set of all midpoints of line segments having endpoints on this grid is {( x 2 , y 2 )|3 x 2n − 1, 3 y 2n − 1}.Given any one of these midpoints M = ( x 2 , y 2 ), any line segment with endpoints (x 1 , y 1 ) and (x 2 , y 2 ) with x 1 = x 2 and midpoint M on the grid must have x 1 or x 2 less than x 2 and the other coordinate greater than x 2 .Without loss of generality, assume x 1 < x 2 < x 2 .Note the number of positive integers less than and the number of positive integers greater than x 2 and less than or equal to n is n − x 2 .Thus, there are possible values for x 1 .Similarly, given x 1 , the number of possible values for y 1 is 2f n (y) as y 1 can be less than or greater than y 2 .Given any one of these line segments, the number of ways to select a second line segment with the same midpoint and endpoints with xand y-coordinates different than (x 1 , y 1 ) and (x 2 , y 2 ) is (f n (x) − 1)(2f n (y) − 2) as we lose one possible value for the x-coordinate (since x 1 must be less than x 2 ) and two possible values for the y-coordinate.Thus, the number of pairs of line segments with midpoint M = ( x 2 , y 2 ) and with each endpoint having distinct x-and y-coordinates on the grid equals where we have multiplied by 1 2 for otherwise we would count each pair of segments twiceonce for each order the segments are selected.We can rewrite the product with binomial coefficients as the electronic journal of combinatorics 23(1) (2016), #P1.44 Thus, summing over all possible midpoints M (see above), we have The indices of the summations in the last expression change since there cannot be two line segments with distinct x-and y-coordinates for their endpoints if the x-or ycoordinate of the midpoint is in the set The final simplification follows from a binomial coefficient identity known as the hockey-stick identity, namely n i=r i r = n+1 r+1 .Repeating this for the summation involving x, we see that if n is even, then l 4 (n) + the electronic journal of combinatorics 23(1) (2016), #P1.44 Thus, if n is odd then hence completing the proof of Theorem 2. We created OEIS entries A234471 and A243643 for l 4 (n) and p 4 (n), respectively, for 1 n 1000.
Direct computation reveals that for 4 n 29, n = 5.The right-hand expression can be interpreted as the probability that none of the violating configurations of order n occurs if we make the assumption that the occurrences of violating configurations are mutually independent events.We have no proof that this inequality holds for all sufficiently large n.If it is valid for n > 5, the inequality can be used to quantify exponential decay.For n > 5, define .
Using the formulas for l 3 (n) and l 4 (n) + p 4 (n) and taking the limit of this expression as n → ∞ gives Conjecture 3.

Configuration Enumeration for Identity Permutations
While a Costas array is a permutation matrix that contains no violating configurations, we may also ask what is the permutation matrix that contains the maximal number of violating configurations.Intuition and numerical evidence suggest that the identity matrix and the anti-diagonal matrix of 1's contain the maximal number of violating configurations, but how many such violating configurations do these matrices contain?Clearly they contain no P 4 -configurations.Let Idl 3 (n) and Idl 4 (n) denote the number of L 3 -configurations and L 4 -configurations I n contains.The results are Theorem 4. For n 3, the electronic journal of combinatorics 23(1) (2016), #P1.44 Theorem 5.For n 4, Focusing on Theorem 4, note that (a, a) and (b, b) are both endpoints of the same L 3 -configuration if and only if a+b 2 is an integer.Thus, a and b must have the same parity.If n is even, the number of pairs of even (or pairs of odd) integers less than or equal to n is ).If n is odd the number of pairs of even integers less than or equal to n is while the number of pairs of odd integers less than or equal to n is , thus completing the proof of Theorem 4.
Turning our attention to proving Theorem 5, we essentially repeat the technique that we used to prove Theorem 2 noting that our midpoints are of the form M = ( x 2 , x 2 ) and the y-coordinates are equal to the x-coordinates for any L 4 -configuration on I n .Thus, we are only free to choose 2 x-coordinates less than x 2 for any midpoint M = ( x 2 , x 2 ), which can be done in fn(x) 2 ways.Summing over the potential midpoints M , the number of L 4 -configurations I n contains is , n odd as derived in Section 4. Sequences Idl 3 (n) and Idl 4 (n) correspond to OEIS entry A002620 and the (n − 4) th term of OEIS entry A002623, respectively.We also noticed that the total number of violating configurations that I n contains, Idl 4 (n) + Idl 3 (n), is the (n − 3) rd term of OEIS entry A002623 and thus also equals Idl 4 (n + 1).While this can be verified algebraically, we provide a combinatorial proof instead.Theorem 6.For n 4, The number of L 4 -configurations contained by I n+1 is the number of L 4 -configurations contained by this matrix that do not include the point (n + 1, n + 1) plus the number that do contain the point (n + 1, n + 1).Those L 4 -configurations that do not contain (n + 1, n + 1) are precisely the L 4 -configurations of I n and hence there are Idl 4 (n) such configurations.For simplicity of notation, we represent the location of a 1 in the identity matrix simply by its corresponding integer, so n + 1 will represent the point (n + 1, n + 1).Given an L improvement to his power-law decay result.Bounding E(W 2 ) is made more complicated by the fact that W is a sum and thus we would be obliged to consider cross terms upon squaring W .The formula for l 4 (n) in Theorem 1 makes it clear that l 4 (n) < n 5 and thus E(Y ) = O(n).As E(X) = O(n) and E(W ) = O(n 2 ), it follows that E(Z) = O(n 2 ) and thus E 2 (Z) = O(n 4 ).Hence Z is the dominant term in W and E(Z) ∼ n 2 18 .We consider applying the second moment method to Z: We approach bounding the second moment of Z in the same way that Davies did within [8] when bounding the second moment of X: The inner sum in the last expression is over ordered pairs (P 1 4 , P 2 4 ) of P 4 -configurations appearing in the permutation matrix A. Interchanging the order of summation allows us to write where m i = m i (n) is the number of ordered pairs of P 4 -configurations with exactly i points in common.Thus, the utility of the second moment method applied to Z for improving density results depends on any formulas and upper bounds for the m i .In finding upper bounds for m i (n), for i < 4, the ones of the second P 4 -configuration that are not also ones of the first P 4 -configuration must be in distinct rows and columns from the ones of the first configuration.Why is this?If we picked one of the remaining 4 − i points as being in the same row or column as a 1 for the first configuration, then since there is only one 1 in each row and column in the permutation matrix, it would have to be a one of the first configuration.Thus there would be at least i + 1 points in common.
Without extensive effort we can derive upper bounds for the m i (n).Clearly m 4 (n) = p 4 (n).To bound m 3 (n), note given a P 4 -configuration, there are 4 ways to select exactly 3 points from it to share with another P 4 -configuration.Given these 3 points, at most 2 additional P 4 -configurations are possible.Hence To see this, first note that there are 4  2 = 6 ways to pick two common points after fixing the first P 4 -configuration.There are at most (n − 4) 2 valid ways to pick a third one in the the electronic journal of combinatorics 23(1) (2016), #P1.44 permutation matrix.Given the third one, the fourth one in the second P 4 -configuration is not uniquely determined, but rather there are 3 possibilities for the fourth one.Since we do not care about the order in which the last 2 points are selected, we divide by 2, avoiding double counting in the case that these last two points are both in the permutation matrix, and reducing the error in allowing the second configuration in the case that the the fourth point falls outside the permutation matrix.
Similar reasoning gives us the inequality Finally, it is clear that m 0 p 4 (n)p 4 (n − 4).Combining these inequalities gives us As mentioned in Section 3, Davies (Theorem 4.2, [8]) showed C(n)  n! = O( 1 n ) as n → ∞ by studying L 3 -configurations in permutation matrices, thereby proving the strongest known result about the asymptotic rate of decay of the density C(n)  n! of Costas arrays.Our result above, proven using P 4 -configurations, confirms this rate of decay.Looking more closely at Davies's proof, he shows that while our upper bound above is asymptotically equal to 28 n .Thus, our asymptotic upper bound above is a slight improvement over Davies's.
The presence of the term 28 n in our bound suggests that a tighter upper bound on m 1 or a different probabilistic inequality should be used.If the bound on the function m 1 (n) could be shown to be asymptotically at most 2/9 of what it currently is the electronic journal of combinatorics 23(1) (2016), #P1.44 then it would be canceled in the limit by the linear term of the quadratic in the numerator: ( 2 9 )2n − 8 18 n = 0.The derivation of our upper bound on m 1 (n) is based on assumptions that do allow room for improvement.For instance, the selection of the second and third vertices on the second P 4 -configuration can be such that the fourth point falls outside the grid.The function m 1 (n) = 0 for n < 7 because two P 4configurations would overlap in at least two rows or columns.We wrote a C++ program to compute the values of m 1 (n) for 7 n 18.We found that m 1 for n = 18.This numerical evidence suggests that it may not be possible to establish quadratic decay for density from the second moment method applied to the random variable Z.However, it is not clear that the ratio must be monotone increasing for larger n.

Table 1 :
Number of Costas arrays C(n) as a function of order n