Problem in solving a question of vector space. The question is :
Let, $V$ be the subspace of all real $n \times n$ matrices such that the entries in every row add up to zero and the entries in every column also add up to zero. What is the dimension of $V$?
Now,I find that for $n=2$ the given condition yields a symmetric matrix of order $2$ which generates a subspace of dimension $3$ and for $n=3$ the matrix is not symmetric and the dimension of the corresponding subspace becomes $6$.But I fail to generalise this concept to get my required result. Please help me.Thank you in advance. 

Actually when $n=2$, you should get 1. Suppose we decide to make the top entry $a$. Then the top right and lower left entries must be $-a$. And once we see that, the bottom right entry must be $a$. So $$V = \textrm{span}\left[\begin{pmatrix}
1 & -1 \\
-1 & 1
\end{pmatrix} \right].$$
If $n=3$, you can fill in the the top-left $2\times 2$ sub-matrix without worry.
$$\begin{pmatrix}
a_1 & a_2 & - \\
a_3 & a_4 & - \\
- & - & -
\end{pmatrix}_.$$
Now the conditions tell us that the rest of the entries must be as follows
$$\begin{pmatrix}
a_1 & a_2 & -(a_1+a_2) \\
a_3 & a_4 & -(a_3+a_4) \\
-(a_1+a_3) & -(a_2+a_4) & a_1 + a_2 + a_3 + a_4
\end{pmatrix}_.$$
So we really only had 4 choices to make. That is, $dim(V) = 4$.
A basis for $V$ when $n=3$ is $$ $$\begin{pmatrix}
1 & 0 & -1 \\
0 & 0 & 0\\
-1 & 0 & 1
\end{pmatrix} \begin{pmatrix}
0 & 1 & -1 \\
0 & 0 & 0 \\
0 & -1 & 1
\end{pmatrix} \begin{pmatrix}
0 & 0 & 0 \\
1 & 0 & -1 \\
-1 & 0 & 1
\end{pmatrix} \begin{pmatrix}
0 & 0 & 0 \\
0 & 1 & -1 \\
0 & -1 & 1
\end{pmatrix}
The general pattern is $dim(V) = (n-1)^2$.
You can see this in a similar fashion to the $3\times 3$ case. I.e. Once you fill in the upper-left $(n-1)\times (n-1)$ submatrix, the rest of the matrix is uniquely determined.
