The subset of all matrices where the sum of the entries in each row and column is zero Let $V = M_3(\mathbb{R}$), and let $S$ be the subspace of matrices where the sum of the entries in each row and column is $0$.  Is there an easy way to see that the dimension of $S$ is $4$?  I row reduced a $6$ by $9$ matrix containing the information about the equations which the entries had to satisfy to find the answer, but that sucked.  What about an $n$ by $n$ matrix?
 A: To expand on TrialAndError's comment, let $V = M_n(\mathbb{R})$ and let $v = (1, \ldots, 1)^t$. Then $S = \{ A \in V \, | Av = 0, v^tA = 0 \}$. Instead of calculating $\dim S$, we can use the natural isomorphism between matrices and operators on $\mathbb{R}^n_{\mathrm{col}}$ to calculate $\dim W$ where
$$ W := \{ T \colon \mathbb{R}^n_{\mathrm{col}} \rightarrow \mathbb{R}^n_{\mathrm{col}} \, | \, T(v) = 0, v \perp \mathrm{im}(T) \}. $$
Extend $v$ to a basis $\mathcal{B} = (v_1 = v, v_2, \ldots, v_n)$ for $\mathbb{R}^n$ with $v_i \perp v_1$ for $2 \leq i \leq n$. If we represent an arbitrary $T$ as a matrix with respect to the basis $\mathcal{B}$, we will have
$$ [T]_{\mathcal{B}} = \left( \begin{matrix} 0_{1 \times 1} & 0_{1 \times (n-1)} \\ 0_{(n-1) \times 1} & C \end{matrix} \right) $$
where $C \in M_{(n-1)\times(n-1)}(\mathbb{R})$. Conversely, if $[T]_{\mathcal{B}}$ has this form, then $T \in W$. Thus, 
$$ \dim V = \dim W = (n-1)^2 = n^2 - 2n + 1. $$
An alternative, and maybe more elementary approach is to note that
$$ \dim S = \dim \{ A \in V \, | \, Av = 0 \} + \dim \{A \in V \, | \, v^tA = 0 \} \\- \dim \{ A + B \in V \, | \, Av = 0, v^tB = 0 \}.$$
We have 
$$\dim \{ A \in V \, | \, Av = 0 \} = \dim \{A \in V \, | \, v^tA = 0 \} = n^2 - n$$
Since the condition $Av = 0$ imposes $n$ linearly independent equations for the coefficients of $A$ and similarly for $v^tA = 0$. For the third term, one can show that
$$ \{ A + B \in V \, | \, Av = 0, v^tB = 0 \} = \{ C \in V \, | \, v^tCv = 0 \} $$
where $\{ C \in V \, | \, v^tCv = 0 \}$ is just the subspace of all matrices for which the sum of all entries is zero. For the non-obvious inclusion, if $v^tCv = 0$ then
$$ C = C - \left( \begin{matrix} \frac{\sum_{i=1}^n a_{1i}}{n} & \ldots & \frac{\sum_{i=1}^n a_{1i}}{n} \\ \vdots & \ddots & \vdots \\ \frac{\sum_{i=1}^n a_{ni}}{n} & \ldots & \frac{\sum_{i=1}^n a_{ni}}{n} \end{matrix} \right) + \left( \begin{matrix} \frac{\sum_{i=1}^n a_{1i}}{n} & \ldots & \frac{\sum_{i=1}^n a_{1i}}{n} \\ \vdots & \ddots & \vdots \\ \frac{\sum_{i=1}^n a_{ni}}{n} & \ldots & \frac{\sum_{i=1}^n a_{ni}}{n} \end{matrix} \right). $$
Thus,
$$ \dim \{ A + B \in V \, | \, Av = 0, v^tB = 0 \} = n^2 - 1 $$
and 
$$ \dim S = 2(n^2 - n) - (n^2 - 1) = n^2 - 2n + 1. $$
