add matrix inverse and trace