Let $A$ be a binary $n \times n$ matrix, such that $A^2=0$. What is the max num of $1$'s that $A$ could have? I noticed:

*

*Fixing $A_{ij}=1$ would imply $i$-th column and $j$-th row are all $0$'s

*From there, I constructed a few matrices with small $n$ and hypothesized $f(n) = \lfloor{n/2}\rfloor \cdot \lceil{n/2}\rceil$

*Interpreting $A$ as an adjacency matrix: $A^2=0$ implies you can't get from $i$ to $j$ in 2 hops. This reminds me of the max number of edges in a bipartite graph of n nodes; if you consider the edges as directed and the two sets as source/sink sets. I wonder if this relates to max flow.

*Searching "nilpotent binary matrix" got me to Nilpotent binary matrices over finite fields.

*I realized directed edges are not necessary in bipartite graph interpretation -- the problem could be considered as Maximum number of edges in a bipartite graph
I feel there are multiple proof approaches. There is something very classic and familiar going on which I can't put my finger to, and I wonder what non-graph approaches would be especially.
 A: I know that you ask about non-graph approaches in particular. I still felt like a complete proof using graph theory might add something to this thread. I use exactly the technique that you propose in your post.
We want to prove that the maximum number of $1$'s in an $n \times n$ binary matrix $A$ with $A^2 = 0$ is $\lfloor \frac{n}{2} \rfloor \lceil \frac{n}{2} \rceil$.
Let $A$ be an arbitrary matrix of this form. Consider the directed graph $G$ with adjacency matrix $A$. As pointed out in the question, $A^2 = 0$ implies that the longest directed path in $G$ has length at most $1$. Hence no vertex in $G$ has an outgoing and an incoming edge. Therefore there exist only sources, sinks and isolated vertices in $G$. Let $U$ be the set of vertices which are sources and let $V$ be the set of vertices which are sinks or isolated vertices. Clearly all edges in $G$ must go from $U$ to $V$. Hence there are at most $|U||V| = |U| (n - |U|)$ edges in $G$.
The function $f(k) = k(n - k) = nk -k^2$ has a global maximum at $k = \frac{n}{2}$. The two global integer maxima are at $k = \lfloor \frac{n}{2} \rfloor$ and $k = \lceil \frac{n}{2} \rceil$ with value $f(\lfloor \frac{n}{2} \rfloor) = f(\lceil \frac{n}{2} \rceil) = \lceil \frac{n}{2} \rceil \lfloor \frac{n}{2} \rfloor$. Applying this to our argument above we get that there are at most $\lceil \frac{n}{2} \rceil \lfloor \frac{n}{2} \rfloor$ edges in $G$.
Every edge in $G$ corresponds to exactly one $1$-entry in $A$. Hence $A$ has at most $\lceil \frac{n}{2} \rceil \lfloor \frac{n}{2} \rfloor$ entries with a $1$.
We still have to prove that there actually exists a binary $n \times n$ matrix $A$ with $A^2 = 0$ and with exactly $\lceil \frac{n}{2} \rceil \lfloor \frac{n}{2} \rfloor$ $1$-entries. Such a matrix can be constructed as follows:
$$ A_{i, j} = 1 \iff i \leq \frac{n}{2} \; \And \; j > \frac{n}{2}$$
A: Let $R=\{i | \text{ row i is not empty}\}$ and let $C= \{ i | \text{ column i is not empty}\}$. Notice $A^2=0$ is equivalent to $R\cap C = \varnothing$. Hence the maximum is achieved when $a_{i,j} = 1 \iff i\in R, j\in C$. So we want to maximize $|R||C|$ which clearly happens when $|R|$ and $|C|$ sum to $n$ and differ by at most $1$.
A: First, let $v$ be a $0, 1$ vector and let $w = \vec 1 - v$, where $\vec 1$ is the all-ones vector. Then $A = v w^t$ satisfies $$A^2 = vw^tvw^t = (w \cdot v)A = 0 \cdot A = 0$$
If $k$ is the number of $1$ entries in $v$ then the number of $1$ entries in $A$ is:
$$k \cdot (n-k)$$
As mentioned in other posts, this is maximal when $k = \lfloor \frac n 2 \rfloor$ (or when $k = \lceil \frac n 2 \rceil$).
Notice that this computation is independent of which positions in $v$ are nonzero, so we may as well assume they are the first $k$ entries of $v$, in which case $A$ has the block structure: $$A = \begin{pmatrix} 0 & 1 \\\ 0 & 0\end{pmatrix},$$ where here "1" is to be interpreted as the $k \times (n - k)$ all-1s matrix. Note that reordering the entries of $v$ (and hence $w$) amounts to conjugating $A$ by a permutation matrix.
To summarize up to this point, the $vw^t$ construction gives us a way to build matrices of the (purported) maximal density.
Now, let $A$ be a nonzero $0, 1$ matrix that satisfies $A^2 = 0$. As noted by the author of the question, if $A_{i,j} = 1$ then row $j$ and column $i$ are zero. In particular, this forces $i \neq j$. By conjugating by a permutation matrix we may assume that $i=1$ and $j=n$, so column $1$ and row $n$ are zero. By repeating this process inductively we may assume that $1 = A_{1, n} = A_{2, n-2} = \dots = A_{k, n + 1 - k}$ for some $k \geq 1$. Then rows $n + 1-k$ through $n$ and columns $1$ through $k$ are all zero. In other words, $A$ is permutation equivalent to $$\begin{pmatrix} 0 & B \\\ 0 & 0 \end{pmatrix}$$ for some $k \times (n-k)$ matrix B.
Any matrix of this form satisfies $A^2 = 0$, so we achieve maximal density when the entries of $B$ are all 1 and $B$ has maximal area, i.e., $k = \lfloor \frac n 2 \rfloor$ or $k = \lceil \frac n 2 \rceil$. Note that in this case, $$A = \begin{pmatrix}1 \\\ 0\end{pmatrix}\begin{pmatrix}0 & 1 \end{pmatrix}$$ where the "1" entries are to be interpreted as subvectors of all 1s. In other words, all maximal-density $0, 1$ matrices satisfying $A^2 = 0$ are of the form $vw^t$ as constructed above, with $v$ having weight $\lfloor \frac n 2 \rfloor$ or $\lceil \frac n 2 \rceil$.
