Inverse of matrix with nonnegative entries I am interested in matrices with the property that both $A$ and $A^{-1}$ have nonnegative entries.  The only such matrices I could construct were diagonal matrices, and my question is whether these are the only such examples.
What I can say about such matrices is that they must preserve the quadrant
$$
Q^+ = \{x\in\mathbb{R}^n \mid x_i \geq 0 \}.
$$
That is, $x\in Q^+$ if and only if $Ax\in Q^+$.  This seems rather unlikely unless $A$ preserves the axes, that is, unless $A$ is diagonal.  But I can't seem to turn this into a proof.
EDIT
Cameron Buie made the nice observation that permutation matrices also work.
So I wonder: are there any examples with more than $n$ nonzero entries?  What about 2x2 examples with at least 3 nonzero entries?
 A: Of course, il maestro @Qiaochu Yuan is right; and, of course, he knows that there exists an elementary proof !
Let $A=[a_{p,q}],A^{-1}=[b_{p,q}]$. We consider the $i^{th}$ row of the matrix $A$ and we assume that there are $j\not= k$ s.t. $a_{i,j},a_{i,k}\not= 0$. Then $AA^{-1}=I$ implies that, for every $p\not= i$, $b_{j,p}=b_{k,p}=0$. Thus, the rows $j,k$ of $B$ are proportional and $B$ is not invertible, that is contradictory. Using $A^{-1}A=I$, we show the same result for the columns of $A$ and we are done.
A: These can be classified using the Perron-Frobenius theorem as follows. The conclusion is that Cameron Buie's examples, the weighted permutation matrices, actually exhaust all examples! 
Let $A$ be a square matrix with nonnegative entries. We'll interpret it as the weighted adjacency matrix of a weighted directed graph $G$, where if the weight is $0$ there is no edge. Say that $A$ is irreducible if this graph is strongly connected, meaning that every vertex can be reached from every other vertex. Any such $A$ can be conjugated by a permutation (note that this preserves the desired property) into a block sum of irreducible blocks corresponding to the strongly connected components of the corresponding weighted graph, and $A$ has the property that $A^{-1}$ has nonnegative entries iff each of its irreducible blocks does. Hence from now on, we'll assume WLOG that $A$ is irreducible.
The Perron-Frobenius theorem asserts that if $A$ is irreducible then, among other things, 


*

*It has eigenvalue $r = \rho(A)$, the spectral radius of $A$ (the largest absolute value of an eigenvalue).

*$r$ has an eigenvector $v_r$ all of whose entries are positive reals.

*The only positive eigenvectors are those with eigenvalue $r$.


This means it's very hard for $A^{-1}$ to also have nonnegative entries, because $A^{-1}$ still has a positive eigenvector $v_r$ but it's now associated to the eigenvalue which is smallest in absolute value rather than largest. Note also that if $A^{-1}$ is reducible then taking inverses again implies that $A$ is reducible, so if $A$ is irreducible then so is $A^{-1}$, so if $A^{-1}$ has nonnegative entries the Perron-Frobenius theorem also applies to it. 
The conclusion is that all of the eigenvalues of $A$ must be the same in absolute value. The Perron-Frobenius theorem says even more now. Define the period $h$ of $A$ to be the gcd of the lengths of all closed directed paths on $G$. For example, if $G$ is a weighted $n$-cycle this period is $n$. 


*

*$A$ has exactly $h$ eigenvalues of absolute value $r$. 

*$A$ can be conjugated by a permutation into an $h \times h$ block matrix whose blocks describe an $h$-cycle.


See the Wikipedia article for the precise statement; the upshot is that in this case we must have $h = n$ because every eigenvalue has absolute value $r$, and the conclusion is that $A$ is, up to conjugation by permutations, a weighted cycle. Blocks of these give weighted permutations and that's all we get. 
