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.

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.
