Pātuhitia tēnei: Generalized inverse of matrices and its applications