TITLE: Suppose $M$ is an $m \times n$ matrix such that all rows and columns of $M$ sum to $1$. Show that $m=n$
QUESTION [27 upvotes]: I find this a rather awkward question,  from the book "Mathematical Circles" by Fomin, Genkin and Itenberg. The question number is Question number 23 from  Chapter 12 ("Invariants"). I was given a hint: use invariants, which I found even more awkward.
There was also a remark : "strange as it may seem, this is an invariants problem". Funny , because I don't know what to expect now!

Suppose $M$ is an $m \times n$ matrix such that all rows and columns of $M$ sum to $1$. Show that $m=n$.

I have no clue how this is a problem on invariants, let alone how to solve this problem. I'll need hints on why this is the case.

REPLY [2 votes]: This question has been answered very nicely, but it might be worth noting that a simple yet less elegant, more brutish way of seeing this problem, is to let the first $(n-1)$ columns be anything.
Say they're given by $a_{ij}, \ i \leq m, \ \   j \leq (n-1)$.
Then the entries of the last column must be $1 - \sum_{j=1}^{n-1} a_{ij}, \ i \leq m$. 
Since these entries add up to $1$, we have $$ 1 =  \sum_{i=1}^{m} (1  - \sum_{j=1}^{n-1} a_{ij}) = m  - \sum_{i=1}^{m} \sum_{j=1}^{n-1} a_{ij} = m \ - \sum_{j=1}^{n-1} \sum_{i=1}^{m} a_{ij} = m  - \sum_{j=1}^{n-1}1 \\= m -(n-1)$$
And thus we have $m=n$.