How do I write the code to calculate the inverse of an NxN matrix? Thank you in advance.