First attempt at a solution

works okay, but doesn’t yet provide error handling (checking for wrong
argument types, whether matrix is invertible, etc.)