A matrix defined by an operation in a finite group Let $G$ be a finite group and $x_1,..., x_n$ be an enumeration of its elements. We consider the matrix $(a_{ij})_{1\le i,j \le n}$ where $a_{ij}=0$ if $x_i x_j^{-1}=x_jx_i^{-1}$ and $a_{ij}=1$ otherwise. Find the parity of $\det(a_{ij})$.
This problem comes from the 2019 District stage of the Romanian Mathematics Olympiad.
Let $A=(a_{ij})_{1\le i,j \le n}$. One of the $x_i$s is going to be the identity element of $G$. WLOG we may consider it to be $x_1$, since changing rows and columns only affects the sign of a determinant.
I managed to obseve that $A$ is symmetric since $a_{ij}=a_{ji}$ always. Furthermore, $A$'s principal diagonal is going to be $0$ because $x_i x_i^{-1}=x_i^{-1}x_i$, $\forall i=\overline{1,n}$. Hence, $A$ is a symmetric hollow matrix whose entries are either $0$ or $1$. Here I got stuck and I would like to know if it is possible to continue along these lines.        
EDIT: As requested, I will translate the official solution:            
$\det(a_{ij})$ is even. To prove this, we will show that $\det(a_{ij})$ is divisible by $|S|$, where $S=\{x | x\in G, x\ne x^{-1}\}$. Since an element of $G$ is in $S$ if and only if its inverse is in $S$, $|S|$ is even (possibly zero), so $\det(a_{ij})$ is even.   
The value of a determinant is not changed if a column is replaced by the sum of all the columns. Hence, to prove the divisibility it is enough to show that every row contains exactly $|S|$ units.   
If $S$ is empty, then $(a_{ij})=O_n$, so $\det(a_{ij})=0$.    
If $S$ isn't empty, we fix a row $i$ and we consider the set $J_i=\{j |a_{ij}=1\}$. Since $j \to x_i x_j^{-1}$ defines a bijection from $J_i$ to $S$, it follows that $|J_i|=|S|$.
 A: Answer: $\det(a_{ij})$ is even. 
We can prove this as follows.
Case 1: $n=|G|$ is odd.  
Note that $a_{ij} = 0$ if an only if $x_ix_j^{-1} = (x_ix_j^{-1})^{-1}$, which is to say that $(x_i x_j^{-1})^2 = 1_G$.  By Lagrange's theorem, this implies that $x_ix_j^{-1} = 1_G$, so that $x_i = x_j$.  In other words, $A$ is a hollow matrix whose off-diagonal entries are all equal to $1$.  
It follows that every row of $A$ has sum $n-1$, which is even.  Taking $A$ to be a matrix over $\Bbb F_2$, we therefore find that the vector $x = (1,\dots,1)^T$ is such that $Ax = 0$.  Thus, $A$ is not invertible, which is to say that $\det A = 0 \pmod 2$, which is to say that $\det A$ is even.
Case 2: $n = |G|$ is even
Let $T = \{g \in G: g^2 = 1_G\}$.  We now have $a_{ij} = 0$ if and only if $x_i x_j^{-1} \in T$, which holds if and only if $x_j = tx_i$ for some $t \in T$.  It follows that each row will contain $|T|$ zeros.  We know that $|T|$ is even.
It follows that the sum of every row is even.  As in the previous case, we deduce  that $\det A$ is even.
