Prove that every row has a single $1$ or a single $-1$ or one of each $\Rightarrow$ $\det A = 1$ or $-1$ or $0$. I am solving the problem of linear algebra textbook.
The problem is

If every row of $A$ has either a single $+1$, or a single $-1$, or one
  of each (and is otherwise zero), show that $\det A = 1$ or $-1$ or
  $0$.


I proved it using induction only when every row has single $1$ or $-1$ case like the following:


*

*I first showed that always a determinant is $1$ or $-1$ or $0$ for any $2$ by $2$ matrices.

*I supposed that a determinant of $k$ by $k$ matrix is $1$ or $-1$ or $0$.

*I proved that it holds for $k+1$ by $k+1$ matrix.



However!!, I failed to prove that one of each case.... please someone let me know how to prove it. thank you!
 A: I will assume we are dealing with square matrices here. The proof will be inductive.
For $1\times1$ matrices, it is trivial. Let $n\in\mathbb N$ and suppose that the statement holds for $n\times n$ matrices. Let $A$ be a $(n+1)\times(n+1)$ matrix. There are two possibilities:


*

*There is a row with a single $1$ or a single $-1$. Then we use Laplace expansion along that row and we use the induction hypothesis, unless we get a matrix with a row of zeros, whose determinant is $0$.

*Otherwise, every row has one and only one $1$, one and only one $-1$ and all other entries are $0$. Then every row belongs to the space $x_1+x_2+\cdots+x_{n+1}=0$ and therefore the determinant is $0$, because the rows are linearly dependent.

A: Define a graph on $2n$ points, representing the rows and columns of the matrix, with an edge for every nonzero entry. By assumption the vertex degrees in the graph are at most$~2$, so the connected components of the graph are either paths or cycles. Moreover each component "occupies" a certain set of rows and columns; by permutation of rows and columns of the matrix we can make those sets be consecutive, and have the matrix in block form; it suffices to show that each square block has determinant in $\{-1,0,1\}$ (and the presence of any non-square block makes the global determinant $0$).
In the case of a "path" connected component, which must have an odd number of edges in order to correspond to a square block, the first edge can be made to kill the second edge by a row or column operation, then the third kills the forth, and so forth so that the only such components that remain are isolated edges; such edges represent a determinant value of $+1$ or $-1$.
In the case of a "cycle" component, all the columns it occupies have sum $1+-1=0$, and this forces them to be linearly dependent (the subspace of zero-sum columns is proper): the determinant is$~0$.
