# Rank of binary matrices: {0, 1} vs {-1, 1}

Let's say you have two matrices, $$M_{\{0, 1\}}$$, a binary matrix with entries in $$\{0, 1\}$$, and $$M_{\{-1, 1\}}$$, a binary matrix with entries in $$\{-1, 1\}$$. Both matrices are identical, except where if the entry is $$0$$ for the first matrix, the corresponding entry is $$-1$$ for the second matrix.

Is there any relationship between $$rank(M_{\{0, 1\}})$$ and $$rank(M_{\{-1, 1\}})$$?

My intuition says $$rank(M_{\{0, 1\}}) \ge rank(M_{\{-1, 1\}})$$ because $$\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$$ has rank 2 while $$\begin{bmatrix} -1 & 1 \\ 1 & -1 \end{bmatrix}$$ has rank 1.

However, I came across this post, where the accepted answer implies that the rank of both should be equal:

The estimate is stated for random matrices with entries in {±1}, but it can be transferred to matrices with entries in {0,1}

As a result, I was confused and wanted to confirm if the statement is true.

• Well, certainly $\operatorname{rk}0_{\{0,1\}}<\operatorname{rk}0_{\{-1,1\}}$. Commented May 3 at 10:14
• Rank(A+B)$\le$Rank(A)+Rank(B). Now if A+B is your $\{-1,1\}$ matrix A is 2 times your $\{0,1\}$ matrix and B is the all -1 matrix then Rank(M$_{\{-1,1\}})\le$1+Rank(M$_{\{0,1\}}$) Commented May 3 at 11:43
• You can get a similar result the other way around by letting A be the -1,1 matrix and B the all 1 matrix. Commented May 3 at 12:02
• Combining both statements, it seems like $\mid rank(M_{\{0,1\}}) - rank(M_{\{-1,1\}}) \mid \le 1$! Commented May 4 at 0:49

If you work over $$\mathbf{Q}$$ (or $$\mathbf{R}$$), which is the context in which that remark was made, there's a correspondence between $$\{-1,1\}$$ matrices and $$\{0,1\}$$ matrices with one less row and column. You can see this by negating rows and columns of the $$\{-1,1\}$$ matrix so that the first row and column contain only $$1$$s, subtracting the first row from each subsequent row, dividing each row except the first by $$-2$$, and then deleting the first row and column. None of the first three operations changes the rank; the final operation drops the rank by exactly $$1$$. (After the first three operations, row $$1$$ is the only row with a nonzero element in column $$1$$.) You can see that the number of $$\{-1,1\}$$ matrices that map to a given $$\{0,1\}$$ matrix by this process is the same for every $$\{0,1\}$$ matrix, which means that, except for the shift by $$1$$ mentioned above, the distribution of ranks won't be affected.

Let's see how this works for $$2\times2$$ $$\{0,1\}$$ matrices.

\begin{align} \begin{bmatrix}0 & 0\\ 0 & 0\end{bmatrix} \text{ (rank 0) comes from } & \begin{bmatrix}1 & 1 & 1\\ 1 & 1 & 1\\ 1 & 1 & 1\end{bmatrix} \text{ and 31 other rank 1 matrices, including }\\ & \begin{bmatrix}1 & 1 & 1\\ 1 & 1 & 1\\ -1 & -1 & -1\end{bmatrix},\ \begin{bmatrix}-1 & -1 & 1\\ -1 & -1 & 1\\ 1 & 1 & -1\end{bmatrix}.\\ \begin{bmatrix}0 & 0\\ 0 & 1\end{bmatrix} \text{ (rank 1) comes from } & \begin{bmatrix}1 & 1 & 1\\ 1 & 1 & 1\\ 1 & 1 & -1\end{bmatrix} \text{ and 31 other rank 2 matrices, including }\\ & \begin{bmatrix}1 & 1 & 1\\ 1 & 1 & 1\\ -1 & -1 & 1\end{bmatrix},\ \begin{bmatrix}-1 & -1 & 1\\ -1 & -1 & 1\\ 1 & 1 & 1\end{bmatrix}.\\ \begin{bmatrix}1 & 0\\ 1 & 0\end{bmatrix} \text{ (rank 1) comes from } & \begin{bmatrix}1 & 1 & 1\\ 1 & -1 & 1\\ 1 & -1 & 1\end{bmatrix} \text{ and 31 other rank 2 matrices, including }\\ & \begin{bmatrix}1 & 1 & 1\\ 1 & -1 & 1\\ -1 & 1 & -1\end{bmatrix},\ \begin{bmatrix}-1 & -1 & 1\\ -1 & 1 & 1\\ 1 & -1 & -1\end{bmatrix}.\\ \begin{bmatrix}1 & 0\\ 1 & 1\end{bmatrix} \text{ (rank 2) comes from } & \begin{bmatrix}1 & 1 & 1\\ 1 & -1 & 1\\ 1 & -1 & -1\end{bmatrix} \text{ and 31 other rank 3 matrices, including }\\ & \begin{bmatrix}1 & 1 & 1\\ 1 & -1 & 1\\ -1 & 1 & 1\end{bmatrix},\ \begin{bmatrix}-1 & -1 & 1\\ -1 & 1 & 1\\ 1 & -1 & 1\end{bmatrix}. \end{align} In all, the $$16$$ $$\{0,1\}$$ matrices of dimensions $$2\times2$$ include one of rank $$0$$, nine of rank $$1$$, and six of rank $$2$$. The $$512=16\cdot32$$ $$\{-1,1\}$$ matrices of dimensions $$3\times3$$ include $$32$$ of rank $$1$$, $$288$$ of rank $$2$$, and $$192$$ of rank $$3$$. Statements like, "$$\frac{3}{8}$$ of $$2\times2$$ $$\{0,1\}$$ matrices are of full rank", translate into statements like, "$$\frac{3}{8}$$ of $$3\times3$$ $$\{-1,1\}$$ matrices are of full rank."

• Can you explain further what this part means and what it entails? I'm having trouble following... "You can see that the number of {−1,1} matrices that map to a given {0,1} matrix by this process is the same for every {0,1} matrix, which means that... the distribution of ranks won't be affected." Commented May 4 at 1:18
• The number of $(n+1)x(n+1)$ $\{-1, 1\}$ matrices that map to a $nxn$ $\{0, 1\}$ matrices is $2^{2n-1}$ right? Because there are $2n-1$ elements in the first column + row, and they each can take $2$ values? I'm not sure how this number gives us insight into the rank of either the bigger $(n+1)x(n+1)$ nor the smaller $nxn$ matrix. Commented May 4 at 1:19
• Suppose the number of $n\times n$ $\{0,1\}$ matrices that have rank $r$ is $N$. Then the number of $(n+1)\times(n+1)$ $\{-1,1\}$ matrices that have rank $r+1$ is $2^{2n+1}N$. Make a histogram according to rank for $n\times n$ $\{0,1\}$ matrices. Then the histogram for $(n+1)\times(n+1)$ $\{-1,1\}$ matrices according to rank will look the same, except shifted to the right one unit and scaled vertically by a factor of $2^{2n+1}$. Commented May 4 at 2:47
• The bigger the matrix, the larger the proportion of full rank matrices. The linked post in your question says that the proportion of full rank matrices approaches $1$ as $n\to\infty$ and the OEIS sequence quoted there shows that, while the proportion drops as $n$ goes from 1 to 2 to 3, the trend is increasing between 3 and 8, and presumably continues that way forever. The Bourgain, Vu, Wood paper will point you to earlier Tao, Vu papers that have an overview of the literature. The intuition is that the dominant mechanism by which a $\pm1$ matrix fails to have full rank is having two... Commented May 5 at 12:28
• ...equal or opposite rows or columns. But this is like two people flipping a coin $n$ times and getting the same or opposite sequence of heads and tails, which has exponentially decaying probability. Of course in bigger matrices there are more chances for this to happen, $\binom{n}{2}$ pairs of rows, for example, but this is a polynomial increase, and the exponential decay wins. Commented May 5 at 12:31

Firstly, there is no relation between these two ranks. Your example shows rank$$(M_{\{0,1\}})$$ can be greater than rank$$(M_{\{-1,1\}})$$. Consider one matrix with all the entries equal to $$0$$ and one with all the entries equal to $$-1$$ for reverse one. In some cases, they can be equal as well.

About the post, it is about "expected rank" of all such matrices. It is completely different from rank of just one matrix. Also the post takes into consideration that field we are using is $$\mathbb{Z}_2$$, which changes things considerably. For e.g., following matrix $$\begin{pmatrix} 1 & 0 & 1 \\ 1 & 1 & 0 \\ 0 & 1 & 1\end{pmatrix}$$ has rank $$3$$ when field is $$\mathbb{R}$$ but rank is $$2$$ when field is $$\mathbb{Z}_2$$.

• I think the question here refers to the last paragraph of this answer where it is claimed that a certain lower estimate for the probability that matrices in $\Bbb Q^{n\times n}$ with entries in $\{-1,1\}$ have full rank actually translates to an estimates for matrices in $\Bbb Q^{n\times n}$ with entries in $\{0,1\}$. Commented May 3 at 11:24
• I quote the passage: "If the matrix is over $\Bbb Q$ instead of over ${\Bbb F}_2$, still with entries which are independently chosen and equally likely to be $0$ or $1$, then, when $n$ becomes large, the probability that the matrix has full rank approaches $1$. Bourgain, Vu, and Wood 2009 estimates it as at least $1-(2^{-1/2}+o(1))^n$. (The estimate is stated for random matrices with entries in $\{\pm 1\}$, but it can be transferred to matrices with entries in $\{0,1\}$.)" Commented May 3 at 11:24
• While your post have shown that there is no one-directional relationship between $rank(M_{\{0,1\}})$ and $rank(M_{\{-1,1\}})$, I think it still might be helpful to see if there is still some interesting properties between the two numbers, such as for example such as upper bound of the difference in rank, or another example is under what conditions would one of them definitely be smaller than the other. I'd be curious to see if we can find any stronger statement, and it might be helpful to someone in the future too Commented May 4 at 1:26