Matrices commuting with the matrix of ones Let $J_n$ be $n \times n$ matrix of ones, so that $J_{ij} = 1$ for all $i,j \in\{1,\ldots,n\}$. I am interested to find the class of matrices which commute with $J_n$, i.e. $$M J_n = J_n M.$$It is not difficult to see that a permutation matrix satisfies this property. By linear superposition, the doubly stochastic matrix also commutes with $J_n$.
Are there any other matrices, apart from doubly stochastic ones, with this property?
 A: The set $V$ of such matrices is easily verified to be a linear subspace of $\operatorname{Mat}(\Bbb{R},n)$. the space of real $n\times n$-matrices. In fact $V$ is the subspace spanned by the doubly stochastic matrices:
First note that $J_n\in V$, and that $\frac{1}{n}J_n$ is doubly stochastic.
Let $M$ be a matrix such that $MJ_n=J_nM$. Then the sum of the entries of each row and each column is the same, say $c$. Let $m$ be the minimum of the entries of $M$. Then all entries of $M-mJ_n$ are nonnegative, and each row and column of $M-mJ_n$ sums to $c-mn$, so in particular $c-mn\geq0$. If $c-mn\neq0$ then
$$\frac{1}{c-mn}(M-mJ_n),$$
is a matrix with nonnegative entries whose rows and columns sum to $1$, and hence a doubly stochastic matrix.
This shows that $M$ is a linear combination of doubly stochastic matrices, because
$$M=(c+mn)\left(\frac{1}{c-mn}(M-mJ_n)\right)+\frac{mn}{c-mn}\left(\frac{1}{n}J_n\right).$$
If $c-mn=0$ then $M-mJ_n=0$ and so $M=mJ_n=mn\left(\frac{1}{n}J_n\right)$, also a linear combination of doubly stochastic matrices.
A: We have that
$$(MJ)_{ij}=\sum_{k=1}^n M_{ik}J_{kj}=\sum_{k=1}^n M_{ik}$$ and 
$$(JM)_{ij}=\sum_{k=1}^n J_{ik}M_{kj}=\sum_{k=1}^n M_{kj}.$$
So $$(MJ)_{ij}=(JM)_{ij} \iff \sum_{k=1}^n M_{ik}=\sum_{k=1}^n M_{kj}.$$ And
$$MJ=JM\iff \sum_{k=1}^n M_{ik}=\sum_{k=1}^n M_{kj}, \forall i,j\in\{1,\cdots,n\}.$$
