Echelon form of matrix have the same rank, after operations modulo In my homework task, I need to prove that if my matrix have rank $k$ modulo $\ell$, then it also have rank $k$ modulo $p$. Please give me advice, how to prove it.
--edit--
The precise task is:
On the diagonal of square matrix of order $n$ are $0$s, other places are $1$ or $2012$. Prove that the rank of this matrix is $n$ or $n-1$. Consider modulo function.
 A: For any nonnegative integer matrix $A\in\mathbb{R}^{n\times n}$ and any natural number $p\ge2$, let "$A\operatorname{mod}p$" denotes matrix in $\mathbb{R}^{n\times n}$ whose entries are the remainder of the entries of $A$ divided by $p$. We have the following lemma:

Lemma. $\operatorname{rank}(A) \ge \operatorname{rank}(A\operatorname{mod}p)$.

Hint: For any square matrix $B$, we have $\det(B) \equiv \det(B\operatorname{mod}p)\,\operatorname{mod}\,p$. Now recall that the rank of a matrix is the size of its maximal square submatrix with nonzero determinant.
We now turn to your specific case. Call the matrix in question $A$. If $n=1$, clearly $\operatorname{rank}A=0=n-1$. Suppose $n\ge2$.
Put $p=2011$ in the above lemma, it suffices to show that $C:=A\operatorname{mod}2011$ is nonsingular. However, note that $C=ee^T-I$, where $e^T=(1,\ldots,1)$. You may prove that $C$ is nonsignular by showing that it is orthogonally similar to a nonsingular diagonal matrix. Alternatively, consider $Cx=0$ and see if there is any nonzero solution $x$.
