On the Construction of Matrix Invariants with Applications