Implement recursive calculation of inverse of mass matrix