Rank of matrix with $0$s and $1$s over finite field $\mathbb{F}_2$ and ring $\mathbb{Z}_q$ Suppose we have a matrix $A$ of size $m\times n$, with $m<n$, which has elements in $\{0,1\}$. Let us denote $\mathbb{F}_2$ as the finite field with elements of $\{0,1\}$ and $\mathbb{Z}_q$ as the ring of integers modulo $q$. Let $q$ be a power of $2$.
I am interested in understanding the relation between the ranks of $A$ when viewed as a matrix over $\mathbb{F}_2$ versus when viewed as a matrix over the commutative ring $\mathbb{Z}_q$, with $q=2^d$ for $d\in \mathbb{N}$.
Let the two ranks be:

*

*$\operatorname{rank}_2(A)$: Cardinality of the maximum set of linearly independent columns in $A$ over $\mathbb{F}_2$ with addition operation $\mod 2$. By linearly dependent columns $\{u_i\}$, we mean $\displaystyle 0=\sum \limits _ia_iu_i\mod 2$, for some $a_i$ in $\{0,1\}$ and not all $a_i=0$.

*$\operatorname{rank}_q(A)$: Cardinality of the maximum set of linearly independent columns in $A$ over $\mathbb{Z}_q$ with addition operation $\mod q$. By linearly dependent columns $\{u_i\}$, we mean $\displaystyle 0=\sum \limits _ia_iu_i\mod q$, for some $a_i$ in $\mathbb{Z}_q$ and not all $a_i=0$.

From my understanding, $\operatorname{rank}_q(A)$ is well-defined as $R$-modules have the invariant basis number property when $R$ is a commutative ring.
Then, for any such matrix $A$, is $\operatorname{rank}_q(A)\geq \operatorname{rank}_2(A)$? I expect the answer to be yes but have not yet succeeded in showing this.
 A: In fact, the ranks are equal.
With Smith normal form, we can write $A$ in the form $UDV$ for unimodular matrices $U,V$ and
$$
D = \operatorname{diag}(d_1,\dots,d_n)
$$
with $d_k \mid d_{k+1}$ for $k = 1,\dots,n-1$. Notably, there is a correspondence between the nullspace of $A$ and the nullspace of $D$:
$$
Ax = 0 \iff (UDV)x = 0 \iff UD(Vx) = 0 \iff D(Vx) = 0.
$$
Notably, $Vx$ will be the zero vector mod $n$ iff $x$ is the zero vector mod $n$. Thus, the matrices $A$ and $D$ will have the same rank over $\Bbb Z_n$ for any $n$.
With that, we can see that $\operatorname{rank}_q(A) = \operatorname{rank}_2(A)$ must hold because $\operatorname{rank}_q(D) = \operatorname{rank}_2(D)$ holds for every diagonal matrix $D$. Indeed, we can see that the nullspace of $D$ in $\Bbb Z_n$ is given by $\{(x_1,\dots,x_n) : d_kx_k \mid n\}$, which means that a set of columns is linearly independent iff all associated diagonal entries are coprime with $n$, which for $n = q = 2^k$ means that all those entries of odd, which is to say that the columns are non-zero over $\Bbb F_2$.

Another way to see that $\operatorname{rank}_q(A) \leq \operatorname{rank}_2(A)$:
If a set of columns $u_1,\dots,u_n$ is linearly dependent over $\Bbb F_2$, it must also be dependent over $\Bbb Z_q$. Indeed, if $a_1u_1 + \cdots + a_nu_n = 0 \pmod 2$ (for $a_i \in \{0,1\}$), then $(q/2)(a_1u_1 + \cdots + a_nu_n) = 0 \pmod q$.
