Dimension of vector space of matrices with zero row and column sum.

Let $V(\mathbb{R})$ be the vector space of $m\times n$ real matrices such that each row sum and each column sum is zero. What is the dimension of $V(\mathbb{R})$? I know by General thinking that its dimension is $(m-1)(n-1)$. But I don’t know what is the method to find its dimension. Please tell me how to think about its dimension. Thanks a lot.

Solutions Collecting From Web of "Dimension of vector space of matrices with zero row and column sum."

Let $K$ be a field. For $A \in \mathrm{M}(m \times n, K)$ let
$$
R_i(A) = \sum_{j=1}^n A_{ij} \quad \text{for every $1 \leq i \leq m$}
$$
and
$$
C_j(A) = \sum_{i=1}^m A_{ij} \quad \text{for every $1 \leq j \leq n$},
$$
and set
$$
V_{m,n}(K) = \{A \in \mathrm{M}(m \times n, K) \mid R_1(A) = \dotsb R_m(A) = C_1(A) = \dotsb = C_n(A)\}.
$$


We show that the map
\begin{align*}
\Phi \colon V_{m,n}(K) &\to \mathrm{M}((m-1) \times (n-1), K), \\
\quad (a_{ij})_{1 \leq i \leq n, 1 \leq j \leq m} &\mapsto (a_{ij})_{1 \leq i \leq n-1, 1 \leq j \leq m-1}
\end{align*}
is an isomorphism; it is clearly linear.

First surjectivity: Let $A = (a_{ij})_{1 \leq i \leq n-1, 1 \leq j \leq m-1} \in \mathrm{M}((m-1) \times (n-1), K)$. For all $1 \leq i \leq m-1$ let $a_{in} = -R_i(A)$ and for all $1 \leq j \leq n-1$ let $a_{mj} = -C_j(A)$. Also let
$$
a_{mn}
= \sum_{\substack{1 \leq i \leq m-1 \\ 1 \leq j \leq n-1}} a_{ij}.
$$
For $\hat{A} = (a_{ij})_{1 \leq i \leq n, 1 \leq j \leq m} \in \mathrm{M}(m \times n, K)$ we have that
$$
R_i(\hat{A}) = \sum_{j=1}^n a_{ij} = R_i(A) + a_{in} = 0
\quad \text{for every $1 \leq i \leq m-1$}
$$
as well as
\begin{align*}
R_m(\hat{A})
&= \sum_{j=1}^n a_{mj}
= \sum_{j=1}^{n-1} a_{mj} + a_{mn} \\
&= -\sum_{j=1}^{n-1} C_j(A) + a_{mn}
= -\sum_{j=1}^{n-1} \sum_{i=1}^{m-1} a_{ij} + \sum_{\substack{1 \leq i \leq m-1 \\ 1 \leq j \leq n-1}} a_{ij}
= 0.
\end{align*}
So all row sums of $\hat{A}$ are zero. Simililarly we find that all column sums of $\hat{A}$ are zero. So $\hat{A} \in V_{m,n}(K)$. Because $\Phi(\hat{A}) = A$ this shows the surjectivity of $\Phi$.

For the injecitvity we argue the other way around: For every $A \in V_{m,n}(K)$ we have $A_{in} = -R_i(\Phi(A))$ for every $1 \leq i \leq m-1$ and $A_{mj} = -C_j(\Phi(A))$ for every $1 \leq j \leq n-1$, as well as
$$
A_{mn}
= -\sum_{j=1}^{n-1} A_{mj}
= \sum_{j=1}^{n-1} C_j(\Phi(A)),
$$
So $A$ is uniquely determined by $\Phi(A)$, showing that $\Phi$ in injective.

Take variable $x_{ij},\ i=1,2,\ldots,m,\ j=1,2\ldots,n$ that correspod to the entries of the matrix. Row sum being eeuqal to zero gives rise to the conditions $s\sum_{j=1}^n x_{1j}=0, \sum_{j=1}^n x_{2j}=0, \ldots$. Similarly one has to get equations corresponding to columns sums being zero. Now consider the rank of this system on $mn$ variables and $m+n$ equations.

Now use rank and nullity theorem.

A variant on Jendrik Stelzner’s excellent answer is to note that if a matrix $a$ has row and column sum zero, then for each $i$
$$
a_{i,n} = – \sum_{s=1}^{n-1} a_{i,s},
$$
for each $j$
$$
a_{m,j} = – \sum_{t=1}^{m-1} a_{t,j},
$$
and finally
$$
a_{m,n} = \sum_{s=1}^{n-1} \sum_{t=1}^{m-1} a_{t, s}.
$$
Conversely, these three conditions imply that $a$ has row and column sum zero.

Now it is immediate that a basis of the space of this matrices is given by the $(m-1)(n-1)$ matrices
$$
e_{i,j} – e_{i,n} – e_{m, j} + e_{m, n},
$$
for $0 \le i < m$, $0 \le j < n$, where $e_{s, t}$ is the usual matrix which has zero everywhere except for a $1$ in position $s, t$. The above show that they span the space, and it suffices to look at the first $n-1$ and $m-1$ rows to see that they are independent.

For instance, when $m = n = 3$ you get
$$
\begin{bmatrix}
1 & 0 & -1\\
0 & 0 & 0\\
-1 & 0 & 1\\
\end{bmatrix},
\quad
\begin{bmatrix}
0 & 0 & 0\\
1 & 0 & -1\\
-1 & 0 & 1\\
\end{bmatrix},
\quad
\begin{bmatrix}
0 & 0 & 0\\
0 & 1 & -1\\
0 & -1& 1\\
\end{bmatrix},
\quad
\begin{bmatrix}
0 & 1 & -1\\
0 & 0 & 0\\
0 & -1& 1\\
\end{bmatrix}.
$$
Note that if you look at the first two rows and columns, you get the usual base of the space of $2 \times 2$ matrices.

consider any one row. since row sum is zero, so at least one component of that row can be written as the linear combination of other components. so that one element can be removed or can be replaced by zero. do this process for each row.
Similarly, do this process for each column. you will find finally (m-1).(n-1) remaining elements. so the dimension is (m-1).(n-1).