Mutually orthogonal binary frequency squares

A \emph{frequency square} is a matrix in which each row and column is a permutation of the same multiset of symbols. We consider only {\em binary} frequency squares of order $n$ with $n/2$ zeroes and $n/2$ ones in each row and column. Two such frequency squares are \emph{orthogonal} if, when superimposed, each of the 4 possible ordered pairs of entries occurs equally often. In this context we say that a $k$-MOFS$(n)$ is a set of $k$ binary frequency squares of order $n$ in which each pair of squares is orthogonal. A $k$-MOFS$(n)$ must satisfy $k\le(n-1)^2$, and any MOFS achieving this bound are said to be \emph{complete}. For any $n$ for which there exists a Hadamard matrix of order $n$ we show that there exists at least $2^{n^2/4-O(n\log n)}$ isomorphism classes of complete MOFS$(n)$. For $2<n\equiv2\pmod4$ we show that there exists a $17$-MOFS$(n)$ but no complete MOFS$(n)$. A $k$-maxMOFS$(n)$ is a $k$-MOFS$(n)$ that is not contained in any $(k+1)$-MOFS$(n)$. By computer enumeration, we establish that there exists a $k$-maxMOFS$(6)$ if and only if $k\in\{1,17\}$ or $5\le k\le 15$. We show that up to isomorphism there is a unique $1$-maxMOFS$(n)$ if $n\equiv2\pmod4$, whereas no $1$-maxMOFS$(n)$ exists for $n\equiv0\pmod4$. We also prove that there exists a $5$-maxMOFS$(n)$ for each order $n\equiv 2\pmod{4}$ where $n\geq 6$.


Introduction
In what follows, rows and columns of an n × n array are each indexed by N(n) = {1, 2, . . . , n}. A frequency square L of type F (n; λ 1 , λ 2 , . . . , λ m ) is an n × n array such that symbol i occurs λ i times in each row and λ i times in each column for each i ∈ N(m); necessarily m i=1 λ i = n. In the case where λ 1 = λ 2 = · · · = λ m = λ we say that L is of type F (n; λ). A frequency square of type F (n; 1) is a Latin square of order n. Two frequency squares of type F (n; λ 1 , λ 2 , . . . , λ m ) are orthogonal if each ordered pair (i, j) occurs λ i λ j times when the squares are superimposed. A set of mutually orthogonal frequency squares (MOFS) is a set of frequency squares in which each pair of squares is orthogonal.
Research into frequency squares focuses mainly on constructing sets of MOFS, motivated originally by problems in statistical experiment design. Hedayat, Raghavarao and Seiden [15] showed that the maximum possible size of a set of MOFS of type F (n; λ) is (n − 1) 2 /(m − 1); such a set is called complete. Complete MOFS of type F (n; λ) for n/λ > 2 are only known to exist when n is a prime power [17,18,19,21]; a unified theory for all known constructions is given in [16].
Starting with a set of mutually orthogonal Latin squares and replacing some subset of the symbols by zeroes, and replacing all other symbols by ones, we can obtain a set of binary MOFS. A slightly less obvious connection between binary MOFS and other designs is the following. An equidistant permutation array A(n, d; k) is a k × n array in which each row contains each integer from 1 to n exactly once and any two distinct rows differ in exactly d positions. One can construct k MOFS of type F (n; n − 1, 1) by writing down the permutation matrices that correspond to the rows of an A(n, n − 1; k). It is known from [9] that there exists an A(n, n − 1; 2n − 4) for any n 6 and from [5] that there exists an A(q 2 + q + 1, q 2 + q, q 3 + q 2 ) for any prime power q.
Two sets of MOFS are isomorphic if one can be obtained from the other by some sequence of the following operations: • Applying the same permutation to the rows of all squares in the set.
• Applying the same permutation to the columns of all squares in the set.
• Transposing all squares in the set.
• Permuting the symbols in one of the squares.
• Permuting the squares within the set (in cases where we have imposed an order on the set).
Isomorphism is an equivalence relation and the equivalence classes it induces are isomorphism classes.
For the remainder of this paper we restrict ourselves to frequency squares of type F (n; λ) where n/λ = 2. In other words, our squares have just two symbols, which we will take to be 0 and 1. We will not say it each time, but all subsequent mention of MOFS will refer to these binary MOFS. As we are assuming that both symbols must occur equally often within each row, the order of our MOFS must be even. We use MOFS(n) to denote MOFS of order n. If there are k MOFS in the set then we write k-MOFS(n).
The following result was proved by Federer [13]; see also [21]. The Hadamard conjecture famously asserts the existence of Hadamard matrices for all orders that are divisible by 4. If true, this would imply the existence of a complete MOFS(n) for every n divisible by 4. Conversely, Theorem 4.6 in [8] gives the asymptotic result that if n is divisible by 4, then there exists a k-MOFS(n) where k = n 2 (1 − o(1))/9, providing a quadratic lower bound on the size of the largest set of MOFS(n). No corresponding bound is known when n/2 is odd. Indeed, very little seems to be known about MOFS(n) when n ≡ 2 (mod 4). Our primary aim in this paper is to shed some light on this case. For example, we will show in §2 that there are no complete MOFS of this type. The corresponding problem for Latin squares is a famous problem that remains open; it would imply the non-existence of a finite projective plane of order n ≡ 2 (mod 4) with n > 2.
Maintaining consistency with Latin square terminology, a bachelor frequency square F is one such that there exists no frequency square F ′ orthogonal to F . In general, a set {F 1 , F 2 , . . . , F k } of k-MOFS(n) is said to be maximal if there does not exist a frequency square F that is orthogonal to F i for each 1 i k. If we wish to specify that a k-MOFS(n) is maximal we may write k-maxMOFS(n).
The structure of the paper is as follows. In §2 we demonstrate a condition that is sufficient to show that a set of MOFS is maximal. The condition is called a relation and is modelled on similar work that has been done for Latin squares. In §3 we show that bachelor frequency squares are unique up to isomorphism for orders that are 2 (mod 4) and do not exist for orders that are 0 (mod 4). The bachelor frequency squares are maximal because they satisfy a relation. The contrast with Latin squares is worth noting. It is known from [12,22] that bachelor Latin squares exist for all orders n > 3. Moreover, there are vast numbers of bachelor Latin squares up to isomorphism [4]. In §4 we study small local changes that can convert a set of MOFS into a non-isomorphic set of MOFS. Using these "trades" we show that for any n for which there exists a Hadamard matrix of order n there are at least 2 n 2 /4−O(n log n) isomorphism classes of complete MOFS(n). This contrasts nicely with the result in §2 that there are no complete MOFS(n) when n ≡ 2 (mod 4) and n > 2. In §5 we report on computer enumerations for MOFS of small order. We find that aside from the unique bachelor there are no k-maxMOFS(6) with k < 5. Also, most but not all of the 5-maxMOFS(6) satisfy a relation. The largest k-MOFS(6) have size k = 17, and they also satisfy relations. In §6 we show how k-MOFS(n) can sometimes by embedded in k-MOFS(n ′ ) for some n ′ > n. Using this technique we show that there exist 17-MOFS(n) for all n ≡ 2 (mod 4) such that n > 2. Then in §7 we use similar ideas to show that there exist 5-maxMOFS(n) for all n ≡ 2 (mod 4) such that n > 2. Finally, in §8 we discuss some interesting questions that have been prompted by our work.

Relations
The technique of relations developed in this section is based on the techniques used in [10] and [11] (with origins in [20]) to analyse the maximal sets of mutually orthogonal Latin squares.
A set {F 1 , . . . , F k } of k-MOFS of order n can be written as an for each i ∈ N(n) and j ∈ N(n). In this context it is safest to consider MOFS to have an indexing that implies an ordering on the squares (and hence the order of the columns in O is well-defined. Let Y c be the set of symbols that occur in column c of O. Then a relation is a (k + 2)-tuple (X 1 , . . . , X k+2 ) of sets such that X i ⊆ Y i for 1 i k + 2, with the property that every row (1) of O has an even number of columns c for which the symbol in column c is an element of X c . A relation is trivial on column c if X c = ∅ or X c = Y c . We will say that a relation is non-trivial if there is some column on which it is not trivial, and full if it is non-trivial on every column except possibly one of the first two. We say that a relation is an In the results below we will show certain restrictions on the kinds of relations that can be achieved. If we start with a relation and two of the X c 's are replaced by their complements, then we obtain another relation. In our context, X c ⊆ {0, 1} for c 3. By complementing X c and X 1 if necessary, we may assume that X c = {1} or X c = ∅ for all c 3. In the latter case, we have a relation on a proper subset of the MOFS. The choices of X 1 and X 2 govern which rows and columns of the MOFS are involved in the relation. However, we are only interested in properties of MOFS up to isomorphism. That means that only 3 quantities really matter to us for a relation: How many MOFS are involved, how many rows are involved and how many columns are involved. These observations will allow us to rule out existence of relations in a number of cases below. They also allow us to provide an easy characterisation of MOFS that satisfy a relation.

Lemma 2. A set of MOFS satisfies a non-trivial relation if and only if some non-empty subset of the
MOFS have a Z 2 -sum that, up to permutation of the rows and columns, has the following structure of constant blocks: Proof. Let the set of MOFS {F 1 , . . . , F k } satisfy a full relation (X 1 , . . . , X k+2 ). For r, c ∈ N(n), let x rc be the sum over the entries in the cell (r, c) of each of the squares. Then, by the definition of a relation, x rc ≡ 0 (mod 2) if r ∈ X 1 and c ∈ X 2 , or if r / ∈ X 1 and c / ∈ X 2 , and x rc ≡ 1 (mod 2) if exactly one of r ∈ X 1 and c ∈ X 2 holds. By permuting the rows and columns appropriately, the Z 2 -sum of F 1 , . . . , F k has a structure of the form in (2).
If the set of MOFS {F 1 , . . . , F k } has a Z 2 -sum that is, up to permutation of the rows and columns, of the form (2), then let X 1 be the set of rows and X 2 be the set of columns corresponding to the upper left 0 block in (2). Then it is easy to check that (X 1 , X 2 , . . . , X k+2 ) with X c = {1} for c 3 is a full relation on {F 1 , . . . , F k }.
Thus, we have shown that a set of MOFS {F 1 , . . . , F k } satisfy a full relation if and only if the Z 2 -sum of F 1 , . . . , F k is of the form (2) up to permutation of the rows and columns. As a set of MOFS satisfies a non-trivial relation if and only if a non-empty subset satisfies a full relation, the lemma follows.
We stress that the blocks in (2) are allowed to be degenerate. For example, here are 2-MOFS(4) that satisfy a relation with X 1 = {1, 2} and X 2 = ∅. Their Z 2 -sum is also given.
Proof. Let O be the orthogonal array corresponding to F . Let be the number of cells containing symbols in the relation among the rows of O for which i = 1 in (1). By noting that X c = {1} for c 3, one finds that s = |X 2 | + λk + 2λδ where δ = 1 if 1 ∈ X 1 and δ = 0 otherwise. By the definition of relations, it follows that |X 2 | + λk is even. A similar argument on the first column of the MOFS shows that |X 1 | + λk is even.
One reason to be interested in relations is that they can be used to diagnose maximality of a set of MOFS.
Theorem 4. Suppose k and λ are both odd. Let F be a k-MOFS(2λ) that satisfies a full relation. Then F is maximal.
Proof. Let R = (X 1 , . . . , X k+2 ) be a full relation of F . By Lemma 3, we know that |X 1 | and |X 2 | are both odd. Suppose that F can be extended by appending a square F . Let F have x ones in cells (r, c) where r ∈ X 1 and c ∈ X 2 . Then F has λ|X 1 | − x ones in cells (r, c) where r ∈ X 1 and c / ∈ X 2 and λ|X 2 | − x ones in cells (r, c) where r / ∈ X 1 and c ∈ X 2 . By orthogonality, the number of pairs (F [r, c], F i [r, c]) such that (F [r, c], F i [r, c]) = (1, 1) is kλ 2 . On the other hand, for a fixed pair (r, c) with F [r, c] = 1 the number of i's such that (F [r, c], F i [r, c]) = 1 is even if either r ∈ X 1 and c ∈ X 2 or r ∈ X 1 and c ∈ X 2 , and is odd if exactly one of r ∈ X 1 and c ∈ X 2 holds. Therefore, we must have that This contradiction proves the theorem.
With Theorem 4 as motivation, we now consider what relations are possible. Our first result is a non-existence result.
Proof. Let {F 1 , . . . , F k } be a k-MOFS(2λ) that satisfies a full relation (X 1 , . . . , X k+2 ). Let x i be the number of k-tuples in the superposition of the k-MOFS(2λ) that contain exactly i ones. Since each square contains 2λ 2 ones, we know that Also each pair of squares has λ 2 cells where both contain a one, so Adding twice (4) to (3) we find that However, by Lemma 3, the existence of the relation enforces odd i Equations (5) and (6) contradict each other when k ≡ 2 or 3 (mod 4).
Next we rule out the case when k is even (thereby finding a second proof for the case k ≡ 2 (mod 4)). So assume that k is even, and, hence, |X 1 | and |X 2 | are both even, by Lemma 3.
Let Ω 0 (respectively Ω 1 ) be the set of cells (r, c) for which F 1 [r, c] = 1 and in which the superposition of F 1 , . . . , F k has an even (respectively, odd) number of ones. We claim that |Ω 1 | is even, since it can be obtained by counting the (even) number of ones in the rows of F 1 with indices in X 1 , adding the (even) number of ones in the columns of F 1 with indices in X 2 , and subtracting twice the number of ones in the intersection. As |Ω 0 | + |Ω 1 | = 2λ 2 , it follows that |Ω 0 | is also even. Now let p be the total number of pairs of ones in the superposition of F 1 with the other (k − 1) squares. Each square contributes λ 2 to p, so p = (k − 1)λ 2 ≡ 1 (mod 2). However, each cell in Ω 0 contributes an odd number of times to p and each cell in Ω 1 contributes an even number, showing that p ≡ |Ω 0 | ≡ 0 (mod 2). This contradiction completes the proof.
In particular, Theorem 5 shows that k = 5 is the smallest k for which Theorem 4 says anything, aside from the fairly trivial case of k = 1. This will be significant later, but for the moment we just give an example to show that a relation can be achieved when k = 5. Consider the following 5-MOFS(6), shown superimposed on the left. Their Z 2 -sum is shown on the right, demonstrating that they satisfy a (5, 3)-relation and hence are maximal.
Proof. Let R = (X 1 , . . . , X k+2 ) be a full relation on a k-MOFS(2λ). By Lemma 3, |X 1 | and |X 2 | are both odd. Let x i be the number of k-tuples in the superposition of the k-MOFS(2λ) that contain exactly i ones. Let α be the number of ones in the superposition of the k-MOFS(2λ) that lie in some position (r, c) where r ∈ X 1 and c ∈ X 2 . As R is a relation, α must be even. Then the total number of ones in the superposition of the k-MOFS(2λ) that lie in a position (r, c) such that exactly one of r ∈ X 1 and c ∈ X 2 is true is Note that equations (3), (4) and (6) from the proof of Theorem 5 only depend on λ being odd and so each of them are still valid in the current setting. From (8) and (6) we have By simplifying 2×(4)+(6)-(3), one finds that By setting 2×(9)=(10) and noting that λ is odd, we see that Since k is odd, we see that 2λ , then we must have |X 1 ||X 2 | ≡ 1 (mod 4) and if k ≡ 5 (mod 8), then we must have |X 1 ||X 2 | ≡ 3 (mod 4), by (11).
Having shown some restrictions on which relations are possible, our next goal is to show that certain relations are actually achievable. We first give a lemma characterising triples of MOFS.
Lemma 7. For each triple t, let x t count the number of cells where t occurs in the superimposition of three frequency squares F 1 , F 2 and F 3 of order 2λ. Then F 1 , F 2 and F 3 are orthogonal if and only if Proof. Orthogonality requires that which is equivalent to (12).
Proof. First suppose k = 1, so we are looking for a relation on a single frequency square F . Considering the fact that the first row of F contains λ zeroes and λ ones we deduce that |X 2 | = λ. Similar consideration of the first column of F shows that |X 1 | = λ. So without loss of generality X 1 = X 2 = Λ. Moreover, this is achieved by a frequency square with four square blocks of order λ, in the pattern given in (2).
Next suppose that k = 2. Let {F 1 , F 2 } be a 2-MOFS(2λ) and (X 1 , X 2 , X 3 , X 4 ) be a relation on F 1 and F 2 . By orthogonality, the superposition of F 1 and F 2 must contain λ 2 occurrences of each of the pairs (0, 1) and (1, 0). It follows that (2λ − |X 1 |)|X 2 | + (2λ − |X 2 |)|X 1 | = 2λ 2 , which implies that |X 1 | = λ or |X 2 | = λ. Also, |X 1 | and |X 2 | must be even, by Lemma 3. Therefore, the conditions in the theorem for k = 2 are necessary. To show sufficiency, we construct the superimposition of F 1 and F 2 :     00 11 01 10 11 00 10 01 01 10 00 11 10 01 11 00 where the first two blocks on the diagonal have dimensions |X 1 |/2 × |X 2 |/2, while the last two blocks on Lastly, consider the case k = 3. By Theorem 5 and Lemma 3, we see that λ, |X 1 | and |X 2 | must all be even. Thus, the conditions in the theorem for k = 3 are necessary. Now we show sufficiency. For even integers y 1 and y 2 , let and the last two blocks on the diagonal have dimensions y 1 4 × y 2 4 . Notice that every 3-tuple has an even number of ones and the pairs (0, 0), (0, 1), (1, 0), (1, 1) occur the same number of times when each tuple is restricted to 2 entries. The number of zeroes and ones in each row is balanced on the 2nd and 3rd entries and number of zeroes and ones in each column is balanced on the 1st and 2nd entries. For even integers y 1 and y 2 let B C y 1 ,y 2 be the complementary array to B y 1 ,y 2 . That is, where the dimensions of the diagonal blocks are the same as those in B y 1 ,y 2 . For any even x 1 , x 2 and λ with x 1 , x 2 2λ, we claim that the array is the superposition of 3-MOFS(2λ) that has a relation on ensures balance in the rows of the first square in (13). The fact that x 1 ≡ 2λ − x 1 (mod 4) ensures balance in the columns of the third square in (13). Other aspects of our claim are straightforward to check, using Lemma 7.
It is worth noting that Theorem 4 does not generalise to even λ. For example, if we take x 1 = x 2 = λ ≡ 0 (mod 4), then the MOFS in (13) satisfy a relation but are not maximal, because they are orthogonal to the frequency square with the block structure given in (2).
To finish this section we consider the relations satisfied by complete sets. A (v * , k * , λ * )-design is a collection B of k * -subsets of a set V of size v * such that each pair from V is contained in exactly λ * blocks (we are using * subscripts on variables here to distinguish them from similarly named variables used throughout the paper). Such a design is said to be resolvable if there is a partition of the blocks into parallel classes (i.e. partitions of V ).
Our next result is implied by Theorem 3.5 from Jungnickel, et al [16], and the proof we give is basically the same as in that paper. We include a proof for completeness and because we want to squeeze a tiny bit more out of it.
Theorem 9. Let F = {F 1 , F 2 , . . . , F k } be complete MOFS of order n where k = (n − 1) 2 . Construct a multiset of blocks B where for each s ∈ {0, 1} and 1 i k there is a block B s,i ∈ B that is the set of columns containing the entry s in the first row of F i . Then B is a resolvable (n, n/2, (n−1)(n−2)/2)-design. Also, if n ≡ 0 (mod 4) then F satisfies a (0, n)-relation.
Let F, F ′ ∈ F . Then since F and F ′ are orthogonal, the number of cells (r, c) = (1, 1) such that (r, c) and (1, 1) share the same entry in F and F ′ is equal to n 2 /4 − 1. Thus, It follows that: Next, define θ 1 = (n/2 − 1)(n − 1) and θ 2 = (n 2 /2 − n + 1) and observe that given (14) and the fact that k = (n − 1) 2 . Thus, we must have θ 1,c = θ 1 = θ r,1 for each r = 1 and c = 1, and θ r,c = θ 2 for all r 2 and c 2. In particular, for each column c = 1, the number of frequency squares which contain the same entry in both cells (1,1) and (1, c) is constant and equal to θ 1 . The same is true if we replace (1, 1) by any other fixed cell in the first row. Thus in the set B as defined above, each pair of columns occurs in precisely θ 1 blocks. Also the blocks B 0,i and B 1,i are complementary sets, for each i. It follows that B is a resolvable (n, n/2, (n − 1)(n − 2)/2)-design. Finally, note that if n ≡ 0 (mod 4) then (n − 1) 2 ≡ θ 1 ≡ θ 2 ≡ 1 (mod 2). Hence, if we standardise F by complementing any square that has a zero in cell (1, 1) then the Z 2 -sum of F will be a matrix in which every entry is 1.
The method used in Theorem 9 would also show that if n ≡ 2 (mod 4) then F must satisfy a relation. However, this is a moot point, given Corollary 11 below. The following theorem is stated in [5,Thm II.7.31]; again we include a short proof for completeness.
Proof. Suppose such a design B exists and let λ * = t(k − 1). For any subset W of V , let r W be the number of blocks containing W as a subset. Suppose that r {x,y,z} = s for some distinct x, y and z. Then the number of blocks containing x but neither y nor z is r {x} − 2λ * + s = t + s. But for each such block B, the pair {y, z} must be in the other block of the parallel class containing B. Thus λ * = r {y,z} = t + 2s. But λ * is even, a contradiction.
Corollary 11. There does not exist a complete MOFS of order n whenever n/2 is odd and n > 2.
Proof. Taking k = n/2 and t = n − 1 in Theorem 10, we find that the design required by Theorem 9 does not exist when n/2 is odd.

The lonely bachelor
In this section we show that for order n = 2λ, there are no bachelor frequency squares if λ is even and only one bachelor square (up to isomorphism) if λ is odd.
Let A 2λ be the unique frequency square satisfying a (non-trivial) relation, as shown in Theorem 8. We will make use of the following well known corollary of Dirac's Theorem: Theorem 12. Let G be a simple graph with 2λ vertices and minimum degree at least λ. Then G has a perfect matching.
Theorem 13. Let B be a frequency square of type F (2λ; λ). Then B is a bachelor if and only if λ is odd and B is isomorphic to A 2λ .
Proof. The fact that A 2λ is a bachelor when λ is odd follows from Theorem 4. So it suffices to construct an orthogonal mate B ′ of type F (2λ; λ) for any B such that λ is even or B is not isomorphic to A 2λ With respect to any two distinct rows r and r ′ of B, we say that a column c is of type 1 if cells (r, c) and (r ′ , c) contain the same entry; otherwise column c is of type 2. We say that a pair of distinct rows {r, r ′ } in B is bad if every column is of type 2 with respect to that pair.
We aim to partition the rows of B into pairs so that no pair is bad. Observe that for a given row r, there are at most λ rows r ′ such that {r, r ′ } is a bad pair. Suppose first that there exists a row r such that there are exactly λ rows r ′ for which {r, r ′ } is a bad pair. Each of those λ rows must be identical, and it quickly follows that B is isomorphic to A 2λ . By our assumptions, λ must then be even, so we can easily avoid bad pairs by partitioning rows into pairs of identical rows.
Otherwise for each row r there exists at most λ − 1 rows r ′ such that {r, r ′ } is a bad pair. Form a graph G where the vertices are the 2λ rows of B, and two rows r and r ′ are joined by an edge if and only if {r, r ′ } is not a bad pair. The minimum degree of G is at least λ, so by Theorem 12, the graph G contains a perfect matching. Thus there exists a partition P of the rows of B into pairs, none of which is bad.
For each {r, r ′ } ∈ P, we next construct corresponding rows r and r ′ in B ′ so that: • Rows r and r ′ in B ′ each contain λ ones and λ zeroes; • Each column in B ′ is of type 2 with respect to rows r and r ′ ; and • When rows r and r ′ of B and B ′ are superimposed, the ordered pairs (0, 0), (0, 1) and (1, 0) and (1, 1) each occur λ times.
Assuming these properties hold for every pair in P, the first and second conditions guarantee that B ′ is a frequency square of type F (2λ; λ) while the third condition guarantees that B ′ is an orthogonal mate for B. Hence, given {r, r ′ } ∈ P it remains to determine the entries of rows r and r ′ of B ′ satisfying these properties. We say that a column c is of type 1a (respectively, 1b) with respect to (r, r ′ ) if (r, c) and (r ′ , c) each contain 0 (respectively, 1). We say that a column c is of type 2a (respectively, 2b) with respect to (r, r ′ ) if (r, c) contains 0 (respectively, 1) and (r ′ , c) contains 1 (respectively, 0).

Trades in MOFS
In this section we consider some transformations that can be used to alter the structure of a set of MOFS. The idea is to identify a comparatively small number of cells that can be changed, whilst preserving the property of being a set of MOFS. This leads to the idea of trades, which has been extensively studied for other designs [1,3,14], but we are not aware of any previous work regarding trades in binary MOFS.
Formally we define a trade in a set {F 1 , . . . , F k } of MOFS to be a suitable set of cells C i for each F i in the set of MOFS. An individual C i can be empty, but they should not all be empty. To switch the trade we change the entries in every cell in C i in square F i for each i. The test for whether the chosen cells are suitable is that the result of switching on the trade should again be a set of MOFS. We do not attempt to characterise the general case any further, but instead look at a simple special case which is already powerful enough to be interesting. In this special case the nonempty C i are all equal. • For each j such that C j = ∅, we have Proof. We note that T is nonempty, because . . , F ′ k } be the matrices produced by switching {F 1 , F 2 , . . . , F k } on T . First suppose that the two conditions are satisfied. The first condition guarantees that each F ′ i is a frequency square. The two conditions together imply that |V 1,1 ∩ V j,0 | = |V 1,0 ∩ V j,0 |. Therefore, the two conditions ensure that F ′ i is orthogonal to F ′ j for all 1 i < j k, since F i is orthogonal to F j . Thus, T is a trade if the two conditions are satisfied. Conversely, if T is a trade, then the first condition is satisfied, since F ′ 1 is a frequency square. Finally, for j such that C j = ∅, F ′ 1 is orthogonal to F ′ j = F j only if the second condition is satisfied. This completes the proof. We call the trades described in Theorem 14, basic trades. There are some fairly trivial examples of basic trades where switching on the trade does not change the combinatorial structure of the MOFS.

Lemma 15. Below are basic trades for which switching does not change the isomorphism class of the MOFS.
• C = N(n) × N(n).
• Taking C to be the set of cells on which F 1 agrees with F j for some fixed j > 1.
• Taking C to be the set of cells on which F 1 disagrees with F j for some fixed j > 1.
Proof. If we take C = N(n) × N(n), then C 1 = C. However, C i = ∅ for i > 1 since F i cannot agree with F 1 on every cell or disagree with it on every cell, since F i is orthogonal to F 1 . So, in this case the trade simply complements F 1 (interchanges zeros and ones within F 1 ).
Next consider what happens when we take C to be the set of cells on which F 1 disagrees with F j . Since F 1 is orthogonal to F j , C must consist of exactly half of all cells in these squares. Switching on these cells converts F 1 into F j and vice versa. Let i ∈ N(k) \ {1, j}. We know that F i is orthogonal to F 1 and hence agrees with F 1 on exactly half of its cells. If F i disagrees with F 1 on every cell in C it would have to equal F j . Also, if F i agrees with F 1 on every cell in C it would have to disagree with F j in every cell. Either option is impossible, since F i is orthogonal to F j . So we conclude that C i = ∅. Moreover, Lemma 7 ensures that |V 1,1 ∩ V i,1 | = |V 1,0 ∩ V i,1 |, so the trade is valid, by Theorem 14. The result of switching on the trade is to interchange F 1 and F j , resulting in an isomorphic set of MOFS.
Taking C to be the set of cells on which F 1 agrees with F j works similarly. Switching on it is equivalent to interchanging F 1 and F j and then complementing both squares.
Theorem 16. Let n > 2 and let F be a set of MOFS(n) in which every frequency square has the property that every pair of rows is either equal or complementary. Then F has at least (n/2) 4 basic trades each of which produce a new set of MOFS that are not isomorphic to F .
Proof. Up to permutations of the rows and columns each square in F has block structure (2). Choose C to be any of the "intercalates" in F 1 , that is, 2 × 2 submatrices that meet all four blocks in F 1 . There are (n/2) 4 choices for C. We claim each of them produces a basic trade. It is obvious that each row and column of F 1 has the same number of zeros and ones in cells in C. Moreover, in each F i the number of ones that occur in cells in C must be even, since the two rows that meet C are either equal or complementary. If C induces an identity matrix or its complement in F i , then C i = C. In the other squares, C must induce a matrix with either constant rows or constant columns, and C i = ∅. Either case satisfies the second condition in Theorem 14.
After switching on the trade, F 1 becomes a matrix with two rows that are neither equal nor complementary, so the new set of MOFS is not isomorphic to the original set. Proof. By Theorem 1, from a Hadamard matrix we can construct a complete MOFS of the same order. The construction used to prove that theorem ensures that every square in that set has the property that each pair of rows is equal or complementary. Any such square is determined by its first row and first column. We assume, without loss of generality, that the first square has block structure (2).
Say that a complete set {F 1 , . . . , F (n−1) 2 } of MOFS(n) is standardised if F i (1, 1) = 0 for 1 i (n−1) 2 . An isomorphism class of MOFS contains e O(n log n) standardised MOFS since the rows and columns can be permuted in n! 2 = e O(n log n) ways and then there is a unique way to standardise the set by complementing any squares that have a one in their (1, 1) cell.
Note that T r,c and T r ′ ,c ′ are on disjoint sets of cells unless r = r ′ and c = c ′ . Hence we can switch on any subset of T to obtain a new complete set of MOFS. As we have preserved the first row and column of each square, and these are unique to that square, we cannot produce two sets of MOFS that are the same but have their squares in a different order. Also, every set that we produce is standardised, so we have built 2 |T | = 2 n 2 /4−O(n) standardised complete MOFS. The result now follows since the number of isomorphism classes is at least 2 n 2 /4−O(n) /e O(n log n) = 2 n 2 /4−O(n log n) .

Computational results
In this section we report the results of a computational exploration of maximality among sets of MOFS of small orders. Our results were each obtained by two independently written programs. The computations took several months of CPU time. In order to present sets of MOFS more compactly we adapt the notation used earlier. Rather than just superimposing the squares as we did in (7), we superimpose them and then convert the resulting entries from binary to decimal. For example, the first row of (7) would be written as [27,23,12,1,2,28] rather than [11011,10111,01100,00001,00010,11100].
All MOFS(4) extend to a complete set, so there are no maximal MOFS(4) that are not complete. There are three different complete MOFS(4), up to isomorphism [5]. One of the 3 sets is related to the other two by basic trades that switch 4 cells in 4 squares: A basic trade on the cells highlighted in the left hand copy above changes the last four frequency squares in the set. A basic trade on the cells highlighted in the right hand copy above changes the 4th, 5th, 6th and 7th frequency squares in the set. Both basic trades produce MOFS that are not isomorphic to each other or the initial set of MOFS. There is no single basic trade that switches between the isomorphism classes of the MOFS that result from the two basic trades highlighted in (15). The MOFS produced by the trade shown on the right in (15) are the ones produced from Theorem 1. They are the only ones in which every frequency square consists of rows which pairwise are either equal or complementary.
Up to equivalence, there are 6 frequency squares of type F (6; 3) and 2435 pairs of MOFS of the same type. For each pair P we found and stored every "mate" that allows the pair to extend to a triple. The number of mates ranged from 5937 to 7413. A graph Γ P was then constructed with the mates as its vertices, and edges indicating orthogonality. It was easily observed that every vertex in Γ P had positive degree (indeed, the minimum degree ranged from 548 to 1369) and that every edge was in a triangle. It follows that aside from the unique bachelor (see Theorem 13), there are no maximal MOFS of type F (6; 3) containing fewer than 5 squares. There are a large number of maximal sets of 5 squares. By the above method we generated 577 418 387 (respectively, 1475) 5-maxMOFS(6) that do (respectively, do not) satisfy a relation. We did not store the former so we cannot say how many isomorphism classes they represent. However, we did store the 1475 examples of 5-maxMOFS(6) that do not satisfy a relation, and these come from 130 isomorphism classes. The most symmetric 5-maxMOFS(6) has an automorphism group of order 10. A representative of that class follows. Its Z 2 -sum is the identity matrix.
Next we used an elementary backtracking search to locate all cliques of size 15 or more in Γ P . Each k-clique of Γ P corresponds to (k + 2)-MOFS (6). Of the 2435 pairs of MOFS(6), there were 842 pairs that extended to a 17-MOFS (6) and no pair extended further. We conclude that the largest set of MOFS(6) has cardinality 17. There are 18 sets of 17-MOFS(6) up to isomorphism. We now present these 18 sets, starting with this example: This completes the specification of the 18 isomorphism classes of 17-MOFS (6). No pair of these classes is connected by basic trades unless our description specified such a relationship.
Here we have partitioned the possibilities into sets of relations that can be transformed into each by the moves described above. As already noted, only the last possibility is achieved by 17-MOFS(6). However, there are 9-MOFS(6) achieving all of the options in (19). We start by giving 9-MOFS(6) with a (1, 1)relation then 9-MOFS(6) with a (1, 5)-relation: If the first and last rows of the first square in (20) are switched, then the result is a 9-maxMOFS(6) that do not satisfy any relation. In (16), (20) and (18) we have described k-maxMOFS(6) for k ∈ {5, 9, 13} that do not satisfy a relation. In fact we found k-maxMOFS(6) for all 5 k 15 that do not satisfy a relation. There are no . Here we give k-maxMOFS (6)  For orders larger than 6 it is not feasible to do exhaustive computations. However, we did a partial enumeration of MOFS(10) inspired by the example in (20). The idea was to impose a block circulant structure similar to that example. Each square was assumed to be composed of 4 circulant blocks. Under this (strong) assumption, we found that the largest set of MOFS(10) that is possible has size 17. Every such example satisfies a (5, 5)-relation, and hence is maximal by Theorem 4. The first and sixth rows of one such example are
Theorem 25 at the end of this section improves each of the lower bounds in Theorem 18 to k = 17. Let s, n be positive even integers with s < n. We define an incomplete frequency square of type (n; s) to be an n × n array F , indexed by N(n), such that: 1. the subarray indexed by N(s) × N(s) is empty and all other cells of F contain 0 or 1, and 2. each row and column is balanced in the sense that it contains equal numbers of the symbols 0 and 1.
Two such incomplete frequency squares are said to be orthogonal if, when superimposed, each of the four possible ordered pairs (0, 0), (0, 1), (1, 0) and (1, 1) occurs the same number of times. We use the notation k-IMOFS(n; s) to denote a set of k incomplete frequency squares, each pair of which is orthogonal in the above sense. We will present IMOFS in superimposed format, similar to (7). Note that similar results to ours below could be developed for IMOFS with multiple holes; however a single hole is enough for the purposes of this paper.
In the following, for any binary vector r, we write r for the complement of r, that is, the vector formed by replacing each entry e with 1 − e. The array I(r) is the 2 × 2 array defined by I(r) = r r r r .
An important property of I(r) is that its rows and columns are balanced.
Proof. The number of filled cells in a pair of IMOFS(n; n−2) is equal to 4n−4. Therefore there are an odd number of cells filled with r for each of the four choices of r. Observe that to achieve balance in any row or column, the number of occurrences of r must equal the number of occurrences of r for each possible r. Let M be the 2 × 2 subarray in the bottom right-hand corner. Suppose, for the sake of contradiction, that there exists an ordered pair r which does not occur in M. Then, without loss of generality (considering the transpose if necessary), r occurs α times within the first n − 2 rows where α is odd. Now, each of the first n − 2 rows contains r if and only if it contains r. Thus, r occurs α times within the first n − 2 rows. Since r and r must occur the same number of times in the final two columns, r cannot occur in M. However, considering the final column, there must be an equal number of occurrences of r and r, contradicting the fact that α is odd. Thus each possibility for r occurs in M exactly once. Next, suppose that r and r occur in the final column of M. Then r occurs an even number of times in the first n − 2 rows. However, r must occur an odd number of times in the first n − 2 columns. Thus r occurs an even number of times altogether, a contradiction. A similar argument shows that r and r cannot occur in any row or column of M, from which the result follows.
Proof. From Lemma 19, without loss of generality the bottom right-hand corner must be isomorphic to: 000 01a 10b 11c Considering the first and third IMOFS in light of Lemma 19, we must have a = c = 1. However, considering the second and third IMOFS, we get a = 0, a contradiction.
We now turn our attention to existence results.

Lemma 21.
There exists a pair of IMOFS(n; n − 2) for each even n 4.
Proof. We first exhibit 2-IMOFS(4, 2): · 01 10 · · 11 00 10 11 00 01 01 00 10 11 For n 6, the above structure can be placed in the bottom right-hand corner. Fill the remaining cells in the last two rows with copies of I(00) and the remaining cells in the last two columns with copies of I(01).
A (v * , k * , λ * ) orthogonal array is a λ * v 2 * × k * array with entries chosen from a set X of size v * such that in every pair of columns of the array, each ordered pair from X occurs exactly λ * times. Let H be a Hadamard matrix of order 4λ * in normalized form (so that the first column are all 1's). Then by the definition of a Hadamard matrix, the remaining columns of H form a (2, 4λ * −1, λ * ) orthogonal array (with X = {1, −1}). Existence results for Hadamard matrices (see [6]) yield the following: There exists a (2, 4λ * − 1, λ * ) orthogonal array whenever 1 λ * < 167 or λ * is a power of 2.
Proof. There are 4b(n − b) non-empty cells in an IMOFS(n; n − 2b). Let α = 4b(n − b)/16λ * . Fill the non-empty cells using α copies of I(r) for each row r of the (2, k * , λ * ) orthogonal array (we are assuming without loss of generality that the symbols of the orthogonal array are 0 and 1).
It is worth noting that if b is odd, the previous theorem is of little use. That is, the embedding approach in this section is not apparently helpful in obtaining set of MOFS of order not divisible by 4 from sets of MOFS of order divisible by 4, the latter of which are far easier to construct.

Maximal sets of MOFS
In this section we show the following existence result.
Proof. Our starting point is the 5-maxMOFS(6) satisfying a (5, 3)-relation that was given in (7). We now embed that 5-maxMOFS(6) into a 5-maxMOFS(4κ + 2), for each κ > 1. In the process we will add each binary 5-tuple the same number of times, thereby ensuring that orthogonality is preserved. Also the resulting 5-MOFS(4κ + 2) will satisfy a (2κ + 3, 2κ + 1)-relation, ensuring that it is maximal, by Theorem 4. Let X 1 be the set of the first 2κ + 3 rows and X 2 the set of the first 2κ + 1 columns. Let X ′ 1 and X ′ 2 be the sets of rows and columns not in X 1 and X 2 , respectively. Our MOFS will have Z 2 -sum given by (2), where the top left block has rows X 1 and columns X 2 .
Next we describe the placement of the 5-maxMOFS (6). These are placed in the first three columns of each of X 2 and X ′ 2 , the first 5 rows of X 1 and the first row of X ′ 1 . Let C be the set of cells which do not include the 36 cells just specified. Then |C| = (4κ + 2) 2 − 6 2 = 16(κ 2 + κ − 2). Excluding the first four rows of C, observe that the remaining cells may be partitioned into intercalates in (2), with one row in each of X 1 and X ′ 1 and one column in each of X 2 and X ′ 2 . We complete our construction by describing how to fill the remaining cells in each frequency square. We do so by first describing how to fill the first four rows then the remaining cells of C using a partition of intercalates as described above.
First suppose that κ ≡ 1 or 2 (mod 4). Then 64 divides |C|; let c = |C|/64. Observe that c = (κ 2 + κ − 2)/4 κ − 1. We fill the cells of C in the first 4 rows with κ − 1 copies of the following array so that the tuples with an even number of ones occur in columns in X 2 and tuples with an odd number of ones occur in columns in X Note that this array has balanced rows and columns. There are 24 binary 5-tuples not in (21), which in turn partition into 12 complementary pairs. Let r i for 1 i 12 be the representatives from these pairs which contain an even number of ones.
To fill the intercalates we first add κ − 1 copies of each I(r i ) to C. We have thus far filled 64(κ − 1) cells of C, including the cells in the first 4 rows, with each binary 5-tuple occurring exactly 2(κ − 1) times. To fill the remaining 64(c − κ + 1) cells of C, we partition all 32 binary 5-tuples into 16 complementary pairs, represented by r i for 1 i 16, and add c − κ + 1 0 copies of I(r i ) for each of the 16 possible values of i. It is now routine to check that the construction indeed results in 5-MOFS(4κ + 2) whose Z 2 -sum is (2). Otherwise κ ≡ 3 or 0 (mod 4). In this case 16(κ 2 + κ − 2) ≡ 32 (mod 64 This array has balanced columns and includes every binary 5-tuple with an odd number of 1's. Therefore, if we take the complement of each tuple we obtain an array B including every 5-tuple with an even number of 1's. Place exactly one copy of B and B in the first 4 rows of C, with B in columns of X 2 and B in columns of X ′ 2 . Note that this is possible since κ 3. The number of remaining cells is divisible by 64 so we can proceed as in the previous case.

Concluding remarks
Theorem 13 showed that for n ≡ 2 (mod 4) there is a unique bachelor frequency square. Our computations showed that there is no other maximal k-MOFS(6) with k < 5. It would be very interesting to know whether this generalises to larger n ≡ 2 (mod 4). Note that we do know that there is a maximal 5-MOFS(n), by Theorem 26. For n ≡ 0 (mod 4), the question of how small a maximal set of MOFS(n) can be, is wide open. If it turns out that there are no maximal sets with fewer than 5 MOFS aside from those in Theorem 13 then that would be a significant difference from Latin squares. It is known [7] that maximal pairs of mutually orthogonal Latin squares exist for all orders n > 6 that are not twice a prime.
In Theorem 17 we gave a lower bound on the number of complete MOFS(n) for n ≡ 0 (mod 4) (assuming the Hadamard conjecture). It would be interesting to obtain a corresponding upper bound. In particular, it would be nice to know whether the exponent in our bound is of the correct order. Note that the corresponding problem for Latin squares has very recently been solved [2].
Two interesting directions for possible generalisation of our results are to frequency squares with 2 symbols that do not occur equally often or to frequency squares with more than 2 symbols. In particular, how many symbols does it take before bachelor frequency squares become common and other small maximal sets become possible?