We construct $ell $-spin-flipping matrices from the coefficient matrices of pure states of $n$ qubits and show that the $ell $-spin-flipping matrices are congruent and unitary congruent whenever two pure states of $n$ qubits are SLOCC and LU equivalent, respectively. The congruence implies the invariance of ranks of the $ell $-spin-flipping matrices under SLOCC and then permits a reduction of SLOCC classification of n qubits to calculation of ranks of the $ell $-spin-flipping matrices. The unitary congruence implies the invariance of singular values of the $ell $-spin-flipping matrices under LU and then permits a reduction of LU classification of n qubits to calculation of singular values of the $ell $-spin-flipping matrices. Furthermore, we show that the invariance of singular values of the $ell $-spin-flipping matrices $Omega _{1}^{(n)}$ implies the invariance of the concurrence for even $n$ qubits and the invariance of the n-tangle for odd $n$ qubits. Thus, the concurrence and the n-tangle can be used for LU classification and computing the concurrence and the n-tangle only performs additions and multiplications of coefficients of states.