import numpy as np x = np.matrix([[1,2,3], [4,5,6], [7,8,0]]) y = np.linalg.inv(x) print(y) print(x*y) # 对角线元素为1,其他元素为0或近似为0 print(y*x)