Skip to content
Justice Tech School

Inverse and Determinant

linalg.inv inverts a square matrix and det gives the determinant.

Example
a = np.array([[4.0, 7.0], [2.0, 6.0]])
print(np.linalg.det(a).round(2))
inv = np.linalg.inv(a)
print(inv.round(2))
print((a @ inv).round(2))

Result

10.0
[[ 0.6 -0.7]
 [-0.2  0.4]]
[[ 1. -0.]
 [-0.  1.]]

Exercise

Inverse.

np.linalg.(a)

Quiz Test

What is A times its inverse?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.