Suppose $M$ is an $m \times n$ matrix such that all rows and columns of $M$ sum to $1$. Show that $m=n$
If $M$ has $m$ rows that sum to $1$, the sum of the matrix is $m$.
If $M$ has $n$ columns that sum to $1$, the sum of the matrix is $n$.
The sum of the matrix is invariant, therefore $m=n$.
Hint: What is the sum of all numbers in the matrix?
Let $\mathrm A \in \mathbb R^{m \times n}$ have its $m$ rows and $n$ columns sum to $1$. Hence,
$$\underbrace{1_m^T \mathrm A}_{=1_n^T} 1_n = 1_n^T 1_n = n$$
and
$$1_m^T \underbrace{\mathrm A 1_n}_{=1_m} = 1_m^T 1_m = m$$
Thus, $m = n$.