# Costas array

In mathematics, a Costas array can be regarded geometrically as a set of n points, each at the center of a square in an n×n square tiling such that each row or column contains only one point, and all of the n(n − 1)/2 displacement vectors between each pair of dots are distinct. This results in an ideal "thumbtack" auto-ambiguity function, making the arrays useful in applications such as sonar and radar. Costas arrays can be regarded as two-dimensional cousins of the one-dimensional Golomb ruler construction, and, as well as being of mathematical interest, have similar applications in experimental design and phased array radar engineering.
Costas arrays are named after John P. Costas, who first wrote about them in a 1965 technical report. Independently, Edgar Gilbert also wrote about them in the same year, publishing what is now known as the logarithmic Welch method of constructing Costas arrays. The general enumeration of Costas arrays is an open problem in computer science and finding an algorithm that can solve it in polynomial time is an open research question.

## Numerical representation

A Costas array may be represented numerically as an n×n array of numbers, where each entry is either 1, for a point, or 0, for the absence of a point. When interpreted as binary matrices, these arrays of numbers have the property that, since each row and column has the constraint that it only has one point on it, they are therefore also permutation matrices. Thus, the Costas arrays for any given n are a subset of the permutation matrices of order n.
Arrays are usually described as a series of indices specifying the column for any row. Since it is given that any column has only one point, it is possible to represent an array one-dimensionally. For instance, the following is a valid Costas array of order N = 4:
    ${\begin{array}{|c|c|c|c|}\hline 0&0&0&1\\\hline 0&0&1&0\\\hline 1&0&0&0\\\hline 0&1&0&0\\\hline \end{array}}$  or simply  ${\begin{array}{|c|c|c|c|}\hline &&&\bullet \\\hline &&\bullet &\\\hline \bullet &&&\\\hline &\bullet &&\\\hline \end{array}}$
There are dots at coordinates: (1,2), (2,1), (3,3), (4,4)
Since the x-coordinate increases linearly, we can write this in shorthand as the set of all y-coordinates. The position in the set would then be the x-coordinate. Observe: {2,1,3,4} would describe the aforementioned array. This defines a permutation. This makes it easy to communicate the arrays for a given order of N.

## Known arrays

Costas array counts are known for orders 1 through 29 (sequence A008404 in the OEIS):
| Order | Number |
| 1 | 1 |
| 2 | 2 |
| 3 | 4 |
| 4 | 12 |
| 5 | 40 |
| 6 | 116 |
| 7 | 200 |
| 8 | 444 |
| 9 | 760 |
| 10 | 2160 |
| 11 | 4368 |
| 12 | 7852 |
| 13 | 12828 |
| 14 | 17252 |
| 15 | 19612 |
| 16 | 21104 |
| 17 | 18276 |
| 18 | 15096 |
| 19 | 10240 |
| 20 | 6464 |
| 21 | 3536 |
| 22 | 2052 |
| 23 | 872 |
| 24 | 200 |
| 25 | 88 |
| 26 | 56 |
| 27 | 204 |
| 28 | 712 |
| 29 | 164 |
Here are some known arrays: N = 1 {1}
N = 2 {1,2} {2,1}
N = 3 {1,3,2} {2,1,3} {2,3,1} {3,1,2}
N = 4 {1,2,4,3} {1,3,4,2} {1,4,2,3} {2,1,3,4} {2,3,1,4} {2,4,3,1} {3,1,2,4} {3,2,4,1} {3,4,2,1} {4,1,3,2} {4,2,1,3} {4,3,1,2}
N = 5 {1,3,4,2,5} {1,4,2,3,5} {1,4,3,5,2} {1,4,5,3,2} {1,5,3,2,4} {1,5,4,2,3} {2,1,4,5,3} {2,1,5,3,4} {2,3,1,5,4} {2,3,5,1,4} {2,3,5,4,1} {2,4,1,5,3} {2,4,3,1,5} {2,5,1,3,4} {2,5,3,4,1} {2,5,4,1,3} {3,1,2,5,4} {3,1,4,5,2} {3,1,5,2,4} {3,2,4,5,1} {3,4,2,1,5} {3,5,1,4,2} {3,5,2,1,4} {3,5,4,1,2} {4,1,2,5,3} {4,1,3,2,5} {4,1,5,3,2} {4,2,3,5,1} {4,2,5,1,3} {4,3,1,2,5} {4,3,1,5,2} {4,3,5,1,2} {4,5,1,3,2} {4,5,2,1,3} {5,1,2,4,3} {5,1,3,4,2} {5,2,1,3,4} {5,2,3,1,4} {5,2,4,3,1} {5,3,2,4,1}
N = 6 {1,2,5,4,6,3} {1,2,6,4,3,5} {1,3,2,5,6,4} {1,3,2,6,4,5} {1,3,6,4,5,2} {1,4,3,5,6,2} {1,4,5,3,2,6} {1,4,6,5,2,3} {1,5,3,4,6,2} {1,5,3,6,2,4} {1,5,4,2,3,6} {1,5,4,6,2,3} {1,5,6,2,4,3} {1,5,6,3,2,4} {1,6,2,4,5,3} {1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} {5,4,1,6,2,3} {5,4,2,3,6,1} {5,4,6,2,3,1} {6,1,3,4,2,5} {6,1,4,2,3,5} {6,1,4,3,5,2} {6,1,4,5,3,2} {6,1,5,3,2,4} {6,2,1,4,5,3} {6,2,1,5,3,4} {6,2,3,1,5,4} {6,2,3,5,4,1} {6,2,4,1,5,3} {6,2,4,3,1,5} {6,3,1,2,5,4} {6,3,2,4,5,1} {6,3,4,2,1,5} {6,4,1,3,2,5} {6,4,5,1,3,2} {6,4,5,2,1,3} {6,5,1,3,4,2} {6,5,2,3,1,4}
Enumeration of known Costas arrays to order 200, order 500 and to order 1030 are available. Although these lists and databases of these Costas arrays are likely near complete, other Costas arrays with orders above 29 that are not in these lists may exist. In general, the currently best known upper bound on the number $C(n)$ of Costas Arrays of order $n$ is of asymptotic form $C(n)/n!\leq e^{-\Theta (n)}$.

## Constructions
### Welch

A Welch–Costas array, or just Welch array, is a Costas array generated using the following method, first discovered by Edgar Gilbert in 1965 and rediscovered in 1982 by Lloyd R. Welch. The Welch–Costas array is constructed by taking a primitive root g of a prime number p and defining the array A by $A_{i,j}=1$ if $j\equiv g^{i}{\bmod {p}}$, otherwise 0. The result is a Costas array of size p − 1.
Example:
3 is a primitive element modulo 5.
    3$^1$ = 3 ≡ 3 (mod 5)
    3$^2$ = 9 ≡ 4 (mod 5)
    3$^3$ = 27 ≡ 2 (mod 5)
    3$^4$ = 81 ≡ 1 (mod 5)
Therefore, [3 4 2 1] is a Costas permutation. More specifically, this is an exponential Welch array. The transposition of the array is a logarithmic Welch array.
The number of Welch–Costas arrays which exist for a given size depends on the totient function.

### Lempel–Golomb

The Lempel–Golomb construction takes α and β to be primitive elements of the finite field GF(q) and similarly defines $A_{i,j}=1$ if $\alpha ^{i}+\beta ^{j}=1$, otherwise 0. The result is a Costas array of size q − 2. If α + β = 1 then the first row and column may be deleted to form another Costas array of size q − 3: such a pair of primitive elements exists for every prime power q>2.

### Extensions by Taylor, Lempel, and Golomb

Generation of new Costas arrays by adding or subtracting a row/column or two with a 1 or a pair of 1's in a corner were published in a paper focused on generation methods and in Golomb and Taylor's landmark 1984 paper.
More sophisticated methods of generating new Costas arrays by deleting rows and columns of existing Costas arrays that were generated by the Welch, Lempel or Golomb generators were published in 1992. There is no upper limit on the order for which these generators will produce Costas arrays.

### Other methods

Two methods that found Costas arrays up to order 52 using more complicated methods of adding or deleting rows and columns were published in 2004 and 2007.

## Variants

Costas arrays on a hexagonal lattice are known as honeycomb arrays. It has been shown that there are only finitely many such arrays, which must have an odd number of elements, arranged in the shape of a hexagon. Currently, 12 such arrays (up to symmetry) are known, which has been conjectured to be the total number.