You could bring the matrix on row echelon form (see http://en.wikipedia.org/wiki/Row_echelon_form) by elementary row operations (http://en.wikipedia.org/wiki/Elementary_matrix#Operations). In case of a 3x3 matrix of rank 2 it will lead to a matrix where the last row includes only 0.