TITLE: The rank of a perturbed triangular matrix
QUESTION [19 upvotes]: $\DeclareMathOperator{\rk}{rk}$
The question below is implicit in this MO post, but I believe it deserves to be asked explicitly, particularly now that I have some more numerical evidence.

Suppose that $A$ is a real, square matrix of order $n$, such that all main-diagonal elements of $A$ are distinct from $0$, and of any two elements symmetric about the main diagonal, at least one is equal to $0$. That is, writing $A=(a_{ij})_{1\le i,j\le n}$, we have $a_{ii}\ne 0$ and $a_{ij}a_{ji}=0$ whenever $i,j\in[1,n]$, $i\ne j$. In other words, $A$ can be obtained from a non-singular triangular matrix by switching some pairs of symmetric elements. How small can the rank of such a matrix be, in terms of $n$?

Since the pointwise product $A\circ A^t$ is full-rank, as an immediate corollary of the inequality $\rk(B\circ C)\le\rk(B)\,\rk(C)$ we have $\rk(A)\ge\sqrt n$. How sharp this estimate is? Is it true that $\liminf_{n\to\infty} \log(\rk(A))/\log(n)=\frac12$?
Computations show that there are matrices of order $6$ and rank $3$ satisfying the assumptions above; taking $A$ to be a tensor power of such a matrix, we will have $\rk(A)=n^c$ with $=\log_6(3)\approx0.6131$.
I do not know whether there exist matrices of order $7$ and rank $3$ with the property in question.

REPLY [3 votes]: $\DeclareMathOperator{\rk}{rk}$It is possible to construct a matrix with $\rk(A)\leq 2\sqrt{n}$. Assuming that $n=r^2$ with an integer $r$, introduce two matrices $B$ and $C$, whose rows and columns are indexed by elements of $\{1,2,\dotsc,r\}^2$, and whose entries are defined by
$$
B_{(x,y),(x',y')}=\begin{cases}1&\text{if }x=x',\\0&\text{otherwise},\end{cases}
$$
and
$$
C_{(x,y),(x',y')}=\begin{cases}-1&\text{if }y<y',\\0&\text{otherwise},\end{cases}
$$
where $(x,y),(x',y')\in \{1,2,\dotsc,r\}^2$.
We have $\rk(B)\leq r$ and $\rk(C)\leq r$, and $A:=B+C$ is an $r^2$-by-$r^2$ matrix satisfying the requisite condition.
This is a minor modification of the constructions that I used in a paper of mine.