Let $M \in \mathbb{N}$ and let $\pi \in S\_{M}$ be an involution with at least one fixed point. I'm interested in finding a latin square $A$ of order $M$ such that $A\_{i,j} = \pi(A\_{j,i})$ for each $i,j \in \{1,\ldots, N^2\}$.


A $B\_1$-type latin square is a latin square $A$ indexed by $\mathbb{Z}\_{n,1} = \mathbb{Z}\_n \cup \{\infty\}$ such that $A\_{i+1, j+1} = A\_{i,j} + 1$ for every $i,j \in \mathbb{Z}\_{n,1}$. Theorem 11 [in this survey](https://www.semanticscholar.org/paper/Diagonally-cyclic-latin-squares-Wanless/22cf4ee8bf0412592fa984173a520200359f8a4f) shows that the latin squares I'm looking for exist when $M \geq 2$ is odd, $\pi$ has a unique fixed point and there exists a symmetric $B\_1$-type latin square ($B\_1$-type latin squares of order $M$ exist for every $M \geq 2$ by Theorem 6 in the same document).


I'm particularly interested in the case when $M = N^2$ for some $N \in \mathbb{N}$ and $\pi \in S\_{N^2}$ has exactly $N$ fixed points. By permuting rows and columns we can assume that $\pi$ fixes the last $N$ elements in $\{1,\ldots, N^2\}$ and $\pi(i) = (N^2 - N)/2 + i$ for $i \in \{1,\ldots, (N^2 - N)/2\}$.


My original motivation comes from constructing symmetric finite-state codes.



Existence of latin squares with an involutory symmetry
To achieve your goal, we can use the "tensor product construction" for Latin squares. It is carried out as follows: Let $X\_a$ be a latin square indexed by $a$, i.e. $X\_a$ is a function $a \times a \rightarrow a$ and $X\_b$ similarly. Then $X\_a \otimes X\_b : (a \times b) \times(a \times b) \rightarrow (a \times b) $ is defined as $((a\_1,b\_1),(a\_2,b\_2)) \rightarrow (X\_a(a\_1,a\_2),X\_b(b\_1,b\_2))$.


The point is that, if there exists permutations $\pi$ and $\rho$ such that $X\_a(i,j) = \pi(X\_a(j,i))$ and $X\_b(i,j) = \rho(X\_b(j,i))$ for all $i$, $j$, then $X\_a \otimes X\_b$ satisfies $X\_a \otimes X\_b (k,l)=(\pi \otimes \rho) (X\_a \otimes X\_b (l,k))$, where $\pi \otimes \rho$ is a permutation on $a \times b$ defined by $(\pi \otimes \rho)(a,b)=(\pi(a),\rho(b))$. The number of fixed points of $(\pi \otimes \rho)$ is the product of that of $\pi$ and that of $\rho$.


For $p$ an odd prime, it's possible to construct latin squares $A\_p(p)$ and $A\_1(p)$ such that the $A\_p(p)$ has all classes invariant under involution, and $A\_1(p)$ has exactly one class invariant under involution.


Index $A\_p(p)$ and $A\_1(p)$ by $\mathbb{Z}\_p$. Then $A\_p(p)$ and $A\_1(p)$ can be defined as $A\_p(x,y)=x+y$ and $A\_1(x,y)=x-y$.


Thus $A\_p(p) \otimes A\_1(p)$ has order $p^2$ and $p$ classes invariant under involution. Call it $B\_p$.


We also need a special latin square $B\_2$ that has two classes invariant under involution:



```
 1 2 3 4
 4 3 2 1
 3 4 1 2
 2 1 4 3

```

By the factorization of $N$ into primes $N=2^{n\_0}p\_1^{n\_1}...p\_k^{n\_k}$ (the primes $p\_1,...,p\_k$ are odd) we can construct a latin square $(\otimes^{n\_0} B\_2) \otimes (\otimes^{n\_1} B\_{p\_1}) \otimes ... \otimes (\otimes^{n\_k} B\_{p\_k})$ that has order $N^2$ and $N$ classes in involution.


